Compare commits
6 commits
10dd5b7fa9
...
321109e064
| Author | SHA1 | Date | |
|---|---|---|---|
| 321109e064 | |||
| 9ffae4ed03 | |||
| 31cdf2a688 | |||
| 54fe8ade87 | |||
| d8296d9c0e | |||
| 500d138339 |
8 changed files with 315 additions and 65 deletions
|
|
@ -6,16 +6,17 @@ require (
|
|||
github.com/gin-contrib/cors v1.7.6
|
||||
github.com/gin-gonic/gin v1.11.0
|
||||
github.com/go-sql-driver/mysql v1.9.3
|
||||
github.com/joho/godotenv v1.5.1
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/bytedance/gopkg v0.1.3 // indirect
|
||||
github.com/bytedance/sonic v1.14.1 // indirect
|
||||
github.com/bytedance/sonic/loader v0.3.0 // indirect
|
||||
github.com/bytedance/sonic v1.14.2 // indirect
|
||||
github.com/bytedance/sonic/loader v0.4.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
|
|
@ -32,7 +33,7 @@ require (
|
|||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.55.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.3.0 // indirect
|
||||
github.com/ugorji/go/codec v1.3.1 // indirect
|
||||
go.uber.org/mock v0.6.0 // indirect
|
||||
golang.org/x/arch v0.22.0 // indirect
|
||||
golang.org/x/crypto v0.43.0 // indirect
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M
|
|||
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
||||
github.com/bytedance/sonic v1.14.1 h1:FBMC0zVz5XUmE4z9wF4Jey0An5FueFvOsTKKKtwIl7w=
|
||||
github.com/bytedance/sonic v1.14.1/go.mod h1:gi6uhQLMbTdeP0muCnrjHLeCUPyb70ujhnNlhOylAFc=
|
||||
github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE=
|
||||
github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980=
|
||||
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
|
||||
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o=
|
||||
github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
|
||||
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
||||
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
|
|
@ -14,6 +18,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY=
|
||||
github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
|
|
@ -37,6 +43,8 @@ github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PU
|
|||
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
|
|
@ -62,15 +70,20 @@ github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8
|
|||
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=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
|
||||
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
||||
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
|
||||
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
||||
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||
golang.org/x/arch v0.21.0 h1:iTC9o7+wP6cPWpDWkivCvQFGAHDQ59SrSxsLPcnkArw=
|
||||
|
|
|
|||
115
backend/main.go
115
backend/main.go
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
// "crypto/rand"
|
||||
|
|
@ -10,11 +11,12 @@ import (
|
|||
// "encoding/base64"
|
||||
// "encoding/pem"
|
||||
// "errors"
|
||||
// "os"
|
||||
"os"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
// DEV
|
||||
|
|
@ -26,6 +28,11 @@ var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
|||
// var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
||||
|
||||
func main() {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.Fatal("Error loading .env file")
|
||||
}
|
||||
|
||||
connect()
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +103,35 @@ func connect() {
|
|||
}
|
||||
c.JSON(http.StatusOK, gin.H{"result": true})
|
||||
|
||||
case "get-listopapproval-occupancy":
|
||||
var result2 string
|
||||
|
||||
array := []string{}
|
||||
array2 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(o.controlNo, '') 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 occupancy o JOIN customer c ON o.customerid = c.customerid JOIN ref_occupancy_type ot ON o.ref_occupancy_typeid = ot.ref_occupancy_typeid JOIN ref_occupancy ro ON ot.ref_occupancyid = ro.ref_occupancyid JOIN occupancydocflowtxn od ON o.occupancyid = od.occupancyreceivingid
|
||||
JOIN (SELECT occupancyreceivingid, MAX(occupancydocflowtxnid) AS latest_occupancydocflowtxnid FROM occupancydocflowtxn GROUP BY occupancyreceivingid) latest_doc ON od.occupancyreceivingid = latest_doc.occupancyreceivingid AND od.occupancydocflowtxnid = latest_doc.latest_occupancydocflowtxnid WHERE remarks = ? AND is_approve = 0 ORDER BY od.txndate DESC`, "FOR OCCUPANCY RECOMMENDING APPROVAL")
|
||||
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-listopapproval-electrical":
|
||||
var result2 string
|
||||
|
||||
|
|
@ -202,9 +238,10 @@ func connect() {
|
|||
})
|
||||
|
||||
case "get-list-registered":
|
||||
headId := os.Getenv("HEADID")
|
||||
array := []string{}
|
||||
|
||||
results, err := db.Query("SELECT IFNULL(employeeid, 0) AS result FROM esign WHERE employeeid <> ?", 276)
|
||||
results, err := db.Query("SELECT IFNULL(employeeid, 0) AS result FROM esign WHERE employeeid <> ?", headId)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
|
|
@ -528,6 +565,28 @@ func connect() {
|
|||
"result": result,
|
||||
})
|
||||
|
||||
case "get-idbyapplication-building":
|
||||
err := db.QueryRow(`SELECT IFNULL(receivingid, '') AS result FROM receiving WHERE applicationNo = ?`, 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,
|
||||
})
|
||||
|
||||
case "get-idbyapplication-occupancy":
|
||||
err := db.QueryRow(`SELECT IFNULL(occupancyid, '') AS result FROM occupancy WHERE controlNo = ?`, 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,
|
||||
})
|
||||
|
||||
case "get-idbyapplication-electrical":
|
||||
err := db.QueryRow(`SELECT IFNULL(electricalid, '') AS result FROM electrical WHERE electricalNo = ?`, data).Scan(&result)
|
||||
if err != nil {
|
||||
|
|
@ -753,6 +812,56 @@ func connect() {
|
|||
"result": result,
|
||||
})
|
||||
|
||||
case "get-popsdetails-occupancy":
|
||||
var result2, result3, result4, result5, result6, result7, result8, result9 string
|
||||
array := []string{}
|
||||
array2 := []string{}
|
||||
array3 := []string{}
|
||||
array4 := []string{}
|
||||
array5 := []string{}
|
||||
array6 := []string{}
|
||||
array7 := []string{}
|
||||
array8 := []string{}
|
||||
array9 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(o.controlNo, '') AS result, IFNULL(c.customerid, 0) AS result2, IFNULL(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 result3,
|
||||
IFNULL(r.locationofconstruction, '') AS result4, IFNULL(op.amount, '') AS result5, IFNULL(op.amt_Gflgu, '') AS result6, IFNULL(op.amt_Gfdpwh, '') AS result7, IFNULL(op.amt_Tfbo, '') AS result8, IFNULL(ref.accountcode, '') AS result9
|
||||
FROM occupancy o JOIN receiving r ON o.bldgApplicationNo = r.applicationNo JOIN customer c ON r.customerid = c.customerid JOIN occupancy_orderofpayment op ON o.occupancyid = op.occupancyid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
WHERE o.occupancyid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?)`, 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, &result4, &result5, &result6, &result7, &result8, &result9)
|
||||
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)
|
||||
array9 = append(array9, result9)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": array,
|
||||
"result2": array2,
|
||||
"result3": array3,
|
||||
"result4": array4,
|
||||
"result5": array5,
|
||||
"result6": array6,
|
||||
"result7": array7,
|
||||
"result8": array8,
|
||||
"result9": array9,
|
||||
})
|
||||
|
||||
case "get-popsdetails-electrical":
|
||||
var result2, result3, result4, result5, result6, result7, result8, result9 string
|
||||
array := []string{}
|
||||
|
|
@ -768,7 +877,7 @@ func connect() {
|
|||
results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.customerid, 0) AS result2, IFNULL(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 result3,
|
||||
IFNULL(e.locationofinstallation, '') AS result4, IFNULL(op.amount, '') AS result5, IFNULL(op.amt_Gflgu, '') AS result6, IFNULL(op.amt_Gfdpwh, '') AS result7, IFNULL(op.amt_Tfbo, '') AS result8, IFNULL(ref.accountcode, '') AS result9
|
||||
FROM electrical e JOIN customer c ON e.customerid = c.customerid JOIN electrical_orderofpayment_new op ON e.electricalid = op.electricalid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
WHERE e.electricalid = ?`, data)
|
||||
WHERE e.electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?)`, data)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<meta name="name" content="OCBO e-Sign" />
|
||||
<meta name="description" content="Digital Signature added for OCBO (Office of the City Building Official)" />
|
||||
<meta name="description" content="Digital Signature for OCBO (Office of the City Building Official)" />
|
||||
<meta name="title" property="og:title" content="OCBO e-Sign" />
|
||||
<meta name="keywords" content="HTML, CSS, JavaScript" />
|
||||
<meta name="developer" content="Patrick Alvin Alcala" />
|
||||
<meta name="designer" content="Patrick Alvin Alcala" />
|
||||
<meta property="og:description" content="Digital Signature added for OCBO (Office of the City Building Official)" />
|
||||
<meta property="og:description" content="Digital Signature for OCBO (Office of the City Building Official)" />
|
||||
<meta property="og:type" content="website" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
|
||||
<title>OCBO e-Sign</title>
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ export default () => {
|
|||
// const [amountList, setAmountList] = createSignal<string[]>([])
|
||||
// const [dateOpList, setDateOpList] = createSignal<string[]>([])
|
||||
|
||||
const [applicationList, setApplicationList] = createSignal<string[]>([])
|
||||
const [nameList, setNameList] = createSignal<string[]>([])
|
||||
const [applicationListElectrical, setApplicationListElectrical] = createSignal<string[]>([])
|
||||
const [nameListElectrical, setNameListElectrical] = createSignal<string[]>([])
|
||||
const [applicationListOccupancy, setApplicationListOccupancy] = createSignal<string[]>([])
|
||||
const [nameListOccupancy, setNameListOccupancy] = createSignal<string[]>([])
|
||||
|
||||
const [errorMessage, setErrorMessage] = createSignal('')
|
||||
const [connected, setConnected] = createSignal(true)
|
||||
|
|
@ -50,38 +52,73 @@ export default () => {
|
|||
|
||||
const getListForApproval = async () => {
|
||||
try {
|
||||
const response = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
||||
setApplicationList(response.result)
|
||||
setNameList(response.result2)
|
||||
const responseE = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
||||
setApplicationListElectrical(responseE.result)
|
||||
setNameListElectrical(responseE.result2)
|
||||
|
||||
const responseO = await ofetch(API + 'get-listopapproval-occupancy', { parseResponse: JSON.parse })
|
||||
setApplicationListOccupancy(responseO.result)
|
||||
setNameListOccupancy(responseO.result2)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
const load = async () => {
|
||||
const getListForApprovalElectrical = async () => {
|
||||
try {
|
||||
const responseE = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
||||
setApplicationListElectrical(responseE.result)
|
||||
setNameListElectrical(responseE.result2)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
const getListForApprovalOccupancy = async () => {
|
||||
try {
|
||||
const responseO = await ofetch(API + 'get-listopapproval-occupancy', { parseResponse: JSON.parse })
|
||||
setApplicationListOccupancy(responseO.result)
|
||||
setNameListOccupancy(responseO.result2)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
const load = async (division: string) => {
|
||||
setConnected(await checkConnection())
|
||||
if (connected() === false) {
|
||||
setErrorMessage('Could not gather list of applicaitons')
|
||||
return
|
||||
}
|
||||
|
||||
await getListForApproval()
|
||||
if (division === 'electrical') {
|
||||
await getListForApprovalElectrical()
|
||||
}
|
||||
if (division === 'occupancy') {
|
||||
await getListForApprovalOccupancy()
|
||||
} else {
|
||||
await getListForApproval()
|
||||
}
|
||||
}
|
||||
|
||||
const getopdetails = async (applicationNo: string) => {
|
||||
const op = await ofetch(API + 'get-opdetails-electrical/' + applicationNo, { parseResponse: JSON.parse })
|
||||
setAssessor(op.result7[0])
|
||||
setLocation(op.result5[0])
|
||||
setType(op.result6[0])
|
||||
setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY'))
|
||||
setApplicationId(op.result11[0])
|
||||
// setAssessorId(op.result12[0])
|
||||
setTotalOp(calculateTotal(op.result9))
|
||||
|
||||
// setDescriptionList(op.result8)
|
||||
// setAmountList(op.result9)
|
||||
// setDateOpList(op.result10)
|
||||
// calculateAmounts()
|
||||
const getopdetails = async (division: string, applicationNo: string) => {
|
||||
if (division === 'electrical') {
|
||||
const op = await ofetch(API + 'get-opdetails-electrical/' + applicationNo, { parseResponse: JSON.parse })
|
||||
setAssessor(op.result7[0])
|
||||
setLocation(op.result5[0])
|
||||
setType(op.result6[0])
|
||||
setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY'))
|
||||
setApplicationId(op.result11[0])
|
||||
setTotalOp(calculateTotal(op.result9))
|
||||
} else if (division === 'occupancy') {
|
||||
const op = await ofetch(API + 'get-opdetails-occupancy/' + applicationNo, { parseResponse: JSON.parse })
|
||||
setAssessor(op.result7[0])
|
||||
setLocation(op.result5[0])
|
||||
setType(op.result6[0])
|
||||
setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY'))
|
||||
setApplicationId(op.result11[0])
|
||||
setTotalOp(calculateTotal(op.result9))
|
||||
}
|
||||
}
|
||||
|
||||
const calculateTotal = (list: number[]) => {
|
||||
|
|
@ -217,11 +254,7 @@ export default () => {
|
|||
|
||||
const closeNotification = async () => {
|
||||
setApproved(false)
|
||||
await load()
|
||||
}
|
||||
|
||||
const openPDF = () => {
|
||||
createPdf()
|
||||
await load('all')
|
||||
}
|
||||
|
||||
const removeEmployee = () => {
|
||||
|
|
@ -280,8 +313,14 @@ export default () => {
|
|||
}
|
||||
}
|
||||
|
||||
const refresh = async () => {
|
||||
await load()
|
||||
const refresh = async (division: string) => {
|
||||
if (division === 'electrical') {
|
||||
await load('electrical')
|
||||
} else if (division === 'occupancy') {
|
||||
await load('occupancy')
|
||||
} else {
|
||||
await load('all')
|
||||
}
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
|
|
@ -293,7 +332,7 @@ export default () => {
|
|||
const logged = await checkLogged()
|
||||
|
||||
if (logged) {
|
||||
await load()
|
||||
await load('all')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -361,33 +400,12 @@ export default () => {
|
|||
</Tabs.Content>
|
||||
<Tabs.Content class="tabs__content" value="occupancy">
|
||||
<Row>
|
||||
{/* <h2>List of Ready to Approve and Sign Occupancy Order of Payments</h2> */}
|
||||
<Box curved thickness={0} background="#602a2abf" padding="1rem 2rem">
|
||||
<h2>Under Development</h2>
|
||||
</Box>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<table class="table">
|
||||
<thead>
|
||||
{/* <tr>
|
||||
<th>Application Number</th>
|
||||
<th>Name</th>
|
||||
<th style="text-align: center">Show Details</th>
|
||||
</tr> */}
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</Row>
|
||||
</Tabs.Content>
|
||||
<Tabs.Content class="tabs__content" value="electrical">
|
||||
<Row>
|
||||
<h2 onClick={openPDF}>List of Ready to Approve and Sign in Electrical Order of Payments</h2>
|
||||
<h2>List of Ready to Approve and Sign Occupancy Order of Payments</h2>
|
||||
</Row>
|
||||
|
||||
<Padding top={0} bottom={0} right={10} left={0}>
|
||||
<Row content="right">
|
||||
<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('occupancy')}></Button>
|
||||
</Row>
|
||||
</Padding>
|
||||
|
||||
|
|
@ -401,10 +419,10 @@ export default () => {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{applicationList().map((item, index) => (
|
||||
{applicationListOccupancy().map((item, index) => (
|
||||
<tr>
|
||||
<td>{item}</td>
|
||||
<td>{nameList()[index]}</td>
|
||||
<td>{nameListOccupancy()[index]}</td>
|
||||
|
||||
<td>
|
||||
<ModalButton
|
||||
|
|
@ -414,7 +432,7 @@ export default () => {
|
|||
background="#121e2acc"
|
||||
color="#ffffffec"
|
||||
function={async () => {
|
||||
await getopdetails(item)
|
||||
await getopdetails('occupancy', item)
|
||||
}}
|
||||
>
|
||||
<Padding top={0} left={2} right={2} bottom={0}>
|
||||
|
|
@ -423,7 +441,94 @@ export default () => {
|
|||
<Padding top={1} left={0} right={0} bottom={0}>
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Name of Applicant:</span>
|
||||
<span class="modal__row__detail">{nameList()[index]}</span>
|
||||
<span class="modal__row__detail">{nameListOccupancy()[index]}</span>
|
||||
</section>
|
||||
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Location:</span>
|
||||
<span class="modal__row__detail">{location()}</span>
|
||||
</section>
|
||||
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Type:</span>
|
||||
<span class="modal__row__detail">{type().toUpperCase()}</span>
|
||||
</section>
|
||||
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Assessed By:</span>
|
||||
<span class="modal__row__detail">{assessor()}</span>
|
||||
</section>
|
||||
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Date Assessed:</span>
|
||||
<span class="modal__row__detail">{dateOp().toUpperCase()}</span>
|
||||
</section>
|
||||
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Total Fee:</span>
|
||||
<span class="modal__row__detail__price">
|
||||
{PESO} {totalOp().toFixed(2)}
|
||||
</span>
|
||||
</section>
|
||||
</Padding>
|
||||
|
||||
<Row padding="2rem 0 0 0">
|
||||
<Button wide label="Approve" edges="curved" design="bo-primary" onClick={() => approveHandler(item)}></Button>
|
||||
<span class="modal__cancel">Click anywhere to cancel</span>
|
||||
</Row>
|
||||
</Padding>
|
||||
</ModalButton>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</Row>
|
||||
</Tabs.Content>
|
||||
<Tabs.Content class="tabs__content" value="electrical">
|
||||
<Row>
|
||||
<h2>List of Ready to Approve and Sign in Electrical Order of Payments</h2>
|
||||
</Row>
|
||||
|
||||
<Padding top={0} bottom={0} right={10} left={0}>
|
||||
<Row content="right">
|
||||
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={() => refresh('electrical')}></Button>
|
||||
</Row>
|
||||
</Padding>
|
||||
|
||||
<Row>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Application Number</th>
|
||||
<th>Name</th>
|
||||
<th style="text-align: center">Show Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{applicationListElectrical().map((item, index) => (
|
||||
<tr>
|
||||
<td>{item}</td>
|
||||
<td>{nameListElectrical()[index]}</td>
|
||||
|
||||
<td>
|
||||
<ModalButton
|
||||
class="modal"
|
||||
label="Show Details"
|
||||
design="bo-link"
|
||||
background="#121e2acc"
|
||||
color="#ffffffec"
|
||||
function={async () => {
|
||||
await getopdetails('electrical', item)
|
||||
}}
|
||||
>
|
||||
<Padding top={0} left={2} right={2} bottom={0}>
|
||||
<span class="modal__application-number">{item}</span>
|
||||
|
||||
<Padding top={1} left={0} right={0} bottom={0}>
|
||||
<section class="modal__row">
|
||||
<span class="modal__row__label">Name of Applicant:</span>
|
||||
<span class="modal__row__detail">{nameListElectrical()[index]}</span>
|
||||
</section>
|
||||
|
||||
<section class="modal__row">
|
||||
|
|
|
|||
22
src/utils/functions/postApi.ts
Normal file
22
src/utils/functions/postApi.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { ofetch } from 'ofetch'
|
||||
import { SHA3 } from 'crypto-js'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
|
||||
export default async (api: string, body: Object) => {
|
||||
|
||||
try {
|
||||
await ofetch(API + api, {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Cache-Control': 'no-cache',
|
||||
'OCBO-Token': '',
|
||||
},
|
||||
method: 'POST',
|
||||
body: body,
|
||||
})
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue