SalesCards
Show the Sales room's report cards, from orders and payments to taxes and refunds, over one SalesFigures result.
Import
import { SalesCards, type SalesCardId } from '@tallyui/components';Usage
<SalesCards figures={figures} currency="NZD" onOpenCard={openPanel}
cashierName={(id) => cashierNames.get(id)} hide={['brands']} />The cards appear in this order: Orders, Payments, Where sold, Top products, Categories, Brands, Cashiers, Taxes and Refunds. Brands shows only when some line has a brand or a cost. Shares beyond the first five rows fold into Other, and Top products lists the first four products. An unknown figure, such as a margin with no costed line, shows —, never 0. When onOpenCard is given, each card's head becomes a button with a chevron. SalesRoom renders these cards, and SalesCardPanel shows a card's detail.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
figures | SalesFigures | required | The period's figures |
currency | string | required | Currency of the figures' minor units |
onOpenCard | (card: SalesCardId) => void | — | Opens the card's panel; omit for cards without a button |
cashierName | (id: string) => string | undefined | — | A cashier id's display name; unknown or absent ids show “Unknown” |
hide | SalesCardId[] | — | Cards to leave out, for example one the backend's report cannot fill; the rest keep their order |
allLeftOut | boolean | false | The host left out every order of the period; the Orders card reads Every order is left out while it counts none |
SalesCardId
type SalesCardId = 'orders' | 'payments' | 'where-sold' | 'products' | 'categories' | 'brands' | 'cashiers' | 'taxes' | 'refunds';