Overview
The POS cart system provides a two-column interface with a product catalog grid and a shopping cart with real-time calculations.Layout Structure
The POS interface uses a grid layout with catalog and cart sections.HTML Structure
panel_nueva-venta.html:56-127
CSS Classes
.pos
Main POS layout container
- Display: Grid
- Grid columns:
1fr 360px - Gap: 18px
- Align items: Start
nueva-venta.css:3-8
Product Catalog
Grid Container
panel_nueva-venta.html:70-95
CSS Classes
.prod-grid
- Display: Grid
- Grid columns:
repeat(auto-fill, minmax(130px, 1fr)) - Gap: 10px
- Max height: 470px
- Overflow Y: Auto
- Padding: 2px
nueva-venta.css:10-17
.prod-card
Individual product card
- Background: White (
var(--bl)) - Border: 1px solid light gray
- Border radius: 8px
- Padding: 14px 10px
- Text align: Center
- Cursor: Pointer
- Box shadow:
0 2px 12px rgba(0, 0, 0, .08) - Transition: Border, shadow, transform
nueva-venta.css:19-28
Product Card Hover
nueva-venta.css:29
Product Card Elements
nueva-venta.css:30-33
Product Card Examples
In Stock Product
panel_nueva-venta.html:71-73
Out of Stock Product
panel_nueva-venta.html:86-88
Shopping Cart
Cart Container
panel_nueva-venta.html:100-126
CSS Classes
.cart
Main cart container
- Background: White
- Border: 1px solid light gray
- Border radius: 8px
- Box shadow:
0 2px 12px rgba(0, 0, 0, .08) - Display: Flex column
- Min height: 540px
nueva-venta.css:35-43
.cart-head
Cart header
- Padding: 16px 18px
- Border bottom: 1px solid gray
- Font size: 14.5px
- Font weight: 700
- Display: Flex
- Justify: Space-between
nueva-venta.css:44-52
.cart-client
Client input section
- Padding: 10px 18px
- Border bottom: 1px solid gray
nueva-venta.css:54
.cart-items
Scrollable items container
- Flex: 1
- Padding: 12px 18px
- Overflow Y: Auto
nueva-venta.css:55
Cart Items
Cart Item Structure
nueva-venta.js:16-25
CSS Classes
.cart-item
Individual cart item
- Display: Flex
- Align items: Center
- Gap: 8px
- Padding: 9px 0
- Border bottom: 1px solid gray
- Font size: 12.5px
nueva-venta.css:57-64
.cart-item-name
- Flex: 1
- Font weight: 500
nueva-venta.css:66
.cart-qty
Quantity controls
- Display: Flex
- Align items: Center
- Gap: 5px
nueva-venta.css:67
.q-btn
Quantity adjustment button
- Width: 22px
- Height: 22px
- Border: 1px solid gray
- Border radius: 4px
- Background: Light gray
- Cursor: Pointer
- Font size: 13px
- Font weight: 700
- Display: Flex center
nueva-venta.css:68-77
.cart-price
Item total price
- Font weight: 700
- Min width: 56px
- Text align: Right
nueva-venta.css:78
Cart Summary
HTML Structure
panel_nueva-venta.html:109-125
CSS Classes
.cart-summary
Summary section
- Padding: 14px 18px
- Border top: 1px solid gray
- Background: Light gray (
var(--gf)) - Border radius: 0 0 8px 8px
nueva-venta.css:80-85
.sum-row
Summary line item
- Display: Flex
- Justify: Space-between
- Font size: 12.5px
- Color: Medium gray
- Margin bottom: 7px
nueva-venta.css:86
.sum-total
Total line
- Font size: 16px
- Font weight: 800
- Color: Black
- Border top: 2px solid gray
- Padding top: 9px
- Margin top: 3px
- Margin bottom: 12px
- Display: Flex
- Justify: Space-between
nueva-venta.css:87-92
JavaScript API
Constants
nueva-venta.js:2-3
DOM Element References
nueva-venta.js:5-9
Core Functions
render()
Renders the cart items and updates totals.
nueva-venta.js:11-27
actualizar(sub)
Updates summary totals with IVA calculation.
sub(number) - Subtotal before tax
- IVA:
subtotal * 0.16 - Total:
subtotal + IVA
nueva-venta.js:29-35
agregar(id, nombre, emo, precio)
Adds a product to the cart or increments quantity.
id(string) - Product SKUnombre(string) - Product nameemo(string) - Product emoji iconprecio(number) - Unit price
- If product exists in cart, increments quantity
- If new product, adds with quantity 1
- Re-renders cart
nueva-venta.js:37-41
cambiar(id, d)
Changes product quantity in cart.
id(string) - Product SKUd(number) - Delta (-1 to decrease, +1 to increase)
- Updates quantity by delta
- Removes product if quantity reaches 0
- Re-renders cart
nueva-venta.js:43-49
Event Listeners
Clear Cart Button
nueva-venta.js:51
Checkout Button
nueva-venta.js:53-58
Cart Data Structure
Cart Item Object
Usage Examples
Adding a Product
panel_nueva-venta.html:77-79
Quantity Controls
render() function
Responsive Behavior
On screens below 860px:- POS grid switches to single column
- Cart appears below catalog
- Both sections use full width
nueva-venta.css:94-96
Initialization
The cart renders on page load:nueva-venta.js:60