Supplier credit note detail
One supplier credit note: header with Issue, Delete (drafts that are not e-invoices) and Apply to bill, the draft notice, amount, applied, available and net and tax figures, details, history, and the bills it was applied to with Reverse. Exports each card for your own layout.
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-note-detailAlso installs: button, card, popover, ap-apply-supplier-credit-dialog, ap-supplier-credit-parts, base-data-table, base-info-hint, base-money, base-page, base-states, base-status-badge, base-timeline, ui-ap-supplier-credit-note-detail.
Usage
import { SupplierCreditNoteDetail } from "@/components/dolfin/ap/supplier-credit-note-detail";
// Place it anywhere inside your <DolfinProvider>.
<SupplierCreditNoteDetail />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 |
|---|---|---|
creditNoteId | string | Fetches the note, its supplier, applications and bill names, and wires every action. |
creditNote | { id?: string; organisationId?: string; supplierId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: number | … | The note to show. Passing it (or `loading` / `error`) fetches nothing; null reads "not found". |
supplierName | string | |
applications | readonly { id?: string; supplierCreditNoteId?: string; billId?: string; supplierId?: string; amount?: number | string; currency: string; sta… | The bills the credit was applied to, oldest first. |
billLabels | Readonly<Record<string, string>> | Bill invoice numbers by bill id, for the applications and history. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
onIssue | () => void | Shows Issue on a draft. |
onDelete | () => void | Shows Delete on a deletable draft. |
onApply | () => void | Shows Apply to bill while credit is left; open your own dialog. Wired to the apply dialog when fetching. |
onReverseApplication | (application: SupplierCreditApplication) => void | Shows Reverse on applied rows. By id, each `onX` you pass replaces the SDK's own handler. |
pendingAction | SupplierCreditNoteAction | The header action running now (Issue or Delete). |
pendingId | string | The application a reversal is running for. |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons after Issue, Delete and Apply to bill. |
before | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Rendered above the header (e.g. a back link). |
onDeleted | () => void | After a draft is deleted; goes back to the list by default. |
onApplied | (result: ApplySupplierCreditResult) => void | |
details | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra rows at the end of the details card, as `<dt>`/`<dd>` pairs. |
hideHistory | boolean | |
hideApplications | boolean | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.supplierCreditNotes
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.
useDolfinLocaleuseDolfinNavigateuseMessagesuseSupplierCreditNoteuseSupplierCreditNoteMutationsFiles
Written to your app by the install command:
components/dolfin/ap/supplier-credit-note-detail.tsx364 linescomponents/dolfin/ap/supplier-credit-note-cards.tsx283 lines