Compare commits

..

7 commits

12 changed files with 217 additions and 64 deletions

View file

@ -1,8 +0,0 @@
{
"hash": "5150e8c9",
"configHash": "5122d30b",
"lockfileHash": "21c3b17e",
"browserHash": "c8ad0cff",
"optimized": {},
"chunks": {}
}

View file

@ -1,3 +0,0 @@
{
"type": "module"
}

View file

@ -1,4 +0,0 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}

11
.vscode/launch.json vendored
View file

@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}

View file

@ -1,3 +1,7 @@
<div align="center">
![OCBO e-Sign Logo](/src/assets/images/logo.png)
# OCBO e-Sign
</div>

View file

@ -1,15 +0,0 @@
FROM golang:1.25.4 AS build
ENV GIN_MODE=release
ENV PORT=4320
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN GOOS=linux GOARCH=amd64 GOAMD64=v1 go build -pgo=auto -ldflags="-s -w" -o /bin/esign-server main.go
FROM alpine:latest
WORKDIR /app
COPY --from=build /bin/esign-server ./server
EXPOSE $PORT
CMD ["./server"]

View file

@ -1,9 +0,0 @@
services:
e-sign-server:
container_name: e-sign-server
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
ports:
- 4320:4320

View file

@ -30,7 +30,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.56.0 // indirect
github.com/quic-go/quic-go v0.57.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.1 // indirect
go.uber.org/mock v0.6.0 // indirect

View file

@ -61,6 +61,8 @@ github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
github.com/quic-go/quic-go v0.56.0 h1:q/TW+OLismmXAehgFLczhCDTYB3bFmua4D9lsNBWxvY=
github.com/quic-go/quic-go v0.56.0/go.mod h1:9gx5KsFQtw2oZ6GZTyh+7YEvOxWCL9WZAepnHxgAo6c=
github.com/quic-go/quic-go v0.57.0 h1:AsSSrrMs4qI/hLrKlTH/TGQeTMY0ib1pAOX7vA3AdqE=
github.com/quic-go/quic-go v0.57.0/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=

View file

@ -291,6 +291,35 @@ func connect() {
"result2": array2,
})
case "get-listopreprinting-electrical":
var result2 string
array := []string{}
array2 := []string{}
results, err := db.Query(`SELECT DISTINCT IFNULL(e.electricalno, '') AS result, IF(c.firstName IS NULL OR c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', IF(c.middleInitial IS NULL OR c.middleInitial = '', '', CONCAT(c.middleInitial, '. ')), c.lastName) ) AS result2
FROM electrical e JOIN customer c ON e.customerid = c.customerid JOIN ref_elec_occupancy ec ON e.ref_elec_occupancyid = ec.ref_elec_occupancyid JOIN electricaldocflowtxn ed ON e.electricalid = ed.electricalid RIGHT JOIN esign_transactions et ON e.electricalNo = et.referenceNo JOIN (SELECT electricalid, MAX(electricaldocflowtxnid) AS latest_electricaldocflowtxnid FROM electricaldocflowtxn GROUP BY electricalid) latest_doc ON ed.electricalid = latest_doc.electricalid AND ed.electricaldocflowtxnid = latest_doc.latest_electricaldocflowtxnid
WHERE remarks = ? AND is_approve = 0 ORDER BY e.electricalno ASC`, "FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION")
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
return
}
for results.Next() {
err = results.Scan(&result, &result2)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
return
}
array = append(array, result)
array2 = append(array2, result2)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
})
case "get-list-assessors":
array := []string{}
@ -882,9 +911,31 @@ func connect() {
var result2, result3, result4, result5, result6, result7, result8 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 = 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)
FROM electrical el JOIN customer cu ON el.customerid = cu.customerid JOIN electrical_orderofpayment_new op ON el.electricalid = op.electricalid JOIN ref_elec_occupancy u ON el.ref_elec_occupancyid = u.ref_elec_occupancyid LEFT JOIN ref_occupancy occ ON u.ref_occupancyid = occ.ref_occupancyid JOIN employee e ON op.assessedbyid = e.employeeid
WHERE 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
}
c.JSON(http.StatusOK, gin.H{
"result": result,
"result2": result2,
"result3": result3,
"result4": result4,
"result5": result5,
"result6": result6,
"result7": result7,
"result8": result8,
})
case "get-reprintdetails-electrical":
var result2, result3, result4, result5, result6, result7, result8 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 JOIN customer cu ON el.customerid = cu.customerid JOIN electrical_orderofpayment_new op ON el.electricalid = op.electricalid JOIN ref_elec_occupancy u ON el.ref_elec_occupancyid = u.ref_elec_occupancyid LEFT JOIN ref_occupancy occ ON u.ref_occupancyid = occ.ref_occupancyid JOIN employee e ON op.assessedbyid = e.employeeid
WHERE op.is_approve = 1 AND op.for_approval = 1 AND is_paid = 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())
@ -997,6 +1048,37 @@ func connect() {
"result3": array3,
})
case "get-reprintdetailsfees-electrical":
var result2, result3 string
array := []string{}
array2 := []string{}
array3 := []string{}
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3
FROM electrical el JOIN electrical_orderofpayment_new op ON el.electricalid = op.electricalid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_paid = 0 AND op.is_delete <> 1 AND op.electricalid = ?`, data)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
return
}
for results.Next() {
err = results.Scan(&result, &result2, &result3)
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)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
"result3": array3,
})
case "get-signatureimage":
err := db.QueryRow("SELECT IFNULL(image, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result)
if err != nil {
@ -1529,6 +1611,46 @@ func connect() {
}
})
router.POST("/api/update-foropreprint-electrical", middleware.TokenChecker(), func(c *gin.Context) {
type UpdateOpData struct {
Data int `json:"data"`
}
var updateOpData UpdateOpData
if err := c.ShouldBindJSON(&updateOpData); err != nil {
c.String(http.StatusBadRequest, "Invalid request body")
return
}
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")
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())
}
defer dbpost.Close()
exec, err := dbpost.Exec(updateOpData.Data)
if err != nil {
panic(err.Error())
}
affect, err := exec.RowsAffected()
if err != nil {
panic(err.Error())
}
if affect > 0 {
c.String(http.StatusOK, "Success on Updating Order of Payment for Printing")
} else {
c.String(http.StatusInternalServerError, "Failed on Updating Order of Payment for Printing")
}
})
router.POST("/api/post-esigntransaction", middleware.TokenChecker(), func(c *gin.Context) {
type UpdateOpData struct {
Data int `json:"data"`

View file

@ -32,7 +32,7 @@ import {
_type,
_units,
} from '../../stores/pdfinfo'
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi } from '../../utils/functions'
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, voidApi } from '../../utils/functions'
import './Assessor.sass'
const PESO = import.meta.env.VITE_PESO
@ -68,7 +68,7 @@ export default () => {
const [filter, setFilter] = createSignal('')
const listType = ['Print', 'Manual Print', 'Reprint']
const listType = ['Print', 'Reprint', 'Reprint and Void']
const [selectedType, setSelectedType] = createSignal('Print')
let bldgadditional = false
@ -81,7 +81,10 @@ export default () => {
}
const getPrintDetails = async (division: string, id: number) => {
const response = await getApiMulti(`get-printdetails-${division}`, id)
let response
if (selectedType() === 'Print') response = await getApiMulti(`get-printdetails-${division}`, id)
else response = await getApiMulti(`get-reprintdetails-${division}`, id)
const applicationno = response.result
const date = response.result2
const location = response.result3
@ -112,7 +115,10 @@ export default () => {
}
const getPrintDetailsFees = async (division: string, id: number) => {
const response = await getApiMulti(`get-printdetailsfees-${division}`, id)
let response
if (selectedType() === 'Print') response = await getApiMulti(`get-printdetailsfees-${division}`, id)
else response = await getApiMulti(`get-reprintdetailsfees-${division}`, id)
const feeList = response.result
const accountCodeList = response.result2
const amountList = response.result3
@ -190,7 +196,6 @@ export default () => {
const additionalResult = await getApi('check-bldgadditional-printing', applicationNo)
bldgadditional = additionalResult > 0
console.log('additionalResult', additionalResult)
const op = await getApiMulti(`get-opdetails-${division}`, applicationNo)
@ -226,7 +231,10 @@ export default () => {
const getListForPrinting = async (division: string) => {
try {
const response = await getApiMulti(`get-listopprinting-${division}`)
let response: any
if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`)
else response = await getApiMulti(`get-listopreprinting-${division}`)
if (filter() !== '' && filter().trim().length !== 0) {
const filteredApplications = response.result.filter((item: string) => item.includes(filter()))
@ -316,6 +324,42 @@ export default () => {
}
}
const rePrintHandler = async (division: string, application: string) => {
// let updateOrderofpayment: boolean = false
setConnected(await checkConnection())
if (connected() === false) {
setErrorMessage('No Connection on Server')
return
}
if (selectedType().includes("Void")) {
if (division === 'electrical') {
await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT REPRINTED', '175', 'ELECOPREPRINTED', 1)
await setNewStatus(division, 'ELECTRICAL ORDERPAYMENT RELEASED', '97', 'ELECRELEASED', 1)
await setNewStatus(division, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE', 0)
await updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT PRINTING')
} else if (division === 'occupancy') {
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT REPRINTED', '176', 'OCCOPREPRINTED', 1)
await setNewStatus(division, 'OCCUPANCY ORDER OF PAYMENT RELEASED', '174', 'OCCOPRELEASED', 1)
await setNewStatus(division, 'ORDER OF PAYMENT RELEASE FOR BUREAU OF FIRE', '24', 'OCOOPRELEASE', 0)
await updateDocflow(division, application, 'APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT')
}
await voidOp(application)
}
postTransaction(application)
setPrintedApplication(application)
setPrinted(true)
if (division === 'electrical') {
createPdfElectrical()
} else if (division === 'occupancy') {
createPdfOccupancy()
} else console.log('building')
}
const updateOp = async (division: string) => {
const post = await postApi(`update-opprinted-${division}`, {
data: parseInt(applicationId().toString(), 10),
@ -420,14 +464,22 @@ export default () => {
navigate('/profile')
}
const voidOp = async (application: string) => {
const response = await voidApi(application)
if (response !== null) return true
return false
}
onMount(async () => {
const logged = await checkLogged()
if (logged) {
setSelectedType('Print')
await checkDivision()
if (isBuilding()) await getListForPrinting('building')
if (isOccupancy()) await getListForPrinting('occupancy')
// if (isElectrical()) await getListForPrinting('electrical')
if (isElectrical()) await getListForPrinting('electrical')
}
})
@ -669,7 +721,12 @@ export default () => {
</Padding>
<Row padding="2rem 0 0 0">
<Show when={selectedType() === 'Print'}>
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
</Show>
<Show when={selectedType() !== 'Print'}>
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('occupancy', item)}></Button>
</Show>
<span class="modal__cancel">Click anywhere to cancel</span>
</Row>
</Padding>
@ -763,7 +820,12 @@ export default () => {
</Padding>
<Row padding="2rem 0 0 0">
<Show when={selectedType() === 'Print'}>
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
</Show>
<Show when={selectedType() !== 'Print'}>
<Button wide label="Reprint" edges="curved" design="bo-primary" onClick={() => rePrintHandler('electrical', item)}></Button>
</Show>
<span class="modal__cancel">Click anywhere to cancel</span>
</Row>
</Padding>

View file

@ -0,0 +1,13 @@
import { ofetch } from 'ofetch'
const VOID = "https://gateway.davaocity.gov.ph/api/pops/voidOP.ashx?oprefid="
export default async (application: string) => {
try {
const fetch = await ofetch(VOID + application, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
const result = fetch
return result
} catch {
return null
}
}