Edit bill page
Edit a bill in review: its document beside the header form and the lines editor, with unsaved-change marking, field errors in place, a conflict notice and a pinned save bar. Returns to the bill after saving. Accepts your own header actions, banners, aside cards, the empty lines note, a create-supplier dialog and the error state.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as 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-bill-pageAlso installs: button, base-theme, base-states, ap-bill-document-viewer, ap-bill-edit-form, ap-bill-lines-editor, ap-create-supplier-dialog, ui-ap-edit-bill-page.
Usage
import { EditBillPage } from "@/components/dolfin/ap/edit-bill-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route({ params }: { params: { billId: string } }) {
return <EditBillPage billId={params.billId} />;
}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 required | string | |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons in the bar above the form, after the title. |
banners | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Above the form: notices such as accounting sync or e-invoicing status. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Cards after the lines (for example accounting codes for each line). |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the note shown when the bill has no lines. |
hideCreateSupplier | boolean | Hides "New Supplier" in the supplier picker (it opens `ApCreateSupplierDialog` prefilled from the bill; the new supplier is picked, and saving links it). |
errorState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the not-found, load error and not-editable state. |
onNavigate | (route: DolfinRoute) => void | Replaces the provider's navigation (back, cancel, after saving, the suggested supplier link). |
onSaved | (bill: Bill) => void | Called with the saved bill before the page goes back to it. |
hideDocument | boolean | Hides the document pane (for hosts that show the document elsewhere). |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.billDraftbase.statescore.errors
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this page uses. Use them directly from @dolfinai/react to build your own version.
useBillDraftuseDolfinNavigateuseMessagesFiles
Written to your app by the install command:
components/dolfin/ap/edit-bill-page.tsx178 lines