dolfindevelopers

Link purchase order dialogs

DialogPayablesSDK + UI

Two matching dialogs: LinkPurchaseOrderDialog picks one of the supplier's open purchase orders, proposes a pairing of its lines with the bill lines that have no order yet (same SKU, the engine's suggestion, same or similar wording), lets the reviewer adjust each pair and links them; MatchManuallyDialog pins a purchase-order line and/or a delivery-note line to one bill line with a quantity (0 records a nil delivery). Both save through your `onSubmit` (by id, `useMatchLineCommands`), with `submitting` and `error`.

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-link-po-dialog

Also installs: button, command, dialog, field, input, select, base-info-hint, base-states, base-status-badge, ui-ap-link-po-dialog.

Usage

screen.tsx
import { LinkPurchaseOrderDialog } from "@/components/dolfin/ap/link-po-dialog";

// Place it anywhere inside your <DolfinProvider>.
<LinkPurchaseOrderDialog open={open} onOpenChange={handleOpenChange} match={match} bill={bill} currency={currency} onSubmit={handleSubmit} />

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
match requiredPick<MatchGroupModel, "lines">
bill requiredPick<{ id?: string; organisationId?: string; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; eInvo…The bill (for its supplier and invoice date): `useMatchGroup(billId).bill`.
currency requiredstring
onSubmit required(link: MatchPurchaseOrderLinkInput) => Promise<unknown> | voidLinks the chosen pairs. Return a promise to keep the dialog open until it settles: it closes once it resolves and stays open (showing `error`) when it rejects.
submittingbooleanThe link is being saved: the buttons wait.
errorErrorWhy the last link failed, shown above the buttons.

Customisation

Without editing the source, you can change:

Messages
ap.match.linkap.match.manualbase.infoHint.moreAboutbase.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.

useDolfinLocaleuseMatchCandidatesuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ap/link-po-dialog.tsx 164 lines
  • components/dolfin/ap/manual-match-dialog.tsx 174 lines