Fixed signature fetching
This commit is contained in:
parent
3c44ce45e3
commit
ff7a522f35
1 changed files with 40 additions and 2 deletions
|
|
@ -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, _signature, _assessorid } from '../../stores/pdfinfo'
|
||||
import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate } from '../../stores/pdfinfo'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
|
|
@ -209,6 +209,7 @@ export default () => {
|
|||
updateOrderofpayment = await updateOp()
|
||||
|
||||
if (updateOrderofpayment) {
|
||||
postTransaction(application)
|
||||
setPrintedApplication(application)
|
||||
setPrinted(true)
|
||||
createPdf()
|
||||
|
|
@ -248,13 +249,50 @@ export default () => {
|
|||
try {
|
||||
const response = await ofetch(API + 'get-signatureimage/' + id, { parseResponse: JSON.parse })
|
||||
const image = response.result
|
||||
_signature.set(image)
|
||||
_signatureAssessor.set(image)
|
||||
|
||||
const response2 = await ofetch(API + 'get-signatureimage/' + 276, { parseResponse: JSON.parse })
|
||||
const image2 = response2.result
|
||||
_signatureApprover.set(image2)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const geteSignId = async () => {
|
||||
try {
|
||||
const response = await ofetch(API + 'get-esignid/' + employeeId(), { parseResponse: JSON.parse })
|
||||
const result = response.result
|
||||
return result
|
||||
} catch {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
const postTransaction = async (application: string) => {
|
||||
const id = await geteSignId()
|
||||
const today = new Date()
|
||||
const formatedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||
|
||||
await ofetch(API + 'post-esigntransaction', {
|
||||
method: 'POST',
|
||||
body: { data: parseInt(id), data2: application, data3: formatedDate },
|
||||
})
|
||||
|
||||
getApprovedDate(id, application)
|
||||
}
|
||||
|
||||
const getApprovedDate = async (id: number, application: string) => {
|
||||
try {
|
||||
const response = await ofetch(API + `get-signeddate/${id}/${application}`, { parseResponse: JSON.parse })
|
||||
const result = response.result
|
||||
_approvedDate.set(result)
|
||||
} catch (error) {
|
||||
_approvedDate.set('')
|
||||
}
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
removeEmployee()
|
||||
navigate('/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue