fix build
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
import { DepartmentInlineForm } from "@/modules/services/inline-forms/department-inline-form"
|
||||
import { toast } from "sonner"
|
||||
import { useAuthApi } from "@/shared/useApi"
|
||||
import { formatTaxLabel } from "@/shared/utils/formatters"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { DEPARTMENT_ROUTES, TAX_ROUTES } from "@garage/api"
|
||||
@@ -71,7 +72,7 @@ function mapToFormValues(data: unknown): JobCardExpenseItemFormValues {
|
||||
? { value: String(d.department.id), label: d.department.name ?? String(d.department.id) }
|
||||
: null,
|
||||
tax: d.tax_id != null
|
||||
? { value: String(d.tax_id), label: d.tax ? `${d.tax.title} (${d.tax.rate}%)` : String(d.tax_id) }
|
||||
? { value: String(d.tax_id), label: formatTaxLabel(d.tax, String(d.tax_id)) }
|
||||
: null,
|
||||
quantity: d.quantity ?? 1,
|
||||
rate: d.rate != null ? Number(d.rate) : 0,
|
||||
|
||||
@@ -20,6 +20,7 @@ import { useAuthApi } from "@/shared/useApi"
|
||||
import { useResourceForm } from "@/shared/hooks/use-resource-form"
|
||||
import { useFormMutation } from "@/shared/hooks/use-form-mutation"
|
||||
import { toRelation, toId } from "@/shared/lib/utils"
|
||||
import { formatTaxLabel } from "@/shared/utils/formatters"
|
||||
|
||||
import {
|
||||
jobCardFormSchema,
|
||||
@@ -106,7 +107,7 @@ function mapToFormValues(data: unknown): JobCardFormValues {
|
||||
sales_person: toRelation(d.sales_person_id, d.sales_person ? `${d.sales_person.first_name} ${d.sales_person.last_name}` : undefined),
|
||||
insurance_type: toRelation(d.insurance_type_id, d.insurance_type?.name),
|
||||
insurer: toRelation(d.insurer_id, d.insurer ? `${d.insurer.first_name} ${d.insurer.last_name}`.trim() || d.insurer.company_name : undefined),
|
||||
tax: toRelation(d.tax_id, d.tax ? `${d.tax.title} (${d.tax.rate}%)` : undefined),
|
||||
tax: toRelation(d.tax_id, formatTaxLabel(d.tax, "") || undefined),
|
||||
order_number: d.order_number || "",
|
||||
estimate_number: d.estimate_number || "",
|
||||
status: d.status || "draft",
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import { DepartmentInlineForm } from "@/modules/services/inline-forms/department-inline-form"
|
||||
import { toast } from "sonner"
|
||||
import { useAuthApi } from "@/shared/useApi"
|
||||
import { formatTaxLabel } from "@/shared/utils/formatters"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { DEPARTMENT_ROUTES, TAX_ROUTES } from "@garage/api"
|
||||
@@ -71,7 +72,7 @@ function mapToFormValues(data: unknown): JobCardPartFormValues {
|
||||
? { value: String(d.department.id), label: d.department.name ?? String(d.department.id) }
|
||||
: null,
|
||||
tax: d.tax_id != null
|
||||
? { value: String(d.tax_id), label: d.tax ? `${d.tax.title} (${d.tax.rate}%)` : String(d.tax_id) }
|
||||
? { value: String(d.tax_id), label: formatTaxLabel(d.tax, String(d.tax_id)) }
|
||||
: null,
|
||||
quantity: d.quantity ?? 1,
|
||||
rate: d.rate != null ? Number(d.rate) : 0,
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
import { DepartmentInlineForm } from "@/modules/services/inline-forms/department-inline-form"
|
||||
import { toast } from "sonner"
|
||||
import { useAuthApi } from "@/shared/useApi"
|
||||
import { formatTaxLabel } from "@/shared/utils/formatters"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { RateType, DEPARTMENT_ROUTES, TAX_ROUTES } from "@garage/api"
|
||||
@@ -80,7 +81,7 @@ function mapToFormValues(data: unknown): JobCardServiceFormValues {
|
||||
? { value: String(d.department.id), label: d.department.name ?? String(d.department.id) }
|
||||
: undefined as any,
|
||||
tax: d.tax_id != null
|
||||
? { value: String(d.tax_id), label: d.tax ? `${d.tax.title} (${d.tax.rate}%)` : String(d.tax_id) }
|
||||
? { value: String(d.tax_id), label: formatTaxLabel(d.tax, String(d.tax_id)) }
|
||||
: null,
|
||||
rate_type: d.rate_type ?? "flat_rate",
|
||||
labor_rate: d.labor_rate
|
||||
|
||||
Reference in New Issue
Block a user