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.

La Comanda operates two parallel preparation queues: the Kitchen queue for food and non-beverage items, and the Barista queue for coffee and drink items. Queue assignment is determined automatically by each product’s category slug at the moment an order is submitted. Both queues expose an identical two-action workflow — preparacion (start preparing) and lista (mark as ready) — through their respective action endpoints. Kitchen endpoints require rol_id = 3 (Cocina) or rol_id = 1 (Admin); Barista endpoints require rol_id = 4 (Barista) or rol_id = 1 (Admin).

Get Kitchen Orders

GET /public/api/obtenerOrdenes.php Returns all open kitchen orders — those containing at least one non-barista item that has not yet reached the entregado (delivered) state. Accessible to Admin (rol_id = 1) and Kitchen (rol_id = 3).

Response

{
  "ok": true,
  "ordenes": [
    {
      "id_orden": 18,
      "numero": 42,
      "mesa": "Mesa 3",
      "notas": "Sin cebolla en la hamburguesa",
      "estado": "en_preparacion",
      "items": [
        {
          "detalle_id": 105,
          "nombre": "Hamburguesa Clásica",
          "cantidad": 2,
          "estado_item": "en_preparacion"
        },
        {
          "detalle_id": 106,
          "nombre": "Papas Fritas",
          "cantidad": 2,
          "estado_item": "pendiente"
        }
      ]
    }
  ]
}
ok
boolean
true on success, false if an error occurred retrieving orders.
ordenes
array
Array of order objects with pending kitchen items.
ordenes[].id_orden
integer
Internal database ID of the order record.
ordenes[].numero
integer
Human-facing order number displayed on kitchen tickets and receipts.
ordenes[].mesa
string
Table label (e.g. "Mesa 3").
ordenes[].notas
string
Free-text notes entered by the waiter at order time (may be an empty string).
ordenes[].estado
string
Overall order state derived from its items: pendiente, en_preparacion, or listo.
ordenes[].items
array
Array of kitchen line items belonging to this order.
ordenes[].items[].detalle_id
integer
ID of the order detail record, used for granular item-level updates.
ordenes[].items[].nombre
string
Product name.
ordenes[].items[].cantidad
integer
Quantity ordered.
ordenes[].items[].estado_item
string
Item-level preparation state: pendiente, en_preparacion, listo, or entregado.

Example Request

curl -b 'PHPSESSID=...' \
  'http://localhost:8080/public/api/obtenerOrdenes.php'

Kitchen Action

POST /public/api/cocinaAccion.php Advances the preparation state of all kitchen items in a given order. Supports both traditional HTML form POST and AJAX requests. The endpoint detects AJAX calls by checking for the X-Requested-With: XMLHttpRequest header or an Accept: application/json header, and adjusts its response format accordingly.

Request Parameters

numero
integer
required
The human-facing order number (not the internal id_orden).
accion
string
required
The action to perform. Accepted values:
  • preparacion — transitions all pendiente kitchen items in the order to en_preparacion and records fecha_inicio_preparacion.
  • lista — transitions all pendiente and en_preparacion kitchen items to listo.

Action State Transitions

ActionSource StatesTarget StateSide Effect
preparacionpendienteen_preparacionSets fecha_inicio_preparacion timestamp
listapendiente, en_preparacionlisto

Responses

AJAX response (JSON):
{ "status": "OK" }
{ "status": "ERROR", "message": "Orden no encontrada." }
Non-AJAX response: HTTP redirect to views/cocina.php.

Example AJAX Request

curl -b 'PHPSESSID=...' \
  -X POST \
  -H 'X-Requested-With: XMLHttpRequest' \
  -F 'numero=42' \
  -F 'accion=preparacion' \
  'http://localhost:8080/public/api/cocinaAccion.php'

Get Barista Orders

GET /public/api/baristaEstado.php Returns the current state of all barista orders, split into two lists: items still requiring action, and recently delivered items. Accessible to Admin (rol_id = 1) and Barista (rol_id = 4).

Response

{
  "ok": true,
  "pendientes": [
    {
      "id_orden": 19,
      "numero": 43,
      "mesa": "Mesa 5",
      "notas": "",
      "estado": "pendiente",
      "items": [
        {
          "detalle_id": 110,
          "nombre": "Cappuccino",
          "cantidad": 1,
          "estado_item": "pendiente"
        }
      ]
    }
  ],
  "listas": []
}
ok
boolean
true on success.
pendientes
array
Orders with at least one barista item in pendiente or en_preparacion state.
listas
array
Up to the 20 most recently delivered barista orders (all items in listo or entregado state). Displayed on the barista screen as a recent-history reference.
The listas array is capped at 20 entries to keep the barista display uncluttered during long service periods. Older delivered orders remain in the database but are not returned by this endpoint.

Example Request

curl -b 'PHPSESSID=...' \
  'http://localhost:8080/public/api/baristaEstado.php'

Barista Action

POST /public/api/baristaAccion.php Advances the preparation state of all barista items (cafes and bebidas category slugs) in a given order. Always returns a JSON response.

Request Parameters

numero
integer
required
The human-facing order number.
accion
string
required
The action to perform:
  • preparacion — transitions all pendiente barista items to en_preparacion.
  • lista — transitions all pendiente and en_preparacion barista items to listo.

Action State Transitions

ActionSource StatesTarget State
preparacionpendienteen_preparacion
listapendiente, en_preparacionlisto

Response

{ "status": "OK" }
{ "status": "ERROR", "message": "Orden no encontrada." }

Example Request

curl -b 'PHPSESSID=...' \
  -X POST \
  -F 'numero=43' \
  -F 'accion=lista' \
  'http://localhost:8080/public/api/baristaAccion.php'

Barista vs Kitchen Item Routing

Every order item is routed to exactly one queue based on the slug of the category its product belongs to. This routing is applied when the order is first created and does not change if the category slug is later edited.
Category SlugQueue
cafesBarista
bebidasBarista
mesasIgnored — never appears in any queue
comidas, postres, especialidades, etc.Kitchen
Renaming the cafes or bebidas category slugs after orders have already been placed will not retroactively re-route existing order items. See the Categories API for full details on slug routing rules.
Both queues poll their respective status endpoints periodically on the kitchen and barista views. If you extend the system with WebSocket push notifications, you can replace the polling calls with event-driven updates to reduce server load during peak service.

Build docs developers (and LLMs) love