Compare commits
5 commits
320a53aac9
...
8b575d2926
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b575d2926 | |||
| b0d40edab3 | |||
| f55447a116 | |||
| 2ee72c8ae1 | |||
| db5a30a9bf |
6 changed files with 89 additions and 100 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -36,4 +36,7 @@ dist-ssr
|
|||
/blob-report/
|
||||
/playwright/.cache/
|
||||
|
||||
# backend
|
||||
/backend/bin
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ func connect() {
|
|||
|
||||
//DEV
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:5173"},
|
||||
AllowOrigins: []string{"http://localhost:5173"},
|
||||
// AllowAllOrigins: true,
|
||||
AllowMethods: []string{"GET", "POST"},
|
||||
AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"},
|
||||
ExposeHeaders: []string{"Content-Length"},
|
||||
|
|
@ -662,31 +663,15 @@ func connect() {
|
|||
// array7 := []string{}
|
||||
// array8 := []string{}
|
||||
|
||||
err := db.QueryRow(`SELECT DISTINCT IFNULL(el.electricalNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(el.locationofinstallation, '') AS result3, IFNULL(occ.occupancy, '') AS result4, IFNULL(u.occupancyoruse, '') AS result5, IFNULL(el.noofUnits, '') AS result6, IFNULL(e.employeename, '') AS result7, IF(cu.firstName IS NULL OR cu.firstName = '', cu.lastName, CONCAT(cu.firstName, ' ', IF(cu.middleInitial IS NULL OR cu.middleInitial = '', '', CONCAT(cu.middleInitial, '. ')), cu.lastName) ) AS result8
|
||||
FROM electrical el, electrical_orderofpayment_new op, ref_occupancy occ, ref_elec_occupancy u, customer cu, employee e
|
||||
WHERE el.customerid = cu.customerid AND el.ref_elec_occupancyid = u.ref_elec_occupancyid AND u.ref_occupancyid = occ.ref_occupancyid AND op.assessedbyid = e.employeeid
|
||||
AND el.electricalid = op.electricalid AND op.is_approve = 0 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND el.electricalid = ?`, data).Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8)
|
||||
err := db.QueryRow(`SELECT DISTINCT IFNULL(el.electricalNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(el.locationofinstallation, '') AS result3, IFNULL(occ.occupancy, '') AS result4, IFNULL(u.occupancyoruse, '') AS result5, IFNULL(el.noofUnits, '') AS result6, IFNULL(e.employeename, '') AS result7, IF(cu.firstName IS NULL OR cu.firstName = '', cu.lastName, CONCAT(cu.firstName, ' ', IF(cu.middleInitial IS NULL OR cu.middleInitial = '', '', CONCAT(cu.middleInitial, '. ')), cu.lastName) ) AS result8
|
||||
FROM electrical el, electrical_orderofpayment_new op, ref_occupancy occ, ref_elec_occupancy u, customer cu, employee e
|
||||
WHERE el.customerid = cu.customerid AND el.ref_elec_occupancyid = u.ref_elec_occupancyid AND u.ref_occupancyid = occ.ref_occupancyid AND op.assessedbyid = e.employeeid
|
||||
AND el.electricalid = op.electricalid AND op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND el.electricalid = ?`, data).Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
// for results.Next() {
|
||||
// err = results.Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8)
|
||||
// if err != nil {
|
||||
// c.AbortWithError(http.StatusBadRequest, err)
|
||||
// c.String(http.StatusBadRequest, err.Error())
|
||||
// return
|
||||
// }
|
||||
// array = append(array, result)
|
||||
// array2 = append(array2, result2)
|
||||
// array3 = append(array3, result3)
|
||||
// array4 = append(array4, result4)
|
||||
// array5 = append(array5, result5)
|
||||
// array6 = append(array6, result6)
|
||||
// array7 = append(array7, result7)
|
||||
// array8 = append(array8, result8)
|
||||
// }
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
"result2": result2,
|
||||
|
|
@ -705,7 +690,7 @@ func connect() {
|
|||
array3 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3 FROM electrical_orderofpayment_new op, ref_bldgcomputationsheet ref, electrical el
|
||||
WHERE op.is_approve = 0 AND op.for_approval = 1 AND op.is_release = 0 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
AND el.electricalid = op.electricalid AND op.electricalid = ?`, data)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
|
|
@ -729,6 +714,44 @@ func connect() {
|
|||
"result3": array3,
|
||||
})
|
||||
|
||||
case "get-signatureimage":
|
||||
err := db.QueryRow("SELECT IFNULL(image, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
router.GET("/api/:method/:data/:data2", func(c *gin.Context) {
|
||||
var result string
|
||||
method := c.Param("method")
|
||||
data := c.Param("data")
|
||||
data2 := c.Param("data2")
|
||||
|
||||
c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
c.Writer.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
c.Writer.Header().Set("X-DNS-Prefetch-Control", "off")
|
||||
c.Writer.Header().Set("X-Frame-Options", "DENY")
|
||||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
switch method {
|
||||
case "check-access":
|
||||
err = db.QueryRow("SELECT COUNT(accessid) AS result FROM access a JOIN ref_access ra ON a.ref_accessid = ra.ref_accessid AND ra.access = ? and employeeid = ?", data, data2).Scan(&result)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -776,33 +799,6 @@ func connect() {
|
|||
|
||||
})
|
||||
|
||||
router.GET("/api/:method/:data/:data2", func(c *gin.Context) {
|
||||
var result string
|
||||
method := c.Param("method")
|
||||
data := c.Param("data")
|
||||
data2 := c.Param("data2")
|
||||
|
||||
c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
c.Writer.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
c.Writer.Header().Set("X-DNS-Prefetch-Control", "off")
|
||||
c.Writer.Header().Set("X-Frame-Options", "DENY")
|
||||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
switch method {
|
||||
case "check-access":
|
||||
err = db.QueryRow("SELECT COUNT(accessid) AS result FROM access a JOIN ref_access ra ON a.ref_accessid = ra.ref_accessid AND ra.access = ? and employeeid = ?", data, data2).Scan(&result)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
router.POST("/api/post-newstatus-electrical", func(c *gin.Context) {
|
||||
type RegistrationData struct {
|
||||
Data int `json:"data"`
|
||||
|
|
@ -907,7 +903,7 @@ func connect() {
|
|||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
dbpost, err := db.Prepare("UPDATE electrical_orderofpayment_new SET popstransmitted = 1 WHERE electricalid = ? AND for_approval = 1 AND is_release = 0 AND is_paid = 0 AND is_approve = 1")
|
||||
dbpost, err := db.Prepare("UPDATE electrical_orderofpayment_new SET popstransmitted = 1, is_release = 1 WHERE electricalid = ? AND for_approval = 1 AND is_paid = 0 AND is_approve = 1")
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
"ofetch": "^1.4.1",
|
||||
"openssl-nodejs": "^1.0.5",
|
||||
"pica": "^9.0.1",
|
||||
"qrcode": "^1.5.4",
|
||||
"sharp": "^0.34.4",
|
||||
"solid-icons": "^1.1.0",
|
||||
"solid-js": "^1.9.9",
|
||||
|
|
|
|||
64
pnpm-lock.yaml
generated
64
pnpm-lock.yaml
generated
|
|
@ -50,6 +50,9 @@ importers:
|
|||
pica:
|
||||
specifier: ^9.0.1
|
||||
version: 9.0.1
|
||||
qrcode:
|
||||
specifier: ^1.5.4
|
||||
version: 1.5.4
|
||||
sharp:
|
||||
specifier: ^0.34.4
|
||||
version: 0.34.4
|
||||
|
|
@ -2628,13 +2631,11 @@ snapshots:
|
|||
dependencies:
|
||||
event-target-shim: 5.0.1
|
||||
|
||||
ansi-regex@5.0.1:
|
||||
optional: true
|
||||
ansi-regex@5.0.1: {}
|
||||
|
||||
ansi-styles@4.3.0:
|
||||
dependencies:
|
||||
color-convert: 2.0.1
|
||||
optional: true
|
||||
|
||||
any-base@1.1.0: {}
|
||||
|
||||
|
|
@ -2686,8 +2687,7 @@ snapshots:
|
|||
base64-js: 1.5.1
|
||||
ieee754: 1.2.1
|
||||
|
||||
camelcase@5.3.1:
|
||||
optional: true
|
||||
camelcase@5.3.1: {}
|
||||
|
||||
caniuse-lite@1.0.30001743: {}
|
||||
|
||||
|
|
@ -2713,15 +2713,12 @@ snapshots:
|
|||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 6.2.0
|
||||
optional: true
|
||||
|
||||
color-convert@2.0.1:
|
||||
dependencies:
|
||||
color-name: 1.1.4
|
||||
optional: true
|
||||
|
||||
color-name@1.1.4:
|
||||
optional: true
|
||||
color-name@1.1.4: {}
|
||||
|
||||
colorjs.io@0.5.2: {}
|
||||
|
||||
|
|
@ -2747,8 +2744,7 @@ snapshots:
|
|||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
decamelize@1.2.0:
|
||||
optional: true
|
||||
decamelize@1.2.0: {}
|
||||
|
||||
destr@2.0.5: {}
|
||||
|
||||
|
|
@ -2757,8 +2753,7 @@ snapshots:
|
|||
|
||||
detect-libc@2.1.0: {}
|
||||
|
||||
dijkstrajs@1.0.3:
|
||||
optional: true
|
||||
dijkstrajs@1.0.3: {}
|
||||
|
||||
dompurify@3.2.7:
|
||||
optionalDependencies:
|
||||
|
|
@ -2767,8 +2762,7 @@ snapshots:
|
|||
|
||||
electron-to-chromium@1.5.222: {}
|
||||
|
||||
emoji-regex@8.0.0:
|
||||
optional: true
|
||||
emoji-regex@8.0.0: {}
|
||||
|
||||
entities@6.0.1: {}
|
||||
|
||||
|
|
@ -2838,15 +2832,13 @@ snapshots:
|
|||
dependencies:
|
||||
locate-path: 5.0.0
|
||||
path-exists: 4.0.0
|
||||
optional: true
|
||||
|
||||
fsevents@2.3.3:
|
||||
optional: true
|
||||
|
||||
gensync@1.0.0-beta.2: {}
|
||||
|
||||
get-caller-file@2.0.5:
|
||||
optional: true
|
||||
get-caller-file@2.0.5: {}
|
||||
|
||||
gifwrap@0.10.1:
|
||||
dependencies:
|
||||
|
|
@ -2880,8 +2872,7 @@ snapshots:
|
|||
is-extglob@2.1.1:
|
||||
optional: true
|
||||
|
||||
is-fullwidth-code-point@3.0.0:
|
||||
optional: true
|
||||
is-fullwidth-code-point@3.0.0: {}
|
||||
|
||||
is-glob@4.0.3:
|
||||
dependencies:
|
||||
|
|
@ -2949,7 +2940,6 @@ snapshots:
|
|||
locate-path@5.0.0:
|
||||
dependencies:
|
||||
p-locate: 4.1.0
|
||||
optional: true
|
||||
|
||||
lru-cache@5.1.1:
|
||||
dependencies:
|
||||
|
|
@ -3000,15 +2990,12 @@ snapshots:
|
|||
p-limit@2.3.0:
|
||||
dependencies:
|
||||
p-try: 2.2.0
|
||||
optional: true
|
||||
|
||||
p-locate@4.1.0:
|
||||
dependencies:
|
||||
p-limit: 2.3.0
|
||||
optional: true
|
||||
|
||||
p-try@2.2.0:
|
||||
optional: true
|
||||
p-try@2.2.0: {}
|
||||
|
||||
pako@1.0.11: {}
|
||||
|
||||
|
|
@ -3027,8 +3014,7 @@ snapshots:
|
|||
dependencies:
|
||||
entities: 6.0.1
|
||||
|
||||
path-exists@4.0.0:
|
||||
optional: true
|
||||
path-exists@4.0.0: {}
|
||||
|
||||
peek-readable@4.1.0: {}
|
||||
|
||||
|
|
@ -3053,8 +3039,7 @@ snapshots:
|
|||
dependencies:
|
||||
pngjs: 6.0.0
|
||||
|
||||
pngjs@5.0.0:
|
||||
optional: true
|
||||
pngjs@5.0.0: {}
|
||||
|
||||
pngjs@6.0.0: {}
|
||||
|
||||
|
|
@ -3073,7 +3058,6 @@ snapshots:
|
|||
dijkstrajs: 1.0.3
|
||||
pngjs: 5.0.0
|
||||
yargs: 15.4.1
|
||||
optional: true
|
||||
|
||||
raf@3.4.1:
|
||||
dependencies:
|
||||
|
|
@ -3098,11 +3082,9 @@ snapshots:
|
|||
regenerator-runtime@0.13.11:
|
||||
optional: true
|
||||
|
||||
require-directory@2.1.1:
|
||||
optional: true
|
||||
require-directory@2.1.1: {}
|
||||
|
||||
require-main-filename@2.0.0:
|
||||
optional: true
|
||||
require-main-filename@2.0.0: {}
|
||||
|
||||
rgbcolor@1.0.1:
|
||||
optional: true
|
||||
|
|
@ -3250,8 +3232,7 @@ snapshots:
|
|||
|
||||
seroval@1.3.2: {}
|
||||
|
||||
set-blocking@2.0.0:
|
||||
optional: true
|
||||
set-blocking@2.0.0: {}
|
||||
|
||||
sharp@0.34.4:
|
||||
dependencies:
|
||||
|
|
@ -3330,7 +3311,6 @@ snapshots:
|
|||
emoji-regex: 8.0.0
|
||||
is-fullwidth-code-point: 3.0.0
|
||||
strip-ansi: 6.0.1
|
||||
optional: true
|
||||
|
||||
string_decoder@1.3.0:
|
||||
dependencies:
|
||||
|
|
@ -3339,7 +3319,6 @@ snapshots:
|
|||
strip-ansi@6.0.1:
|
||||
dependencies:
|
||||
ansi-regex: 5.0.1
|
||||
optional: true
|
||||
|
||||
strtok3@6.3.0:
|
||||
dependencies:
|
||||
|
|
@ -3450,15 +3429,13 @@ snapshots:
|
|||
|
||||
webworkify@1.5.0: {}
|
||||
|
||||
which-module@2.0.1:
|
||||
optional: true
|
||||
which-module@2.0.1: {}
|
||||
|
||||
wrap-ansi@6.2.0:
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
optional: true
|
||||
|
||||
xml-parse-from-string@1.0.1: {}
|
||||
|
||||
|
|
@ -3469,8 +3446,7 @@ snapshots:
|
|||
|
||||
xmlbuilder@11.0.1: {}
|
||||
|
||||
y18n@4.0.3:
|
||||
optional: true
|
||||
y18n@4.0.3: {}
|
||||
|
||||
yallist@3.1.1: {}
|
||||
|
||||
|
|
@ -3478,7 +3454,6 @@ snapshots:
|
|||
dependencies:
|
||||
camelcase: 5.3.1
|
||||
decamelize: 1.2.0
|
||||
optional: true
|
||||
|
||||
yargs@15.4.1:
|
||||
dependencies:
|
||||
|
|
@ -3493,6 +3468,5 @@ snapshots:
|
|||
which-module: 2.0.1
|
||||
y18n: 4.0.3
|
||||
yargs-parser: 18.1.3
|
||||
optional: true
|
||||
|
||||
zod@3.25.76: {}
|
||||
|
|
|
|||
|
|
@ -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 } from '../../stores/pdfinfo'
|
||||
import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeList, _codeList, _amountList, _signature, _assessorid } from '../../stores/pdfinfo'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
|
|
@ -48,6 +48,8 @@ export default () => {
|
|||
const [employeeId, setEmployeeId] = createSignal(0)
|
||||
const [employeeName, setEmployeeName] = createSignal('')
|
||||
|
||||
const [sign, setSign] = createSignal('')
|
||||
|
||||
// const [docApplicationNo, setDocApplicationNo] = createSignal('')
|
||||
// const [docDate, setDocDate] = createSignal('')
|
||||
// const [docLocation, setDocLocation] = createSignal('')
|
||||
|
|
@ -79,6 +81,7 @@ export default () => {
|
|||
_location.set(location)
|
||||
_type.set(type)
|
||||
_assessor.set(assessor)
|
||||
_assessorid.set(employeeId())
|
||||
}
|
||||
|
||||
const getPrintDetailsFees = async (id: number) => {
|
||||
|
|
@ -151,6 +154,7 @@ export default () => {
|
|||
|
||||
getPrintDetails(op.result11[0])
|
||||
getPrintDetailsFees(op.result11[0])
|
||||
getSignatureImage(employeeId())
|
||||
}
|
||||
|
||||
const calculateTotal = (list: number[]) => {
|
||||
|
|
@ -207,14 +211,14 @@ export default () => {
|
|||
// updateOrderofpayment = await updateOp()
|
||||
|
||||
// if (updateOrderofpayment) {
|
||||
// setPrintedApplication(application)
|
||||
// setPrinted(true)
|
||||
// getPrintDetails(applicationId())
|
||||
// setPrintedApplication(application)
|
||||
// setPrinted(true)
|
||||
createPdf()
|
||||
// }
|
||||
}
|
||||
|
||||
const updateOp = async () => {
|
||||
console.log(applicationId())
|
||||
try {
|
||||
await ofetch(API + 'update-opprinted-electrical', {
|
||||
method: 'POST',
|
||||
|
|
@ -242,6 +246,17 @@ export default () => {
|
|||
}
|
||||
}
|
||||
|
||||
const getSignatureImage = async (id: number) => {
|
||||
try {
|
||||
const response = await ofetch(API + 'get-signatureimage/' + id, { parseResponse: JSON.parse })
|
||||
const image = response.result
|
||||
_signature.set(image)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
removeEmployee()
|
||||
navigate('/')
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export default () => {
|
|||
setName(APPROVERNAME)
|
||||
}
|
||||
const hash = SHA3(id().toString())
|
||||
setSignature(`Scan this using OCBO e-Sign Validator - scanid=${hash.toString()}`)
|
||||
setSignature(`Use OCBO e-Sign Validator - scanid=${hash.toString()}`)
|
||||
|
||||
try {
|
||||
register()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue