Updated assessor page

This commit is contained in:
Patrick Alvin Alcala 2026-03-06 18:37:09 +08:00
parent dd2e551b12
commit ce03cd31ac

View file

@ -80,11 +80,13 @@ export default () => {
const [filter, setFilter] = createSignal('') const [filter, setFilter] = createSignal('')
const listType = ['Print', 'Reprint (No Change)', 'Void and Reapprove'] // const listType = ['Print', 'Reprint (No Change)', 'Void and Reapprove']
const listType = ['Print', 'Reprint (No Change)']
const [selectedType, setSelectedType] = createSignal('Print') const [selectedType, setSelectedType] = createSignal('Print')
const [voidError, setVoidError] = createSignal(false) const [voidError, setVoidError] = createSignal(false)
const [isLoading, setIsLoading] = createSignal(false) const [isLoading, setIsLoading] = createSignal(false)
const [loadingText, setLoadingText] = createSignal('')
let bldgadditional = false let bldgadditional = false
@ -249,11 +251,10 @@ export default () => {
} }
const getListForPrinting = async (division: string) => { const getListForPrinting = async (division: string) => {
setIsLoading(true)
try { try {
setIsLoading(true)
setLoadingText('Downloading Data')
let response: any let response: any
if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`) if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`)
else response = await getApiMulti(`get-listopreprinting-${division}`) else response = await getApiMulti(`get-listopreprinting-${division}`)
@ -286,11 +287,10 @@ export default () => {
setApplicationListBuilding(response.result) setApplicationListBuilding(response.result)
setNameListBuilding(response.result2) setNameListBuilding(response.result2)
} }
setIsLoading(false)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
setIsLoading(false)
} }
const removeEmployee = () => { const removeEmployee = () => {
@ -321,6 +321,8 @@ export default () => {
return return
} }
setIsLoading(true)
setLoadingText(`Processing ${application}`)
if (division === 'electrical') { if (division === 'electrical') {
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED', 1) await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED', 1)
await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1) await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1)
@ -340,12 +342,14 @@ export default () => {
setPrintedApplication(application) setPrintedApplication(application)
setPrinted(true) setPrinted(true)
setLoadingText(`Generating PDF`)
if (division === 'electrical') { if (division === 'electrical') {
createPdfElectrical() createPdfElectrical()
} else if (division === 'occupancy') { } else if (division === 'occupancy') {
createPdfOccupancy() createPdfOccupancy()
} else console.log('building') } else console.log('building')
} }
setIsLoading(false)
} }
const rePrintHandler = async (division: string, application: string) => { const rePrintHandler = async (division: string, application: string) => {
@ -358,15 +362,14 @@ export default () => {
return return
} }
setIsLoading(true)
setLoadingText(`Reprinting ${application}`)
if (selectedType().includes('Void')) { if (selectedType().includes('Void')) {
// Return to APPROVAL setLoadingText('Clearing POPS records')
// TODO:
// Set current status (for validation) to 1, is_approve = 1
// Clear esign_transactions
if (BACKEND.includes('localhost')) { if (BACKEND.includes('localhost')) {
const status = await checkStatusPopsLocal(application) const status = await checkStatusPopsLocal(application)
console.log('status', status)
if (status.result > 0) popsExist = true if (status.result > 0) popsExist = true
if (status.result2 > 0) popsPaid = true if (status.result2 > 0) popsPaid = true
} else { } else {
@ -379,25 +382,29 @@ export default () => {
// const message = status.message // const message = status.message
if (!popsExist) { if (!popsExist) {
setIsLoading(false)
setVoidError(true) setVoidError(true)
setErrorMessage('No record found on Pops') setErrorMessage('No record found on Pops')
return return
} else {
// const pops_paid = message.pops_paid
// const epay_paid = message.epay_paid
} }
if (popsPaid) { if (popsPaid) {
setIsLoading(false)
setVoidError(true) setVoidError(true)
setErrorMessage('Already Paid') setErrorMessage('Already Paid')
return return
} }
setLoadingText('Processing for Re-approval')
if (division === 'electrical') { if (division === 'electrical') {
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT VOIDED', '173', 'ELECOPVOIDED', 1) await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT VOIDED', '173', 'ELECOPVOIDED', 1)
await setNewStatus(division, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL', '94', 'ELECOPAPPROVE', 0) await setNewStatus(division, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL', '94', 'ELECOPAPPROVE', 0)
setLoadingText('Processing for Re-approvalsss222')
await updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING') await updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING')
setLoadingText('Processing for Re-approvalsss')
await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
await updateOpForApproval(division, application) await updateOpForApproval(division, application)
setLoadingText('Processing for Re-approvalsss')
await clearEsignTransactions(application) await clearEsignTransactions(application)
} else if (division === 'occupancy') { } else if (division === 'occupancy') {
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT VOIDED', '174', 'OCCOPVOIDED', 1) await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT VOIDED', '174', 'OCCOPVOIDED', 1)
@ -405,9 +412,14 @@ export default () => {
await updateDocflow(division, application, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT') await updateDocflow(division, application, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT')
} }
await voidPopsOp(application) const successVoid = await voidPopsOp(application)
await postTransaction(application) if (successVoid) {
await postTransaction(application)
} else {
setIsLoading(false)
}
} else { } else {
setLoadingText('Generating PDF')
setPrintedApplication(application) setPrintedApplication(application)
setPrinted(true) setPrinted(true)
@ -417,6 +429,7 @@ export default () => {
createPdfOccupancy() createPdfOccupancy()
} else console.log('building') } else console.log('building')
} }
setIsLoading(false)
} }
const updateOp = async (division: string) => { const updateOp = async (division: string) => {
@ -889,10 +902,12 @@ export default () => {
</Tabs.Content> </Tabs.Content>
<Tabs.Content class="tabs__content" value="electrical"> <Tabs.Content class="tabs__content" value="electrical">
<Row> <Row>
<h2>List of Ready to Print in Electrical Order of Payments</h2> <Padding top={2} bottom={2} right={0} left={0}>
<h3>Ready for Signing and Printing Electrical Order of Payments</h3>
</Padding>
</Row> </Row>
<Padding top={0} bottom={0} right={10} left={10}> <Padding top={0} bottom={0} right={9} left={9}>
<Row content="split"> <Row content="split">
<Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" /> <Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" />
<Row gap={0.5}> <Row gap={0.5}>
@ -908,7 +923,7 @@ export default () => {
<Padding top={2} bottom={0} right={10} left={10}> <Padding top={2} bottom={0} right={10} left={10}>
<Column gap={1}> <Column gap={1}>
<AiOutlineLoading3Quarters class="loading-spinner" size={42} opacity={0.8} /> <AiOutlineLoading3Quarters class="loading-spinner" size={42} opacity={0.8} />
<span>Downloading Data</span> <span>{loadingText()}</span>
</Column> </Column>
</Padding> </Padding>
</Show> </Show>