fix(dashboard): resolve tutorial QA notes (clips 2–6)
- settings/company: show success toast on save (2.1) - inspection templates: add explicit Save button (2.6) - parts: label price fields with AED currency (3.1) - service groups: add parts/services picker to packages (3.3) - vehicles: add insurance (has_insurance + insurance type) field (4.2) - appointments: add calendar view with list/calendar toggle (5.1) - job card check-in: require department (5.4) - job card payments: refresh job card/invoice queries so PAID shows (5.6) - vendors: add phone + address fields (6.1) - bill payments: surface real vendor/employee validation errors (6.4) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -213,21 +213,24 @@ export function PaymentMadeForm({ resourceId, initialData, onSuccess, billId, ex
|
||||
return
|
||||
}
|
||||
|
||||
const vendorError = error.validationErrors.vendor_id?.[0]
|
||||
const employeeError = error.validationErrors.employee_id?.[0]
|
||||
const billError = error.validationErrors.bill_id?.[0]
|
||||
// Surface the actual backend validation messages on each field
|
||||
// instead of blanket-replacing them with the "not both" message —
|
||||
// that masked unrelated errors and showed the wrong text when only
|
||||
// one of vendor/employee was selected.
|
||||
const errors = error.validationErrors
|
||||
const billError = errors.bill_id?.[0]
|
||||
const vendorError = errors.vendor_id?.[0]
|
||||
const employeeError = errors.employee_id?.[0]
|
||||
|
||||
if (billError) {
|
||||
form.setError("bill", { message: billError })
|
||||
}
|
||||
|
||||
if (!vendorError && !employeeError) {
|
||||
return
|
||||
if (vendorError) {
|
||||
form.setError("vendor", { message: vendorError })
|
||||
}
|
||||
if (employeeError) {
|
||||
form.setError("employee", { message: employeeError })
|
||||
}
|
||||
|
||||
const message = "Select either a vendor or an employee, not both"
|
||||
form.setError("vendor", { message })
|
||||
form.setError("employee", { message })
|
||||
},
|
||||
onSuccess: () => {
|
||||
form.reset()
|
||||
|
||||
Reference in New Issue
Block a user