dolfindevelopers

Create supplier credit note dialog

DialogPayablesSDK + UI

Records credit a supplier owes you as a draft: a searchable supplier picker (or a fixed supplier), gross amount, currency and an optional reason. Also ships SupplierCreditSupplierPicker.

Dialog: a modal you open from your own screen. You control when it opens with its props. 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/ap-new-supplier-credit-note-dialog

Also installs: button, command, dialog, input, label, popover, select, base-states, ui-ap-new-supplier-credit-note-dialog.

Usage

screen.tsx
import { NewSupplierCreditNoteDialog } from "@/components/dolfin/ap/new-supplier-credit-note-dialog";

// Place it anywhere inside your <DolfinProvider>.
<NewSupplierCreditNoteDialog open={open} onOpenChange={handleOpenChange} />

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
open requiredboolean
onOpenChange required(open: boolean) => void
onCreated(note: SupplierCreditNote) => voidCalled with the new draft after the dialog closes.
onSubmit(draft: NewSupplierCreditNoteDraft) => void | Promise<unknown>Records the draft yourself: called with the validated values instead of creating it through the API. Resolve to close the dialog; reject (or set `error`) to keep it open.
submittingboolean
errorErrorWhy your save failed (a `DolfinError` reads as the API's message).
suppliersreadonly SupplierChoice[]Suppliers to pick from (with `onSubmit`). Given, the picker fetches nothing.
fixedSupplierIdstringPre-selects and locks the supplier (hides the picker).
currenciesreadonly string[]Currencies to offer; GBP, USD and EUR by default.
defaultCurrencystring
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.supplierCreditNotes.newDialogcore.errors

Or edit the installed file directly: it is your code. See theming for colours and fonts.

Hooks

The SDK hooks this dialog uses. Use them directly from @dolfinai/react to build your own version.

useMessagesuseSupplierCreditNoteMutationsuseSupplierCreditSupplierSearch

Files

Written to your app by the install command:

  • components/dolfin/ap/new-supplier-credit-note-dialog.tsx 272 lines