diff --git a/.vite/deps/_metadata.json b/.vite/deps/_metadata.json new file mode 100644 index 0000000..96c549f --- /dev/null +++ b/.vite/deps/_metadata.json @@ -0,0 +1,8 @@ +{ + "hash": "5150e8c9", + "configHash": "5122d30b", + "lockfileHash": "21c3b17e", + "browserHash": "c8ad0cff", + "optimized": {}, + "chunks": {} +} \ No newline at end of file diff --git a/.vite/deps/package.json b/.vite/deps/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/.vite/deps/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..22a1505 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d642209 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/README.md b/README.md index def2422..b1b7a27 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ -
- ![OCBO e-Sign Logo](/src/assets/images/logo.png) # OCBO e-Sign - -
diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..e212690 --- /dev/null +++ b/backend/Dockerfile @@ -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"] \ No newline at end of file diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml new file mode 100644 index 0000000..1992173 --- /dev/null +++ b/backend/docker-compose.yml @@ -0,0 +1,9 @@ +services: + e-sign-server: + container_name: e-sign-server + restart: unless-stopped + build: + context: . + dockerfile: Dockerfile + ports: + - 4320:4320 diff --git a/backend/go.mod b/backend/go.mod index f9e1b17..17a6095 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -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.57.0 // indirect + github.com/quic-go/quic-go v0.56.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 diff --git a/backend/go.sum b/backend/go.sum index 640f757..3e4bd08 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -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/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= diff --git a/backend/main.go b/backend/main.go index 75f6d0c..25761e0 100644 --- a/backend/main.go +++ b/backend/main.go @@ -291,35 +291,6 @@ 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{} @@ -911,31 +882,9 @@ 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 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) + 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()) @@ -1048,37 +997,6 @@ 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 { @@ -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) { type UpdateOpData struct { Data int `json:"data"` diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index 3147bad..48282c7 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -32,7 +32,7 @@ import { _type, _units, } 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' const PESO = import.meta.env.VITE_PESO @@ -68,7 +68,7 @@ export default () => { const [filter, setFilter] = createSignal('') - const listType = ['Print', 'Reprint', 'Reprint and Void'] + const listType = ['Print', 'Manual Print', 'Reprint'] const [selectedType, setSelectedType] = createSignal('Print') let bldgadditional = false @@ -81,10 +81,7 @@ export default () => { } const getPrintDetails = async (division: string, id: number) => { - let response - if (selectedType() === 'Print') response = await getApiMulti(`get-printdetails-${division}`, id) - else response = await getApiMulti(`get-reprintdetails-${division}`, id) - + const response = await getApiMulti(`get-printdetails-${division}`, id) const applicationno = response.result const date = response.result2 const location = response.result3 @@ -115,10 +112,7 @@ export default () => { } const getPrintDetailsFees = async (division: string, id: number) => { - let response - if (selectedType() === 'Print') response = await getApiMulti(`get-printdetailsfees-${division}`, id) - else response = await getApiMulti(`get-reprintdetailsfees-${division}`, id) - + const response = await getApiMulti(`get-printdetailsfees-${division}`, id) const feeList = response.result const accountCodeList = response.result2 const amountList = response.result3 @@ -196,6 +190,7 @@ 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) @@ -231,10 +226,7 @@ export default () => { const getListForPrinting = async (division: string) => { try { - let response: any - - if (selectedType() === 'Print') response = await getApiMulti(`get-listopprinting-${division}`) - else response = await getApiMulti(`get-listopreprinting-${division}`) + const response = await getApiMulti(`get-listopprinting-${division}`) if (filter() !== '' && filter().trim().length !== 0) { 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 post = await postApi(`update-opprinted-${division}`, { data: parseInt(applicationId().toString(), 10), @@ -464,22 +420,14 @@ 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') } }) @@ -721,12 +669,7 @@ export default () => { - - - - - - + Click anywhere to cancel @@ -747,7 +690,7 @@ export default () => { - + @@ -820,12 +763,7 @@ export default () => { - - - - - - + Click anywhere to cancel diff --git a/src/utils/functions/voidApi.ts b/src/utils/functions/voidApi.ts deleted file mode 100644 index 904bf1b..0000000 --- a/src/utils/functions/voidApi.ts +++ /dev/null @@ -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 - } -}