Added checking of missing data
This commit is contained in:
parent
eb80b12e62
commit
72abd22fee
1 changed files with 47 additions and 11 deletions
|
|
@ -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 () => {
|
|||
</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>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue