Updated assessor page

This commit is contained in:
Patrick Alvin Alcala 2026-03-28 15:51:10 +08:00
parent f1dfe0884d
commit 581275ebfa

View file

@ -32,7 +32,7 @@ import {
_type,
_units,
} from '../../stores/pdfinfo.ts'
import { checkConnection, createPdfElectrical, createPdfOccupancy, deleteApi, getApi, getApiMulti, getDateTime, postApi, saveNewName, saveNewPassword, securePassword, statusPopsApi, voidPopsApi } from '../../utils/functions/index.ts'
import { checkConnection, createPdfElectrical, createPdfOccupancy, deleteApi, getApi, getApiMulti, getDateTime, postApi, saveNewName, saveNewPassword, securePassword, statusPopsApi, voidPopsApi, voidApi } from '../../utils/functions/index.ts'
import { AiOutlineLoading3Quarters } from 'solid-icons/ai'
import './Assessor.sass'
@ -80,7 +80,7 @@ export default () => {
const [filter, setFilter] = createSignal('')
const listType = ['Print', 'Reprint (No Change)', 'Void and Reapprove']
const listType = ['Print', 'Reprint (No Change)', 'Void (Back to Approval)']
// const listType = ['Print', 'Reprint (No Change)']
const [selectedType, setSelectedType] = createSignal('Print')
@ -88,6 +88,8 @@ export default () => {
const [isLoading, setIsLoading] = createSignal(false)
const [loadingText, setLoadingText] = createSignal('')
const [voidNotification, setVoidNotification] = createSignal(false)
let bldgadditional = false
const checkAccess = async (access: string) => {
@ -402,14 +404,14 @@ export default () => {
await updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING')
}
setLoadingText('Processing for Re-approvalsss')
setLoadingText('Processing for Re-approval')
const checkOrValidation = await checkDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
if (checkOrValidation) {
await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
}
// await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
await updateOpForApproval(division, application)
setLoadingText('Processing for Re-approvalsss')
setLoadingText('Processing for Re-approval')
await clearEsignTransactions(application)
} else if (division === 'occupancy') {
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT VOIDED', '174', 'OCCOPVOIDED', 1)
@ -417,9 +419,12 @@ export default () => {
await updateDocflow(division, application, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT')
}
const successVoid = await voidPopsOp(application)
const successVoid = BACKEND.includes('localhost') ? await voidPopsOpLocal(application) : await voidPopsOp(application)
if (successVoid) {
await postTransaction(application)
setIsLoading(false)
setPrintedApplication(application)
setVoidNotification(true)
} else {
setIsLoading(false)
}
@ -541,17 +546,17 @@ export default () => {
navigate('/')
}
// const gotoProfile = () => {
// sessionStorage.setItem('name', employeeName())
// navigate('/profile')
// }
const voidPopsOp = async (application: string) => {
const response = await voidPopsApi(application)
if (response.includes('Error')) return false
return true
}
const voidPopsOpLocal = async (application: string) => {
const response = await voidApi('void-op-local', { data: application })
return response
}
const checkStatusPopsLocal = async (application: string) => {
const response = await getApiMulti('check-statuspops-local', application)
return response
@ -568,8 +573,15 @@ export default () => {
}
const clearEsignTransactions = async (application: string) => {
const response = await deleteApi('delete-esigntransactions', { data: application })
return response
let deleteTran
const check = await getApi('check-esigntransaction', application)
if (parseInt(check) > 0) {
deleteTran = await deleteApi('delete-esigntransactions', { data: application })
return deleteTran
} else {
return 0
}
}
const saveConfig = async () => {
@ -896,9 +908,12 @@ export default () => {
<Show when={selectedType() === 'Print'}>
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
</Show>
<Show when={selectedType() !== 'Print'}>
<Show when={selectedType().includes('Reprint')}>
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('occupancy', item)}></Button>
</Show>
<Show when={selectedType().includes('Void')}>
<Button wide label="Void" edges="curved" design="bo-primary" onClick={() => rePrintHandler('occupancy', item)}></Button>
</Show>
<span class="modal__cancel">Click anywhere to cancel</span>
</Row>
</Padding>
@ -1008,9 +1023,12 @@ export default () => {
<Show when={selectedType() === 'Print'}>
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
</Show>
<Show when={selectedType() !== 'Print'}>
<Show when={selectedType().includes('Reprint')}>
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('electrical', item)}></Button>
</Show>
<Show when={selectedType().includes('Void')}>
<Button wide label="Void" edges="curved" design="bo-primary" onClick={() => rePrintHandler('electrical', item)}></Button>
</Show>
<span class="modal__cancel">Click anywhere to cancel</span>
</Row>
</Padding>
@ -1154,6 +1172,28 @@ export default () => {
</Padding>
</Modal>
</div>
<div onClick={() => setVoidNotification(false)}>
<Modal trigger={voidNotification() === true} background="#123220ff" color="#cdfbe1f0" opacity={0.8}>
<Padding top={1} bottom={1} left={2} right={2}>
<Column>
<Row gap={4}>
<FaSolidThumbsUp size={75} />
<Box curved thickness={3} color="#cdfbe1f0" padding="1rem">
<span class="approval">Account Voided and Returned to Approval</span>
</Box>
</Row>
<Row padding="2rem 0 0 0">
<h2>{printedApplication()}</h2>
</Row>
<Row>
<span class="close-text">Click anywhere to proceed</span>
</Row>
</Column>
</Padding>
</Modal>
</div>
</>
)
}