Compare commits

..

No commits in common. "058c7e8de5307ab212e87bdf7bd18af7563802d9" and "2748bbc4a6aabed1aa46349851cda8f0a22aa3ab" have entirely different histories.

12 changed files with 64 additions and 217 deletions

View file

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

3
.vite/deps/package.json Normal file
View file

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

4
.vscode/extensions.json vendored Normal file
View file

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

11
.vscode/launch.json vendored Normal file
View file

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

View file

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

15
backend/Dockerfile Normal file
View file

@ -0,0 +1,15 @@
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

@ -0,0 +1,9 @@
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/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/quic-go/qpack v0.6.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.57.0 // indirect github.com/quic-go/quic-go v0.56.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.1 // indirect github.com/ugorji/go/codec v1.3.1 // indirect
go.uber.org/mock v0.6.0 // indirect go.uber.org/mock v0.6.0 // indirect

View file

@ -61,8 +61,6 @@ 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/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 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.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.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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=

View file

@ -291,35 +291,6 @@ func connect() {
"result2": array2, "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": case "get-list-assessors":
array := []string{} array := []string{}
@ -911,31 +882,9 @@ func connect() {
var result2, result3, result4, result5, result6, result7, result8 string 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 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 FROM electrical el, electrical_orderofpayment_new op, ref_occupancy occ, ref_elec_occupancy u, customer cu, employee e
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) 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
if err != nil { 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)
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 { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error()) c.String(http.StatusBadRequest, err.Error())
@ -1048,37 +997,6 @@ func connect() {
"result3": array3, "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": case "get-signatureimage":
err := db.QueryRow("SELECT IFNULL(image, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result) err := db.QueryRow("SELECT IFNULL(image, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result)
if err != nil { if err != nil {
@ -1611,46 +1529,6 @@ 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) { router.POST("/api/post-esigntransaction", middleware.TokenChecker(), func(c *gin.Context) {
type UpdateOpData struct { type UpdateOpData struct {
Data int `json:"data"` Data int `json:"data"`

View file

@ -32,7 +32,7 @@ import {
_type, _type,
_units, _units,
} from '../../stores/pdfinfo' } from '../../stores/pdfinfo'
import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi, voidApi } from '../../utils/functions' import { checkConnection, createPdfElectrical, createPdfOccupancy, getApi, getApiMulti, postApi } from '../../utils/functions'
import './Assessor.sass' import './Assessor.sass'
const PESO = import.meta.env.VITE_PESO const PESO = import.meta.env.VITE_PESO
@ -68,7 +68,7 @@ export default () => {
const [filter, setFilter] = createSignal('') const [filter, setFilter] = createSignal('')
const listType = ['Print', 'Reprint', 'Reprint and Void'] const listType = ['Print', 'Manual Print', 'Reprint']
const [selectedType, setSelectedType] = createSignal('Print') const [selectedType, setSelectedType] = createSignal('Print')
let bldgadditional = false let bldgadditional = false
@ -81,10 +81,7 @@ export default () => {
} }
const getPrintDetails = async (division: string, id: number) => { const getPrintDetails = async (division: string, id: number) => {
let response const response = await getApiMulti(`get-printdetails-${division}`, id)
if (selectedType() === 'Print') response = await getApiMulti(`get-printdetails-${division}`, id)
else response = await getApiMulti(`get-reprintdetails-${division}`, id)
const applicationno = response.result const applicationno = response.result
const date = response.result2 const date = response.result2
const location = response.result3 const location = response.result3
@ -115,10 +112,7 @@ export default () => {
} }
const getPrintDetailsFees = async (division: string, id: number) => { const getPrintDetailsFees = async (division: string, id: number) => {
let response const response = await getApiMulti(`get-printdetailsfees-${division}`, id)
if (selectedType() === 'Print') response = await getApiMulti(`get-printdetailsfees-${division}`, id)
else response = await getApiMulti(`get-reprintdetailsfees-${division}`, id)
const feeList = response.result const feeList = response.result
const accountCodeList = response.result2 const accountCodeList = response.result2
const amountList = response.result3 const amountList = response.result3
@ -196,6 +190,7 @@ export default () => {
const additionalResult = await getApi('check-bldgadditional-printing', applicationNo) const additionalResult = await getApi('check-bldgadditional-printing', applicationNo)
bldgadditional = additionalResult > 0 bldgadditional = additionalResult > 0
console.log('additionalResult', additionalResult)
const op = await getApiMulti(`get-opdetails-${division}`, applicationNo) const op = await getApiMulti(`get-opdetails-${division}`, applicationNo)
@ -231,10 +226,7 @@ export default () => {
const getListForPrinting = async (division: string) => { const getListForPrinting = async (division: string) => {
try { try {
let response: any const response = await getApiMulti(`get-listopprinting-${division}`)
if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`)
else response = await getApiMulti(`get-listopreprinting-${division}`)
if (filter() !== '' && filter().trim().length !== 0) { if (filter() !== '' && filter().trim().length !== 0) {
const filteredApplications = response.result.filter((item: string) => item.includes(filter())) const filteredApplications = response.result.filter((item: string) => item.includes(filter()))
@ -324,42 +316,6 @@ 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 updateOp = async (division: string) => {
const post = await postApi(`update-opprinted-${division}`, { const post = await postApi(`update-opprinted-${division}`, {
data: parseInt(applicationId().toString(), 10), data: parseInt(applicationId().toString(), 10),
@ -464,22 +420,14 @@ export default () => {
navigate('/profile') navigate('/profile')
} }
const voidOp = async (application: string) => {
const response = await voidApi(application)
if (response !== null) return true
return false
}
onMount(async () => { onMount(async () => {
const logged = await checkLogged() const logged = await checkLogged()
if (logged) { if (logged) {
setSelectedType('Print')
await checkDivision() await checkDivision()
if (isBuilding()) await getListForPrinting('building') if (isBuilding()) await getListForPrinting('building')
if (isOccupancy()) await getListForPrinting('occupancy') if (isOccupancy()) await getListForPrinting('occupancy')
if (isElectrical()) await getListForPrinting('electrical') // if (isElectrical()) await getListForPrinting('electrical')
} }
}) })
@ -721,12 +669,7 @@ export default () => {
</Padding> </Padding>
<Row padding="2rem 0 0 0"> <Row padding="2rem 0 0 0">
<Show when={selectedType() === 'Print'}> <Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
<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> <span class="modal__cancel">Click anywhere to cancel</span>
</Row> </Row>
</Padding> </Padding>
@ -747,7 +690,7 @@ export default () => {
<Row content="split"> <Row content="split">
<Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" /> <Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" />
<Row gap={0.5}> <Row gap={0.5}>
<Combobox options={listType} value={selectedType()} onChange={setSelectedType} placeholder="Select Type" width='200px' /> <Combobox options={listType} value={selectedType()} onChange={setSelectedType} placeholder="Select Type" width='200px'/>
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={refresh}></Button> <Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={refresh}></Button>
</Row> </Row>
</Row> </Row>
@ -820,12 +763,7 @@ export default () => {
</Padding> </Padding>
<Row padding="2rem 0 0 0"> <Row padding="2rem 0 0 0">
<Show when={selectedType() === 'Print'}> <Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
<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> <span class="modal__cancel">Click anywhere to cancel</span>
</Row> </Row>
</Padding> </Padding>

View file

@ -1,13 +0,0 @@
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
}
}