Skip to content

feat(display): add order filter and POS controls - #1531

Merged
khaira777 merged 6 commits into
mainfrom
fm/flocafe-customer-display-order-types-and-pos-controls
Nov 9, 2026
Merged

khaira777 merged 6 commits into
mainfrom
fm/flocafe-customer-display-order-types-and-pos-controls

Conversation

@khaira777

@khaira777 khaira777 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1523

Intent

Build the Customer Display Order-Type Filter and POS Ready/Picked-Up Controls so that:

  1. Settings -> Customer Display has an option to set which order types are shown on the Customer Display (defaulting to Takeaway / Pickup only so Delivery and table-served Dine-In do not clutter the pickup screen unless enabled).
  2. Orders do not get stuck in the Preparing column on the Customer Display when KDS is not used or is disabled: add Mark Ready and Picked Up controls directly on the POS Orders page so staff can move orders from Preparing to Ready for Pickup and clear them once picked up, and keep paid Customer-Display-eligible orders on the board until marked Picked Up even when KDS is disabled.

What Changed

  • Added an order_types filter (takeaway, dine_in, online, delivery, defaulting to ['takeaway']) to Customer Display configuration, settings UI (CustomerDisplayCard), GET /api/customer-display/feed, and GET /api/orders multi-type query filtering (type=takeaway,dine_in) so board pagination and projection filter eligible order types in SQL.
  • Kept settled completed orders with unserved live items in active order views and Customer Display projections regardless of whether KDS is enabled, and updated PATCH /api/orders/:id/status for ready and served transitions to advance active order_items while preserving terminal completed order status.
  • Added getOrderEffectivePrepStatus and Mark Ready / Picked Up controls on the POS Orders list and detail panel (OrderCard, OrderDetailPanel, OrdersMasterList) with localized labels across all supported locales.

Risk Assessment

✅ Low: Customer display order-type filtering, POS ready/picked-up controls, pre-pagination SQL filtering, item catch-up transitions, and documentation contracts are cleanly implemented and verified across backend, frontend, and test suites.

Testing

Ran focused backend suites (test:customer-display-config, test:customer-display-settings-route, test:customer-display-feed, and test:orders-search), built the backend and static frontend, and drove the full browser E2E scenarios in frontend/e2e/customer-display-kds-readiness.spec.ts against an isolated server instance on ports 43001-43003, capturing 6 visual screenshots in the evidence directory; after fixing a prior-section fixture leak in tests/customer-display-feed.test.ts and a false selectedOrderNotInCurrentList banner in handleUpdateOrderPrepStatus, all scenarios and checks passed.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Default Order-Type Filter in Settings and Customer Display Exclusion of Non-Takeaway Orders: Opening Settings -> Kitchen Display shows 'Order types shown' defaulting to only 'Takeaway / Pickup' checke… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/01-settings-customer-display-order-types.png, frontend/e2e/customer-display-kds-readiness.spec.ts, tests/customer-display-feed.te…
Adversarial Guard - Prevent Deselecting All Order Types in Settings UI and Reject Empty/Invalid order_types on API: Clicking the last checked order type ('Takeaway / Pickup') in Settings -> Customer D… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/01-settings-customer-display-order-types.png, frontend/e2e/customer-display-kds-readiness.spec.ts, tests/customer-display-setting…
Dynamic Order-Type Filter Updates on Customer Display Without Reload: Enabling 'Dine-in' in Settings -> Customer Display and clicking Save causes an active Dine-in order to appear alongside the Takeaw… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/02-customer-display-dine-in-enabled.png, frontend/e2e/customer-display-kds-readiness.spec.ts
POS Orders Mark Ready and Picked Up Controls Advance Paid Order on Customer Display When KDS is Disabled: With kds_enabled=false and prepaid billing, a newly paid Takeaway order stays in Preparing on… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/03-pos-orders-mark-ready.png, ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/04-pos-orders-picked-up.png,…
SQL Pre-Filtering by Order Type Before Pagination and Active Order Catch-Up Transitions: Signed-in and paired Customer Display queries filter out excluded order types in SQL before pagination so 250+… ✅ pass live tests/customer-display-feed.test.ts, tests/orders-search-api.test.ts

Settings -> Customer Display showing Order types shown defaulting to Takeaway / Pickup only
Paired Customer Display showing Dine-in and Takeaway orders in Preparing after enabling Dine-in in Settings
POS Orders screen showing Mark Ready controls in both the master list and detail panel for a paid Takeaway order when KDS is disabled
POS Orders screen after clicking Mark Ready showing Picked Up controls and ready item status without false stale-list banner
Paired Customer Display showing paid Takeaway order moved to Ready for Pickup after clicking Mark Ready on POS Orders
Paired Customer Display cleared after clicking Picked Up on POS Orders

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • 🚨 main/routes/orders.ts:3587 - In PATCH /api/orders/:id/status, isSameOrderState (main/routes/orders.ts:3587-3594) explicitly excludes (currentOrder.status === 'ready' && status === 'ready' && hasPendingOrPreparingItems) and (currentOrder.status === 'served' && status === 'served' && hasActivePickupItems) so unadvanced order_items can catch up when an active order has pending/preparing/ready lines (for example after POST /api/orders/:id/items appends a pending item while kds_enabled = 'false'). However, VALID_TRANSITIONS[currentOrder.status] (main/routes/orders.ts:3616-3623) never includes currentOrder.status and canTransitionCompletedPreparation (main/routes/orders.ts:3625-3634) only checks currentOrder.status === 'completed', so any request that bypasses isSameOrderState via those two conditions immediately throws 400 Cannot transition order status from 'ready' to 'ready' (or 'served' to 'served') at main/routes/orders.ts:3636-3643. Conversely, when currentOrder.status === 'completed' and all active items are already 'served', projectBoardStatusFromItems returns null, so repeating PATCH /api/orders/:id/status with { status: 'served' } is neither matched by isSameOrderState (main/routes/orders.ts:3591-3593, which only checks status === 'ready') nor allowed by canTransitionCompletedPreparation, throwing 400 instead of returning an idempotent 200. Sibling site: getOrderEffectivePrepStatus (shared/order-item-status.ts:180-185) only calls projectBoardStatusFromItems(order.items) when order.status === 'completed', so if a new pending item is appended/restored onto a ready or served active order while KDS is disabled, the POS /orders page continues showing Picked Up (or no button for served) instead of Mark Ready until the order is settled to completed.
  • ⚠️ main/routes/orders.ts:821 - The paired Customer Display feed (main/services/customer-display-tokens.ts:406-411) passes orderTypes: config.order_types into selectBoardEligibleOrderPage so excluded order types (dine_in, delivery, online by default) are filtered in SQL before pagination. On the signed-in Customer Display path, however, fetchSignedInBoardOrders (frontend/src/lib/customer-display.ts:161-178) does not pass the configured order_types to GET /api/orders, and main/routes/orders.ts:818-824 (plus sibling main/routes/orders.ts:848-853) hardcodes CUSTOMER_DISPLAY_ORDER_TYPES (all four order types) when calling selectBoardEligibleOrderPage and collectProjectedCompletedOrderIds. Because <24h completed orders with unserved items are now included even when kds_enabled = 'false' (where every paid dine_in, delivery, or online order retains order_items.status = 'pending'), excluded order types consume GET /api/orders page slots and server-side batchHydrateOrders work before fetchSignedInBoardOrders discards them on the client, increasing poll page count and hiding older eligible takeaway orders once 5,000 excluded-type rows sit ahead of them. Pass the configured board order types to GET /api/orders and filter by them in selectBoardEligibleOrderPage / collectProjectedCompletedOrderIds before pagination.
  • ⚠️ docs/architecture/frontend.md:222 - docs/architecture/frontend.md:222-238 introduces a duplicate ### Customer Display board filtering and POS pickup controls subsection under ## State management instead of updating the canonical ## Customer display section at docs/architecture/frontend.md:595-633 (where docs/architecture/frontend.md:608 still states that the config only sets which statuses show, the refresh interval, and whether the last-updated time is shown). Sibling documentation sites with stale contracts from this change: docs/architecture/order-lifecycle.md:424-434 still states that <24h completed orders with unfinished live items remain in GET /api/orders?view=active, GET /api/orders?status=active, and /customer-display only "When KDS is enabled" and omits PATCH /api/orders/:id/status (ready/served) on completed orders; docs/reference/api.md:650-651 omits order_types from GET /api/settings/customer-display and PUT /api/settings/customer-display; and docs/reference/api.md:327 still states that completed is unconditionally terminal on PATCH /api/orders/:id/status.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Default Order-Type Filter in Settings and Customer Display Exclusion of Non-Takeaway Orders: Opening Settings -> Kitchen Display shows 'Order types shown' defaulting to only 'Takeaway / Pickup' checke… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/01-settings-customer-display-order-types.png, frontend/e2e/customer-display-kds-readiness.spec.ts, tests/customer-display-feed.te…
Adversarial Guard - Prevent Deselecting All Order Types in Settings UI and Reject Empty/Invalid order_types on API: Clicking the last checked order type ('Takeaway / Pickup') in Settings -> Customer D… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/01-settings-customer-display-order-types.png, frontend/e2e/customer-display-kds-readiness.spec.ts, tests/customer-display-setting…
Dynamic Order-Type Filter Updates on Customer Display Without Reload: Enabling 'Dine-in' in Settings -> Customer Display and clicking Save causes an active Dine-in order to appear alongside the Takeaw… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/02-customer-display-dine-in-enabled.png, frontend/e2e/customer-display-kds-readiness.spec.ts
POS Orders Mark Ready and Picked Up Controls Advance Paid Order on Customer Display When KDS is Disabled: With kds_enabled=false and prepaid billing, a newly paid Takeaway order stays in Preparing on… ✅ pass live ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/03-pos-orders-mark-ready.png, ~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET/04-pos-orders-picked-up.png,…
SQL Pre-Filtering by Order Type Before Pagination and Active Order Catch-Up Transitions: Signed-in and paired Customer Display queries filter out excluded order types in SQL before pagination so 250+… ✅ pass live tests/customer-display-feed.test.ts, tests/orders-search-api.test.ts
  • npm run test:customer-display-config
  • npm run test:customer-display-settings-route
  • npm run test:customer-display-feed
  • npm run test:orders-search
  • npm run build && npm run build:frontend
  • cd frontend && E2E_BASE_URL=http://127.0.0.1:43001 E2E_KDS_BASE_URL=http://127.0.0.1:43002 E2E_SERVER_APP_BASE_URL=http://127.0.0.1:43003 FLO_E2E_EVIDENCE_DIR=~/.no-mistakes/evidence/01M6YKM0CCKHGTSSW8J47YY4ET npx playwright test e2e/customer-display-kds-readiness.spec.ts --config=playwright.config.ts --project=chromium
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-code-review

Copy link
Copy Markdown

ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Filter customer display order types and add POS pickup controls

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Default Customer Display to takeaway orders, with configurable order types filtered before
 pagination.
• Add POS Mark Ready and Picked Up controls so staff can advance orders without KDS.
• Keep paid orders visible until pickup, while preserving their completed status and updating item
 statuses.
Diagram

graph TD
  Settings["Display settings"] --> Config["Display config"] --> Query["Board queries"] --> Board["Customer display"]
  POS["POS controls"] --> Status["Status API"] --> Data[("Orders and items")] --> Query
Loading
High-Level Assessment

Using the existing order-status API and shared item-status projection keeps POS actions and both display paths aligned. A separate pickup state or POS-only board filter would duplicate lifecycle rules or leave paginated feeds inconsistent.

Files changed (50) +1683 / -148

Enhancement (9) +406 / -45
page.tsxWire POS preparation actions to the status API +30/-0

Wire POS preparation actions to the status API

• Adds permission-gated ready and served requests, refreshes the order list, and passes action and loading state to list and detail views.

frontend/src/app/(dashboard)/orders/page.tsx

OrderCard.tsxAdd readiness controls to order cards +35/-1

Add readiness controls to order cards

• Uses effective preparation status to show Mark Ready or Picked Up for eligible orders and disables the action while its request is in progress.

frontend/src/components/orders/OrderCard.tsx

OrderDetailPanel.tsxAdd readiness controls to order details +30/-0

Add readiness controls to order details

• Shows the appropriate Mark Ready or Picked Up action in the detail panel based on effective preparation status.

frontend/src/components/orders/OrderDetailPanel.tsx

OrdersMasterList.tsxExpose pickup actions in the master list +45/-9

Expose pickup actions in the master list

• Adds ready and pickup buttons alongside list entries, with selection styling retained on the list item.

frontend/src/components/orders/OrdersMasterList.tsx

CustomerDisplayCard.tsxAdd Customer Display order-type selection +44/-0

Add Customer Display order-type selection

• Adds checkboxes for takeaway, dine-in, online, and delivery orders, preventing the last selected type from being removed.

frontend/src/components/settings/CustomerDisplayCard.tsx

customer-display.tsFilter signed-in board requests by order type +53/-10

Filter signed-in board requests by order type

• Adds order types to display configuration and sends them with paginated board requests. Supports legacy configuration with a takeaway default and excludes unexpected returned types.

frontend/src/lib/customer-display.ts

orders.tsFilter board queries and advance preparation items +101/-20

Filter board queries and advance preparation items

• Adds SQL order-type filtering before board pagination and keeps recently completed orders with unfinished items in active views without KDS. Ready and served requests advance active items, including on settled orders, while preserving completed order status.

main/routes/orders.ts

customer-display-tokens.tsFilter paired display pages by order type +44/-5

Filter paired display pages by order type

• Applies configured order types to active and projected-completed order selection before feed pagination. Completed-order projection no longer depends on KDS being enabled.

main/services/customer-display-tokens.ts

order-item-status.tsDerive effective POS preparation status +24/-0

Derive effective POS preparation status

• Adds a shared helper that determines whether released orders, including completed orders with unfinished items, can be marked ready or picked up.

shared/order-item-status.ts

Tests (5) +790 / -11
customer-display-kds-readiness.spec.tsCover display filtering and POS pickup end to end +264/-0

Cover display filtering and POS pickup end to end

• Tests settings selection, signed-in and paired boards, and a paid takeaway order moving from Preparing to Ready to cleared with KDS disabled. Adds optional screenshot evidence.

frontend/e2e/customer-display-kds-readiness.spec.ts

customer-display-config.test.tsTest configuration defaults and preparation projection +150/-2

Test configuration defaults and preparation projection

• Covers order-type validation and normalization, legacy defaults, frontend configuration handling, and effective POS preparation status.

tests/customer-display-config.test.ts

customer-display-feed.test.tsTest board filtering and manual pickup transitions +351/-3

Test board filtering and manual pickup transitions

• Covers paired and signed-in type filtering, filtering before pagination, paid-order visibility without KDS, item catch-up, and clearing an order after pickup.

tests/customer-display-feed.test.ts

customer-display-settings-route.test.tsTest display order-type settings API +14/-2

Test display order-type settings API

• Checks takeaway defaults, invalid selections, and normalization and persistence of valid order types.

tests/customer-display-settings-route.test.ts

orders-search-api.test.tsTest active paid orders without KDS +11/-4

Test active paid orders without KDS

• Verifies that recently completed orders with unfinished items remain in active results when KDS is disabled, while served orders do not.

tests/orders-search-api.test.ts

Documentation (3) +36 / -24
frontend.mdDocument display filtering and POS pickup actions +16/-8

Document display filtering and POS pickup actions

• Explains configured order-type filtering in the signed-in board query and the POS controls that move orders through readiness and pickup.

docs/architecture/frontend.md

order-lifecycle.mdDocument paid-order readiness without KDS +15/-11

Document paid-order readiness without KDS

• Clarifies that recently completed orders with unfinished items remain eligible regardless of KDS, and that manual transitions advance items without reopening settled orders.

docs/architecture/order-lifecycle.md

api.mdUpdate display settings and order API contracts +5/-5

Update display settings and order API contracts

• Documents order-type filtering, display defaults, feed eligibility, and the item-status effects of ready and served transitions.

docs/reference/api.md

Other (33) +451 / -68
ar.jsonLocalize display and pickup controls in Arabic +13/-2

Localize display and pickup controls in Arabic

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ar.json

bn.jsonLocalize display and pickup controls in Bengali +13/-2

Localize display and pickup controls in Bengali

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/bn.json

de.jsonLocalize display and pickup controls in German +13/-2

Localize display and pickup controls in German

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/de.json

en.jsonAdd English labels for display and pickup controls +13/-2

Add English labels for display and pickup controls

• Defines the order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/en.json

es.jsonLocalize display and pickup controls in Spanish +13/-2

Localize display and pickup controls in Spanish

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/es.json

fa.jsonLocalize display and pickup controls in Persian +13/-2

Localize display and pickup controls in Persian

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/fa.json

fil.jsonLocalize display and pickup controls in Filipino +13/-2

Localize display and pickup controls in Filipino

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/fil.json

fr.jsonLocalize display and pickup controls in French +13/-2

Localize display and pickup controls in French

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/fr.json

ha.jsonLocalize display and pickup controls in Hausa +13/-2

Localize display and pickup controls in Hausa

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ha.json

hi.jsonLocalize display and pickup controls in Hindi +13/-2

Localize display and pickup controls in Hindi

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/hi.json

id.jsonLocalize display and pickup controls in Indonesian +13/-2

Localize display and pickup controls in Indonesian

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/id.json

it.jsonLocalize display and pickup controls in Italian +13/-2

Localize display and pickup controls in Italian

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/it.json

ja.jsonLocalize display and pickup controls in Japanese +13/-2

Localize display and pickup controls in Japanese

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ja.json

jv.jsonLocalize display and pickup controls in Javanese +13/-2

Localize display and pickup controls in Javanese

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/jv.json

ko.jsonLocalize display and pickup controls in Korean +13/-2

Localize display and pickup controls in Korean

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ko.json

mr.jsonLocalize display and pickup controls in Marathi +13/-2

Localize display and pickup controls in Marathi

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/mr.json

ne.jsonLocalize display and pickup controls in Nepali +13/-2

Localize display and pickup controls in Nepali

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ne.json

nl.jsonLocalize display and pickup controls in Dutch +13/-2

Localize display and pickup controls in Dutch

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/nl.json

pa.jsonLocalize display and pickup controls in Punjabi +13/-2

Localize display and pickup controls in Punjabi

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/pa.json

pt.jsonLocalize display and pickup controls in Portuguese +13/-2

Localize display and pickup controls in Portuguese

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/pt.json

ru.jsonLocalize display and pickup controls in Russian +13/-2

Localize display and pickup controls in Russian

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ru.json

sq.jsonLocalize display and pickup controls in Albanian +13/-2

Localize display and pickup controls in Albanian

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/sq.json

sw.jsonLocalize display and pickup controls in Swahili +13/-2

Localize display and pickup controls in Swahili

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/sw.json

ta.jsonLocalize display and pickup controls in Tamil +13/-2

Localize display and pickup controls in Tamil

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ta.json

te.jsonLocalize display and pickup controls in Telugu +13/-2

Localize display and pickup controls in Telugu

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/te.json

th.jsonLocalize display and pickup controls in Thai +13/-2

Localize display and pickup controls in Thai

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/th.json

tr.jsonLocalize display and pickup controls in Turkish +13/-2

Localize display and pickup controls in Turkish

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/tr.json

uk.jsonLocalize display and pickup controls in Ukrainian +13/-2

Localize display and pickup controls in Ukrainian

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/uk.json

ur.jsonLocalize display and pickup controls in Urdu +13/-2

Localize display and pickup controls in Urdu

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/ur.json

vi.jsonLocalize display and pickup controls in Vietnamese +13/-2

Localize display and pickup controls in Vietnamese

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/vi.json

zh-tw.jsonLocalize display and pickup controls in Traditional Chinese +13/-2

Localize display and pickup controls in Traditional Chinese

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/zh-tw.json

zh.jsonLocalize display and pickup controls in Simplified Chinese +13/-2

Localize display and pickup controls in Simplified Chinese

• Adds order-type settings labels and POS readiness, pickup, success, and error messages.

frontend/src/lib/i18n/messages/zh.json

customer-display-config.tsValidate display order types with a takeaway default +35/-4

Validate display order types with a takeaway default

• Adds canonical order types to display configuration, normalizes selections, and defaults legacy or absent selections to takeaway.

main/services/customer-display-config.ts

@khaira777 khaira777 changed the title feat: add customer display order-type filter and POS ready controls feat(display): add order filter and POS controls Nov 8, 2026
@qodo-code-review

qodo-code-review Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Every paid order clogs the POS Active tab without KDS 🐞 Bug ≡ Correctness
Description
The view=active / status=active subquery in GET /api/orders no longer gates completed orders
on isKdsEnabled(), so any completed order from the last 24h that still has a
pending/preparing/ready item is listed as active. Settlement leaves items pending when KDS
is disabled, so after this PR every paid order of every type (dine-in, delivery, online included)
shows on the default Active tab of the POS Orders page until someone clicks Picked Up on it, even
order types the Customer Display is configured to hide.
Code

main/routes/orders.ts[R675-678]

+          WHERE +co.status = 'completed'
            AND co.created_at >= ?
            AND EXISTS (
              SELECT 1 FROM order_items AS active_item
Relevance

●● Moderate

Broad inclusion partly matches PR intent; no close accepted or rejected precedent for the Active-tab
scope.

PR-#1404

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The active-view subquery now has no KDS gate. A settled order with pending items becomes completed
without its items being touched. The POS Orders page opens on the active tab by default. So in
stores with KDS disabled, every order paid in the last 24h shows up there, whatever its type. The
order-type filter is applied only on the Customer Display board path, which needs `boardStatuses !==
null`.

main/routes/orders.ts[668-684]
main/routes/bills.ts[3651-3678]
frontend/src/app/(dashboard)/orders/page.tsx[205-205]
main/routes/orders.ts[708-721]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
With KDS disabled, settled orders become `completed` with items still `pending`. The active-view query no longer checks KDS, so all of these orders (every type) stay in the POS Active list for 24h until someone marks each one Picked Up.

## Fix Focus Areas
- main/routes/orders.ts[668-684]

## Recommended Fix
Only include `completed` orders in `view=active`/`status=active` when KDS is enabled, or when KDS is disabled and the order's type is in the stored Customer Display `order_types` (read via `readStoredCustomerDisplayConfig`). Dine-in, delivery and other excluded types should drop out of the active list once they are completed, as they did before this PR.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Remediation recommended

2. Paid orders picked up from POS never complete ✓ Resolved

Resolving commit: de72852

Resolution reason
N/A
Description
The new served branch of PATCH /api/orders/:id/status sets the items and the order to served
but never calls completeSettledReleasedOrderIfServed, which every item-level KDS route calls once
the last item is served. A fully paid takeaway order that is still non-completed (for example a
dispatch_policy='on_payment' release with KDS enabled) is stuck as served after Picked Up and
stays in active views and the cloud active-order count.

3. Old completed orders all show a Mark Ready button 🐞 Bug ≡ Correctness
Description
getOrderEffectivePrepStatus returns the item projection for any completed order with no 24h
completedKdsProjectionCutoff window, and the server's canTransitionPreparation has no age check
either. In stores without KDS every historical completed order still has pending items, so the All
tab and the detail panel show Mark Ready on orders from days or months ago, and one click rewrites
their item statuses and ready_at.
Code

shared/order-item-status.ts[R91-93]

+  if (order.status === 'completed' || order.status === 'served') {
+    return projectBoardStatusFromItems(order.items);
+  }
Relevance

●● Moderate

Real backend/shared 24h window inconsistency; closest precedent was left undetermined, not decided.

PR-#1404

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The backend limits completed-order board projection to a 24h window. The new shared helper and the
PATCH transition guard both skip that window, so the controls and the write are available on
completed orders of any age.

shared/order-item-status.ts[83-105]
main/services/orders.ts[343-350]
main/routes/orders.ts[3648-3656]
frontend/src/components/orders/OrderCard.tsx[1140-1162]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Mark Ready / Picked Up controls and the server transition apply to completed orders of any age, not just those inside the 24h Customer Display projection window.

## Fix Focus Areas
- shared/order-item-status.ts[83-105]
- main/routes/orders.ts[3592-3656]

## Recommended Fix
In `getOrderEffectivePrepStatus`, return null for `completed` orders whose `created_at` is older than the 24h window (accept `created_at` and an optional `now`). In the PATCH route, only allow `canTransitionPreparation` / the completed-order same-state checks when `currentOrder.created_at >= completedKdsProjectionCutoff()`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


4. POS staff can override kitchen station progress 🐞 Bug ⛨ Security
Description
The ready/served cases of the order-status route now bulk-update every pending/preparing (or
ready) row in order_items, gated only by orders.status.update. They skip
kitchen.status.update, KDS category/station scoping and requireKdsEnabled, which the item-level
route enforces. The POS buttons are rendered whether or not KDS is enabled, so in a KDS store a
cashier or server who presses Mark Ready marks items at other stations (e.g. still being cooked at
the bar or grill) as ready, and they vanish from those KDS screens.
Code

main/routes/orders.ts[R3833-3836]

+            db.prepare(`
+            UPDATE order_items SET status = 'ready', updated_at = ?
+            WHERE order_id = ? AND status IN ('pending', 'preparing')
+          `).run(nowStr, req.params.id);
Relevance

●● Moderate

Concrete permission and station-scope gap, but no matching precedent for bulk order-status item
writes.

PR-#1525
PR-#1508

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Before this PR, PATCH ready only changed orders.status. Now it writes item statuses across all
stations, without the permission and scope checks the dedicated item route applies. The frontend
shows the controls to anyone with orders.status.update, whatever the KDS setting.

main/routes/order-items.ts[73-77]
main/routes/order-items.ts[289-318]
main/routes/orders.ts[3586-3589]
frontend/src/app/(dashboard)/orders/page.tsx[466-466]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Order-level Mark Ready / Picked Up now overwrite every item's kitchen status without the KDS permission and station scope checks, even when KDS is in use.

## Fix Focus Areas
- main/routes/orders.ts[3832-3866]
- frontend/src/app/(dashboard)/orders/page.tsx[466-467]

## Recommended Fix
Only run the bulk `order_items` updates (and the completed-order catch-up) when `kds_enabled = 'false'`, or require `kitchen.status.update` for them. On the frontend, only pass `onUpdatePrepStatus` when KDS is disabled (or the user has `kitchen.status.update`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Linked PRs:
  🌐 PR #39
  🌐 PR #34
✅ Compliance rules (platform): 5 rules
✅ Cross-repo context — repo relationships
Review mode: Auto: 🧠 Deep: 144 hunks across order state transitions, SQL pagination, and paired feeds; first pass found multiple real defects.

Grey Divider

Tip of the day
💡 Did you know, you can see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread main/routes/orders.ts Resolved
Comment thread shared/order-item-status.ts Resolved
Comment thread main/routes/orders.ts Resolved
Comment thread main/routes/orders.ts Resolved
@khaira777
khaira777 force-pushed the fm/flocafe-customer-display-order-types-and-pos-controls branch from bd58d1a to de72852 Compare November 8, 2026 23:27
@khaira777
khaira777 force-pushed the fm/flocafe-customer-display-order-types-and-pos-controls branch from de72852 to 9aa3dea Compare November 8, 2026 23:27
@khaira777
khaira777 merged commit 511eb7e into main Nov 9, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-customer-display-order-types-and-pos-controls branch November 9, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(customer-display): add order-type filter setting and POS ready/picked-up controls

1 participant