Updated main page
This commit is contained in:
parent
7f60d5a347
commit
ca95125188
1 changed files with 49 additions and 63 deletions
|
|
@ -147,11 +147,6 @@ export default () => {
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
// const sample = async () => {
|
|
||||||
// const data = await lockData('asdasdsadsad')
|
|
||||||
// console.log(data)
|
|
||||||
// }
|
|
||||||
|
|
||||||
const approveHandler = async (division: string, application: string) => {
|
const approveHandler = async (division: string, application: string) => {
|
||||||
let signed: boolean = false
|
let signed: boolean = false
|
||||||
let forprinting: boolean = false
|
let forprinting: boolean = false
|
||||||
|
|
@ -169,7 +164,6 @@ export default () => {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
setLoadingText('Checking POPS record')
|
setLoadingText('Checking POPS record')
|
||||||
|
|
||||||
if (division === 'electrical') {
|
|
||||||
if (BACKEND.includes('localhost')) {
|
if (BACKEND.includes('localhost')) {
|
||||||
const status = await checkStatusPopsLocal(application)
|
const status = await checkStatusPopsLocal(application)
|
||||||
if (status.result > 0) popsExist = true
|
if (status.result > 0) popsExist = true
|
||||||
|
|
@ -188,6 +182,7 @@ export default () => {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
if (BACKEND.includes('localhost')) {
|
if (BACKEND.includes('localhost')) {
|
||||||
|
setLoadingText('Clearing unpaid POPS record')
|
||||||
const voidOP = await voidPopsOpLocal(application)
|
const voidOP = await voidPopsOpLocal(application)
|
||||||
|
|
||||||
if (!voidOP) {
|
if (!voidOP) {
|
||||||
|
|
@ -212,11 +207,12 @@ export default () => {
|
||||||
|
|
||||||
setLoadingText('Posting new record to POPS')
|
setLoadingText('Posting new record to POPS')
|
||||||
await postPops(division, application)
|
await postPops(division, application)
|
||||||
// const popsResult = await checkPops(application)
|
|
||||||
setLoadingText(`Approving ${application}`)
|
setLoadingText(`Approving ${application}`)
|
||||||
const dataLocked = await lockOpData(division, application)
|
const dataLocked = await lockOpData(division, application)
|
||||||
|
|
||||||
if (dataLocked) {
|
if (dataLocked) {
|
||||||
|
if (division === 'electrical') {
|
||||||
setLoadingText(`Pushing ${application} for printing`)
|
setLoadingText(`Pushing ${application} for printing`)
|
||||||
signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1)
|
signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1)
|
||||||
updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL')
|
updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL')
|
||||||
|
|
@ -232,22 +228,11 @@ export default () => {
|
||||||
setApprovedApplication(application)
|
setApprovedApplication(application)
|
||||||
setApproved(true)
|
setApproved(true)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
setIsLoading(false)
|
|
||||||
setPostError(true)
|
|
||||||
setErrorMessage('Error on posting on POPS Server, please try again')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else if (division === 'occupancy') {
|
} else if (division === 'occupancy') {
|
||||||
|
setLoadingText('Checking for Building Additional')
|
||||||
const additionalResult = await getApi('check-bldgadditional-approval', application)
|
const additionalResult = await getApi('check-bldgadditional-approval', application)
|
||||||
bldgadditional = additionalResult > 0
|
bldgadditional = additionalResult > 0
|
||||||
|
|
||||||
await voidPopsOp(application)
|
|
||||||
await postPops(division, application)
|
|
||||||
const popsResult = await checkPops(application)
|
|
||||||
const lockResult = await lockOpData(division, application)
|
|
||||||
|
|
||||||
if (popsResult && lockResult) {
|
|
||||||
signed = await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT APPROVED AND SIGNED', '172', 'OCCOPAPPROVEDSIGNED', 1)
|
signed = await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT APPROVED AND SIGNED', '172', 'OCCOPAPPROVEDSIGNED', 1)
|
||||||
updateDocflow(division, application, 'FOR OCCUPANCY RECOMMENDING APPROVAL')
|
updateDocflow(division, application, 'FOR OCCUPANCY RECOMMENDING APPROVAL')
|
||||||
if (bldgadditional) {
|
if (bldgadditional) {
|
||||||
|
|
@ -266,14 +251,15 @@ export default () => {
|
||||||
setApprovedApplication(application)
|
setApprovedApplication(application)
|
||||||
setApproved(true)
|
setApproved(true)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setIsLoading(false)
|
||||||
setPostError(true)
|
setPostError(true)
|
||||||
setErrorMessage('Error on posting on POPS Server, please try again')
|
setErrorMessage('Error on posting on POPS Server, please try again')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// const approveElectrical = async (division: string, application: string) => {
|
// const approveElectrical = async (division: string, application: string) => {
|
||||||
// let signed: boolean = false
|
// let signed: boolean = false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue