Update assessors page

This commit is contained in:
Patrick Alvin Alcala 2025-10-09 16:43:15 +08:00
parent 519b901928
commit afa20dbc94

View file

@ -9,6 +9,7 @@ import { checkConnection, createPdf } from '../../utils/functions'
import { FaSolidThumbsUp } from 'solid-icons/fa' import { FaSolidThumbsUp } from 'solid-icons/fa'
import { _employeeName, _employeeId } from '../../stores/employee' import { _employeeName, _employeeId } from '../../stores/employee'
import { useNavigate } from '@solidjs/router' import { useNavigate } from '@solidjs/router'
import { _applicationNo, _date, _optn, _name, _location, _type } from '../../stores/pdfinfo'
const API = import.meta.env.VITE_BACKEND const API = import.meta.env.VITE_BACKEND
const PESO = import.meta.env.VITE_PESO const PESO = import.meta.env.VITE_PESO
@ -47,6 +48,10 @@ export default () => {
const [employeeId, setEmployeeId] = createSignal(0) const [employeeId, setEmployeeId] = createSignal(0)
const [employeeName, setEmployeeName] = createSignal('') const [employeeName, setEmployeeName] = createSignal('')
// const [docApplicationNo, setDocApplicationNo] = createSignal('')
// const [docDate, setDocDate] = createSignal('')
// const [docLocation, setDocLocation] = createSignal('')
const checkAccess = async (access: string) => { const checkAccess = async (access: string) => {
try { try {
const response = await ofetch(`${API}check-access/${access}/${employeeId()}`) const response = await ofetch(`${API}check-access/${access}/${employeeId()}`)
@ -58,6 +63,26 @@ export default () => {
} }
} }
const getPrintDetails = async (id: number) => {
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
const applicationno = response.result[0]
const date = response.result2[0]
const location = response.result3[0]
const name = response.result8[0]
const type = `${response.result4[0]} - ${response.result5[0]}`
_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)
// setDocApplicationNo(applicationno)
// setDocDate(dayjs(date).format('MMMM DD, YYYY'))
// setDocLocation(location)
}
// const calculateAmounts = () => { // const calculateAmounts = () => {
// const amounts: string[] = amountList() // const amounts: string[] = amountList()
// let gflguList: number[] = [] // let gflguList: number[] = []
@ -114,6 +139,8 @@ export default () => {
// setAmountList(op.result9) // setAmountList(op.result9)
// setDateOpList(op.result10) // setDateOpList(op.result10)
// calculateAmounts() // calculateAmounts()
getPrintDetails(op.result11[0])
} }
const calculateTotal = (list: number[]) => { const calculateTotal = (list: number[]) => {
@ -161,18 +188,20 @@ export default () => {
return return
} }
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED') // signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED')
if (!signed) return // if (!signed) return
forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE') // forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE')
if (!forprinting) return // if (!forprinting) return
updateOrderofpayment = await updateOp() // updateOrderofpayment = await updateOp()
if (updateOrderofpayment) { // if (updateOrderofpayment) {
setPrintedApplication(application) // setPrintedApplication(application)
setPrinted(true) // setPrinted(true)
} // getPrintDetails(applicationId())
createPdf()
// }
} }
const updateOp = async () => { const updateOp = async () => {