diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index e6a94f1..1b9145d 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -32,7 +32,7 @@ import { _type, _units, } 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 './Assessor.sass' @@ -80,7 +80,7 @@ export default () => { 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 [selectedType, setSelectedType] = createSignal('Print') @@ -88,6 +88,8 @@ export default () => { const [isLoading, setIsLoading] = createSignal(false) const [loadingText, setLoadingText] = createSignal('') + const [voidNotification, setVoidNotification] = createSignal(false) + let bldgadditional = false const checkAccess = async (access: string) => { @@ -402,14 +404,14 @@ export default () => { 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') if (checkOrValidation) { await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION') } // await updateDocflow(division, application, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION') await updateOpForApproval(division, application) - setLoadingText('Processing for Re-approvalsss') + setLoadingText('Processing for Re-approval') await clearEsignTransactions(application) } else if (division === 'occupancy') { 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') } - const successVoid = await voidPopsOp(application) + const successVoid = BACKEND.includes('localhost') ? await voidPopsOpLocal(application) : await voidPopsOp(application) if (successVoid) { await postTransaction(application) + setIsLoading(false) + setPrintedApplication(application) + setVoidNotification(true) } else { setIsLoading(false) } @@ -541,17 +546,17 @@ export default () => { navigate('/') } - // const gotoProfile = () => { - // sessionStorage.setItem('name', employeeName()) - // navigate('/profile') - // } - const voidPopsOp = async (application: string) => { const response = await voidPopsApi(application) if (response.includes('Error')) return false return true } + const voidPopsOpLocal = async (application: string) => { + const response = await voidApi('void-op-local', { data: application }) + return response + } + const checkStatusPopsLocal = async (application: string) => { const response = await getApiMulti('check-statuspops-local', application) return response @@ -568,8 +573,15 @@ export default () => { } const clearEsignTransactions = async (application: string) => { - const response = await deleteApi('delete-esigntransactions', { data: application }) - return response + let deleteTran + 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 () => { @@ -896,9 +908,12 @@ export default () => { printHandler('occupancy', item)}> - + rePrintHandler('occupancy', item)}> + + rePrintHandler('occupancy', item)}> + Click anywhere to cancel @@ -1008,9 +1023,12 @@ export default () => { printHandler('electrical', item)}> - + rePrintHandler('electrical', item)}> + + rePrintHandler('electrical', item)}> + Click anywhere to cancel @@ -1154,6 +1172,28 @@ export default () => { + + setVoidNotification(false)}> + + + + + + + Account Voided and Returned to Approval + + + + {printedApplication()} + + + + Click anywhere to proceed + + + + + > ) }