ClosuresRoom
Browse closures and open tills for a business-day range and export settled closure figures as CSV.
Import
import { ClosuresRoom } from '@tallyui/components';Usage
<ClosuresRoom rows={rows} sessions={sessions} currency="GBP" timezone="Europe/London"
scopeFrom={from} scopeTo={to} status={status} hasMore={hasMore} onLoadMore={loadMore}
onRetry={retry} onSelect={setSelected} panel={panel} onExportCsv={saveCsv} />ClosuresRoom places ClosureStats above ClosureList, with a SessionCard for each open or counting till in scope. The host supplies the data, handles selection and can pass a ClosurePanel to display after the scrollable list. A cashier filter draws and counts only sessions opened by that cashier.
With onExportCsv, the room shows Export CSV. The Open tab disables it because open sessions are not closures. All and Closed export the loaded closure rows to closures-<scopeFrom>-<scopeTo>.csv. The columns are Business day, Closure, Register, Store, Opened, Closed and Closer, then Expected, Counted and Variance for each tender in first-seen order, and finally Status. Amounts use the currency’s decimal precision and include settled corrections. Withheld figures leave tender cells blank. Unsynced takes precedence over Corrected. If the host’s export fails, the room shows “Export failed. Try again.”
Ready shows the list or its empty state. The other statuses show “Loading...”, “Unavailable offline”, “Report access is not permitted” or “Could not load closures”. Error shows Retry instead of Load more. Otherwise, when another page is available, the footer shows Load more and the stats indicate that counts are partial.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
rows | readonly ClosureRow[] | required | Loaded closures for the scope, stamped with their business days |
sessions | readonly OpenSessionRow[] | [] | Open or counting tills in scope |
currency | string | required | ISO currency for display and export |
timezone | string | required | IANA time zone or device for day headings and row times |
now | () => Date | Current time | Clock for Today and Yesterday |
scopeFrom | string | required | First business day, YYYY-MM-DD |
scopeTo | string | required | Last business day, inclusive |
status | ClosuresStatus | required | loading, ready, unavailable, denied or error |
hasMore | boolean | false | More closure rows can be loaded |
onLoadMore | () => void | --- | Request the next page |
onRetry | () => void | --- | Retry a failed read |
blind | boolean | false | Hide the stats and session expected cash; disable session printing |
cashierId | string | --- | Show and count only this cashier’s sessions |
storeName | string | --- | CSV store label; otherwise the closure’s store ID is used |
onSelect | (row: ClosureRow) => void | --- | Select an available closure |
panel | ReactNode | --- | Host’s panel for the selected closure |
onExportCsv | (csv: string, filename: string) => void | Promise<void> | --- | Show Export CSV and deliver its contents and filename to the host |
onPrintXReport | (session: OpenSessionRow) => void | Promise<void> | --- | Show the session’s Print X-report button and request a print |