Updated assessor page

This commit is contained in:
Patrick Alvin Alcala 2025-11-27 16:09:51 +08:00
parent 2b8071a4a8
commit be452c5cd0

View file

@ -1,12 +1,12 @@
import { Tabs } from '@kobalte/core/tabs' import { Tabs } from '@kobalte/core/tabs';
import { useNavigate } from '@solidjs/router' import { useNavigate } from '@solidjs/router';
import dayjs from 'dayjs' import dayjs from 'dayjs';
import { FaSolidThumbsUp } from 'solid-icons/fa' import { FaSolidThumbsUp } from 'solid-icons/fa';
import { FiLogOut } from 'solid-icons/fi' import { FiLogOut } from 'solid-icons/fi';
import { VsRefresh } from 'solid-icons/vs' import { VsRefresh } from 'solid-icons/vs';
import { createEffect, createSignal, onMount } from 'solid-js' import { createEffect, createSignal, onMount } from 'solid-js';
import { Show } from 'solid-js/web' import { Show } from 'solid-js/web';
import { Box, Button, Clickable, Column, Combobox, Input, Link, Logo, Modal, ModalButton, Padding, Page, Row } from '../../components' import { Box, Button, Clickable, Column, Combobox, Input, Link, Logo, Modal, ModalButton, Padding, Page, Row } from '../../components/index.ts';
import { import {
_additional, _additional,
_additionalAmountList, _additionalAmountList,
@ -31,9 +31,9 @@ import {
_totalUnits, _totalUnits,
_type, _type,
_units, _units,
} from '../../stores/pdfinfo' } from '../../stores/pdfinfo.ts';
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, voidApi } from '../../utils/functions' import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, statusPopsApi, voidPopsApi } from '../../utils/functions/index.ts';
import './Assessor.sass' import './Assessor.sass';
const PESO = import.meta.env.VITE_PESO const PESO = import.meta.env.VITE_PESO
@ -71,6 +71,8 @@ export default () => {
const listType = ['Print', 'Reprint', 'Reprint and Void'] const listType = ['Print', 'Reprint', 'Reprint and Void']
const [selectedType, setSelectedType] = createSignal('Print') const [selectedType, setSelectedType] = createSignal('Print')
const [voidError, setVoidError] = createSignal(false)
let bldgadditional = false let bldgadditional = false
const checkAccess = async (access: string) => { const checkAccess = async (access: string) => {
@ -334,6 +336,24 @@ export default () => {
} }
if (selectedType().includes("Void")) { if (selectedType().includes("Void")) {
const status = await statusPopsOp(application)
const message = status.message
if (message.includes('No record')) {
setVoidError(true)
setErrorMessage("No record found on Pops")
return
} else {
const pops_paid = message.pops_paid
const epay_paid = message.epay_paid
if (pops_paid || epay_paid) {
setVoidError(true)
setErrorMessage("Already Paid")
return
}
}
if (division === 'electrical') { if (division === 'electrical') {
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT REPRINTED', '175', 'ELECOPREPRINTED', 1) await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT REPRINTED', '175', 'ELECOPREPRINTED', 1)
await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1) await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1)
@ -346,10 +366,10 @@ 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')
} }
await voidOp(application) await voidPopsOp(application)
await postTransaction(application)
} }
postTransaction(application)
setPrintedApplication(application) setPrintedApplication(application)
setPrinted(true) setPrinted(true)
@ -454,20 +474,25 @@ export default () => {
if (isElectrical()) await getListForPrinting('electrical') if (isElectrical()) await getListForPrinting('electrical')
} }
const logout = async () => { const logout = () => {
removeEmployee() removeEmployee()
navigate('/') navigate('/')
} }
const gotoProfile = async () => { const gotoProfile = () => {
sessionStorage.setItem('name', employeeName()) sessionStorage.setItem('name', employeeName())
navigate('/profile') navigate('/profile')
} }
const voidOp = async (application: string) => { const voidPopsOp = async (application: string) => {
const response = await voidApi(application) const response = await voidPopsApi(application)
if (response !== null) return true if (response.includes('Error')) return false
return false return true
}
const statusPopsOp = async (application: string) => {
const response = await statusPopsApi(application)
return response
} }
onMount(async () => { onMount(async () => {
@ -885,6 +910,28 @@ export default () => {
</Padding> </Padding>
</Modal> </Modal>
</div> </div>
<div onClick={() => setVoidError(false)}>
<Modal trigger={voidError()} background="#562020ff" color="#ffebebe6" opacity={0.8}>
<Padding top={1} bottom={1} left={4} right={4}>
<Column>
<Row>
<Box curved thickness={3} color="#ffebebe6" padding="1rem">
<h2>Invalid Application Void</h2>
</Box>
</Row>
<Row>
<h3>{errorMessage()}</h3>
</Row>
<Row>
<span class="close-text">Click anywhere to close</span>
</Row>
</Column>
</Padding>
</Modal>
</div>
</> </>
) )
} }