The Chef (Cocinero) dashboard is the kitchen-side counterpart to the waiter interface. It subscribes to Firebase in real time and surfaces every order that waiters have dispatched, grouped by status. Chefs advance orders through a defined lifecycle — accepting, preparing, and marking them ready — and the status changes propagate back to the waiter’sDocumentation 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.
OrdersScreen instantly. The inventory tab gives chefs a read-only view of ingredient stock levels with search and category filtering. ChefMainScreen is reached from AppNavigation once userRole == UserRole.COCINERO is confirmed.
Workflow
Receive New Orders
ChefViewModel.setupFirebaseRealtimeUpdates() subscribes to firebaseOrderRepository.listenToNewOrders(). Every incoming ENVIADO order is saved to Room and surfaced in the Nuevas Órdenes section of the kitchen queue. A ChefNotification of type NEW_ORDER is added to the notification queue.Accept the Order
The chef taps Aceptar on the
OrderCard, which calls viewModel.acceptOrder(orderId). This sets status = ACEPTADO in both Room and Firebase. At the same time, updateInventoryForOrder() is triggered: for each OrderItem where trackInventory == true, the product’s stock is decremented in Firebase and synced to the InventoryViewModel.Start Preparation
Tapping Comenzar calls
viewModel.startOrderPreparation(orderId), setting status = EN_PREPARACION. The order moves from the Aceptadas section to En Preparación.Mark as Ready
Tapping Listo calls
viewModel.markOrderAsReady(orderId), setting status = LISTO. The waiter’s OrdersScreen now shows the order in the Listas para servir section, and the waiter receives a ORDER_READY notification.Monitor Inventory
Switching to the INVENTARIO tab renders the
InventoryScreen (chef variant) powered by InventoryViewModel. Chefs can search products by name, apply quick filters (All / Out of Stock / Low Stock / Enough Stock), and filter by category to monitor what ingredients are running low before accepting the next order.Screens
- ChefMainScreen
- OrdersScreen (Chef)
- InventoryScreen (Chef)
The root screen for the Cocinero role. Contains a
Scaffold with a custom Surface top bar showing the app name, a notification bell badge, and a logout button. A ConnectionStatusBannerChefMain card indicates Firebase connectivity state. The body hosts a two-tab TabRow — ORDENES (index 0) and INVENTARIO (index 1) — and an optional ChefNotificationPanel that slides in when the bell is tapped.ChefViewModel
ChefViewModel is a @HiltViewModel that manages the kitchen order queue with an offline-first Room cache and Firebase Realtime listeners.
StateFlows
| StateFlow | Type | Description |
|---|---|---|
orders | StateFlow<List<Order>> | Active kitchen orders (excludes COMPLETED and CANCELLED), deduped by ID |
isLoading | StateFlow<Boolean> | True while initial Room load or manual sync is in progress |
selectedOrder | StateFlow<Order?> | Currently highlighted order, updated on selectOrder() |
isFirebaseConnected | StateFlow<Boolean> | Reflects Firebase reachability |
isInternetAvailable | StateFlow<Boolean> | Set by ConnectivityManager.NetworkCallback |
errorMessage | StateFlow<String?> | Ephemeral error banner |
successMessage | StateFlow<String?> | Ephemeral success banner |
connectionMessage | StateFlow<String?> | Ephemeral connectivity banner |
notifications | StateFlow<List<ChefNotification>> | In-app notification queue, capped at 5 entries |
Computed Properties
Convenience Methods
updateOrderStatus() method, which validates that the target status is in [ACEPTADO, EN_PREPARACION, LISTO, COMPLETED, CANCELLED] before writing.
Status Update Flow
status == ACEPTADO, updateInventoryForOrder() iterates the order’s items. For each item where trackInventory == true, it fetches the current stock from firebaseProductRepository.getProductStock(), subtracts the ordered quantity, and writes the new value back to both firebaseProductRepository.updateProductStock() and firebaseInventoryRepository.updateStock().
OrderCard and StatusChip
OrderCard (from presentation/screens/chef/components/) renders a single order with:
- Table number and creation timestamp
- A
StatusChipcomposable displaying the currentOrderStatusas a colour-coded label - A collapsible list of
OrderItemrows showing quantity, product name, and subtotal - A
QuickActionbutton row that is configured per-section
StatusChip maps each OrderStatus to a background colour and display text: ENVIADO → orange / “Enviado”, ACEPTADO → error colour / “Aceptado”, EN_PREPARACION → orange / “En Prep.”, LISTO → green / “Listo”. All other statuses display a neutral “Desconocido” label.
QuickAction is a simple data class that bundles the label, target OrderStatus, and button colour:
ChefNotificationPanel
ChefNotificationPanel (from presentation/screens/chef/components/) is rendered inline inside ChefMainScreen directly below the top bar when showNotifications == true and notifications.isNotEmpty(). Unlike the waiter’s overlay, it fills the full horizontal width of the screen.
Notification Types
ChefNotificationType | Trigger |
|---|---|
NEW_ORDER | A waiter sends an order with status = ENVIADO |
ORDER_ACCEPTED | Status advances to ACEPTADO |
ORDER_IN_PREPARATION | Status advances to EN_PREPARACION |
ORDER_READY | Status advances to LISTO |
ORDER_DELIVERED | Waiter marks delivery (ENTREGADO) |
ORDER_CANCELLED | A waiter or chef cancels the order |
INVENTORY_UPDATED | Stock is decremented after order acceptance |