From ce03cd31ac8422861595361f4c8723dba45733bc Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Fri, 6 Mar 2026 18:37:09 +0800 Subject: [PATCH] Updated assessor page --- src/pages/AssessorPage/Assessor.tsx | 53 ++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index 7774278..f1f1e9d 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -80,11 +80,13 @@ export default () => { 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 [voidError, setVoidError] = createSignal(false) const [isLoading, setIsLoading] = createSignal(false) + const [loadingText, setLoadingText] = createSignal('') let bldgadditional = false @@ -249,11 +251,10 @@ export default () => { } const getListForPrinting = async (division: string) => { - setIsLoading(true) - try { + setIsLoading(true) + setLoadingText('Downloading Data') let response: any - if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`) else response = await getApiMulti(`get-listopreprinting-${division}`) @@ -286,11 +287,10 @@ export default () => { setApplicationListBuilding(response.result) setNameListBuilding(response.result2) } + setIsLoading(false) } catch (error) { console.error(error) } - - setIsLoading(false) } const removeEmployee = () => { @@ -321,6 +321,8 @@ export default () => { return } + setIsLoading(true) + setLoadingText(`Processing ${application}`) if (division === 'electrical') { await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED', 1) await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1) @@ -340,12 +342,14 @@ export default () => { setPrintedApplication(application) setPrinted(true) + setLoadingText(`Generating PDF`) if (division === 'electrical') { createPdfElectrical() } else if (division === 'occupancy') { createPdfOccupancy() } else console.log('building') } + setIsLoading(false) } const rePrintHandler = async (division: string, application: string) => { @@ -358,15 +362,14 @@ export default () => { return } + setIsLoading(true) + setLoadingText(`Reprinting ${application}`) + if (selectedType().includes('Void')) { - // Return to APPROVAL - // TODO: - // Set current status (for validation) to 1, is_approve = 1 - // Clear esign_transactions + setLoadingText('Clearing POPS records') if (BACKEND.includes('localhost')) { const status = await checkStatusPopsLocal(application) - console.log('status', status) if (status.result > 0) popsExist = true if (status.result2 > 0) popsPaid = true } else { @@ -379,25 +382,29 @@ export default () => { // const message = status.message if (!popsExist) { + setIsLoading(false) setVoidError(true) setErrorMessage('No record found on Pops') return - } else { - // const pops_paid = message.pops_paid - // const epay_paid = message.epay_paid } if (popsPaid) { + setIsLoading(false) setVoidError(true) setErrorMessage('Already Paid') return } + setLoadingText('Processing for Re-approval') if (division === 'electrical') { await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT VOIDED', '173', 'ELECOPVOIDED', 1) 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') + setLoadingText('Processing for Re-approvalsss') + await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION') await updateOpForApproval(division, application) + setLoadingText('Processing for Re-approvalsss') await clearEsignTransactions(application) } else if (division === 'occupancy') { 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 voidPopsOp(application) - await postTransaction(application) + const successVoid = await voidPopsOp(application) + if (successVoid) { + await postTransaction(application) + } else { + setIsLoading(false) + } } else { + setLoadingText('Generating PDF') setPrintedApplication(application) setPrinted(true) @@ -417,6 +429,7 @@ export default () => { createPdfOccupancy() } else console.log('building') } + setIsLoading(false) } const updateOp = async (division: string) => { @@ -889,10 +902,12 @@ export default () => { -

List of Ready to Print in Electrical Order of Payments

+ +

Ready for Signing and Printing Electrical Order of Payments

+
- + @@ -908,7 +923,7 @@ export default () => { - Downloading Data + {loadingText()}