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 { 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, _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 API = import.meta.env.VITE_BACKEND
|
||||||
const PESO = import.meta.env.VITE_PESO
|
const PESO = import.meta.env.VITE_PESO
|
||||||
|
|
@ -209,6 +209,7 @@ export default () => {
|
||||||
updateOrderofpayment = await updateOp()
|
updateOrderofpayment = await updateOp()
|
||||||
|
|
||||||
if (updateOrderofpayment) {
|
if (updateOrderofpayment) {
|
||||||
|
postTransaction(application)
|
||||||
setPrintedApplication(application)
|
setPrintedApplication(application)
|
||||||
setPrinted(true)
|
setPrinted(true)
|
||||||
createPdf()
|
createPdf()
|
||||||
|
|
@ -248,13 +249,50 @@ export default () => {
|
||||||
try {
|
try {
|
||||||
const response = await ofetch(API + 'get-signatureimage/' + id, { parseResponse: JSON.parse })
|
const response = await ofetch(API + 'get-signatureimage/' + id, { parseResponse: JSON.parse })
|
||||||
const image = response.result
|
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
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
return false
|
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 () => {
|
const logout = async () => {
|
||||||
removeEmployee()
|
removeEmployee()
|
||||||
navigate('/')
|
navigate('/')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue