Added checking of missing data

This commit is contained in:
Patrick Alvin Alcala 2026-02-24 18:48:22 +08:00
parent eb80b12e62
commit 72abd22fee

View file

@ -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,6 +112,8 @@ export default () => {
op = await getApiMulti('get-opdetails-occupancy', applicationNo)
}
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])
@ -122,6 +125,13 @@ export default () => {
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 () => {
</Padding>
</Modal>
</div>
<div onClick={() => setIsIncomplete(false)}>
<Modal trigger={isIncomplete() === true} background="#562020ff" color="#ffebebe6" opacity={0.8}>
<Padding top={1} bottom={1} left={4} right={4}>
<Column>
<Row>
<Box curved thickness={3} color="#ffebebe6" padding="1rem">
<h2>Incomplete Data</h2>
</Box>
</Row>
<Row>
<h2>Some Data were missing</h2>
</Row>
<Row>
<h4>To avoid further error, application will be automatically pushed back on Assessment for correction</h4>
</Row>
<Row>
<span class="close-text">Click anywhere to close</span>
</Row>
</Column>
</Padding>
</Modal>
</div>
</>
)
}