Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JAQA20/LaComanda/llms.txt

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

Tables are the central unit of activity in La Comanda. Every order is tied to a specific table, and the system keeps each table’s status in sync automatically as orders are created, prepared, and delivered. Admins can also customise the visual floor plan using a drag-and-drop interface, giving each venue a layout that mirrors its physical space.

Table States

Each row in the mesas table carries an estado column that reflects whether a table is free or in use. Only two states exist:
StateDescription
disponibleTable is free and can receive a new order
ocupadaTable has an active order in progress
State transitions happen automatically — no manual intervention is needed:
  • A table moves to ocupada the moment an order is submitted via guardarOrden.php.
  • It returns to disponible once all items in every sub-order (kitchen and barista) have been marked entregado.

Viewing Table Status

To retrieve the current state of all tables for the logged-in user, call:
GET /public/api/estadoMesas.php
The response is a JSON object with the following shape:
{
  "status": "OK",
  "data": {
    "1": {
      "estado": "ocupada",
      "numero_orden": 42
    },
    "2": {
      "estado": "disponible",
      "numero_orden": null
    }
  }
}
Each key under data is the table number (mesaNumero) as a string. The numero_orden field is null when the table is disponible, and contains the active order number when ocupada. This endpoint is polled by views/index.php to keep the table map up to date in real time.

Floor Layout (Admin Only)

The layout_configs table stores the drag-and-drop position of each table icon on the visual floor map. Three endpoints manage this layout:
MethodEndpointDescription
GET/public/api/layoutMesas.phpReturns the current layout positions for all tables
POST/public/api/layoutMesas.phpSaves new positions for one or more tables
DELETE/public/api/layoutMesas.phpResets the entire layout back to default positions
Only users with rol_id = 1 (admin) may call the POST and DELETE methods. All authenticated users can read the layout via GET.

Saving a Layout

Send a POST request with a JSON body containing an items object. Each key is a table identifier string (e.g. "mesa-1") and the value is a coordinate pair:
{
  "items": {
    "mesa-1": { "left": 15.5, "top": 20.0 },
    "mesa-2": { "left": 30.0, "top": 20.0 }
  }
}
You can update a subset of tables in a single request — only the tables included in items are affected.

Layout Coordinate System

Positions are expressed as percentages of the floor-plan container’s width and height, giving the layout a resolution-independent coordinate space. Both left and top accept floating-point values and are clamped to the range −2 to 98 before being stored, ensuring table icons remain visible even when dragged to the very edge of the map.
PropertyTypeRangeDescription
leftfloat−2 to 98Horizontal position as a percentage of container width
topfloat−2 to 98Vertical position as a percentage of container height
Values outside the valid range are clamped automatically by the API, so no client-side validation is required.

Default Tables

The database is seeded with 12 tables numbered 1 through 12. All tables start with estado = 'disponible'. The default floor layout arranges these tables in a grid pattern, which admins can freely rearrange through the drag-and-drop interface.
Only admins can modify the floor layout. All authenticated users can read it.

Build docs developers (and LLMs) love