RecountSheet
RecountSheet records an online recount of one store Z closure, with every tender typed afresh, a required reason, and a manager's approval when the cashier needs one.
Import
import { RecountSheet } from '@tallyui/components';Usage
const { recount } = useClosureRecount(connector, context);
<RecountSheet
closure={closure}
currency="EUR"
online={online}
cashier={connector.cashier}
onRecount={(input) => recount!(closure.id, input)}
onSaved={() => refresh()}
onOpenChange={setRecountOpen}
/>Renders an open dialog with one amount field per tender: cash first, then every tender the closure expected or counted, including one that only a correction added. Every field starts empty; nothing is prefilled from the closure and no variance is shown. Cash can also be counted by notes and coins; typing in the cash field clears the tiles.
A reason is required, up to 500 characters. Record count stays disabled while offline ("Connect to recount"), while any amount is empty or invalid, or while the reason is blank.
Manager approval follows the cashier: hidden for a cashier who may manage closures, required for one who may not, and optional when there is no cashier. A store refusal of approval_required makes it required. Credentials are sent only when both are filled, and the password is cleared once the recount is recorded.
A store refusal or a failed send shows inline and keeps every typed value. While the recount or onSaved runs, the sheet cannot be dismissed; after a recorded recount whose onSaved fails, Record count stays disabled so a retry cannot send a second correction.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
closure | StoreClosure | required | The store closure to recount, with its corrections |
currency | string | required | ISO 4217 code for the amount format and the minor-unit digits sent |
online | boolean | required | False disables Record count and shows "Connect to recount" |
cashier | Cashier | null | --- | The signed-in cashier; absent means approval is optional, never granted |
onRecount | (input) => Promise<RecountResult> | required | Sends counted, the trimmed reason and any approval, normally through useClosureRecount |
onSaved | (closure: StoreClosure | undefined) => void | Promise<void> | required | Called with the closure the store returned; the sheet stays busy until it settles, then closes |
onOpenChange | (open: boolean) => void | required | Receives dialog visibility changes; called with false after a recorded recount |