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 admin dashboard, located at views/admin/admin.php, is the central control panel for restaurant managers. It requires rol_id=1 and provides a unified view of live order activity, currently connected staff, and quick navigation to product, category, and user management. Every section of the dashboard is designed to give administrators immediate situational awareness without leaving a single screen.

Dashboard Sections

Order History

A real-time order table displaying order number, table, total, date, and the computed estado_general for every order. Summary statistics at the top of the card show total orders, total revenue, delivered count, and pending count. Data is fetched via:
GET /public/api/ordenesAdminData.php

Connected Users

A live table of every staff member currently logged in, showing their role, IP address, current page, last activity timestamp, and device/browser. Powered by:
GET /public/api/usuariosConectados.php
Sessions with no activity in the last 30 minutes are automatically removed.

Products & Categories

Browse and manage the full product catalog and the category structure that drives kitchen and barista routing. Product and category management views are located at:
  • views/admin/productos.php

User Management

Create, edit, and delete staff accounts for waiters, kitchen staff, and baristas. All user operations are performed from:
  • views/admin/usuarios.php

Order Estado Calculation

The estado_general field displayed in the order history table is not stored directly — it is computed dynamically from the individual detalle_orden items belonging to each order. The logic follows this priority chain:
ConditionResulting estado_general
All items have status entregadoentregada
All items are listo or entregadolista
Any item is en_preparacionen_preparacion
None of the above applypendiente
This means an order’s overall status always reflects the real-time state of its constituent items — there is no manual step required to advance the order-level state under normal workflow.

Admin Override

Administrators can forcibly set any order to any valid state using the override endpoint:
POST /public/api/adminCambiarEstadoOrden.php
Required parameters:
ParameterDescription
numeroThe order number to update
estadoThe target state to apply
areaThe area context for the update
Valid target states: pendiente, en_proceso, lista, entregada This bypasses the normal item-level workflow and is particularly useful for fixing stuck orders — for example, an order where a preparation item was never marked ready but the food has already been served. Use this override sparingly; it does not update individual detalle_orden item statuses, only the order-level record.

Connected Users Details

The GET /public/api/usuariosConectados.php endpoint returns a JSON array of session objects. Each object contains the following fields:
FieldDescription
usuario_idUnique ID of the logged-in user
nombreDisplay name of the user
emailUser’s email address
rolRole label (e.g. Admin, Mesero, Cocina, Barista)
login_atTimestamp of when the session was created
ultima_actividadTimestamp of the most recent activity ping
dispositivoDetected device type — Desktop, Móvil, or Tablet — plus the browser name
pagina_actualThe last URL or view the user was active on
ipClient IP address at login
logout_atTimestamp of explicit logout, or null if still active
estado_labelHuman-readable status: Activo ahora, Inactivo reciente, or Inactivo
estado_classCSS class corresponding to the estado label, used for badge styling
Session data is stored in controller/sesiones_activas.json, not in MySQL. Sessions inactive for more than 30 minutes are automatically removed.

Build docs developers (and LLMs) love