From 8640ba74587042b00b28b67a264cc7ef7446a84a Mon Sep 17 00:00:00 2001 From: Potenz Date: Mon, 11 Aug 2025 00:51:51 +0530 Subject: [PATCH] ui done --- apps/Backend/src/routes/payments.ts | 2 +- .../payments/payment-edit-modal.tsx | 30 ++++++++++--------- .../payments/payments-recent-table.tsx | 12 ++++---- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/apps/Backend/src/routes/payments.ts b/apps/Backend/src/routes/payments.ts index c947133..6eadbe9 100644 --- a/apps/Backend/src/routes/payments.ts +++ b/apps/Backend/src/routes/payments.ts @@ -221,7 +221,7 @@ router.delete("/:id", async (req: Request, res: Response): Promise => { if (!userId) return res.status(401).json({ message: "Unauthorized" }); const id = parseIntOrError(req.params.id, "Payment ID"); - await storage.deletePayment(userId, id); + await storage.deletePayment(id, userId); res.status(200).json({ message: "Payment deleted successfully" }); } catch (err: unknown) { diff --git a/apps/Frontend/src/components/payments/payment-edit-modal.tsx b/apps/Frontend/src/components/payments/payment-edit-modal.tsx index fc30762..efdf5aa 100644 --- a/apps/Frontend/src/components/payments/payment-edit-modal.tsx +++ b/apps/Frontend/src/components/payments/payment-edit-modal.tsx @@ -26,9 +26,8 @@ import { SelectItem, SelectTrigger, SelectValue, -} from "@radix-ui/react-select"; +} from "@/components/ui/select"; import { Input } from "@/components/ui/input"; -import Decimal from "decimal.js"; import { toast } from "@/hooks/use-toast"; type PaymentEditModalProps = { @@ -47,7 +46,7 @@ export default function PaymentEditModal({ onEditServiceLine, }: PaymentEditModalProps) { if (!payment) return null; - + const [expandedLineId, setExpandedLineId] = useState(null); const [paymentStatus, setPaymentStatus] = React.useState( payment.status @@ -167,15 +166,15 @@ export default function PaymentEditModal({

Total Billed: $ - {payment.totalBilled.toNumber().toFixed(2)} + {Number(payment.totalBilled || 0).toFixed(2)}

Total Paid: $ - {payment.totalPaid.toNumber().toFixed(2)} + {Number(payment.totalPaid || 0).toFixed(2)}

Total Due: $ - {payment.totalDue.toNumber().toFixed(2)} + {Number(payment.totalDue || 0).toFixed(2)}

@@ -237,19 +236,19 @@ export default function PaymentEditModal({

Billed: $ - {line.totalBilled.toFixed(2)} + {Number(line.totalBilled || 0).toFixed(2)}

Paid: $ - {line.totalPaid.toFixed(2)} + {Number(line.totalPaid || 0).toFixed(2)}

Adjusted: $ - {line.totalAdjusted.toFixed(2)} + {Number(line.totalAdjusted || 0).toFixed(2)}

Due: $ - {line.totalDue.toFixed(2)} + {Number(line.totalDue || 0).toFixed(2)}

@@ -265,7 +264,7 @@ export default function PaymentEditModal({
{expandedLineId === line.id && ( -
+
)} diff --git a/apps/Frontend/src/components/payments/payments-recent-table.tsx b/apps/Frontend/src/components/payments/payments-recent-table.tsx index 8193c11..b4b418f 100644 --- a/apps/Frontend/src/components/payments/payments-recent-table.tsx +++ b/apps/Frontend/src/components/payments/payments-recent-table.tsx @@ -355,9 +355,9 @@ export default function PaymentsRecentTable({ ) : ( paymentsData?.payments.map((payment) => { - const totalBilled = payment.totalBilled.toNumber(); - const totalPaid = payment.totalPaid.toNumber(); - const totalDue = payment.totalDue.toNumber(); + const totalBilled = Number(payment.totalBilled || 0); + const totalPaid = Number(payment.totalPaid || 0); + const totalDue = Number(payment.totalDue || 0); return ( @@ -379,8 +379,8 @@ export default function PaymentsRecentTable({
- Total Billed: $ - {totalBilled.toFixed(2)} + Total Billed: $ + {Number(totalBilled).toFixed(2)} Total Paid: ${totalPaid.toFixed(2)} @@ -454,7 +454,7 @@ export default function PaymentsRecentTable({ isOpen={isDeletePaymentOpen} onConfirm={handleConfirmDeletePayment} onCancel={() => setIsDeletePaymentOpen(false)} - entityName={String(currentPayment?.claimId)} + entityName={`ClaimID : ${currentPayment?.claimId}`} /> {/* /will hanlde both modal later */}