Updated assessor page
This commit is contained in:
parent
2b8071a4a8
commit
be452c5cd0
1 changed files with 67 additions and 20 deletions
|
|
@ -1,12 +1,12 @@
|
|||
import { Tabs } from '@kobalte/core/tabs'
|
||||
import { useNavigate } from '@solidjs/router'
|
||||
import dayjs from 'dayjs'
|
||||
import { FaSolidThumbsUp } from 'solid-icons/fa'
|
||||
import { FiLogOut } from 'solid-icons/fi'
|
||||
import { VsRefresh } from 'solid-icons/vs'
|
||||
import { createEffect, createSignal, onMount } from 'solid-js'
|
||||
import { Show } from 'solid-js/web'
|
||||
import { Box, Button, Clickable, Column, Combobox, Input, Link, Logo, Modal, ModalButton, Padding, Page, Row } from '../../components'
|
||||
import { Tabs } from '@kobalte/core/tabs';
|
||||
import { useNavigate } from '@solidjs/router';
|
||||
import dayjs from 'dayjs';
|
||||
import { FaSolidThumbsUp } from 'solid-icons/fa';
|
||||
import { FiLogOut } from 'solid-icons/fi';
|
||||
import { VsRefresh } from 'solid-icons/vs';
|
||||
import { createEffect, createSignal, onMount } from 'solid-js';
|
||||
import { Show } from 'solid-js/web';
|
||||
import { Box, Button, Clickable, Column, Combobox, Input, Link, Logo, Modal, ModalButton, Padding, Page, Row } from '../../components/index.ts';
|
||||
import {
|
||||
_additional,
|
||||
_additionalAmountList,
|
||||
|
|
@ -31,9 +31,9 @@ import {
|
|||
_totalUnits,
|
||||
_type,
|
||||
_units,
|
||||
} from '../../stores/pdfinfo'
|
||||
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, voidApi } from '../../utils/functions'
|
||||
import './Assessor.sass'
|
||||
} from '../../stores/pdfinfo.ts';
|
||||
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, statusPopsApi, voidPopsApi } from '../../utils/functions/index.ts';
|
||||
import './Assessor.sass';
|
||||
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
|
||||
|
|
@ -71,6 +71,8 @@ export default () => {
|
|||
const listType = ['Print', 'Reprint', 'Reprint and Void']
|
||||
const [selectedType, setSelectedType] = createSignal('Print')
|
||||
|
||||
const [voidError, setVoidError] = createSignal(false)
|
||||
|
||||
let bldgadditional = false
|
||||
|
||||
const checkAccess = async (access: string) => {
|
||||
|
|
@ -334,6 +336,24 @@ export default () => {
|
|||
}
|
||||
|
||||
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') {
|
||||
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT REPRINTED', '175', 'ELECOPREPRINTED', 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 voidOp(application)
|
||||
await voidPopsOp(application)
|
||||
await postTransaction(application)
|
||||
}
|
||||
|
||||
postTransaction(application)
|
||||
setPrintedApplication(application)
|
||||
setPrinted(true)
|
||||
|
||||
|
|
@ -454,20 +474,25 @@ export default () => {
|
|||
if (isElectrical()) await getListForPrinting('electrical')
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
const logout = () => {
|
||||
removeEmployee()
|
||||
navigate('/')
|
||||
}
|
||||
|
||||
const gotoProfile = async () => {
|
||||
const gotoProfile = () => {
|
||||
sessionStorage.setItem('name', employeeName())
|
||||
navigate('/profile')
|
||||
}
|
||||
|
||||
const voidOp = async (application: string) => {
|
||||
const response = await voidApi(application)
|
||||
if (response !== null) return true
|
||||
return false
|
||||
const voidPopsOp = async (application: string) => {
|
||||
const response = await voidPopsApi(application)
|
||||
if (response.includes('Error')) return false
|
||||
return true
|
||||
}
|
||||
|
||||
const statusPopsOp = async (application: string) => {
|
||||
const response = await statusPopsApi(application)
|
||||
return response
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
|
|
@ -885,6 +910,28 @@ export default () => {
|
|||
</Padding>
|
||||
</Modal>
|
||||
</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>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue