Screens / Orders (POS)
Orders (POS)
Open orders list, item picker and cart: create an order or add a round, confirm to the kitchen, serve or cancel lines, complete (close) the order. The order being typed (lines and customer) is kept for the session (PAN-62): leaving Orders and coming back keeps the draft, and the phone list shows a "Not sent yet · @count items" banner ("Not sent yet · 1 item" for one) with Continue. The draft is cleared on a business switch, on sign-out and once the order is placed; if the order was closed elsewhere meanwhile, a fresh one starts. Back on the tab (PAN-59) the lists show at once and refresh quietly; the search, menu chip and cancel error reset. Complete order (PAN-69, handoff §19) stays disabled while any line is placed (not sent to the kitchen yet), while new lines are still in the cart, or when no live line is left, with "Send or remove unsent items first." under it; a banner says lines still preparing will be served. Owners and managers also get Cancel order (hidden for cashiers, and after a 403), confirmed in a sheet with the item counts (and a warning that stock already used by served items is not returned); the order then leaves the list. Open orders / All orders segments sit above the list; All orders is its own page. Since then: Confirm (Place order / Confirm round) can answer a stock shortage, and the low-stock prompt (PAN-85) offers Process with remaining stock, Change to N and Cancel. Owners and managers (`costs.view`) also see an estimated cost under order lines and the total (PAN-86). Lines carry Ready and Served ticks (PAN-87): Ready needs `orders.prepare`, Served needs `orders.serve`. Cancel order asks for an optional reason (PAN-74). Buttons follow permission keys: `orders.create`, `orders.complete`, `orders.cancel` (PAN-88). Charges (PAN-129): the cart lists the active charges with the subtotal, each charge's amount and the total; a default-on charge can be switched off (cashiers only when the charge allows it) and a default-off one switched on, and confirm sends removed_charge_ids and added_charge_ids. Split bill (PAN-135) opens /orders/id/:orderId/split. Restyled to the refined design (PAN-136). Order detail applies the charges once after Place order (PAN-139). Complete order asks for the payment method (cash, QRIS, card, transfer) and sends it with the close (PAN-142); a round review footer sits under the cart (PAN-136).
- App routes
/orders/orders/new/orders/new/cart/orders/id/:orderId/orders/id/:orderId/cart- Access
- orders.create (new order), orders.view
- Screen code
lib/screens/orders/orders_page.dartlib/screens/orders/orders_controller.dartlib/screens/orders/widgets/unsent_order_banner.dartlib/screens/orders/widgets/customer_field.dartlib/screens/orders/widgets/order_close_actions.dartlib/screens/orders/widgets/cancel_order_sheet.dartlib/screens/orders/order_action_copy.dartlib/domain/orders/order_rules.dartlib/domain/orders/order_access.dartlib/screens/orders/low_stock_flow.dartlib/screens/orders/low_stock_prompt.dartlib/screens/orders/widgets/low_stock_sheet.dartlib/screens/orders/widgets/est_cost.dartlib/screens/orders/widgets/order_line_ticks.dartlib/screens/orders/widgets/order_progress.dartlib/screens/orders/widgets/short_on_chip.dartlib/screens/orders/widgets/cart_charges.dartlib/domain/charges/charge_rules.dartlib/screens/orders/widgets/round_review_footer.dartlib/domain/orders/sales_changes.dart- Source
- elmermj/panly-app @ pre-staging-test (72aaffd)
API calls (13)
| Call | Why the screen makes it | Where in the app code |
|---|---|---|
GET /v1/menusList menus |
Menus for the item picker (limit=100, all pages). Cached for 2 minutes (PAN-59): a cached catalogue shows at once and refreshes in the background; pull-to-refresh and retry always fetch | lib/screens/orders/orders_controller.dart:154lib/domain/usecases/orders/catalog_usecase.dart:43lib/domain/usecases/orders/catalog_usecase.dart:67lib/data/datasources/catalog_remote.dart:16 |
GET /v1/menu-itemsList menu items |
Menu items for the item picker (limit=100, all pages). Cached for 2 minutes (PAN-59): a cached catalogue shows at once and refreshes in the background; pull-to-refresh and retry always fetch | lib/screens/orders/orders_controller.dart:154lib/domain/usecases/orders/catalog_usecase.dart:43lib/domain/usecases/orders/catalog_usecase.dart:67lib/data/datasources/catalog_remote.dart:25 |
GET /v1/ordersList orders |
Open orders (status=open, all pages) | lib/screens/orders/orders_controller.dart:155lib/data/datasources/orders_remote.dart:19 |
GET /v1/orders/{orderId}Get order with items and balance |
Open one order | lib/screens/orders/orders_controller.dart:320lib/data/datasources/orders_remote.dart:34 |
POST /v1/ordersCreate order (optionally with round 1) |
Create an order with its first round | lib/screens/orders/orders_controller.dart:712lib/data/datasources/orders_remote.dart:42 |
POST /v1/orders/{orderId}/itemsAdd another round of items ("order more") |
Add a round to an open order | lib/screens/orders/orders_controller.dart:713lib/data/datasources/orders_remote.dart:52 |
POST /v1/orders/{orderId}/confirmConfirm a round to the kitchen (with stock check) |
Confirm placed items to the kitchen (stock check). A 409 stock shortage opens the low-stock prompt; its buttons confirm again with allow_partial and the shortage_token (Process with remaining stock) or after lowering the short lines and sending cancel_item_ids for lines nothing covers (Change to N) A stale shortage token answers 409 again with token_stale and a fresh list, which replaces the prompt in place. |
lib/screens/orders/orders_controller.dart:738lib/data/datasources/orders_remote.dart:108 |
POST /v1/stock-checkPreview stock for a cart or an unconfirmed round |
Read-only stock preview of the round that was just refused for stock, used only to price the low-stock prompt (est. cost with the stock available and with full stock). Skipped without `costs.view`; a failed check just leaves the cost line out The server answers 403 to the kitchen role. The app sends the order id and round number, not cart lines. |
lib/screens/orders/orders_controller.dart:794lib/domain/usecases/orders/orders_usecase.dart:88lib/data/repositories/orders_repository.dart:87lib/data/datasources/orders_remote.dart:127 |
PATCH /v1/orders/{orderId}/items/{orderItemId}Update a placed item, tick it ready / served, or move it to preparing / served / cancelled |
Cancel, edit or change a line's quantity or note | lib/screens/orders/orders_controller.dart:604lib/screens/orders/orders_controller.dart:665lib/data/datasources/orders_remote.dart:70 |
PATCH /v1/orders/{orderId}/items/{orderItemId}Update a placed item, tick it ready / served, or move it to preparing / served / cancelled |
Tick a line Ready (owner, manager, kitchen) or Served (owner, manager, cashier), or undo the tick, with {"ready"} or {"served"} (PAN-87). Repeating a tick is safe 409 item_cancelled, order_not_open, item_already_served, item_not_ready and item_not_confirmed are answered with the app's own words. |
lib/screens/orders/orders_controller.dart:633lib/domain/usecases/orders/orders_usecase.dart:60lib/data/repositories/orders_repository.dart:63lib/data/datasources/orders_remote.dart:87 |
POST /v1/orders/{orderId}/closeClose order (counts as paid) |
Complete the order (counts as paid). Body {"method": cash|qris|card|transfer} picked in the Complete order dialog (PAN-142, PAN-136); Idempotency-Key close-<orderId>, the same on every try so the sale is not recorded twice The button is disabled while any line is placed (order_rules.dart:21). If the server still answers 409 items_still_placed the app shows "Send or remove unsent items first." and reopens the order; 409 order_not_open (completed or cancelled elsewhere) shows "This order is no longer open." and goes back to the reloaded list. Server side (PAN-64): lines still preparing are served by the close and their stock is consumed in the same transaction. |
lib/screens/orders/orders_page.dart:209lib/screens/orders/orders_controller.dart:487lib/domain/usecases/orders/orders_usecase.dart:93lib/data/repositories/orders_repository.dart:92lib/data/datasources/orders_remote.dart:140 |
POST /v1/orders/{orderId}/cancelCancel open order |
Cancel order (`orders.cancel`), after the confirm sheet. The server cancels the placed and preparing lines with the order and releases their stock (PAN-64). The sheet has an optional reason: sent as {"note"} only when it has text after trimming, otherwise no body (PAN-74) Shown only with `orders.cancel` on an open order; a 403 hides it for the rest of the visit. 409 order_not_open shows "This order is no longer open." and goes back to the reloaded list. 422 cancel_note_too_long above 200 characters. Success shows "Order #<number> cancelled". |
lib/screens/orders/orders_page.dart:223lib/screens/orders/orders_controller.dart:533lib/domain/usecases/orders/orders_usecase.dart:96lib/data/datasources/orders_remote.dart:158lib/data/repositories/orders_repository.dart:99 |
GET /v1/chargesList bill charges |
The business charges (tax, service) shown and switched on or off in the cart | lib/screens/orders/orders_controller.dart:253lib/screens/charges/charges_controller.dart:44lib/domain/usecases/charges/charge_usecase.dart:12lib/data/repositories/charge_repository.dart:15 |
Each call links to its operation in the API reference. Code locations are file:line in panly-app at 72aaffd, listed from the screen down to the line that sends the request.