Updated main page
This commit is contained in:
parent
11aaecdf0f
commit
225269a7d4
1 changed files with 54 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import { checkConnection, createPdf } from '../../utils/functions'
|
|||
import { FaSolidThumbsUp } from 'solid-icons/fa'
|
||||
import { _employeeName } from '../../stores/employee'
|
||||
import { useNavigate } from '@solidjs/router'
|
||||
import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate, _assessedDate } from '../../stores/pdfinfo'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
|
|
@ -96,10 +97,12 @@ export default () => {
|
|||
return
|
||||
}
|
||||
|
||||
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED')
|
||||
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1)
|
||||
const approvedid = await getIdByApplication(application)
|
||||
updateDocflow(approvedid, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL')
|
||||
if (!signed) return
|
||||
|
||||
forprinting = await setNewStatus('FOR ELECTRICAL ORDER OF PAYMENT PRINTING', '95', 'ELECOPPRINT')
|
||||
forprinting = await setNewStatus('FOR ELECTRICAL ORDER OF PAYMENT PRINTING', '95', 'ELECOPPRINT', 0)
|
||||
if (!forprinting) return
|
||||
|
||||
updateOrderofpayment = await updateOp()
|
||||
|
|
@ -111,7 +114,7 @@ export default () => {
|
|||
}
|
||||
}
|
||||
|
||||
const setNewStatus = async (status: string, tag: string, tagword: string) => {
|
||||
const setNewStatus = async (status: string, tag: string, tagword: string, approved: number) => {
|
||||
const today = new Date()
|
||||
const formattedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||
const statusid = parseInt(applicationId().toString())
|
||||
|
|
@ -119,7 +122,7 @@ export default () => {
|
|||
try {
|
||||
await ofetch(API + 'post-newstatus-electrical', {
|
||||
method: 'POST',
|
||||
body: { data: statusid, data2: formattedDate, data3: status, data4: tag, data5: tagword, data6: parseInt(ID) },
|
||||
body: { data: statusid, data2: formattedDate, data3: status, data4: tag, data5: tagword, data6: parseInt(approved.toString()), data7: parseInt(ID) },
|
||||
})
|
||||
return true
|
||||
} catch {
|
||||
|
|
@ -139,6 +142,36 @@ export default () => {
|
|||
}
|
||||
}
|
||||
|
||||
const getPrintDetails = async (id: number) => {
|
||||
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
||||
const applicationno = response.result
|
||||
const date = response.result2
|
||||
const location = response.result3
|
||||
const name = response.result8
|
||||
const type = `${response.result4} - ${response.result5}`
|
||||
const assessor = response.result7
|
||||
|
||||
_optn.set('M' + applicationno.split('-')[0] + applicationno.split('-')[1])
|
||||
_applicationNo.set(applicationno)
|
||||
_date.set(dayjs(date).format('MMMM DD, YYYY'))
|
||||
_name.set(name)
|
||||
_location.set(location)
|
||||
_type.set(type)
|
||||
_assessor.set(assessor)
|
||||
_assessorid.set(employeeId())
|
||||
}
|
||||
|
||||
const postPops = async (application: string) => {
|
||||
const today = new Date()
|
||||
const formattedDate = dayjs(today).format('YYYY-MM-DD')
|
||||
const formattedDatewithTime = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||
|
||||
await ofetch(API + 'update-opapproved-electrical', {
|
||||
method: 'POST',
|
||||
body: { data: application, data2: formattedDate },
|
||||
})
|
||||
}
|
||||
|
||||
// const calculateAmounts = () => {
|
||||
// const amounts: string[] = amountList()
|
||||
// let gflguList: number[] = []
|
||||
|
|
@ -212,6 +245,23 @@ export default () => {
|
|||
})
|
||||
}
|
||||
|
||||
const updateDocflow = async (electricalid: number, status: string) => {
|
||||
await ofetch(API + 'update-docflow-electrical', {
|
||||
method: 'POST',
|
||||
body: { data: parseInt(electricalid.toString()), data2: status },
|
||||
})
|
||||
}
|
||||
|
||||
const getIdByApplication = async (applicationNo: string) => {
|
||||
try {
|
||||
const response = await ofetch(API + 'get-idbyapplication-electrical/' + applicationNo, { parseResponse: JSON.parse })
|
||||
const result = response.result
|
||||
return parseInt(result)
|
||||
} catch {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
removeEmployee()
|
||||
navigate('/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue