fix build errors
This commit is contained in:
parent
38565298fc
commit
b0361fcbfb
@ -76,51 +76,52 @@ export function AppointmentActions({ appointmentId, currentStatus, jobCardId }:
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" disabled={isLoading}>
|
||||
<Ellipsis className="size-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => editDialog.open(appointmentId)}>
|
||||
<Pencil className="size-4" />
|
||||
Edit
|
||||
</DropdownMenuItem>
|
||||
{currentStatus !== "confirmed" && (
|
||||
<>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" disabled={isLoading}>
|
||||
<Ellipsis className="size-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => editDialog.open(appointmentId)}>
|
||||
<Pencil className="size-4" />
|
||||
Edit
|
||||
</DropdownMenuItem>
|
||||
{currentStatus !== "confirmed" && (
|
||||
<DropdownMenuItem onClick={() => handleChangeStatus("confirmed")}>
|
||||
<CheckCircle className="size-4" />
|
||||
Confirm
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{currentStatus !== "completed" && (
|
||||
)}
|
||||
{currentStatus !== "completed" && (
|
||||
<DropdownMenuItem onClick={() => handleChangeStatus("completed")}>
|
||||
<CheckCircle className="size-4" />
|
||||
Mark Completed
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{currentStatus !== "cancelled" && (
|
||||
)}
|
||||
{currentStatus !== "cancelled" && (
|
||||
<DropdownMenuItem onClick={() => handleChangeStatus("cancelled")}>
|
||||
<CheckCircle className="size-4" />
|
||||
Cancel
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{jobCardId && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={handleUnlinkJobCard}>
|
||||
<Unlink className="size-4" />
|
||||
Unlink Job Card
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem variant="destructive" onClick={handleDelete}>
|
||||
<Trash2 className="size-4" />
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)}
|
||||
{jobCardId && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={handleUnlinkJobCard}>
|
||||
<Unlink className="size-4" />
|
||||
Unlink Job Card
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem variant="destructive" onClick={handleDelete}>
|
||||
<Trash2 className="size-4" />
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
<Dialog open={editDialog.isOpen} onOpenChange={(v) => { if (!v) editDialog.close() }}>
|
||||
<DialogContent className="min-w-xl lg:min-w-4xl">
|
||||
<DialogHeader>
|
||||
@ -137,5 +138,6 @@ export function AppointmentActions({ appointmentId, currentStatus, jobCardId }:
|
||||
</ScrollArea>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</> )
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ const DEFAULT_VALUES: PaymentMadeFormValues & { details: Array<{ bill_id?: strin
|
||||
employee: null,
|
||||
payment_mode: null,
|
||||
payment_for: "bill",
|
||||
amount: "",
|
||||
amount: 0,
|
||||
payment_number: "",
|
||||
payment_reference: "",
|
||||
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),
|
||||
payment_mode: toRelation(paymentModeId, paymentModeLabel),
|
||||
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_reference: d.payment_reference || "",
|
||||
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) {
|
||||
const paymentDetails =
|
||||
expenseId ? [{ expense_id: expenseId, amount_paid: values.amount ? Number(values.amount) : 0 }]
|
||||
: [{ bill_id: billId, amount_paid: values.amount ? Number(values.amount) : 0 }]
|
||||
expenseId ? [{ expense_id: expenseId, amount_paid: values.amount || 0 }]
|
||||
: [{ bill_id: billId, amount_paid: values.amount || 0 }]
|
||||
return {
|
||||
vendor_id: toId(values.vendor),
|
||||
employee_id: toId(values.employee) || undefined,
|
||||
payment_mode_id: toId(values.payment_mode),
|
||||
payment_for: values.payment_for,
|
||||
amount: values.amount ? Number(values.amount) : 0,
|
||||
amount: values.amount || 0,
|
||||
payment_number: values.payment_number || undefined,
|
||||
payment_reference: values.payment_reference || undefined,
|
||||
payment_date: values.payment_date,
|
||||
paid_through: values.paid_through || undefined,
|
||||
notes: values.notes || undefined,
|
||||
payment_made: values.amount,
|
||||
payment_made: values.amount || 0,
|
||||
details: paymentDetails,
|
||||
...(billId ? { bill_id: Number(billId) } : {}),
|
||||
...(expenseId ? { expense_id: Number(expenseId) } : {}),
|
||||
|
||||
@ -44,7 +44,7 @@ const DEFAULT_VALUES: PaymentReceivedFormValues = {
|
||||
job_card: null,
|
||||
payment_mode: null,
|
||||
customer: null,
|
||||
amount_received: "",
|
||||
amount_received: 0,
|
||||
payment_number: "",
|
||||
payment_date: new Date().toISOString().split("T")[0],
|
||||
note: "",
|
||||
@ -59,7 +59,7 @@ function mapToFormValues(data: unknown): PaymentReceivedFormValues {
|
||||
job_card: toRelation(d.job_card_id, d.job_card_name),
|
||||
payment_mode: toRelation(d.payment_mode_id, d.payment_mode_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_date: d.payment_date || "",
|
||||
note: d.note || "",
|
||||
@ -106,7 +106,7 @@ export function PaymentReceivedForm({ resourceId, initialData, onSuccess, defaul
|
||||
base.customer = toRelation(invoiceCustomer.id, customerLabel)
|
||||
}
|
||||
if (invoiceAmount != null && invoiceAmount !== "") {
|
||||
base.amount_received = String(invoiceAmount)
|
||||
base.amount_received = Number(invoiceAmount)
|
||||
}
|
||||
}
|
||||
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