Supplier credit tab
A supplier's credit for a tab on the supplier page: the credit available per currency and a paged ledger of every movement (credit notes issued, applied to bills, reversed) that links to the note or the bill. Takes columns.
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components
Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.
Installation
Needs the Dolfin registry token. The CLI copies the source into your app.
bunx --bun shadcn@4.23.0 add @dolfin/ap-supplier-credit-tabAlso installs: base-data-table, base-money, base-page, base-states, base-theme, ui-ap-supplier-credit-tab.
Usage
import { SupplierCreditTab } from "@/components/dolfin/ap/supplier-credit-tab";
// Place it anywhere inside your <DolfinProvider>.
<SupplierCreditTab />Renders inside DolfinProvider (set it up once). By default it loads its own data through the SDK. Supplied-data examples show how to override that behavior.
API reference
| Prop | Type | Description |
|---|---|---|
supplierId | string | Fetches the supplier's balances and ledger. Leave it out and pass `balances` and `entries` to draw your own. |
balances | readonly { currency: string; available?: number | string; }[] | Credit available, one per currency. Passing it, `entries`, `loading` or `error` fetches nothing. |
entries | readonly { entryType?: components["schemas"]["SupplierCreditLedgerEntryType"]; supplierCreditNoteId?: string; billId?: null | string; applic… | The ledger page shown, newest first. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
page | number | 1-based page shown; the pager shows with `onPageChange`. |
hasNextPage | boolean | |
onPageChange | (page: number) => void | |
columns | readonly Column[] | ((defaults: Column[]) => readonly Column[]) | Replace the columns, or adjust the defaults (date, movement, reference, amount). |
pageSize | number | |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the ledger's empty state. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.supplierCreditNotes.tab
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useDolfinLocaleuseMessagesuseSupplierCreditFiles
Written to your app by the install command:
components/dolfin/ap/supplier-credit-tab.tsx226 lines