Updated assessor page
This commit is contained in:
parent
328a64297e
commit
058c7e8de5
1 changed files with 72 additions and 10 deletions
|
|
@ -32,7 +32,7 @@ import {
|
|||
_type,
|
||||
_units,
|
||||
} from '../../stores/pdfinfo'
|
||||
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi } from '../../utils/functions'
|
||||
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, voidApi } from '../../utils/functions'
|
||||
import './Assessor.sass'
|
||||
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
|
|
@ -68,7 +68,7 @@ export default () => {
|
|||
|
||||
const [filter, setFilter] = createSignal('')
|
||||
|
||||
const listType = ['Print', 'Manual Print', 'Reprint']
|
||||
const listType = ['Print', 'Reprint', 'Reprint and Void']
|
||||
const [selectedType, setSelectedType] = createSignal('Print')
|
||||
|
||||
let bldgadditional = false
|
||||
|
|
@ -81,7 +81,10 @@ export default () => {
|
|||
}
|
||||
|
||||
const getPrintDetails = async (division: string, id: number) => {
|
||||
const response = await getApiMulti(`get-printdetails-${division}`, id)
|
||||
let response
|
||||
if (selectedType() === 'Print') response = await getApiMulti(`get-printdetails-${division}`, id)
|
||||
else response = await getApiMulti(`get-reprintdetails-${division}`, id)
|
||||
|
||||
const applicationno = response.result
|
||||
const date = response.result2
|
||||
const location = response.result3
|
||||
|
|
@ -112,7 +115,10 @@ export default () => {
|
|||
}
|
||||
|
||||
const getPrintDetailsFees = async (division: string, id: number) => {
|
||||
const response = await getApiMulti(`get-printdetailsfees-${division}`, id)
|
||||
let response
|
||||
if (selectedType() === 'Print') response = await getApiMulti(`get-printdetailsfees-${division}`, id)
|
||||
else response = await getApiMulti(`get-reprintdetailsfees-${division}`, id)
|
||||
|
||||
const feeList = response.result
|
||||
const accountCodeList = response.result2
|
||||
const amountList = response.result3
|
||||
|
|
@ -190,7 +196,6 @@ export default () => {
|
|||
|
||||
const additionalResult = await getApi('check-bldgadditional-printing', applicationNo)
|
||||
bldgadditional = additionalResult > 0
|
||||
console.log('additionalResult', additionalResult)
|
||||
|
||||
const op = await getApiMulti(`get-opdetails-${division}`, applicationNo)
|
||||
|
||||
|
|
@ -226,7 +231,10 @@ export default () => {
|
|||
|
||||
const getListForPrinting = async (division: string) => {
|
||||
try {
|
||||
const response = await getApiMulti(`get-listopprinting-${division}`)
|
||||
let response: any
|
||||
|
||||
if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`)
|
||||
else response = await getApiMulti(`get-listopreprinting-${division}`)
|
||||
|
||||
if (filter() !== '' && filter().trim().length !== 0) {
|
||||
const filteredApplications = response.result.filter((item: string) => item.includes(filter()))
|
||||
|
|
@ -316,6 +324,42 @@ export default () => {
|
|||
}
|
||||
}
|
||||
|
||||
const rePrintHandler = async (division: string, application: string) => {
|
||||
// let updateOrderofpayment: boolean = false
|
||||
|
||||
setConnected(await checkConnection())
|
||||
if (connected() === false) {
|
||||
setErrorMessage('No Connection on Server')
|
||||
return
|
||||
}
|
||||
|
||||
if (selectedType().includes("Void")) {
|
||||
if (division === 'electrical') {
|
||||
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT REPRINTED', '175', 'ELECOPREPRINTED', 1)
|
||||
await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1)
|
||||
await setNewStatus(division, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE', 0)
|
||||
await updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING')
|
||||
} else if (division === 'occupancy') {
|
||||
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT REPRINTED', '176', 'OCCOPREPRINTED', 1)
|
||||
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT RELEASED', '174', 'OCCOPRELEASED', 1)
|
||||
await setNewStatus(division, 'ORDER OF PAYMENT RELEASE FOR BUREAU OF FIRE', '24', 'OCOOPRELEASE', 0)
|
||||
await updateDocflow(division, application, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT')
|
||||
}
|
||||
|
||||
await voidOp(application)
|
||||
}
|
||||
|
||||
postTransaction(application)
|
||||
setPrintedApplication(application)
|
||||
setPrinted(true)
|
||||
|
||||
if (division === 'electrical') {
|
||||
createPdfElectrical()
|
||||
} else if (division === 'occupancy') {
|
||||
createPdfOccupancy()
|
||||
} else console.log('building')
|
||||
}
|
||||
|
||||
const updateOp = async (division: string) => {
|
||||
const post = await postApi(`update-opprinted-${division}`, {
|
||||
data: parseInt(applicationId().toString(), 10),
|
||||
|
|
@ -420,14 +464,22 @@ export default () => {
|
|||
navigate('/profile')
|
||||
}
|
||||
|
||||
const voidOp = async (application: string) => {
|
||||
const response = await voidApi(application)
|
||||
if (response !== null) return true
|
||||
return false
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
const logged = await checkLogged()
|
||||
|
||||
if (logged) {
|
||||
setSelectedType('Print')
|
||||
|
||||
await checkDivision()
|
||||
if (isBuilding()) await getListForPrinting('building')
|
||||
if (isOccupancy()) await getListForPrinting('occupancy')
|
||||
// if (isElectrical()) await getListForPrinting('electrical')
|
||||
if (isElectrical()) await getListForPrinting('electrical')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -669,7 +721,12 @@ export default () => {
|
|||
</Padding>
|
||||
|
||||
<Row padding="2rem 0 0 0">
|
||||
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
|
||||
<Show when={selectedType() === 'Print'}>
|
||||
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
|
||||
</Show>
|
||||
<Show when={selectedType() !== 'Print'}>
|
||||
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('occupancy', item)}></Button>
|
||||
</Show>
|
||||
<span class="modal__cancel">Click anywhere to cancel</span>
|
||||
</Row>
|
||||
</Padding>
|
||||
|
|
@ -690,7 +747,7 @@ export default () => {
|
|||
<Row content="split">
|
||||
<Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" />
|
||||
<Row gap={0.5}>
|
||||
<Combobox options={listType} value={selectedType()} onChange={setSelectedType} placeholder="Select Type" width='200px'/>
|
||||
<Combobox options={listType} value={selectedType()} onChange={setSelectedType} placeholder="Select Type" width='200px' />
|
||||
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={refresh}></Button>
|
||||
</Row>
|
||||
</Row>
|
||||
|
|
@ -763,7 +820,12 @@ export default () => {
|
|||
</Padding>
|
||||
|
||||
<Row padding="2rem 0 0 0">
|
||||
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
|
||||
<Show when={selectedType() === 'Print'}>
|
||||
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
|
||||
</Show>
|
||||
<Show when={selectedType() !== 'Print'}>
|
||||
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('electrical', item)}></Button>
|
||||
</Show>
|
||||
<span class="modal__cancel">Click anywhere to cancel</span>
|
||||
</Row>
|
||||
</Padding>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue