Updated assessor page
This commit is contained in:
parent
ca4883eb1c
commit
03b637b494
1 changed files with 40 additions and 14 deletions
|
|
@ -32,11 +32,12 @@ import {
|
|||
_type,
|
||||
_units,
|
||||
} from '../../stores/pdfinfo.ts'
|
||||
import { checkConnection, createPdfElectrical, createPdfOccupancy, 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 } from '../../utils/functions/index.ts'
|
||||
import { AiOutlineLoading3Quarters } from 'solid-icons/ai'
|
||||
import './Assessor.sass'
|
||||
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
const BACKEND = import.meta.env.VITE_BACKEND
|
||||
|
||||
export default () => {
|
||||
const navigate = useNavigate()
|
||||
|
|
@ -348,6 +349,9 @@ export default () => {
|
|||
}
|
||||
|
||||
const rePrintHandler = async (division: string, application: string) => {
|
||||
let popsExist: boolean = false
|
||||
let popsPaid: boolean = false
|
||||
|
||||
setConnected(await checkConnection())
|
||||
if (connected() === false) {
|
||||
setErrorMessage('No Connection on Server')
|
||||
|
|
@ -355,34 +359,46 @@ export default () => {
|
|||
}
|
||||
|
||||
if (selectedType().includes('Void')) {
|
||||
// Return to ASSESSMENT
|
||||
// Return to APPROVAL
|
||||
// TODO:
|
||||
// Set current status (for validation) to 1, is_approve = 1
|
||||
// Clear order of payment as long as not Paid
|
||||
// Clear esign_transactions
|
||||
|
||||
const status = await statusPopsOp(application)
|
||||
const message = status.message
|
||||
if (BACKEND.includes('localhost')) {
|
||||
const status = await checkStatusPopsLocal(application)
|
||||
console.log('status', status)
|
||||
if (status.result > 0) popsExist = true
|
||||
if (status.result2 > 0) popsPaid = true
|
||||
} else {
|
||||
const status = await await statusPopsOp(application)
|
||||
if (status.message === 'Success') popsExist = true
|
||||
if (status.pops_paid === true) popsPaid = true
|
||||
}
|
||||
|
||||
if (message.includes('No record')) {
|
||||
// const status = await statusPopsOp(application)
|
||||
// const message = status.message
|
||||
|
||||
if (!popsExist) {
|
||||
setVoidError(true)
|
||||
setErrorMessage('No record found on Pops')
|
||||
return
|
||||
} else {
|
||||
const pops_paid = message.pops_paid
|
||||
const epay_paid = message.epay_paid
|
||||
// const pops_paid = message.pops_paid
|
||||
// const epay_paid = message.epay_paid
|
||||
}
|
||||
|
||||
if (pops_paid || epay_paid) {
|
||||
if (popsPaid) {
|
||||
setVoidError(true)
|
||||
setErrorMessage('Already Paid')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (division === 'electrical') {
|
||||
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT VOIDED', '173', 'ELECOPVOIDED', 1)
|
||||
await setNewStatus(division, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL', '94', 'ELECOPAPPROVE', 0)
|
||||
await updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING')
|
||||
await updateOpForApproval(division, application)
|
||||
await clearEsignTransactions(application)
|
||||
} else if (division === 'occupancy') {
|
||||
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT VOIDED', '174', 'OCCOPVOIDED', 1)
|
||||
//UNFINISH
|
||||
|
|
@ -514,7 +530,7 @@ export default () => {
|
|||
}
|
||||
|
||||
const checkStatusPopsLocal = async (application: string) => {
|
||||
const response = await getApi('check-statuspops-local', application)
|
||||
const response = await getApiMulti('check-statuspops-local', application)
|
||||
return response
|
||||
}
|
||||
|
||||
|
|
@ -523,6 +539,16 @@ export default () => {
|
|||
return response
|
||||
}
|
||||
|
||||
const updateOpForApproval = async (division: string, application: string) => {
|
||||
const response = await postApi(`update-opforapproval-${division}`, { data: application })
|
||||
return response
|
||||
}
|
||||
|
||||
const clearEsignTransactions = async (application: string) => {
|
||||
const response = await deleteApi('delete-esigntransactions', { data: application })
|
||||
return response
|
||||
}
|
||||
|
||||
const saveConfig = async () => {
|
||||
if (configNewName() !== '') await saveNewName(parseInt(employeeId().toString()), configNewName())
|
||||
if (configNewPassword() !== '') await saveNewPassword(parseInt(employeeId().toString()), configNewEncPassword())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue