diff --git a/package.json b/package.json index 9a6ee2b..16e86c2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "tsc -b && vite build", "buildf": "vite build", "preview": "vite preview" }, diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index f1f1e9d..7774278 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -80,13 +80,11 @@ export default () => { const [filter, setFilter] = createSignal('') - // const listType = ['Print', 'Reprint (No Change)', 'Void and Reapprove'] - const listType = ['Print', 'Reprint (No Change)'] + const listType = ['Print', 'Reprint (No Change)', 'Void and Reapprove'] const [selectedType, setSelectedType] = createSignal('Print') const [voidError, setVoidError] = createSignal(false) const [isLoading, setIsLoading] = createSignal(false) - const [loadingText, setLoadingText] = createSignal('') let bldgadditional = false @@ -251,10 +249,11 @@ 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}`) @@ -287,10 +286,11 @@ export default () => { setApplicationListBuilding(response.result) setNameListBuilding(response.result2) } - setIsLoading(false) } catch (error) { console.error(error) } + + setIsLoading(false) } const removeEmployee = () => { @@ -321,8 +321,6 @@ 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) @@ -342,14 +340,12 @@ 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) => { @@ -362,14 +358,15 @@ export default () => { return } - setIsLoading(true) - setLoadingText(`Reprinting ${application}`) - if (selectedType().includes('Void')) { - setLoadingText('Clearing POPS records') + // Return to APPROVAL + // TODO: + // Set current status (for validation) to 1, is_approve = 1 + // Clear esign_transactions 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 { @@ -382,29 +379,25 @@ 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) @@ -412,14 +405,9 @@ export default () => { await updateDocflow(division, application, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT') } - const successVoid = await voidPopsOp(application) - if (successVoid) { - await postTransaction(application) - } else { - setIsLoading(false) - } + await voidPopsOp(application) + await postTransaction(application) } else { - setLoadingText('Generating PDF') setPrintedApplication(application) setPrinted(true) @@ -429,7 +417,6 @@ export default () => { createPdfOccupancy() } else console.log('building') } - setIsLoading(false) } const updateOp = async (division: string) => { @@ -902,12 +889,10 @@ export default () => { - -

Ready for Signing and Printing Electrical Order of Payments

-
+

List of Ready to Print in Electrical Order of Payments

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