Edit supplier dialog
Edit a supplier's contact details, terms, address and bank details in a dialog, with client-side checks and the API's field errors. Changing the account clears its pay-by-bank confirmation.
Dialog: a modal you open from your own screen. You control when it opens with its props. 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-edit-supplier-dialogAlso installs: button, dialog, base-theme, ap-supplier-form, ui-ap-edit-supplier-dialog.
Usage
import { ApEditSupplierDialog } from "@/components/dolfin/ap/edit-supplier-dialog";
// Place it anywhere inside your <DolfinProvider>.
<ApEditSupplierDialog supplier={supplier} 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
| Prop | Type | Description |
|---|---|---|
supplier required | { id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; website?: null | string; taxNumber?: nul… | The supplier to edit; the form is filled from it each time the dialog opens. |
open required | boolean | |
onOpenChange required | (open: boolean) => void | |
onUpdated | (supplier: Supplier) => void | After the save; the dialog has closed. |
onSubmit | (values: SupplierFormValue) => void | Promise<unknown> | Saves the changes yourself: called with the validated form instead of updating through the API. Resolve to close the dialog; reject (or set `error`) to keep it open. |
submitting | boolean | Your save is running. |
error | Error | Why your save failed, shown above the button. |
title | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
description | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
hideAddress | boolean | |
hideBankDetails | boolean | |
countries | readonly CodeOption[] | Your countries and currencies for the pickers. Given, those lists are not fetched. |
currencies | readonly { id?: string; code: string; name: string; symbol: string; decimalPlaces?: number | string; }[] | |
bankProfiles | Readonly<Record<string, { countryCode: string; countryName: string; defaultCurrencies: string[]; accountHolderName: components["schemas"]["B… | Your bank profiles by country code. Given, or with your `countries`, no bank profile is fetched. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.supplierscore.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.
useMessagesuseSupplierMutationsFiles
Written to your app by the install command:
components/dolfin/ap/edit-supplier-dialog.tsx170 lines