Supplier credit notes list page
The supplier credit notes list page: Payables header with New credit note, status tabs, a supplier filter with that supplier's available credit, and the table. Accepts your own header actions, the empty state and an aside; takes the table's columns, rowActions and filters.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as props. Pages vs components
Works with Dolfin’s SDK context, 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-notes-list-pageAlso installs: button, ap-new-supplier-credit-note-dialog, ap-supplier-credit-notes-table, base-page, ui-ap-supplier-credit-notes-list-page.
Usage
import { SupplierCreditNotesListPage } from "@/components/dolfin/ap/supplier-credit-notes-list-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <SupplierCreditNotesListPage />;
}Renders inside DolfinProvider (set it up once). It renders the data you pass as props.
API reference
| Prop | Type | Description |
|---|---|---|
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons beside "New credit note". |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the table's empty state. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | A column beside the table. |
hideCreate | boolean | Hide the "New credit note" button and dialog. |
onCreated | (note: SupplierCreditNote) => void | Called with a new draft; the list refreshes either way. |
className | string | |
columns | SupplierCreditNoteColumnsProp | |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Record<string, boolean>> | |
rowActions | SupplierCreditNoteRowActionsProp | Replace or extend the row menu (Issue when `onIssue` is given). Pass `[]` for none. |
supplierId | string | |
variant | DataTableVariant | |
loading | boolean | |
filters | SupplierCreditNoteFilters | Initial filters when the table fetches: a status, a supplier, a currency. A changed `supplierId` re-applies. |
error | Error | |
status | "Draft" | "Issued" | "PartiallyApplied" | "Applied" | The status or supplier the rows are filtered by, for the empty state's words. |
page | number | 1-based page shown; the pager shows with `onPageChange`. |
creditNotes | readonly { id?: string; organisationId?: string; supplierId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: … | The rows to show. Passing them (or `loading` / `error`) fetches nothing; rows still link to the note. |
filtered | boolean | A search hides every row, so the empty state says nothing matches. |
onRetry | () => void | |
pageSize | number | |
hideToolbar | boolean | Hide the status tabs and supplier filter (shown only when the table fetches). |
toolbarActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra controls at the end of the toolbar. |
hasNextPage | boolean | |
onPageChange | (page: number) => void | |
supplierNames | Readonly<Record<string, string>> | Supplier names by id, for the supplier column (e.g. `useSupplierCreditNotes().supplierNamesRecord`). |
pendingId | string | The row an action is running on. |
onRowClick | (note: SupplierCreditNote) => void | |
getRowRoute | (note: SupplierCreditNote) => DolfinRoute | null | Where a row links to when there is no `onRowClick`; the credit note by default (`null` for a plain row). |
classNames | DataTableClassNames | |
pager | boolean | Show the built-in previous / next pager when there is more than one page. Default true; pass false when you draw your own pager from the list's pagination (the table still dims while a page loads). |
onRowHover | (row: { id?: string; organisationId?: string; supplierId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: num… | Called with the row the pointer moves onto, and with `null` when the pointer leaves the rows (e.g. to highlight the row's point in a chart next to the table). Moving between rows reports the new row without a `null` first. |
onSupplierFilterChange | (supplierId: string | null) => void | |
hideSupplierFilter | boolean | |
hideBalances | boolean | Hide the "Available from" balance shown while one supplier is filtered. |
balances | readonly { currency: string; available?: number | string; }[] | Credit available from the supplier in view, shown above the table. |
onIssue | (note: SupplierCreditNote) => void | Shows Issue on drafts. Wired for you when the table fetches. |
Customisation
Without editing the source, you can change:
- Class names
classNameclassNames.frameclassNames.headerclassNames.headerCellclassNames.rowclassNames.cellclassNames.pager- Messages
ap.supplierCreditNotes
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this page uses. Use them directly from @dolfinai/react to build your own version.
useMessagesFiles
Written to your app by the install command:
components/dolfin/ap/supplier-credit-notes-list-page.tsx96 lines