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.

The Tables API covers two distinct concerns: real-time occupancy status, which any authenticated staff member can read to know which tables are free, and floor-plan layout management, which lets administrators position table icons on the dining-room canvas. Layout coordinates are stored as viewport percentages so the floor plan scales correctly across different screen sizes.

Get Table Status

GET /public/api/estadoMesas.php Returns the current occupancy state of every table. Available to any authenticated user. The response is a map keyed by table number (as a string) where each value contains at least an estado field and, when occupied, the associated order number.

Response

{
  "status": "OK",
  "data": {
    "1": { "estado": "disponible" },
    "2": { "estado": "ocupada", "numero_orden": 42 },
    "3": { "estado": "ocupada", "numero_orden": 37 }
  }
}
status
string
Always "OK" on success.
data
object
Map of table numbers (string keys) to their current status objects.
data[n].estado
string
Occupancy state. One of "disponible" (free) or "ocupada" (occupied with an open order).
data[n].numero_orden
integer
Order number associated with the table. Only present when estado = "ocupada".

Example Request

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

Get Floor Layout

GET /public/api/layoutMesas.php Returns the saved floor-plan positions for all table icons. Any authenticated user can read the layout; only admins can modify it. The isAdmin flag in the response controls whether the drag-and-drop editor is enabled in the front end.

Response

{
  "status": "OK",
  "data": {
    "mesa-1": { "left": 15.5, "top": 20.0 },
    "mesa-2": { "left": 30.0, "top": 45.0 }
  },
  "isAdmin": true
}
status
string
Always "OK" on success.
data
object
Map of table identifiers (e.g. "mesa-1") to position objects.
data[key].left
number
Horizontal position as a percentage of the canvas width (0 – 100).
data[key].top
number
Vertical position as a percentage of the canvas height (0 – 100).
isAdmin
boolean
true when the requesting session has rol_id = 1, enabling the drag-and-drop editor in the UI.

Example Request

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

Save Floor Layout

POST /public/api/layoutMesas.php Persists new positions for all table icons. Requires rol_id = 1 (Admin). The request body must be JSON; left and top values are accepted as any number but are clamped to the range −2 .. 98 before saving, preventing tables from being positioned entirely off-canvas.
This endpoint expects Content-Type: application/json. Sending application/x-www-form-urlencoded or multipart/form-data will result in the body being ignored and the request failing.

Request Body

{
  "items": {
    "mesa-1": { "left": 15.5, "top": 20.0 },
    "mesa-2": { "left": 30.0, "top": 20.0 }
  }
}
items
object
required
Map of table identifiers to position objects. Each key should follow the "mesa-{number}" naming convention used by the front end.
items[key].left
number
required
Desired horizontal position as a percentage of canvas width. Clamped to −2 .. 98.
items[key].top
number
required
Desired vertical position as a percentage of canvas height. Clamped to −2 .. 98.

Responses

{ "status": "OK", "message": "Layout guardado correctamente." }
HTTP StatusCondition
200 OKLayout saved successfully
403 ForbiddenRequesting session does not have rol_id = 1
422 Unprocessable Entityitems is missing or not a valid object/array

Example Request

curl -b 'PHPSESSID=...' \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"items":{"mesa-1":{"left":15.5,"top":20.0},"mesa-2":{"left":30.0,"top":45.0}}}' \
  'http://localhost:8080/public/api/layoutMesas.php'

Reset Floor Layout

DELETE /public/api/layoutMesas.php Discards the saved layout and restores all table icons to their default positions. Requires rol_id = 1 (Admin).
The default layout is defined in the application source. After a reset, the next GET request will return the built-in default positions and staff will see the default arrangement immediately on their next page load.

Response

{ "status": "OK", "message": "Layout restablecido correctamente." }

Example Request

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

Build docs developers (and LLMs) love