Fixed display of assessed date on pdf

This commit is contained in:
Patrick Alvin Alcala 2025-10-21 11:43:51 +08:00
parent 084da93524
commit 65b5237169
3 changed files with 33 additions and 3 deletions

View file

@ -9,7 +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, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate } from '../../stores/pdfinfo'
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
@ -156,6 +156,14 @@ export default () => {
const approversignId = await geteSignId(276)
getApprovedDate(approversignId, applicationNo)
const assessorId = await getEmployeeId(op.result7[0])
const assessorsignId = await geteSignId(assessorId)
getAssessedDate(op.result11[0])
console.log('name', op.result7[0])
console.log('id', assessorId)
console.log('esignid', assessorsignId)
console.log('aaaa', op.result11[0])
}
const calculateTotal = (list: number[]) => {
@ -294,6 +302,27 @@ export default () => {
}
}
const getAssessedDate = async (electricalid: number) => {
try {
const response = await ofetch(API + 'get-signeddateassessed-electrical/' + electricalid, { parseResponse: JSON.parse })
const result = response.result
console.log('date', result)
_assessedDate.set(result)
} catch (error) {
_assessedDate.set('')
}
}
const getEmployeeId = async (name: string) => {
try {
const response = await ofetch(API + 'get-employeeid/' + name, { parseResponse: JSON.parse })
const result = response.result
return parseInt(result)
} catch (error) {
return 0
}
}
const logout = async () => {
removeEmployee()
navigate('/')

View file

@ -18,3 +18,4 @@ export const _signatureAssessor = atom('')
export const _signatureApprover = atom('')
export const _approvedDate = atom('')
export const _assessedDate = atom('')

View file

@ -1,7 +1,7 @@
import jsPDF from 'jspdf'
// @ts-ignore
import jspdfBarcode from 'jspdf-barcode'
import { _optn, _applicationNo, _date, _name, _type, _location, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate } from '../../stores/pdfinfo'
import { _optn, _applicationNo, _date, _name, _type, _location, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate, _assessedDate } from '../../stores/pdfinfo'
import dayjs from 'dayjs'
// @ts-ignore
import QRCode from 'qrcode'
@ -234,7 +234,7 @@ export default async () => {
doc.setFontSize(4)
doc.text('Digitally signed by :', 30, 118)
doc.text(ASSESSOR, 30, 120)
doc.text('Date: ' + dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'), 30, 122)
doc.text('Date: ' + dayjs(_assessedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 30, 122)
doc.addImage(_signatureApprover.get(), 'PNG', 156, 110, 41.4, 5.9, 'signatureApprover', 'NONE', 0)
doc.text('Digitally signed by :', 156, 118)