diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index 0e30b27..6f632b9 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -9,6 +9,7 @@ import { checkConnection, createPdf } from '../../utils/functions' import { FaSolidThumbsUp } from 'solid-icons/fa' import { _employeeName, _employeeId } from '../../stores/employee' import { useNavigate } from '@solidjs/router' +import { _applicationNo, _date, _optn, _name, _location, _type } from '../../stores/pdfinfo' const API = import.meta.env.VITE_BACKEND const PESO = import.meta.env.VITE_PESO @@ -47,6 +48,10 @@ export default () => { const [employeeId, setEmployeeId] = createSignal(0) const [employeeName, setEmployeeName] = createSignal('') + // const [docApplicationNo, setDocApplicationNo] = createSignal('') + // const [docDate, setDocDate] = createSignal('') + // const [docLocation, setDocLocation] = createSignal('') + const checkAccess = async (access: string) => { try { 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 amounts: string[] = amountList() // let gflguList: number[] = [] @@ -114,6 +139,8 @@ export default () => { // setAmountList(op.result9) // setDateOpList(op.result10) // calculateAmounts() + + getPrintDetails(op.result11[0]) } const calculateTotal = (list: number[]) => { @@ -161,18 +188,20 @@ export default () => { return } - signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED') - if (!signed) return + // signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED') + // if (!signed) return - forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE') - if (!forprinting) return + // forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE') + // if (!forprinting) return - updateOrderofpayment = await updateOp() + // updateOrderofpayment = await updateOp() - if (updateOrderofpayment) { - setPrintedApplication(application) - setPrinted(true) - } + // if (updateOrderofpayment) { + // setPrintedApplication(application) + // setPrinted(true) + // getPrintDetails(applicationId()) + createPdf() + // } } const updateOp = async () => {