# Sifariş idarəsi (Order management) — spec

## Purpose

Single screen for managing every active order in the terminal: receipts grouped by order
status, plus a **Pending (Gözləyən)** tab that surfaces *incoming* orders/requests that still
need an operator decision (accept / reject / create receipt). Mirrors the production terminal
`OrderManagementPage`.

## Layout

- **Status nav** (`order-nav` → `status-wrapper`): the **Pending** tab comes first, followed by the
  order statuses (Hazırlanır · Hazır · Götürüldü · Tamamlandı · Ləğv edilib). Each tab shows a live
  count; the active tab is filled blue. A filter button (`filter-wrapper`) sits on the right with a
  red dot when filters are applied.
- **List** (`order-receipt-wrapper`): full-width rows, each a 4-column grid — source/info ·
  customer · id/badges · total + status/time.

## Pending tab

Incoming items come from delivery integrations, call center, self-ordering kiosk and e-menu (QR).
Each row shows the source (logo or fallback icon on a blue tile), order number, order type, customer
(name / phone / address) or a service-request label, the total, a process indicator
(loading / success / error) and the time.

## Pending modal

Opens on row tap. `xl` when there is left content, `md` otherwise.

- **Header**: source icon, source label, `#order-number`, order type, close.
- **Alerts**: stop-list / order-level warnings.
- **Body** (2-col when left content exists): left = customer + extra info (payment, delivery time,
  note); right = product list (count badge · name · modifiers · price · total, with per-line alerts)
  and the total.
- **Actions**: reject first, then accept / create-receipt / go-to-receipt. Accept is disabled while a
  request is in-flight or when a stop-list product blocks the order.

## Status tabs — OrderItem cards

The non-pending tabs (Planlaşdırılmış · Hazırlanır · Hazır · Götürüldü · Tamamlandı ·
Ləğv edilib) render `OrderItem` cards (`order-item.tsx`): integration logo (or sale-type tile by
channel — IN/DELIVERY/TAKEAWAY), sale-type name, order number, courier line (red dashed when a
delivery has no courier), customer (name + comment icon / phone / address), `#displayId` + badges
(reopen · unprinted-station), total + chevron, time, and a **status button** showing the next
status. Open (unclosed) orders use the amber `.open` background.

- Status button on an active order → advances to the next status (READY without a courier →
  COMPLETED).
- Status button on a COMPLETED / CANCELLED order → opens the **FilterModal** to pick any status.
- Tapping the card → **ReceiptModal**.

## FilterModal — order status select

`filter-modal.tsx` — `GenModal` titled `Sifariş statusu #<displayId>`, a single column of status
rows (status icon + label), the current status disabled. Selecting a row sets the order status.

## ReceiptModal — receipt detail

`receipt-modal.tsx` — opens on card tap, titled `Çek #<displayId>`. Reuses the existing **Çek arxivi**
receipt-detail design (`ReceiptArchiveView`); in this prototype it is embedded from the
`archive-receipt` page.

## Filter panel — OpenReceiptFilter

The top-right filter button toggles the `filter-grid` panel (`open-receipt-filter.tsx`): an ID number
input + select chips (Satış növü · İşçi · Zal · Masa · Kuryer) each opening a **FilterModal**, a
Pre-çek toggle, and a **customize** button. A selected chip shows its value + a reset ✕; the red dot
on the filter button marks active filters.

### FilterConfig

The customize button opens `FilterConfig` (`filter-config.tsx`) — "Filtr konfiqurasiyası": each filter
with an active toggle (check / empty circle) and up/down reorder arrows, plus Sıfırla / Yadda saxla.

## Reject reason modal

`UISelectListModal` — single-select list of delivery reject reasons (label + optional description),
footer with **Ləğv et** (cancel) and a danger **Sifarişi imtina et** (reject order).

## Variants

| Variant | Source | Status |
|---|---|---|
| accepted | _order-management/* (interactive pending prototype) | accepted |
| b-pending-modal | _order-management/pending-modal.tsx | review |
| c-reject-reason | OrderRejectReason/OrderRejectReasonModal.tsx | review |
| archive/legacy-cardgrid | old auto-migrated mock | rejected |
