Added error message on posting Pops

This commit is contained in:
Patrick Alvin Alcala 2026-02-20 13:38:02 +08:00
parent cb754f6f54
commit 1e2b875104

View file

@ -56,6 +56,7 @@ export default () => {
const [configNewPassword, setConfigNewPassword] = createSignal('') const [configNewPassword, setConfigNewPassword] = createSignal('')
const [configNewEncPassword, setConfigNewEncPassword] = createSignal('') const [configNewEncPassword, setConfigNewEncPassword] = createSignal('')
const [configError, setConfigError] = createSignal('') const [configError, setConfigError] = createSignal('')
const [postError, setPostError] = createSignal(false)
const [configNotification, setConfigNotification] = createSignal(false) const [configNotification, setConfigNotification] = createSignal(false)
@ -140,6 +141,10 @@ export default () => {
} }
if (division === 'electrical') { if (division === 'electrical') {
postPops(division, application)
const popsResult = await checkPops(application)
if (popsResult) {
signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1) signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1)
updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL') updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL')
if (!signed) return if (!signed) return
@ -150,19 +155,24 @@ export default () => {
updateOrderofpayment = await updateOp(division) updateOrderofpayment = await updateOp(division)
if (updateOrderofpayment) { if (updateOrderofpayment) {
postPops(division, application)
const popsResult = await checkPops(application)
if (popsResult) {
postTransaction() postTransaction()
setApprovedApplication(application) setApprovedApplication(application)
setApproved(true) setApproved(true)
} }
} else {
setPostError(true)
setErrorMessage('Error on posting on POPS Server, please try again')
return
} }
} else if (division === 'occupancy') { } else if (division === 'occupancy') {
const additionalResult = await getApi('check-bldgadditional-approval', application) const additionalResult = await getApi('check-bldgadditional-approval', application)
bldgadditional = additionalResult > 0 bldgadditional = additionalResult > 0
postPops(division, application)
const popsResult = await checkPops(application)
if (popsResult) {
signed = await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT APPROVED AND SIGNED', '172', 'OCCOPAPPROVEDSIGNED', 1) signed = await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT APPROVED AND SIGNED', '172', 'OCCOPAPPROVEDSIGNED', 1)
updateDocflow(division, application, 'FOR OCCUPANCY RECOMMENDING APPROVAL') updateDocflow(division, application, 'FOR OCCUPANCY RECOMMENDING APPROVAL')
if (bldgadditional) { if (bldgadditional) {
@ -177,14 +187,14 @@ export default () => {
updateOrderofpayment = await updateOp(division) updateOrderofpayment = await updateOp(division)
if (updateOrderofpayment) { if (updateOrderofpayment) {
postPops(division, application)
const popsResult = await checkPops(application)
if (popsResult) {
postTransaction() postTransaction()
setApprovedApplication(application) setApprovedApplication(application)
setApproved(true) setApproved(true)
} }
} else {
setPostError(true)
setErrorMessage('Error on posting on POPS Server, please try again')
return
} }
} }
} }
@ -686,7 +696,7 @@ export default () => {
</Padding> </Padding>
</Page> </Page>
<div onClick={() => setApproved(false)}> {/* <div onClick={() => setApproved(false)}>
<Modal trigger={approved()} background="#123220ff" color="#cdfbe1f0" opacity={0.8}> <Modal trigger={approved()} background="#123220ff" color="#cdfbe1f0" opacity={0.8}>
<Padding top={1} bottom={1} left={2} right={2}> <Padding top={1} bottom={1} left={2} right={2}>
<Column> <Column>
@ -706,7 +716,7 @@ export default () => {
</Column> </Column>
</Padding> </Padding>
</Modal> </Modal>
</div> </div> */}
<div onClick={closeNotification}> <div onClick={closeNotification}>
<Modal trigger={approved()} background="#123220ff" color="#cdfbe1f0" opacity={0.8}> <Modal trigger={approved()} background="#123220ff" color="#cdfbe1f0" opacity={0.8}>
@ -752,35 +762,6 @@ export default () => {
</Modal> </Modal>
</div> </div>
{/* <div onClick={() => setApology(false)}>
<Modal trigger={apology()} background="#562020ff" color="#ffebebe6" opacity={0.8}>
<Padding top={1} bottom={1} left={4} right={4}>
<Column>
<Row gap={2}>
<BiRegularErrorAlt size={90} color="#ffebebe6" />
<Box curved thickness={3} color="#ffebebe6" padding="1rem">
<h2>Delayed Release of Feature</h2>
</Box>
</Row>
<Row>
<h3>{errorMessage()}</h3>
</Row>
<Row>
<Column gap={0.5}>
<span>Occupancy Approval is delayed until Occupancy Printing is complete</span>
</Column>
</Row>
<Row>
<span class="close-text">Click anywhere to close</span>
</Row>
</Column>
</Padding>
</Modal>
</div> */}
<Modal trigger={openConfig()} background="#16212c" color="#ffffffed" opacity={0.8} width='30rem'> <Modal trigger={openConfig()} background="#16212c" color="#ffffffed" opacity={0.8} width='30rem'>
<Padding top={1} bottom={1} left={4} right={4}> <Padding top={1} bottom={1} left={4} right={4}>
<section class='config'> <section class='config'>
@ -789,8 +770,6 @@ export default () => {
<span>{employeeName()}</span> <span>{employeeName()}</span>
</div> </div>
<div class='config__edit'> <div class='config__edit'>
<span class='config__edit__title'>Change Displayed Name</span> <span class='config__edit__title'>Change Displayed Name</span>
<Input value={configNewName()} onChange={setConfigNewName} placeholder='Enter new name' /> <Input value={configNewName()} onChange={setConfigNewName} placeholder='Enter new name' />
@ -843,6 +822,28 @@ export default () => {
</Padding> </Padding>
</Modal > </Modal >
</div> </div>
<div onClick={() => setPostError(false)}>
<Modal trigger={postError() === 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>Signing Error</h2>
</Box>
</Row>
<Row>
<h3>{errorMessage()}</h3>
</Row>
<Row>
<span class="close-text">Click anywhere to close</span>
</Row>
</Column>
</Padding>
</Modal>
</div>
</> </>
) )
} }