The Waiter (Mesero) dashboard is the primary point-of-sale interface for floor staff. It follows an offline-first architecture: all tables, products, and orders are cached in Room so the waiter can continue working when Firebase is unreachable, and pending orders are synced automatically as soon as internet connectivity is restored. The dashboard opens atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/luisumit/LaPreviaRestobar/llms.txt
Use this file to discover all available pages before exploring further.
waiter_main, which renders WaiterMainScreen after AppNavigation verifies that userRole == UserRole.MESERO.
Workflow
View Tables
TablesScreen displays all tables in a 2-column LazyVerticalGrid, sorted by table number. A summary card shows total, occupied, free, and active order counts. Tapping a TableCard navigates to table_details/{tableId} where tableId is an integer in the range 1–8.Browse Products and Build an Order
TableDetailsScreen calls viewModel.setCurrentTable(tableId) on load, binding all subsequent cart operations to that table. Active products are rendered as ProductItem cards; tapping one calls viewModel.addItemToCurrentOrder(product). The cart counter badge on the top-bar IconButton updates in real time from currentOrderItems.Confirm and Send to Kitchen
When the waiter taps the cart icon,
ConfirmOrderDialog shows a line-item summary with the running total. Confirming calls viewModel.createOrder(tableId, tableNumber), which constructs an Order with status = OrderStatus.ENVIADO and persists it to Room. If internet is available, it is immediately pushed to Firebase and the table is marked OCUPADA via firebaseTableRepository.assignOrderToTable(). If offline, the order is saved with syncStatus = "PENDING" for later sync.Track Order Status
OrdersScreen groups all active orders by status into labelled sections: Enviadas a cocina, Aceptadas, En preparación, and Listas para servir. The waiter also receives real-time notifications via NotificationPanel when the chef changes an order’s status.Deliver and Free the Table
Once an order reaches
LISTO, the waiter taps ENTREGAR on the OrderCard, calling viewModel.markOrderAsDelivered(orderId) which sets the status to ENTREGADO. After the client finishes, tapping LIBERAR calls viewModel.markTableAsFree(orderId), which marks the order COMPLETED and resets the table to LIBRE.Screens
- TablesScreen
- TableDetailsScreen
- ProductsScreen
- OrdersScreen (Waiter)
- InventoryScreen (Waiter)
Renders the full table grid and a
TablesSummary stat card. Observes viewModel.tables and viewModel.orders. Calls viewModel.refreshData() on first composition. Shows an offline banner if isInternetAvailable == false or isFirebaseConnected == false, with a Reconectar button that calls viewModel.syncWithFirebase().WaiterViewModel
WaiterViewModel is a @HiltViewModel that owns the entire Mesero data layer. It combines a Room database (offline-first) with Firebase Realtime listeners for live kitchen updates.
StateFlows
| StateFlow | Type | Description |
|---|---|---|
tables | StateFlow<List<Table>> | All restaurant tables, filtered to IDs 1–8 and status-corrected against active orders |
orders | StateFlow<List<Order>> | Active orders (excludes COMPLETED and CANCELLED) sourced from Room |
products | StateFlow<List<Product>> | Full product list, kept live via firebaseProductRepository.listenToProductChanges() |
isLoading | StateFlow<Boolean> | True while initial data load or manual refresh is in progress |
currentOrderItems | StateFlow<List<OrderItem>> | Cart contents for the currently selected table |
currentTableId | StateFlow<Int?> | ID of the table currently being served |
isFirebaseConnected | StateFlow<Boolean> | Reflects live Firebase reachability |
isInternetAvailable | StateFlow<Boolean> | Set by ConnectivityManager.NetworkCallback |
connectionStatus | StateFlow<String> | Human-readable connectivity string for display in banners |
connectionMessage | StateFlow<String?> | Ephemeral banner text, auto-cleared after 3 s |
successMessage | StateFlow<String?> | Ephemeral success banner text |
errorMessage | StateFlow<String?> | Ephemeral error banner text |
notifications | StateFlow<List<Notification>> | In-app notification queue, capped at 5 entries |
Computed Properties
Use Cases Called
firebaseTableRepository.getTables()— initial table loadfirebaseTableRepository.assignOrderToTable(tableId, orderId)— locks table when order is sentfirebaseTableRepository.clearTable(tableId)— frees table on delivery or cancellationfirebaseOrderRepository.createOrder(order)— pushes new order to FirebasefirebaseOrderRepository.updateOrderStatus(orderId, status)— marks delivered, served, or cancelledfirebaseOrderRepository.listenToOrderChanges()— real-time status updates from cheffirebaseProductRepository.getSellableProducts()— initial product loadfirebaseProductRepository.listenToProductChanges()— live stock updatessyncManager.syncOrders()— uploads pending Room orders after reconnect
Order Creation
Navigation Graph
WaiterMainScreen uses a ScrollableTabRow with three tabs rendered by TabContent:
| Tab index | Label | Composable |
|---|---|---|
| 0 | MESAS | TablesScreen |
| 1 | PRODUCTOS | ProductsScreen |
| 2 | ORDENES | OrdersScreen |
TableDetailsScreen is not a tab — it is reached from TablesScreen via navController.navigate("table_details/${table.id}") and exists as a separate composable route ("table_details/{tableId}") in AppNavigation. InventoryScreen is also registered as a standalone "inventory" route in AppNavigation rather than as a tab inside WaiterMainScreen.
On tablets in landscape orientation (screenWidthDp >= 600 and ORIENTATION_LANDSCAPE), the tab row is replaced by a NavigationRail on the left side of the screen, with the content filling the remaining space.
NotificationPanel
NotificationPanel is rendered as a floating overlay anchored to the top-end of the content area when the notification bell icon is tapped. It displays up to 5 entries from viewModel.notifications.
WaiterViewModel.showStatusChangeNotification() whenever the chef advances an order’s status. Each notification type corresponds to a NotificationType enum value:
NotificationType | Trigger |
|---|---|
ORDER_ACCEPTED | Chef changes status to ACEPTADO |
ORDER_IN_PREPARATION | Chef changes status to EN_PREPARACION |
ORDER_READY | Chef changes status to LISTO |
ORDER_DELIVERED | Status changes to ENTREGADO |
ORDER_CANCELLED | Waiter calls cancelOrder() |