TorbatYar/docs/frontend/form-patterns.md
Mortezakoohjani 5c6a2e78cf feat(platform): seed service registry, deploy all modules, and fix homepage catalog.
Register all active platform services and base features in core DB so admin can manage them, add delivery/hospitality/sports-center backend phases, update apps catalog and production deploy tooling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 12:39:51 +03:30

14 lines
854 B
Markdown

# Form Patterns
- **Library**: React Hook Form + Zod + `@hookform/resolvers`
- **Feedback**: FieldError under controls; Sonner for server errors
- **Submit**: disable while `mutation.isPending`
- **Dirty**: rely on RHF `formState.isDirty` for future autosave
- **Server validation**: map `AccountingApiError.message` to toast (field mapping when backend returns field errors)
- **Money**: `MoneyInput` only — never plain `<Input type="number">` for currency; parse with `parseMoneyInput` before API if needed
- **Party / item**: `PartyCombobox` / `ItemCombobox` — AJAX from registered masters, not free text
Voucher create uses `useFieldArray` with minimum two balanced lines (enforced by Zod + backend).
Operational invoices/orders use line item comboboxes bound to inventory items and party comboboxes bound to customers/suppliers.