From 72abd22fee2df1d9fdd4cdd3482034f81ff1a819 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 24 Feb 2026 18:48:22 +0800 Subject: [PATCH] Added checking of missing data --- src/pages/MainPage/Main.tsx | 58 ++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 0d9c6ca..85f52fb 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -59,6 +59,7 @@ export default () => { const [postError, setPostError] = createSignal(false) const [configNotification, setConfigNotification] = createSignal(false) + const [isIncomplete, setIsIncomplete] = createSignal(false) let bldgadditional = false @@ -111,17 +112,26 @@ export default () => { op = await getApiMulti('get-opdetails-occupancy', applicationNo) } - setLocation(op.result[0]) - setType(op.result2[0]) - setAssessor(op.result3[0]) - const total = calculateTotal(op.result4) - const formattedTotal = new Intl.NumberFormat('en-US', { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }).format(total) - setTotalOp(formattedTotal) - setDateOp(dayjs(op.result5[0]).format('MMMM DD, YYYY')) - setApplicationId(op.result6[0]) + if (isDetailsComplete(op.result, op.result2, op.result3, op.result4, op.result5, op.result6)) { + setIsIncomplete(false) + setLocation(op.result[0]) + setType(op.result2[0]) + setAssessor(op.result3[0]) + const total = calculateTotal(op.result4) + const formattedTotal = new Intl.NumberFormat('en-US', { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }).format(total) + setTotalOp(formattedTotal) + setDateOp(dayjs(op.result5[0]).format('MMMM DD, YYYY')) + setApplicationId(op.result6[0]) + } else { + setIsIncomplete(true) + } + } + + const isDetailsComplete = (result: string[], result2: string[], result3: string[], result4: string[], result5: string[], result6: string[]) => { + return result.length > 0 && result2.length > 0 && result3.length > 0 && result4.length > 0 && result5.length > 0 && result6.length > 0 ? false : false } const calculateTotal = (list: number[]) => { @@ -846,6 +856,32 @@ export default () => { + +
setIsIncomplete(false)}> + + + + + +

Incomplete Data

+
+
+ + +

Some Data were missing

+
+ + +

To avoid further error, application will be automatically pushed back on Assessment for correction

+
+ + + Click anywhere to close + +
+
+
+
) }