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 [configNewEncPassword, setConfigNewEncPassword] = createSignal('')
const [configError, setConfigError] = createSignal('')
const [postError, setPostError] = createSignal(false)
const [configNotification, setConfigNotification] = createSignal(false)
@ -140,51 +141,60 @@ export default () => {
}
if (division === 'electrical') {
signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1)
updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL')
if (!signed) return
postPops(division, application)
const popsResult = await checkPops(application)
forprinting = await setNewStatus(division, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING', '95', 'ELECOPPRINT', 0)
if (!forprinting) return
if (popsResult) {
signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1)
updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL')
if (!signed) return
updateOrderofpayment = await updateOp(division)
forprinting = await setNewStatus(division, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING', '95', 'ELECOPPRINT', 0)
if (!forprinting) return
if (updateOrderofpayment) {
postPops(division, application)
const popsResult = await checkPops(application)
updateOrderofpayment = await updateOp(division)
if (popsResult) {
if (updateOrderofpayment) {
postTransaction()
setApprovedApplication(application)
setApproved(true)
}
} else {
setPostError(true)
setErrorMessage('Error on posting on POPS Server, please try again')
return
}
} else if (division === 'occupancy') {
const additionalResult = await getApi('check-bldgadditional-approval', application)
bldgadditional = additionalResult > 0
signed = await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT APPROVED AND SIGNED', '172', 'OCCOPAPPROVEDSIGNED', 1)
updateDocflow(division, application, 'FOR OCCUPANCY RECOMMENDING APPROVAL')
if (bldgadditional) {
const neededToUpdate = await checkApproval(application, 'FOR ADDITIONAL ORDER OF PAYMENT RECOMMENDING APPROVAL')
if (!neededToUpdate) updateDocflow(division, application, 'FOR ADDITIONAL ORDER OF PAYMENT RECOMMENDING APPROVAL')
}
if (!signed) return
postPops(division, application)
const popsResult = await checkPops(application)
forprinting = await setNewStatus(division, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT', '23', 'OCORDEROFPAYMENT', 0)
if (!forprinting) return
if (popsResult) {
signed = await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT APPROVED AND SIGNED', '172', 'OCCOPAPPROVEDSIGNED', 1)
updateDocflow(division, application, 'FOR OCCUPANCY RECOMMENDING APPROVAL')
if (bldgadditional) {
const neededToUpdate = await checkApproval(application, 'FOR ADDITIONAL ORDER OF PAYMENT RECOMMENDING APPROVAL')
if (!neededToUpdate) updateDocflow(division, application, 'FOR ADDITIONAL ORDER OF PAYMENT RECOMMENDING APPROVAL')
}
if (!signed) return
updateOrderofpayment = await updateOp(division)
forprinting = await setNewStatus(division, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT', '23', 'OCORDEROFPAYMENT', 0)
if (!forprinting) return
if (updateOrderofpayment) {
postPops(division, application)
const popsResult = await checkPops(application)
updateOrderofpayment = await updateOp(division)
if (popsResult) {
if (updateOrderofpayment) {
postTransaction()
setApprovedApplication(application)
setApproved(true)
}
} else {
setPostError(true)
setErrorMessage('Error on posting on POPS Server, please try again')
return
}
}
}
@ -686,7 +696,7 @@ export default () => {
</Padding>
</Page>
<div onClick={() => setApproved(false)}>
{/* <div onClick={() => setApproved(false)}>
<Modal trigger={approved()} background="#123220ff" color="#cdfbe1f0" opacity={0.8}>
<Padding top={1} bottom={1} left={2} right={2}>
<Column>
@ -706,7 +716,7 @@ export default () => {
</Column>
</Padding>
</Modal>
</div>
</div> */}
<div onClick={closeNotification}>
<Modal trigger={approved()} background="#123220ff" color="#cdfbe1f0" opacity={0.8}>
@ -752,35 +762,6 @@ export default () => {
</Modal>
</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'>
<Padding top={1} bottom={1} left={4} right={4}>
<section class='config'>
@ -789,8 +770,6 @@ export default () => {
<span>{employeeName()}</span>
</div>
<div class='config__edit'>
<span class='config__edit__title'>Change Displayed Name</span>
<Input value={configNewName()} onChange={setConfigNewName} placeholder='Enter new name' />
@ -843,6 +822,28 @@ export default () => {
</Padding>
</Modal >
</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>
</>
)
}