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 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 () => {
</Tabs.Content>
<Tabs.Content class="tabs__content" value="electrical">
<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>
<Padding top={0} bottom={0} right={10} left={10}>
<Padding top={0} bottom={0} right={9} left={9}>
<Row content="split">
<Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" />
<Row gap={0.5}>
@ -908,7 +923,7 @@ export default () => {
<Padding top={2} bottom={0} right={10} left={10}>
<Column gap={1}>
<AiOutlineLoading3Quarters class="loading-spinner" size={42} opacity={0.8} />
<span>Downloading Data</span>
<span>{loadingText()}</span>
</Column>
</Padding>
</Show>