Purchase order detail
Blocks for one purchase order: header (PO number, net total, supplier, status, Close and Cancel), details card, lines with ordered and matched quantities, matched bills and linked delivery notes, plus PurchaseOrderDetail composing them with loading and error states.
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/ap-purchase-order-detailAlso installs: button, table, ap-purchase-order-parts, base-data-table, base-money, base-page, base-states, ui-ap-purchase-order-detail.
Usage
import { PurchaseOrderDetail } from "@/components/dolfin/ap/purchase-order-detail";
// Place it anywhere inside your <DolfinProvider>.
<PurchaseOrderDetail />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 |
|---|---|---|
purchaseOrderId | string | Fetches the order, its supplier, matched bills and linked delivery notes, and wires Close and Cancel. |
purchaseOrder | { id?: string; organisationId?: string; supplierId?: null | string; externalRef?: null | string; poNumber: string; currency: string; status?… | The order to show. Passing it (or `loading` / `error`) fetches nothing; null reads "not found". |
supplier | { id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; website?: null | string; taxNumber?: nul… | |
matchedBills | readonly { billId: string; matchGroupId: string; matchGroupStatus: components["schemas"]["MatchGroupStatus"]; invoiceNumber?: null | string;… | |
matchedBillCurrencies | Readonly<Record<string, string>> | Each matched bill's currency by bill id. |
deliveryNotes | readonly { id?: string; organisationId?: string; supplierId?: null | string; externalRef?: null | string; dnNumber: string; purchaseOrderId?… | |
loading | boolean | |
error | Error | |
onRetry | () => void | |
onClose | () => void | Shows Close in the header while the order is open. |
onCancel | () => void | Shows Cancel in the header while the order is open. |
pendingAction | OrderTransition | The transition running now: its button shows progress, and both wait. |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Before Close and Cancel in the header; a function receives the loaded order (e.g. to open it for editing). |
before | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Above the header (a back link). |
hideDeliveryNotes | boolean | Hide the linked delivery notes card. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.orders
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.
useDolfinLocaleuseLinkedDeliveryNotesuseMessagesusePurchaseOrderusePurchaseOrderActionsuseSupplierFiles
Written to your app by the install command:
components/dolfin/ap/purchase-order-detail.tsx395 linescomponents/dolfin/ap/purchase-order-linked-notes.tsx82 lines