dolfindevelopers

Invoice credit notes card

ComponentReceivablesSDK + UI

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

Choose your integration

Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/ar-credit-notes-card

Also installs: button, card, ar-create-credit-note-dialog, ar-credit-note-parts, base-info-hint, base-states, ui-ar-credit-notes-card.

Usage

screen.tsx
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

PropTypeDescription
invoiceIdstringLoads 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).
creditNotesreadonly { id?: string; organisationId?: string; invoiceId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: n…Your own credit notes: the card then makes no request.
loadingboolean
errorError
onRetry() => void
onNewCreditNote() => voidShows New credit note; open your own dialog from it.
newCreditNoteDisabledReasonstringWhy New credit note is unavailable (e.g. the invoice is not open); disables it and says why beside it.
onIssue(note: CreditNote) => Promise<unknown> | voidShows Issue on drafts (the apply step).
onDelete(note: CreditNote) => Promise<unknown> | voidShows Delete on drafts.
draftActionsDisabledReasonstringA non-empty reason disables Issue and Delete (e.g. the role may not manage invoices) and says why beside them.
pendingIdstringThe 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) => ReactNodeBadges after a note's status, e.g. its e-invoice delivery or accounting sync.
hideCreatebooleanBy id: hide "New credit note" (e.g. a read-only view).
onCreated(note: CreditNote) => void
classNamestring

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.

useCreditNoteMutationsuseInvoiceuseInvoiceCreditNotesuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/credit-notes-card.tsx 216 lines