feat: add template checkpoint edit dialog and vendor management components
- Implemented TemplateCheckpointEditDialog for creating and editing inspection checkpoints. - Added VendorActions component for managing vendor actions including edit, activate/deactivate, and delete. - Created VendorContext for managing vendor state across components. - Developed VendorGeneralInfo component to display detailed vendor information. - Introduced AedSymbol and Money components for consistent currency representation. - Added PromptDialog for user input prompts throughout the application. - Implemented RelationLink component for unified related-data display in CRUD tables. - Created InspectionTemplatesClient for API interactions related to inspection templates.
This commit is contained in:
+11
-4
@@ -27,14 +27,21 @@ export function InspectionCategoryInlineForm({ onSuccess }: InlineCreateFormProp
|
||||
const handleSubmit = async (values: FormValues) => {
|
||||
try {
|
||||
const result = await api.inspections.createCategory({
|
||||
title: values.inspection_name,
|
||||
inspection_name: values.inspection_name,
|
||||
} as any)
|
||||
toast.success("Inspection category created")
|
||||
form.reset()
|
||||
const item = (result as any)?.data ?? result
|
||||
onSuccess({ value: String(item.id), label: item.name ?? values.inspection_name })
|
||||
} catch {
|
||||
toast.error("Failed to create inspection category")
|
||||
onSuccess({
|
||||
value: String(item.id),
|
||||
label: item.inspection_name ?? values.inspection_name,
|
||||
})
|
||||
} catch (e: any) {
|
||||
const errors = e?.payload?.errors
|
||||
const firstError = errors && typeof errors === "object"
|
||||
? (Object.values(errors)[0] as string[])?.[0]
|
||||
: null
|
||||
toast.error(firstError ?? e?.message ?? "Failed to create inspection category")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user