This commit is contained in:
2026-04-06 02:32:47 +03:00
parent 5f3d208158
commit 24a44481a0
152 changed files with 85913 additions and 44338 deletions
@@ -0,0 +1,319 @@
"use client"
import { AlertTriangle, Save } from "lucide-react"
import { useEffect } from "react"
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { useQuery } from "@tanstack/react-query"
import { toast } from "sonner"
import { Button } from "@/shared/components/ui/button"
import { Alert, AlertTitle } from "@/shared/components/ui/alert"
import { FieldGroup } from "@/shared/components/ui/field"
import {
Rhform,
RhfTextField,
RhfSelectField,
RhfAsyncSelectField,
RhfTextareaField,
} from "@/shared/components/form"
import { useAuthApi } from "@/shared/useApi"
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
import { toId } from "@/shared/lib/utils"
import { FirstDayOfWork } from "@garage/api"
import { SETTINGS_ROUTES } from "@garage/api"
import { settingsFormSchema, type SettingsFormValues } from "./settings.schema"
// ── Constants ──
const FIRST_DAY_OPTIONS = FirstDayOfWork.map((d) => ({
value: d,
label: d.charAt(0).toUpperCase() + d.slice(1),
}))
const mapLookupOption = (item: any) => ({ value: String(item.id), label: item.name })
const STORE_OBJECT = { getOptionValue: (o: any) => o, getOptionLabel: (o: any) => o.label }
// ── Default values ──
const DEFAULT_VALUES: SettingsFormValues = {
name: "",
email: "",
phone: "",
alternative_phone: "",
website: "",
time_zone: "",
upi_id: "",
first_day_of_work: "",
latitude: "",
longitude: "",
bank_details: "",
first_address_line: "",
second_address_line: "",
country: null,
state: null,
city: "",
zip_code: "",
description: "",
security: "",
privacy_policy: "",
}
// ── Mapping helpers ──
function mapToFormValues(data: unknown): SettingsFormValues {
const d = (data as any)?.data ?? data ?? {}
return {
name: d.name ?? "",
email: d.email ?? "",
phone: d.phone ?? "",
alternative_phone: d.alternative_phone ?? "",
website: d.website ?? "",
time_zone: d.time_zone ?? "",
upi_id: d.upi_id ?? "",
first_day_of_work: d.first_day_of_work ?? "",
latitude: d.latitude ?? "",
longitude: d.longitude ?? "",
bank_details: d.bank_details ?? "",
first_address_line: d.first_address_line ?? "",
second_address_line: d.second_address_line ?? "",
country: null,
state: null,
city: d.city ?? "",
zip_code: d.zip_code ?? "",
description: d.description ?? "",
security: d.security ?? "",
privacy_policy: d.privacy_policy ?? "",
}
}
function mapFormToPayload(values: SettingsFormValues) {
return {
name: values.name,
email: values.email || undefined,
phone: values.phone || undefined,
time_zone: values.time_zone || undefined,
first_day_of_work: values.first_day_of_work || undefined,
first_address_line: values.first_address_line || undefined,
country_id: toId(values.country),
city: values.city || undefined,
}
}
// ── Component ──
export function SettingsForm() {
const api = useAuthApi()
const form = useForm<SettingsFormValues>({
resolver: zodResolver(settingsFormSchema) as any,
defaultValues: DEFAULT_VALUES,
})
const { data, isLoading } = useQuery({
queryKey: [SETTINGS_ROUTES.INDEX],
queryFn: () => api.settings.fetch(),
})
useEffect(() => {
if (!data) return
const raw = (data as any)?.data
const record = Array.isArray(raw) ? raw[0] : raw
if (record) {
form.reset(mapToFormValues(record))
}
}, [data]) // eslint-disable-line react-hooks/exhaustive-deps
const { mutate, error, isPending } = useFormMutation(form, {
mutationFn: (values: SettingsFormValues) => {
const payload = mapFormToPayload(values)
const promise = api.settings.update(payload)
toast.promise(promise, {
loading: "Saving settings...",
success: "Settings saved successfully",
error: "Failed to save settings",
})
return promise
},
})
return (
<Rhform form={form} onSubmit={(values) => mutate(values)}>
{error && (
<Alert variant="destructive" className="mb-4">
<AlertTriangle className="me-2 h-4 w-4" />
<AlertTitle>Failed to save settings</AlertTitle>
{error.message}
</Alert>
)}
<FieldGroup>
{/* General Info */}
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfTextField
name="name"
label="Workshop Name"
placeholder="My Workshop"
required
disabled={isLoading}
/>
<RhfTextField
name="email"
label="Email"
placeholder="workshop@example.com"
type="email"
disabled={isLoading}
/>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfTextField
name="phone"
label="Phone"
placeholder="+971501234567"
type="tel"
disabled={isLoading}
/>
<RhfTextField
name="alternative_phone"
label="Alternative Phone"
placeholder="+971509876543"
type="tel"
disabled={isLoading}
/>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfTextField
name="website"
label="Website"
placeholder="https://example.com"
disabled={isLoading}
/>
<RhfTextField
name="upi_id"
label="UPI ID"
placeholder="workshop@upi"
disabled={isLoading}
/>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfTextField
name="time_zone"
label="Time Zone"
placeholder="Asia/Dubai"
disabled={isLoading}
/>
<RhfSelectField
name="first_day_of_work"
label="First Day of Work"
placeholder="Select day"
options={FIRST_DAY_OPTIONS}
disabled={isLoading}
/>
</div>
{/* Address */}
<RhfTextField
name="first_address_line"
label="Address Line 1"
placeholder="Street 10"
disabled={isLoading}
/>
<RhfTextField
name="second_address_line"
label="Address Line 2"
placeholder="Near Central Plaza"
disabled={isLoading}
/>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfAsyncSelectField
name="country"
label="Country"
placeholder="Select country"
queryKey={["countries"]}
listFn={() => api.geo.countries()}
mapOption={mapLookupOption}
{...STORE_OBJECT}
/>
<RhfAsyncSelectField
name="state"
label="State"
placeholder="Select state"
queryKey={["states"]}
listFn={() => api.geo.states()}
mapOption={mapLookupOption}
{...STORE_OBJECT}
/>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfTextField
name="city"
label="City"
placeholder="Dubai"
disabled={isLoading}
/>
<RhfTextField
name="zip_code"
label="Zip Code"
placeholder="00000"
disabled={isLoading}
/>
</div>
{/* Location */}
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfTextField
name="latitude"
label="Latitude"
placeholder="25.2048"
disabled={isLoading}
/>
<RhfTextField
name="longitude"
label="Longitude"
placeholder="55.2708"
disabled={isLoading}
/>
</div>
{/* Other */}
<RhfTextareaField
name="bank_details"
label="Bank Details"
placeholder="Bank name, account number, IBAN..."
disabled={isLoading}
/>
<RhfTextareaField
name="description"
label="Description"
placeholder="About the workshop..."
disabled={isLoading}
/>
<RhfTextareaField
name="security"
label="Security Policy"
placeholder="Security policy text..."
disabled={isLoading}
/>
<RhfTextareaField
name="privacy_policy"
label="Privacy Policy"
placeholder="Privacy policy text..."
disabled={isLoading}
/>
<div className="flex justify-end">
<Button type="submit" disabled={isPending || isLoading}>
<Save />
{isPending ? "Saving..." : "Save Settings"}
</Button>
</div>
</FieldGroup>
</Rhform>
)
}
@@ -0,0 +1,30 @@
import { z } from "zod"
export const relationFieldSchema = z
.object({ value: z.string(), label: z.string() })
.nullable()
export const settingsFormSchema = z.object({
name: z.string().min(1, "Name is required"),
email: z.union([z.string().email("Invalid email address"), z.literal("")]).optional(),
phone: z.string().optional(),
alternative_phone: z.string().optional(),
website: z.string().optional(),
time_zone: z.string().optional(),
upi_id: z.string().optional(),
first_day_of_work: z.string().optional(),
latitude: z.string().optional(),
longitude: z.string().optional(),
bank_details: z.string().optional(),
first_address_line: z.string().optional(),
second_address_line: z.string().optional(),
country: relationFieldSchema,
state: relationFieldSchema,
city: z.string().optional(),
zip_code: z.string().optional(),
description: z.string().optional(),
security: z.string().optional(),
privacy_policy: z.string().optional(),
})
export type SettingsFormValues = z.infer<typeof settingsFormSchema>
@@ -0,0 +1,24 @@
import { z } from "zod"
export const salesConfigFormSchema = z.object({
sell_rates_tax_inclusive: z.string().optional(),
give_discounts: z.string().optional(),
})
export type SalesConfigFormValues = z.infer<typeof salesConfigFormSchema>
export const purchaseConfigFormSchema = z.object({
purchase_rates_tax_inclusive: z.string().optional(),
receive_discounts: z.string().optional(),
})
export type PurchaseConfigFormValues = z.infer<typeof purchaseConfigFormSchema>
export const generalPreferencesFormSchema = z.object({
sell_rates_tax_inclusive: z.string().optional(),
give_discounts: z.string().optional(),
purchase_rates_tax_inclusive: z.string().optional(),
receive_discounts: z.string().optional(),
})
export type GeneralPreferencesFormValues = z.infer<typeof generalPreferencesFormSchema>
@@ -0,0 +1,102 @@
"use client"
import { AlertTriangle, Save } from "lucide-react"
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { toast } from "sonner"
import { Button } from "@/shared/components/ui/button"
import { Alert, AlertTitle } from "@/shared/components/ui/alert"
import { FieldGroup } from "@/shared/components/ui/field"
import { Rhform, RhfSelectField } from "@/shared/components/form"
import { useAuthApi } from "@/shared/useApi"
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
import { TaxInclusive, DiscountType } from "@garage/api"
import { generalPreferencesFormSchema, type GeneralPreferencesFormValues } from "./configurations.schema"
const TAX_INCLUSIVE_OPTIONS = TaxInclusive.map((v) => ({ value: v, label: v }))
const DISCOUNT_OPTIONS = DiscountType.map((v) => ({
value: v,
label: v === "no" ? "No Discount" : v === "line_item_level" ? "Line Item Level" : "Transaction Level",
}))
const DEFAULT_VALUES: GeneralPreferencesFormValues = {
sell_rates_tax_inclusive: "",
give_discounts: "",
purchase_rates_tax_inclusive: "",
receive_discounts: "",
}
export function GeneralPreferencesForm() {
const api = useAuthApi()
const form = useForm<GeneralPreferencesFormValues>({
resolver: zodResolver(generalPreferencesFormSchema) as any,
defaultValues: DEFAULT_VALUES,
})
const { mutate, error, isPending } = useFormMutation(form, {
mutationFn: (values: GeneralPreferencesFormValues) => {
const promise = api.configurations.updateGeneralPreferences(values)
toast.promise(promise, {
loading: "Saving general preferences...",
success: "General preferences saved",
error: "Failed to save general preferences",
})
return promise
},
})
return (
<Rhform form={form} onSubmit={(values) => mutate(values)}>
{error && (
<Alert variant="destructive" className="mb-4">
<AlertTriangle className="me-2 h-4 w-4" />
<AlertTitle>Failed to save general preferences</AlertTitle>
{error.message}
</Alert>
)}
<FieldGroup>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfSelectField
name="sell_rates_tax_inclusive"
label="Sell Rates Tax"
placeholder="Select tax type"
options={TAX_INCLUSIVE_OPTIONS}
/>
<RhfSelectField
name="give_discounts"
label="Give Discounts"
placeholder="Select discount type"
options={DISCOUNT_OPTIONS}
/>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<RhfSelectField
name="purchase_rates_tax_inclusive"
label="Purchase Rates Tax"
placeholder="Select tax type"
options={TAX_INCLUSIVE_OPTIONS}
/>
<RhfSelectField
name="receive_discounts"
label="Receive Discounts"
placeholder="Select discount type"
options={DISCOUNT_OPTIONS}
/>
</div>
<div className="flex justify-end">
<Button type="submit" disabled={isPending}>
<Save />
{isPending ? "Saving..." : "Save"}
</Button>
</div>
</FieldGroup>
</Rhform>
)
}
@@ -0,0 +1,83 @@
"use client"
import { AlertTriangle, Save } from "lucide-react"
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { toast } from "sonner"
import { Button } from "@/shared/components/ui/button"
import { Alert, AlertTitle } from "@/shared/components/ui/alert"
import { FieldGroup } from "@/shared/components/ui/field"
import { Rhform, RhfSelectField } from "@/shared/components/form"
import { useAuthApi } from "@/shared/useApi"
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
import { TaxInclusive, DiscountType } from "@garage/api"
import { purchaseConfigFormSchema, type PurchaseConfigFormValues } from "./configurations.schema"
const TAX_INCLUSIVE_OPTIONS = TaxInclusive.map((v) => ({ value: v, label: v }))
const DISCOUNT_OPTIONS = DiscountType.map((v) => ({
value: v,
label: v === "no" ? "No Discount" : v === "line_item_level" ? "Line Item Level" : "Transaction Level",
}))
const DEFAULT_VALUES: PurchaseConfigFormValues = {
purchase_rates_tax_inclusive: "",
receive_discounts: "",
}
export function PurchaseConfigForm() {
const api = useAuthApi()
const form = useForm<PurchaseConfigFormValues>({
resolver: zodResolver(purchaseConfigFormSchema) as any,
defaultValues: DEFAULT_VALUES,
})
const { mutate, error, isPending } = useFormMutation(form, {
mutationFn: (values: PurchaseConfigFormValues) => {
const promise = api.configurations.updatePurchaseTaxDiscount(values)
toast.promise(promise, {
loading: "Saving purchase configuration...",
success: "Purchase configuration saved",
error: "Failed to save purchase configuration",
})
return promise
},
})
return (
<Rhform form={form} onSubmit={(values) => mutate(values)}>
{error && (
<Alert variant="destructive" className="mb-4">
<AlertTriangle className="me-2 h-4 w-4" />
<AlertTitle>Failed to save purchase configuration</AlertTitle>
{error.message}
</Alert>
)}
<FieldGroup>
<RhfSelectField
name="purchase_rates_tax_inclusive"
label="Purchase Rates Tax"
placeholder="Select tax type"
options={TAX_INCLUSIVE_OPTIONS}
/>
<RhfSelectField
name="receive_discounts"
label="Receive Discounts"
placeholder="Select discount type"
options={DISCOUNT_OPTIONS}
/>
<div className="flex justify-end">
<Button type="submit" disabled={isPending}>
<Save />
{isPending ? "Saving..." : "Save"}
</Button>
</div>
</FieldGroup>
</Rhform>
)
}
@@ -0,0 +1,83 @@
"use client"
import { AlertTriangle, Save } from "lucide-react"
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { toast } from "sonner"
import { Button } from "@/shared/components/ui/button"
import { Alert, AlertTitle } from "@/shared/components/ui/alert"
import { FieldGroup } from "@/shared/components/ui/field"
import { Rhform, RhfSelectField } from "@/shared/components/form"
import { useAuthApi } from "@/shared/useApi"
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
import { TaxInclusive, DiscountType } from "@garage/api"
import { salesConfigFormSchema, type SalesConfigFormValues } from "./configurations.schema"
const TAX_INCLUSIVE_OPTIONS = TaxInclusive.map((v) => ({ value: v, label: v }))
const DISCOUNT_OPTIONS = DiscountType.map((v) => ({
value: v,
label: v === "no" ? "No Discount" : v === "line_item_level" ? "Line Item Level" : "Transaction Level",
}))
const DEFAULT_VALUES: SalesConfigFormValues = {
sell_rates_tax_inclusive: "",
give_discounts: "",
}
export function SalesConfigForm() {
const api = useAuthApi()
const form = useForm<SalesConfigFormValues>({
resolver: zodResolver(salesConfigFormSchema) as any,
defaultValues: DEFAULT_VALUES,
})
const { mutate, error, isPending } = useFormMutation(form, {
mutationFn: (values: SalesConfigFormValues) => {
const promise = api.configurations.updateSalesTaxDiscount(values)
toast.promise(promise, {
loading: "Saving sales configuration...",
success: "Sales configuration saved",
error: "Failed to save sales configuration",
})
return promise
},
})
return (
<Rhform form={form} onSubmit={(values) => mutate(values)}>
{error && (
<Alert variant="destructive" className="mb-4">
<AlertTriangle className="me-2 h-4 w-4" />
<AlertTitle>Failed to save sales configuration</AlertTitle>
{error.message}
</Alert>
)}
<FieldGroup>
<RhfSelectField
name="sell_rates_tax_inclusive"
label="Sell Rates Tax"
placeholder="Select tax type"
options={TAX_INCLUSIVE_OPTIONS}
/>
<RhfSelectField
name="give_discounts"
label="Give Discounts"
placeholder="Select discount type"
options={DISCOUNT_OPTIONS}
/>
<div className="flex justify-end">
<Button type="submit" disabled={isPending}>
<Save />
{isPending ? "Saving..." : "Save"}
</Button>
</div>
</FieldGroup>
</Rhform>
)
}
@@ -0,0 +1,112 @@
"use client"
import { AlertTriangle, Plus, Save } from "lucide-react"
import { Button } from "@/shared/components/ui/button"
import { Alert, AlertTitle } from "@/shared/components/ui/alert"
import { FieldGroup } from "@/shared/components/ui/field"
import { Rhform, RhfTextField, RhfSelectField } from "@/shared/components/form"
import { toast } from "sonner"
import { useAuthApi } from "@/shared/useApi"
import { useResourceForm } from "@/shared/hooks/use-resource-form"
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
import { DEPARTMENT_ROUTES } from "@garage/api"
import { DEPARTMENT_ASSIGNMENT_TYPE_OPTIONS } from "@/modules/services/department-assignment-types"
import { departmentFormSchema, type DepartmentFormValues } from "./department.schema"
export type DepartmentFormProps = {
resourceId?: string | null
initialData?: unknown
onSuccess?: () => void
}
const DEFAULT_VALUES: DepartmentFormValues = {
name: "",
assignment_type: "none",
}
function mapToFormValues(data: unknown): DepartmentFormValues {
const d = (data as any)?.data ?? data ?? {}
return {
name: d.name ?? "",
assignment_type: d.assignment_type ?? "none",
}
}
function mapFormToPayload(values: DepartmentFormValues) {
return {
name: values.name,
assignment_type: values.assignment_type || undefined,
}
}
export function DepartmentForm({ resourceId, initialData, onSuccess }: DepartmentFormProps) {
const api = useAuthApi()
const { form, isEditing } = useResourceForm<DepartmentFormValues, any>({
schema: departmentFormSchema,
defaultValues: DEFAULT_VALUES,
resourceId,
initialData,
queryKey: [DEPARTMENT_ROUTES.BY_ID, resourceId],
mapToFormValues,
})
const { mutate, error, isPending } = useFormMutation(form, {
mutationFn: (values: DepartmentFormValues) => {
const payload = mapFormToPayload(values)
const promise = isEditing && resourceId
? api.departments.update(resourceId, payload)
: api.departments.create(payload)
toast.promise(promise, {
loading: isEditing ? "Updating department..." : "Creating department...",
success: isEditing ? "Department updated successfully" : "Department created successfully",
error: isEditing ? "Failed to update department" : "Failed to create department",
})
return promise
},
onSuccess: () => {
form.reset()
onSuccess?.()
},
})
return (
<Rhform form={form} onSubmit={(values) => mutate(values)}>
{error && (
<Alert variant="destructive" className="mb-4">
<AlertTriangle className="me-2 h-4 w-4" />
<AlertTitle>
{isEditing ? "Failed to update department" : "Failed to create department"}
</AlertTitle>
{error.message}
</Alert>
)}
<FieldGroup>
<RhfTextField
name="name"
label="Name"
placeholder="e.g. Mechanical"
required
/>
<RhfSelectField
name="assignment_type"
label="Assignment Type"
placeholder="Select assignment type"
options={[...DEPARTMENT_ASSIGNMENT_TYPE_OPTIONS]}
/>
<Button type="submit" variant="default" disabled={isPending}>
{isEditing ? <Save /> : <Plus />}
{isPending
? (isEditing ? "Updating..." : "Creating...")
: (isEditing ? "Update Department" : "Create Department")}
</Button>
</FieldGroup>
</Rhform>
)
}
@@ -0,0 +1,8 @@
import { z } from "zod"
export const departmentFormSchema = z.object({
name: z.string().min(1, "Name is required"),
assignment_type: z.string().optional(),
})
export type DepartmentFormValues = z.infer<typeof departmentFormSchema>
@@ -0,0 +1,102 @@
"use client"
import { AlertTriangle, Plus, Save } from "lucide-react"
import { Button } from "@/shared/components/ui/button"
import { Alert, AlertTitle } from "@/shared/components/ui/alert"
import { FieldGroup } from "@/shared/components/ui/field"
import { Rhform, RhfTextField } from "@/shared/components/form"
import { toast } from "sonner"
import { useAuthApi } from "@/shared/useApi"
import { useResourceForm } from "@/shared/hooks/use-resource-form"
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
import { INSURANCE_TYPE_ROUTES } from "@garage/api"
import { insuranceTypeFormSchema, type InsuranceTypeFormValues } from "./insurance-type.schema"
export type InsuranceTypeFormProps = {
resourceId?: string | null
initialData?: unknown
onSuccess?: () => void
}
const DEFAULT_VALUES: InsuranceTypeFormValues = {
title: "",
}
function mapToFormValues(data: unknown): InsuranceTypeFormValues {
const d = (data as any)?.data ?? data ?? {}
return {
title: d.title ?? d.name ?? "",
}
}
function mapFormToPayload(values: InsuranceTypeFormValues) {
return {
title: values.title,
}
}
export function InsuranceTypeForm({ resourceId, initialData, onSuccess }: InsuranceTypeFormProps) {
const api = useAuthApi()
const { form, isEditing } = useResourceForm<InsuranceTypeFormValues, any>({
schema: insuranceTypeFormSchema,
defaultValues: DEFAULT_VALUES,
resourceId,
initialData,
queryKey: [INSURANCE_TYPE_ROUTES.BY_ID, resourceId],
mapToFormValues,
})
const { mutate, error, isPending } = useFormMutation(form, {
mutationFn: (values: InsuranceTypeFormValues) => {
const payload = mapFormToPayload(values)
const promise = isEditing && resourceId
? api.insuranceTypes.update(resourceId, payload)
: api.insuranceTypes.create(payload)
toast.promise(promise, {
loading: isEditing ? "Updating insurance type..." : "Creating insurance type...",
success: isEditing ? "Insurance type updated successfully" : "Insurance type created successfully",
error: isEditing ? "Failed to update insurance type" : "Failed to create insurance type",
})
return promise
},
onSuccess: () => {
form.reset()
onSuccess?.()
},
})
return (
<Rhform form={form} onSubmit={(values) => mutate(values)}>
{error && (
<Alert variant="destructive" className="mb-4">
<AlertTriangle className="me-2 h-4 w-4" />
<AlertTitle>
{isEditing ? "Failed to update insurance type" : "Failed to create insurance type"}
</AlertTitle>
{error.message}
</Alert>
)}
<FieldGroup>
<RhfTextField
name="title"
label="Title"
placeholder="e.g. Comprehensive"
required
/>
<Button type="submit" variant="default" disabled={isPending}>
{isEditing ? <Save /> : <Plus />}
{isPending
? (isEditing ? "Updating..." : "Creating...")
: (isEditing ? "Update Insurance Type" : "Create Insurance Type")}
</Button>
</FieldGroup>
</Rhform>
)
}
@@ -0,0 +1,7 @@
import { z } from "zod"
export const insuranceTypeFormSchema = z.object({
title: z.string().min(1, "Title is required"),
})
export type InsuranceTypeFormValues = z.infer<typeof insuranceTypeFormSchema>