OrdersList
Recent orders and orders needing attention with sync details and retry actions
Import
import { OrdersList } from '@tallyui/components';Usage
<OrdersList
orders={orders}
onRetry={(orderIds) => outbox.requeue(orderIds)}
stuck={outbox.state.stuck}
/>Renders Recent orders and a Needs attention section when applicable, with expandable line and payment details, sync status, and warnings. Eligible rejected orders have a Retry action that calls onRetry.
With onReopen, a sale the store refused with coupon_invalid or total_mismatch shows a "Reopen" button in Needs attention instead of no action. It calls onReopen(order). When the coupons can't be carried at the amounts charged, the row offers "Reopen without the coupon: amount to collect", which calls onReopen(order, { withoutCoupons: true }); the till never drops the coupons on its own. A reopened sale stays in Needs attention, marked "Reopened as a parked sale.", with a Resume button when onResume is passed.
OrderSyncNotices renders one sale's sync notices on their own, for an app's own order screen: <OrderSyncNotices order={order} stuck={outbox.state.stuck}>{retry}</OrderSyncNotices>. Its children go where OrdersList puts Retry, between the notes and the store's warnings.
Server order history
Pass the store's order history as history to show it in Recent with the till's own sales. Each row is platform-neutral, and the app maps its own store's orders into it:
import { OrdersList, type OrderHistoryRow } from '@tallyui/components';
const history: OrderHistoryRow[] = storeOrders.map((order) => ({
id: order.id,
clientOrderId: order.clientOrderId, // the till's PosOrder id, when the till placed it
reference: order.code,
placedAt: order.placedAt,
totalMinor: order.totalMinor,
currency: order.currency,
itemCount: order.itemCount,
stateLabel: order.stateLabel,
}));
<OrdersList orders={orders} history={history} onRetry={(orderIds) => outbox.requeue(orderIds)} />- The outbox row wins. A history row whose
clientOrderIdis theidof an order inordersis hidden while that order is there. - Newest first. Recent merges outbox orders (by
createdAt) and history rows (byplacedAt). At equal times the outbox order comes first. A time that does not parse goes last. - Read-only. A history row shows
Order <reference> · <n> itemsand<date> · <total> · <stateLabel>, withreference,itemCountandstateLabelas given. It has no detail, no Retry and no warnings, and never appears under Needs attention.
Without history, the list renders exactly as before, with orders in the given order.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
orders | PosOrder[] | required | Orders shown in Recent and filtered into Needs attention |
onRetry | (orderIds: string[]) => Promise<number> | required | Requeues rejected orders; a result of zero re-enables Retry immediately |
formatDate | (iso: string) => string | defaultFormatDate | Formats order times; the default uses a medium date and short time, leaving unparseable values unchanged |
footer | ReactNode | --- | App content rendered after the order sections |
stuck | OutboxState['stuck'] | --- | Outbox entries that make pending orders need attention and supply each order's waiting-since time |
history | OrderHistoryRow[] | --- | The store's orders, shown read-only in Recent; a row is hidden while an outbox order has its clientOrderId as id |
onOpen | (row: PosOrder | OrderHistoryRow) => void | --- | Adds an Open button to each row, outbox order or history row, that passes it to the app |
onReopen | (order: PosOrder, options?: { withoutCoupons: true }) => Promise<void> | --- | Adds Reopen to a Needs attention row the store refused with a reopenable code; the app wires reopenRefusedOrder |
onResume | (order: PosOrder) => void | --- | Adds Resume to a reopened row in Needs attention; the app resumes the parked sale |
CustomerDisplayPairing
CustomerDisplayPairing is the whole screen of a customer display on its own device, pairing it with a till by code and then showing the sale.
OrderSyncNotices
OrderSyncNotices shows one sale's sync notices, the same ones OrdersList shows under each order, for an app's own order screen.