fix build errors
This commit is contained in:
parent
38565298fc
commit
b0361fcbfb
@ -76,6 +76,7 @@ export function AppointmentActions({ appointmentId, currentStatus, jobCardId }:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="ghost" size="icon" disabled={isLoading}>
|
<Button variant="ghost" size="icon" disabled={isLoading}>
|
||||||
@ -137,5 +138,6 @@ export function AppointmentActions({ appointmentId, currentStatus, jobCardId }:
|
|||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</> )
|
</>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ const DEFAULT_VALUES: PaymentMadeFormValues & { details: Array<{ bill_id?: strin
|
|||||||
employee: null,
|
employee: null,
|
||||||
payment_mode: null,
|
payment_mode: null,
|
||||||
payment_for: "bill",
|
payment_for: "bill",
|
||||||
amount: "",
|
amount: 0,
|
||||||
payment_number: "",
|
payment_number: "",
|
||||||
payment_reference: "",
|
payment_reference: "",
|
||||||
payment_date: getTodayDate(),
|
payment_date: getTodayDate(),
|
||||||
@ -80,7 +80,7 @@ function mapToFormValues(data: unknown): typeof DEFAULT_VALUES {
|
|||||||
employee: toRelation(d.employee_id, d.employee?.first_name ? `${d.employee.first_name} ${d.employee.last_name ?? ""}`.trim() : d.employee_name),
|
employee: toRelation(d.employee_id, d.employee?.first_name ? `${d.employee.first_name} ${d.employee.last_name ?? ""}`.trim() : d.employee_name),
|
||||||
payment_mode: toRelation(paymentModeId, paymentModeLabel),
|
payment_mode: toRelation(paymentModeId, paymentModeLabel),
|
||||||
payment_for: d.payment_for || "bill",
|
payment_for: d.payment_for || "bill",
|
||||||
amount: d.payment_made ? String(d.payment_made) : "",
|
amount: d.payment_made != null ? Number(d.payment_made) : 0,
|
||||||
payment_number: d.payment_number || "",
|
payment_number: d.payment_number || "",
|
||||||
payment_reference: d.payment_reference || "",
|
payment_reference: d.payment_reference || "",
|
||||||
payment_date: d.payment_date || "",
|
payment_date: d.payment_date || "",
|
||||||
@ -93,20 +93,20 @@ function mapToFormValues(data: unknown): typeof DEFAULT_VALUES {
|
|||||||
|
|
||||||
function mapFormToPayload(values: PaymentMadeFormValues, billId?: string | number | null, expenseId?: string | number | null) {
|
function mapFormToPayload(values: PaymentMadeFormValues, billId?: string | number | null, expenseId?: string | number | null) {
|
||||||
const paymentDetails =
|
const paymentDetails =
|
||||||
expenseId ? [{ expense_id: expenseId, amount_paid: values.amount ? Number(values.amount) : 0 }]
|
expenseId ? [{ expense_id: expenseId, amount_paid: values.amount || 0 }]
|
||||||
: [{ bill_id: billId, amount_paid: values.amount ? Number(values.amount) : 0 }]
|
: [{ bill_id: billId, amount_paid: values.amount || 0 }]
|
||||||
return {
|
return {
|
||||||
vendor_id: toId(values.vendor),
|
vendor_id: toId(values.vendor),
|
||||||
employee_id: toId(values.employee) || undefined,
|
employee_id: toId(values.employee) || undefined,
|
||||||
payment_mode_id: toId(values.payment_mode),
|
payment_mode_id: toId(values.payment_mode),
|
||||||
payment_for: values.payment_for,
|
payment_for: values.payment_for,
|
||||||
amount: values.amount ? Number(values.amount) : 0,
|
amount: values.amount || 0,
|
||||||
payment_number: values.payment_number || undefined,
|
payment_number: values.payment_number || undefined,
|
||||||
payment_reference: values.payment_reference || undefined,
|
payment_reference: values.payment_reference || undefined,
|
||||||
payment_date: values.payment_date,
|
payment_date: values.payment_date,
|
||||||
paid_through: values.paid_through || undefined,
|
paid_through: values.paid_through || undefined,
|
||||||
notes: values.notes || undefined,
|
notes: values.notes || undefined,
|
||||||
payment_made: values.amount,
|
payment_made: values.amount || 0,
|
||||||
details: paymentDetails,
|
details: paymentDetails,
|
||||||
...(billId ? { bill_id: Number(billId) } : {}),
|
...(billId ? { bill_id: Number(billId) } : {}),
|
||||||
...(expenseId ? { expense_id: Number(expenseId) } : {}),
|
...(expenseId ? { expense_id: Number(expenseId) } : {}),
|
||||||
|
|||||||
@ -44,7 +44,7 @@ const DEFAULT_VALUES: PaymentReceivedFormValues = {
|
|||||||
job_card: null,
|
job_card: null,
|
||||||
payment_mode: null,
|
payment_mode: null,
|
||||||
customer: null,
|
customer: null,
|
||||||
amount_received: "",
|
amount_received: 0,
|
||||||
payment_number: "",
|
payment_number: "",
|
||||||
payment_date: new Date().toISOString().split("T")[0],
|
payment_date: new Date().toISOString().split("T")[0],
|
||||||
note: "",
|
note: "",
|
||||||
@ -59,7 +59,7 @@ function mapToFormValues(data: unknown): PaymentReceivedFormValues {
|
|||||||
job_card: toRelation(d.job_card_id, d.job_card_name),
|
job_card: toRelation(d.job_card_id, d.job_card_name),
|
||||||
payment_mode: toRelation(d.payment_mode_id, d.payment_mode_name),
|
payment_mode: toRelation(d.payment_mode_id, d.payment_mode_name),
|
||||||
customer: toRelation(d.customer_id, d.customer_name),
|
customer: toRelation(d.customer_id, d.customer_name),
|
||||||
amount_received: d.amount_received ? String(d.amount_received) : "",
|
amount_received: d.amount_received != null ? Number(d.amount_received) : 0,
|
||||||
payment_number: d.payment_number || "",
|
payment_number: d.payment_number || "",
|
||||||
payment_date: d.payment_date || "",
|
payment_date: d.payment_date || "",
|
||||||
note: d.note || "",
|
note: d.note || "",
|
||||||
@ -106,7 +106,7 @@ export function PaymentReceivedForm({ resourceId, initialData, onSuccess, defaul
|
|||||||
base.customer = toRelation(invoiceCustomer.id, customerLabel)
|
base.customer = toRelation(invoiceCustomer.id, customerLabel)
|
||||||
}
|
}
|
||||||
if (invoiceAmount != null && invoiceAmount !== "") {
|
if (invoiceAmount != null && invoiceAmount !== "") {
|
||||||
base.amount_received = String(invoiceAmount)
|
base.amount_received = Number(invoiceAmount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Object.keys(base).length ? base : initialData
|
return Object.keys(base).length ? base : initialData
|
||||||
|
|||||||
BIN
build-output.log
Normal file
BIN
build-output.log
Normal file
Binary file not shown.
BIN
dashboard-build.log
Normal file
BIN
dashboard-build.log
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user