Bill match panel
Three-way match blocks: BillMatchPanel (the bill page's card with each line's variance badges, matched documents, suggestions, resolve actions, linking a purchase order and matching by hand, with loading, empty and error states; by bill id it fetches and wires every action, Approve included where the bill's state offers it (asking first; hideApprove leaves it out), given a match it fetches nothing and shows a button per callback passed, with per-line progress (`pendingId`), the running write (`pendingAction`, which keeps every write button waiting) and errors), plus the workspace blocks MatchHeader, MatchDocumentCards, MatchLinesTable (ordered, billed and received per line with totals) and MatchSummaryCard.
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-bill-match-panelAlso installs: button, card, popover, ap-match-line, ap-link-po-dialog, base-info-hint, base-page, base-states, base-status-badge, ui-ap-bill-match-panel.
Usage
import { BillMatchPanel } from "@/components/dolfin/ap/bill-match-panel";
// Place it anywhere inside your <DolfinProvider>.
<BillMatchPanel />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 |
|---|---|---|
billId | string | Fetches the bill's match and wires every action. Also where "Open match workspace" leads. |
match | MatchGroupModel | Your match, e.g. `useMatchGroup(billId).match`. Passing `match`, `loading` or `error` means nothing is fetched; `null` is the "no match yet" state. Buttons then show only for the callbacks you pass. Given with `billId`, the match wins. |
loading | boolean | |
error | Error | |
onRetry | () => void | Shows "Try again" in the error state. |
currency | string | Defaults to the bill's own currency (by id). |
editable | boolean | By id: whether the match can change. Defaults to whether the bill is still in review. |
onConfirmLine | (lineId: string, pick: MatchLinePick) => void | Confirm one of a line's suggestions. By id, each `onX` you pass replaces the SDK's own handler. |
onResolveLine | (lineId: string, action: MatchLineResolveAction) => void | Accept a line's variance, or ask the supplier for a credit note. |
onDisputeLine | (lineId: string) => void | |
onUndoLine | (lineId: string) => void | Take back the decision recorded on a line. |
onUnlinkLine | (lineId: string, allocationId: string) => void | Remove one of a line's matched documents. |
onMatchLineManually | (line: MatchLineModel) => void | Shows "Match manually" on the lines that can take one; open your matching dialog. |
onLinkPurchaseOrder | () => void | Shows "Link purchase order"; open your linking dialog. |
onApprove | () => void | Shows "Approve" in the header. By id the SDK wires it where the bill's state offers approval, and its own asks first; yours replaces it, confirmation included, and runs at once. |
approveDisabledReason | string | A non-empty reason disables Approve and says why. By id, the reason comes from the user's role and the match. |
hideApprove | boolean | Hides Approve (for a page that shows the bill's own actions beside the panel). |
pendingId | string | The line a write is running on: it shows progress. |
pendingAction | BillMatchPanelAction | The write running now, with or without a line (linking an order, removing a document, re-running the match, approving). While `pendingId` or `pendingAction` is set, every write button waits. |
errors | Readonly<Record<string, string>> | Why the last write failed, per bill line id, shown on that line. |
onOpenMatchUi | () => void | Replaces the "Open match workspace" link (which goes to the `ap.billMatch` route). |
hideWorkspaceLink | boolean | Hide the link to the match workspace. |
hideLinking | boolean | By id: hide "Link purchase order" and "Match manually". |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra header buttons. |
children | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Rendered inside the card after the lines (your dialogs, a note). |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.bill.actionsap.matchbase.infoHint.moreAboutbase.states.retry
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.
useBilluseBillActionsuseBillPermissionsuseDolfinLocaleuseMatchGroupuseMatchLineCommandsuseMessagesusePermissionsFiles
Written to your app by the install command:
components/dolfin/ap/bill-match-panel.tsx303 linescomponents/dolfin/ap/match-overview.tsx187 linescomponents/dolfin/ap/match-lines-table.tsx104 lines