Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/azahel79/Spartans-gym/llms.txt

Use this file to discover all available pages before exploring further.

The Point of Sale screen lets any authenticated user — both admins and receptionists — ring up products without leaving the gym dashboard. It presents the full product catalog in a browsable grid, collects items into a live cart, accepts cash or card payment, and automatically prints a receipt as soon as the sale is confirmed. Stock levels are validated in real time so the register never oversells an item.

Product Catalog

All active products are loaded when the screen opens and displayed as cards in a responsive grid. Each card shows the product image, name, category, price, and the remaining available units.

Category Filters

A horizontal filter bar lets you narrow the catalog to a single category. Available filters:

Todos

Shows every product regardless of category.

Suplementos

Protein powders, vitamins, and pre-workouts.

Bebidas

Bottled water, sports drinks, and shakes.

Merchandising

Branded apparel and gym wear.

Accesorios

Straps, gloves, and training accessories.

Snacks

Energy bars, nuts, and protein snacks.
Selecting a filter immediately re-renders the grid. Selecting Todos removes any active filter.

Out-of-Stock Products

Products with zero available units are shown with grayscale styling and a cursor-not-allowed pointer. Clicking them has no effect; a toast warning is shown instead. They remain visible in the catalog so staff can see the full product range.

Cart

The cart panel sits on the right side of the screen (or below the catalog on mobile). It tracks everything that has been added in the current sale session.

Cart Actions

ActionHow to trigger
Add itemClick any in-stock product card
Increase quantityClick the + button inside the cart row
Decrease quantityClick the button; removing the last unit deletes the row
Remove item entirelyClick the trash icon on the cart row
Clear all itemsClick the delete button next to the Finalizar Venta button

Stock Validation

The cart enforces stock limits client-side before the sale is submitted:
  • If a product is already out of stock when you click it, a warning toast appears and nothing is added.
  • If the quantity in the cart already equals the available stock, clicking + again shows a “Stock insuficiente” warning and the quantity is not incremented.
Adding more units than available stock is blocked. The cart quantity for any item can never exceed the stock value returned by the catalog.

Payment Methods

The cart footer contains a two-button toggle for selecting how the customer is paying:
  • Efectivo — cash payment (default)
  • Tarjeta — card payment
Transferencia (bank transfer) is not available as a payment method in the Point of Sale. It is only accepted for membership plan payments. If you need to record a transfer for a product sale, use the Transactions module directly.

Completing a Sale

1

Select products

Browse or filter the catalog and click each product card to add it to the cart. Adjust quantities using the + and controls in the cart.
2

Choose payment method

Select either Efectivo or Tarjeta in the cart footer toggle.
3

Finalize the sale

Click Finalizar Venta. The button is disabled if the cart is empty or a sale is already being processed.
4

Sale is processed

The frontend calls processSale, which sends a POST /api/transactions request with the following body:
{
  "tipo": "PRODUCTO",
  "metodo": "Efectivo",
  "monto": 350.00,
  "clienteId": null,
  "productos": [
    { "id": 4, "quantity": 2 },
    { "id": 9, "quantity": 1 }
  ]
}
The backend iterates over the productos array, decrements each product’s stock atomically via Prisma, and assembles the concepto string from the product names (e.g., "Whey Protein (x2), Agua 600ml").
5

Receipt prints automatically

On a successful response, printSaleReceipt() opens a new browser window pre-loaded with an HTML ticket and immediately triggers the browser’s print dialog. The ticket lists each item with its quantity and subtotal, the payment method, and the total amount.
6

Cart resets

After the receipt window opens, the cart is cleared and the product catalog is refreshed so stock counts reflect the sale.
The receipt window is a standard browser print dialog. On most systems you can choose to print to a physical receipt printer or save to PDF. The ticket layout is optimized for 72 mm thermal paper.

Error Handling

If the server returns an error (for example, because a product went out of stock between page load and submission), a toast notification displays the error message from the API response. The cart is not cleared on error, so the cashier can correct the issue and retry.

Build docs developers (and LLMs) love