From e687a2b3e5c8bb111a00e9ef15a3d401d0d9cd9a Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Sun, 7 Jan 2024 15:06:59 +0000 Subject: [PATCH] Payment Record: Prevent the tick without all files submitted --- src/pages/payment-record.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pages/payment-record.tsx b/src/pages/payment-record.tsx index 580500a7..fade89c2 100644 --- a/src/pages/payment-record.tsx +++ b/src/pages/payment-record.tsx @@ -577,16 +577,18 @@ export default function PaymentRecord() { id: "isPaid", cell: (info) => { const {value} = columHelperValue(info.column.id, info); + return ( - user?.type !== "agent" && !value - ? confirm(`Are you sure you want to consider this payment paid?`) - ? updatePayment(info.row.original, "isPaid", e) - : null - : null - }> + onChange={(e) => { + if (user?.type === agent || value) return null; + if (!info.row.original.commissionTransfer || !info.row.original.corporateTransfer) + return alert("All files need to be uploaded to consider it paid!"); + if (!confirm(`Are you sure you want to consider this payment paid?`)) return null; + + return updatePayment(info.row.original, "isPaid", e); + }}> );