Invoice credit notes card
An invoice's credit notes for the invoice page: New credit note (sent or partly paid invoices only) opening the create dialog, then each note with its number (linking to the credit note), status, reason and signed amount, with Issue and Delete on drafts. A renderBadges hook for per-note badges such as e-invoice delivery or accounting sync.
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/ar-credit-notes-cardAlso installs: button, card, ar-create-credit-note-dialog, ar-credit-note-parts, base-info-hint, base-states, ui-ar-credit-notes-card.
Usage
import { CreditNotesCard } from "@/components/dolfin/ar/credit-notes-card";
// Place it anywhere inside your <DolfinProvider>.
<CreditNotesCard />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 |
|---|---|---|
invoiceId | string | Loads the invoice and its credit notes, and wires New credit note, Issue and Delete. |
invoice | { id?: string; organisationId?: string; customerId?: string; documentNumber?: null | string; currency: string; issueDate?: string; dueDate?:… | The invoice whose credit notes to load and credit (its status, lines, currency and balance). |
creditNotes | readonly { id?: string; organisationId?: string; invoiceId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: n… | Your own credit notes: the card then makes no request. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
onNewCreditNote | () => void | Shows New credit note; open your own dialog from it. |
newCreditNoteDisabledReason | string | Why New credit note is unavailable (e.g. the invoice is not open); disables it and says why beside it. |
onIssue | (note: CreditNote) => Promise<unknown> | void | Shows Issue on drafts (the apply step). |
onDelete | (note: CreditNote) => Promise<unknown> | void | Shows Delete on drafts. |
draftActionsDisabledReason | string | A non-empty reason disables Issue and Delete (e.g. the role may not manage invoices) and says why beside them. |
pendingId | string | The note an Issue or Delete is running for: its buttons show a spinner and the others wait. |
pendingAction | "delete" | "issue" | Which action is running on `pendingId`. |
renderBadges | (note: CreditNote) => ReactNode | Badges after a note's status, e.g. its e-invoice delivery or accounting sync. |
hideCreate | boolean | By id: hide "New credit note" (e.g. a read-only view). |
onCreated | (note: CreditNote) => void | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.creditNotesbase.infoHint.moreAbout
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.
useCreditNoteMutationsuseInvoiceuseInvoiceCreditNotesuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/credit-notes-card.tsx216 lines