Delivery note form dialog
Record or edit a delivery note in a dialog: DN number, supplier, received date, the purchase order it was despatched against (its lines copy across, received in full until changed) and the received lines (description, SKU, quantity received, unit). Checks the fields before saving and refreshes order lists, bill matches and the overview afterwards. Also ships NewDeliveryNoteButton and EditDeliveryNoteButton.
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-delivery-note-form-dialogAlso installs: button, dialog, input, select, base-theme, base-states, ap-purchase-order-form-parts, ui-ap-delivery-note-form-dialog.
Usage
import { DeliveryNoteFormDialog } from "@/components/dolfin/ap/delivery-note-form-dialog";
// Place it anywhere inside your <DolfinProvider>.
<DeliveryNoteFormDialog 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 |
|---|---|---|
open required | boolean | |
onOpenChange required | (open: boolean) => void | |
deliveryNote | { id?: string; organisationId?: string; supplierId?: null | string; externalRef?: null | string; dnNumber: string; purchaseOrderId?: null | … | The note to edit; omit (or pass null) to record a new one. |
purchaseOrder | { id?: string; organisationId?: string; supplierId?: null | string; externalRef?: null | string; poNumber: string; currency: string; status?… | A new note starts against this order, with its supplier and lines. When editing, names the linked order. |
onSaved | (deliveryNote: DeliveryNote) => void | After a save; the dialog has closed. |
onSubmit | (value: DeliveryNoteFormValue) => void | Promise<unknown> | Saves the note yourself: called with the validated form instead of saving through the API. Resolve to close the dialog; reject (or set `error`) to keep it open. |
submitting | boolean | |
error | Error | Why your save failed. |
supplierOptions | readonly { id: string; name: string; }[] | Suppliers to pick from (with `onSubmit`). Given, the picker fetches nothing. |
purchaseOrderOptions | readonly { id?: string; organisationId?: string; supplierId?: null | string; externalRef?: null | string; poNumber: string; currency: string… | Open purchase orders to despatch against (with `onSubmit`). |
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… | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.ordersbase.states.retrycore.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.
useDeliveryNoteMutationsuseDolfinLocaleuseMessagesusePurchaseOrderOptionsFiles
Written to your app by the install command:
components/dolfin/ap/delivery-note-form-dialog.tsx359 linescomponents/dolfin/ap/delivery-note-form-saver.tsx68 lines