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, _type,
_units, _units,
} from '../../stores/pdfinfo.ts' } 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 { AiOutlineLoading3Quarters } from 'solid-icons/ai'
import './Assessor.sass' import './Assessor.sass'
@ -80,7 +80,7 @@ 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 (Back to Approval)']
// const listType = ['Print', 'Reprint (No Change)'] // const listType = ['Print', 'Reprint (No Change)']
const [selectedType, setSelectedType] = createSignal('Print') const [selectedType, setSelectedType] = createSignal('Print')
@ -88,6 +88,8 @@ export default () => {
const [isLoading, setIsLoading] = createSignal(false) const [isLoading, setIsLoading] = createSignal(false)
const [loadingText, setLoadingText] = createSignal('') const [loadingText, setLoadingText] = createSignal('')
const [voidNotification, setVoidNotification] = createSignal(false)
let bldgadditional = false let bldgadditional = false
const checkAccess = async (access: string) => { const checkAccess = async (access: string) => {
@ -402,14 +404,14 @@ export default () => {
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') setLoadingText('Processing for Re-approval')
const checkOrValidation = await checkDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION') const checkOrValidation = await checkDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
if (checkOrValidation) { if (checkOrValidation) {
await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION') await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
} }
// await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION') // await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION')
await updateOpForApproval(division, application) await updateOpForApproval(division, application)
setLoadingText('Processing for Re-approvalsss') setLoadingText('Processing for Re-approval')
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)
@ -417,9 +419,12 @@ 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')
} }
const successVoid = await voidPopsOp(application) const successVoid = BACKEND.includes('localhost') ? await voidPopsOpLocal(application) : await voidPopsOp(application)
if (successVoid) { if (successVoid) {
await postTransaction(application) await postTransaction(application)
setIsLoading(false)
setPrintedApplication(application)
setVoidNotification(true)
} else { } else {
setIsLoading(false) setIsLoading(false)
} }
@ -541,17 +546,17 @@ export default () => {
navigate('/') navigate('/')
} }
// const gotoProfile = () => {
// sessionStorage.setItem('name', employeeName())
// navigate('/profile')
// }
const voidPopsOp = async (application: string) => { const voidPopsOp = async (application: string) => {
const response = await voidPopsApi(application) const response = await voidPopsApi(application)
if (response.includes('Error')) return false if (response.includes('Error')) return false
return true return true
} }
const voidPopsOpLocal = async (application: string) => {
const response = await voidApi('void-op-local', { data: application })
return response
}
const checkStatusPopsLocal = async (application: string) => { const checkStatusPopsLocal = async (application: string) => {
const response = await getApiMulti('check-statuspops-local', application) const response = await getApiMulti('check-statuspops-local', application)
return response return response
@ -568,8 +573,15 @@ export default () => {
} }
const clearEsignTransactions = async (application: string) => { const clearEsignTransactions = async (application: string) => {
const response = await deleteApi('delete-esigntransactions', { data: application }) let deleteTran
return response 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 () => { const saveConfig = async () => {
@ -896,9 +908,12 @@ export default () => {
<Show when={selectedType() === 'Print'}> <Show when={selectedType() === 'Print'}>
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button> <Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
</Show> </Show>
<Show when={selectedType() !== 'Print'}> <Show when={selectedType().includes('Reprint')}>
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('occupancy', item)}></Button> <Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('occupancy', item)}></Button>
</Show> </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> <span class="modal__cancel">Click anywhere to cancel</span>
</Row> </Row>
</Padding> </Padding>
@ -1008,9 +1023,12 @@ export default () => {
<Show when={selectedType() === 'Print'}> <Show when={selectedType() === 'Print'}>
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button> <Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
</Show> </Show>
<Show when={selectedType() !== 'Print'}> <Show when={selectedType().includes('Reprint')}>
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('electrical', item)}></Button> <Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('electrical', item)}></Button>
</Show> </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> <span class="modal__cancel">Click anywhere to cancel</span>
</Row> </Row>
</Padding> </Padding>
@ -1154,6 +1172,28 @@ export default () => {
</Padding> </Padding>
</Modal> </Modal>
</div> </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>
</> </>
) )
} }