Compare commits

...

7 commits

11 changed files with 167 additions and 361 deletions

View file

@ -2,7 +2,6 @@ package main
import ( import (
"database/sql" "database/sql"
"log"
"net/http" "net/http"
"strings" "strings"
@ -76,9 +75,6 @@ func connect() {
c.Writer.Header().Set("Referrer-Policy", "no-referrer") c.Writer.Header().Set("Referrer-Policy", "no-referrer")
c.Writer.Header().Set("Server", "Batman") c.Writer.Header().Set("Server", "Batman")
log.Println("Method", method)
// log.Println("Data", data)
switch method { switch method {
case "test": case "test":
err = db.QueryRow("SELECT employeename FROM employee WHERE uname = 'TEST'").Scan(&result) err = db.QueryRow("SELECT employeename FROM employee WHERE uname = 'TEST'").Scan(&result)
@ -98,6 +94,26 @@ func connect() {
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"result": "Connection is OK", "result": "Connection is OK",
}) })
case "get-listopapproval-electrical":
array := []string{}
results, err := db.Query("SELECT DISTINCT electricalid FROM electricaldocflowtxn WHERE remarks = 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL'")
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
})
} }
}) })
@ -113,9 +129,6 @@ func connect() {
c.Writer.Header().Set("X-Download-Options", "noopen") c.Writer.Header().Set("X-Download-Options", "noopen")
c.Writer.Header().Set("Referrer-Policy", "no-referrer") c.Writer.Header().Set("Referrer-Policy", "no-referrer")
log.Println("Method", method)
log.Println("Data", data)
switch method { switch method {
case "check-building": case "check-building":
err = db.QueryRow("SELECT COUNT(receivingid) AS result FROM receiving WHERE applicationNo = ?", data).Scan(&result) err = db.QueryRow("SELECT COUNT(receivingid) AS result FROM receiving WHERE applicationNo = ?", data).Scan(&result)
@ -167,7 +180,7 @@ func connect() {
"result": result, "result": result,
}) })
case "GetOwnerNameBuilding": case "get-owner-building":
var result2, result3, result4, result5, result6 string var result2, result3, result4, result5, result6 string
err = db.QueryRow("SELECT IFNULL(c.firstName, '') AS result, IFNULL(c.middleInitial, '') AS result2, IFNULL(c.lastName, '') AS result3, IFNULL(rp.block, '') AS result4, IFNULL(rp.lot, '') AS result5, IFNULL(rp.address, '') AS result6 FROM customer c, receiving r, receiving_permitnoaddress rp WHERE r.customerid = c.customerid AND r.receivingid = rp.receivingid AND r.applicationNo = ?", data).Scan(&result, &result2, &result3, &result4, &result5, &result6) err = db.QueryRow("SELECT IFNULL(c.firstName, '') AS result, IFNULL(c.middleInitial, '') AS result2, IFNULL(c.lastName, '') AS result3, IFNULL(rp.block, '') AS result4, IFNULL(rp.lot, '') AS result5, IFNULL(rp.address, '') AS result6 FROM customer c, receiving r, receiving_permitnoaddress rp WHERE r.customerid = c.customerid AND r.receivingid = rp.receivingid AND r.applicationNo = ?", data).Scan(&result, &result2, &result3, &result4, &result5, &result6)
@ -184,7 +197,7 @@ func connect() {
"result6": result6, "result6": result6,
}) })
case "GetOwnerNameOccupancy": case "get-owner-occupancy":
var result2, result3, result4 string var result2, result3, result4 string
err = db.QueryRow("SELECT IFNULL(c.firstName, '') AS result, IFNULL(c.middleInitial, '') AS result2, IFNULL(c.lastName, '') AS result3, IFNULL(c.address, '') AS result4 FROM customer c, receiving r, occupancy o WHERE r.customerid = c.customerid AND r.applicationNo = o.bldgApplicationNo AND o.controlNo = ?", data).Scan(&result, &result2, &result3, &result4) err = db.QueryRow("SELECT IFNULL(c.firstName, '') AS result, IFNULL(c.middleInitial, '') AS result2, IFNULL(c.lastName, '') AS result3, IFNULL(c.address, '') AS result4 FROM customer c, receiving r, occupancy o WHERE r.customerid = c.customerid AND r.applicationNo = o.bldgApplicationNo AND o.controlNo = ?", data).Scan(&result, &result2, &result3, &result4)
@ -199,42 +212,7 @@ func connect() {
"result4": result4, "result4": result4,
}) })
// } else if method == "GetOwnerNameSignage" { case "get-owner-electrical":
// var result2, result3, result4 string
// err = db.QueryRow("SELECT c.firstName AS result, c.middleInitial AS result2, c.lastName AS result3, c.address AS result4 FROM customer c, signage s WHERE s.customerid = c.customerid AND s.signApplicationNo = ?", data).Scan(&result, &result2, &result3, &result4)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// result, err := encrypt(result)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result2, err := encrypt(result2)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result3, err := encrypt(result3)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result4, err := encrypt(result4)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// })
case "GetOwnerNameElectrical":
var result2, result3, result4 string var result2, result3, result4 string
err = db.QueryRow("SELECT c.firstName AS result, c.middleInitial AS result2, c.lastName AS result3, c.address AS result4 FROM customer c, electrical e WHERE e.customerid = c.customerid AND e.electricalNo = ?", data).Scan(&result, &result2, &result3, &result4) err = db.QueryRow("SELECT c.firstName AS result, c.middleInitial AS result2, c.lastName AS result3, c.address AS result4 FROM customer c, electrical e WHERE e.customerid = c.customerid AND e.electricalNo = ?", data).Scan(&result, &result2, &result3, &result4)
@ -249,42 +227,7 @@ func connect() {
"result4": result4, "result4": result4,
}) })
// } else if method == "GetOwnerNameMech" { case "get-status-building":
// var result2, result3, result4 string
// err = db.QueryRow("SELECT c.firstName AS result, c.middleInitial AS result2, c.lastName AS result3, c.address AS result4 FROM customer c, mechanical m WHERE m.customerid = c.customerid AND m.mechApplicationNo= ?", data).Scan(&result, &result2, &result3, &result4)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// result, err := encrypt(result)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result2, err := encrypt(result2)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result3, err := encrypt(result3)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result4, err := encrypt(result4)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// })
case "GetStatusBuilding":
var result2 string var result2 string
array := []string{} array := []string{}
@ -302,16 +245,6 @@ func connect() {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error()) c.String(http.StatusBadRequest, err.Error())
} }
// result, err := encrypt(result)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result2, err := encrypt(result2)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
array = append(array, result) array = append(array, result)
array2 = append(array2, result2) array2 = append(array2, result2)
} }
@ -320,7 +253,7 @@ func connect() {
"result2": array2, "result2": array2,
}) })
case "GetStatusOccupancy": case "get-status-occupancy":
var result2 string var result2 string
array := []string{} array := []string{}
@ -346,33 +279,7 @@ func connect() {
"result2": array2, "result2": array2,
}) })
case "GetStatusSign": case "get-status-electrical":
var result2 string
array := []string{}
array2 := []string{}
results, err := db.Query(`SELECT DATE_FORMAT(b.txndate, '%M %d, %Y') AS result, b.remarks AS result2
FROM signagedocflowtxn b, signage s WHERE s.signageid = b.signageid AND s.signApplicationNo = ? ORDER BY b.signagedocflowtxnid DESC`, data)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result, &result2)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
array2 = append(array2, result2)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
})
case "GetStatusElectrical":
var result2 string var result2 string
array := []string{} array := []string{}
@ -398,43 +305,7 @@ func connect() {
"result2": array2, "result2": array2,
}) })
// } else if method == "GetTableDataMech" { case "get-list-clients":
// var result2 string
// array := []string{}
// array2 := []string{}
// results, err := db.Query(`SELECT DATE_FORMAT(b.txndate, '%M %d, %Y') AS result, b.remarks AS result2
// FROM mechanicaldocflowtxn b, mechanical m WHERE m.mechanicalid = b.mechanicalid AND m.mechApplicationNo = ? ORDER BY b.mechanicaldocflowtxnid DESC`, data)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// for results.Next() {
// err = results.Scan(&result, &result2)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// result, err := encrypt(result)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// result2, err := encrypt(result2)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// array = append(array, result)
// array2 = append(array2, result2)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// })
case "GetListOfClients":
var result2, result3, result4 string var result2, result3, result4 string
array := []string{} array := []string{}
@ -465,96 +336,7 @@ func connect() {
"result4": array4, "result4": array4,
}) })
// } else if method == "GetBuilding2" { case "get-laststatus-building":
// var result2, result3, result4 string
// err := db.QueryRow(`SELECT e.applicationNo AS result, IF (c.firstName IS NULL or c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName, c.lastName)) AS result2, e.locationofconstruction AS result3, d.remarks AS result4 FROM receiving e, customer c, docflowtxn d WHERE e.customerid = c.customerid AND e.receivingid = d.receivingid AND d.docflowtxnid = (SELECT MAX(docflowtxnid) FROM docflowtxn WHERE receivingid = ?)`, data).Scan(&result, &result2, &result3, &result4)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// })
// } else if method == "GetOccupancy2" {
// var result2, result3, result4 string
// err := db.QueryRow(`SELECT e.controlNo AS result, IF (c.firstName IS NULL or c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName, c.lastName)) AS result2, r.locationofconstruction AS result3, d.remarks AS result4 FROM occupancy e, customer c, occupancydocflowtxn d, receiving r
// WHERE e.customerid = c.customerid AND e.bldgApplicationNo = r.applicationNo AND e.occupancyid = d.occupancyreceivingid AND d.occupancydocflowtxnid = (SELECT MAX(occupancydocflowtxnid) FROM occupancydocflowtxn WHERE occupancyreceivingid = ?)`, data).Scan(&result, &result2, &result3, &result4)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// })
// } else if method == "GetElectrical2" {
// var result2, result3, result4 string
// err := db.QueryRow(`SELECT e.electricalNo AS result, IF (c.firstName IS NULL or c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName, c.lastName)) AS result2, e.locationofinstallation AS result3, d.remarks AS result4 FROM electrical e, customer c, electricaldocflowtxn d
// WHERE e.customerid = c.customerid AND e.electricalid = d.electricalid AND d.electricaldocflowtxnid = (SELECT MAX(electricaldocflowtxnid) FROM electricaldocflowtxn WHERE electricalid = ?)`, data).Scan(&result, &result2, &result3, &result4)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// })
// } else if method == "Update" {
// err := db.QueryRow(`SELECT receivingid AS result FROM receiving`, data).Scan(&result)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetMax" {
// err := db.QueryRow(`SELECT MAX(docflowtxnid) AS result FROM docflowtxn WHERE receivingid = ?`, data).Scan(&result)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetAllYear" {
// var result2, result3, result4, result5 string
// err := db.QueryRow(`SELECT r.applicationNo AS result, r.receivedate AS result2, IF(c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName)) AS result3, c.address AS result4, w.whereabouts as result5 FROM receiving r, customer c, whereabouts w, building_laststatus l, docflowtxn d WHERE r.customerid = c.customerid AND r.receivingid = l.receivingid and l.statusid = d.docflowtxnid and d.tagword = w.tagword and r.applicationNo LIKE ?`, data+"%").Scan(&result, &result2, &result3, &result4, &result5)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// "result5": result5,
// })
case "GetLastStatusBuilding":
err := db.QueryRow(`SELECT IFNULL(remarks, '') AS result FROM docflowtxn WHERE docflowtxnid = (SELECT MAX(docflowtxnid) FROM docflowtxn WHERE receivingid = ?)`, data).Scan(&result) err := db.QueryRow(`SELECT IFNULL(remarks, '') AS result FROM docflowtxn WHERE docflowtxnid = (SELECT MAX(docflowtxnid) FROM docflowtxn WHERE receivingid = ?)`, data).Scan(&result)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
@ -565,7 +347,7 @@ func connect() {
"result": result, "result": result,
}) })
case "GetLastStatusOccupancy": case "get-laststatus-occupancy":
err := db.QueryRow(`SELECT remarks AS result FROM occupancydocflowtxn WHERE occupancydocflowtxnid = (SELECT MAX(occupancydocflowtxnid) FROM occupancydocflowtxn WHERE occupancyreceivingid = ?)`, data).Scan(&result) err := db.QueryRow(`SELECT remarks AS result FROM occupancydocflowtxn WHERE occupancydocflowtxnid = (SELECT MAX(occupancydocflowtxnid) FROM occupancydocflowtxn WHERE occupancyreceivingid = ?)`, data).Scan(&result)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
@ -575,7 +357,7 @@ func connect() {
"result": result, "result": result,
}) })
case "GetLastStatusElectrical": case "get-laststatus-electrical":
err := db.QueryRow(`SELECT remarks AS result FROM electricaldocflowtxn WHERE electricaldocflowtxnid = (SELECT MAX(electricaldocflowtxnid) FROM electricaldocflowtxn WHERE electricalid = ?)`, data).Scan(&result) err := db.QueryRow(`SELECT remarks AS result FROM electricaldocflowtxn WHERE electricaldocflowtxnid = (SELECT MAX(electricaldocflowtxnid) FROM electricaldocflowtxn WHERE electricalid = ?)`, data).Scan(&result)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
@ -585,31 +367,7 @@ func connect() {
"result": result, "result": result,
}) })
// } else if method == "GetApplications" { case "get-applicationbyid-building":
// err := db.QueryRow(`SELECT applicationNo AS result FROM receiving WHERE applicationNo LIKE ?`, data).Scan(&result)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetInformation" {
// err := db.QueryRow(`SELECT r.applicationNo AS result, IF (r.receivedate IS NULL, r.receivezoning, r.receivedate) AS result2, IF(c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName)) AS result3, c.address
// AS result4, d.remarks AS result5 FROM receiving r, customer c, docflowtxn d WHERE r.customerid = c.customerid AND r.receivingid = d.receivingid
// AND d.docflowtxnid = (SELECT MAX(docflowtxnid) FROM docflowtxn WHERE receivingid = (SELECT receivingid FROM receiving WHERE applicationNo = ?))`, data).Scan(&result)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
case "GetApplicationByID":
err := db.QueryRow(`SELECT applicationNo AS result FROM receiving WHERE receivingid = ?`, data).Scan(&result) err := db.QueryRow(`SELECT applicationNo AS result FROM receiving WHERE receivingid = ?`, data).Scan(&result)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
@ -619,7 +377,7 @@ func connect() {
"result": result, "result": result,
}) })
case "GetOccupancyApplicationByID": case "get-applicationbyid-occupancy":
err := db.QueryRow(`SELECT controlNo AS result FROM occupancy WHERE occupancyid = ?`, data).Scan(&result) err := db.QueryRow(`SELECT controlNo AS result FROM occupancy WHERE occupancyid = ?`, data).Scan(&result)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
@ -629,7 +387,7 @@ func connect() {
"result": result, "result": result,
}) })
case "GetElectricalApplicationByID": case "get-applicationbyid-electrical":
err := db.QueryRow(`SELECT electricalNo AS result FROM electrical WHERE electricalid = ?`, data).Scan(&result) err := db.QueryRow(`SELECT electricalNo AS result FROM electrical WHERE electricalid = ?`, data).Scan(&result)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
@ -639,62 +397,6 @@ func connect() {
"result": result, "result": result,
}) })
// } else if method == "GetIDByApplication" {
// err := db.QueryRow(`SELECT receivingid AS result FROM receiving WHERE applicationNo = ?`, data).Scan(&result)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetOrderofPayment" {
// var result2, result3, result4, result5, result6 string
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// array4 := []string{}
// array5 := []string{}
// array6 := []string{}
// results, err := db.Query(`SELECT bo.amount AS result, bo.is_approve AS result2, bo.for_approval AS result3, bo.is_paid AS result4, IFNULL(bo.orNo, "") AS result5, r.accountdescription AS result6 FROM building_orderofpayment bo, ref_bldgcomputationsheet r WHERE bo.bldgApplicationNo = ? AND bo.ref_bldgcomputationsheetid = r.ref_bldgcomputationsheetid`, data)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// for results.Next() {
// err = results.Scan(&result, &result2, &result3, &result4, &result5, &result6)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// result, _ := encrypt(result)
// result2, _ := encrypt(result2)
// result3, _ := encrypt(result3)
// result4, _ := encrypt(result4)
// result5, _ := encrypt(result5)
// result6, _ := encrypt(result6)
// array = append(array, result)
// array2 = append(array2, result2)
// array3 = append(array3, result3)
// array4 = append(array4, result4)
// array5 = append(array5, result5)
// array6 = append(array6, result6)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// "result3": array3,
// "result4": array4,
// "result5": array5,
// "result6": array6,
// })
case "GetFeesBuilding": case "GetFeesBuilding":
var result2, result3 string var result2, result3 string
array := []string{} array := []string{}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Before After
Before After

View file

@ -20,6 +20,7 @@
"gsap": "^3.13.0", "gsap": "^3.13.0",
"lightningcss": "^1.30.1", "lightningcss": "^1.30.1",
"nanostores": "^1.0.1", "nanostores": "^1.0.1",
"ofetch": "^1.4.1",
"purgecss": "^7.0.2", "purgecss": "^7.0.2",
"sharp": "^0.34.4", "sharp": "^0.34.4",
"solid-icons": "^1.1.0", "solid-icons": "^1.1.0",

3
pnpm-lock.yaml generated
View file

@ -38,6 +38,9 @@ importers:
nanostores: nanostores:
specifier: ^1.0.1 specifier: ^1.0.1
version: 1.0.1 version: 1.0.1
ofetch:
specifier: ^1.4.1
version: 1.4.1
purgecss: purgecss:
specifier: ^7.0.2 specifier: ^7.0.2
version: 7.0.2 version: 7.0.2

View file

@ -0,0 +1,23 @@
@use '/src/styles/variables.sass' as vars
@use 'sass:color'
.table
width: 100%
border-collapse: collapse
margin: 2rem
th, td
border: 1px solid vars.$tableBorderColor
padding: 0.75rem
text-align: left
font-size: 1.1rem
td:nth-child(1)
width: 12rem
td:nth-child(3)
width: 9rem
th
background-color: vars.$tableHeaderBackground
color: white

View file

@ -0,0 +1,94 @@
import './Table.sass'
import { createSignal, onMount, Index, For } from 'solid-js'
import { ofetch } from 'ofetch'
import { Button } from '../../../fwt'
const api = import.meta.env.BACKEND
export default () => {
const [updatedList, setUpdatedList] = createSignal<string[]>([])
const getListOfReadyForApproval = async () => {
const response = await ofetch(api + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
return response.result
}
const getListOfReadyForApprovalFiltered = async (list: number[]) => {
let newList = []
for (let i = 0; i < 10; i++) {
const response = await ofetch(api + 'get-laststatus-electrical/' + list[i], { parseResponse: JSON.parse })
if (response.result === 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL') {
newList.push(list[i])
} else {
// console.log(response.result)
}
}
return [...newList]
}
const getApplicationById = async (list: number[]) => {
let applicationList: string[] = []
for (let i = 0; i < list.length; i++) {
const response = await ofetch(api + 'get-applicationbyid-electrical/' + list[i], { parseResponse: JSON.parse })
applicationList.push(response.result)
}
setUpdatedList([...applicationList])
}
const load = async () => {
const listOfReadyForApproval = await getListOfReadyForApproval()
const listOfReadyForApprovalFiltered = await getListOfReadyForApprovalFiltered(listOfReadyForApproval)
await getApplicationById(listOfReadyForApprovalFiltered)
console.log(updatedList())
}
load()
return (
<>
<table class="table">
<thead>
<tr>
<th>Application Number</th>
<th>Name</th>
</tr>
</thead>
<tbody>
{updatedList().map((item) => (
<tr>
<td>{item.slice(0, 1)}</td>
</tr>
))}
{/* <tr>
<td>111</td>
<td>11</td>
<td>
<Button label="Show Details" design="bu-ghost" />
</td>
</tr>
<tr>
<td>222</td>
<td>11</td>
<td>
<Button label="Show Details" design="bu-ghost" />
</td>
</tr> */}
</tbody>
</table>
</>
)
}
// ;<For each={instance.getPaginationRowModel().rows}>
// {(row) => (
// <tr {...row.getRowProps()}>
// <For each={row.getVisibleCells()}>{(cell) => <td {...cell.getCellProps()}>{cell.renderCell()}</td>}</For>
// </tr>
// )}
// </For>

View file

@ -11,13 +11,13 @@ import { Button, Logo, Box, Link, Page, Footer, Row, Column, Image, Copyright, O
<Display desktop tablet> <Display desktop tablet>
<Row content="split"> <Row content="split">
<Row content="left" gap={2}> <Row content="left" gap={2}>
<Logo size={140} /> <Logo size={200} />
<h1>OCBO e-Sign</h1> <h1>OCBO e-Sign</h1>
</Row> </Row>
<Row content="left" gap={1}> <Row content="left" gap={1}>
<Button label="Login" edges="curved" to="/login" /> <Button label="Login" edges="curved" design="bo-link" to="/login" />
<Button label="Register" edges="curved" to="/register" /> <Button label="Register" edges="curved" design="bo-primary" to="/register" />
</Row> </Row>
</Row> </Row>
</Display> </Display>

View file

@ -10,7 +10,7 @@ import { RiArrowsArrowGoBackLine } from 'solid-icons/ri'
<Row content="split"> <Row content="split">
<Display desktop tablet> <Display desktop tablet>
<Row content="left" gap={2}> <Row content="left" gap={2}>
<Logo size={140} /> <Logo size={200} />
<h1>OCBO e-Sign</h1> <h1>OCBO e-Sign</h1>
</Row> </Row>
</Display> </Display>

View file

@ -2,6 +2,8 @@
import Layout from '../layouts/Layout.astro' import Layout from '../layouts/Layout.astro'
import { Button, Logo, Link, Page, Footer, Row, Column, Image, Copyright, OptimizeLogo, Display, Padding, Modal } from '../../fwt/' import { Button, Logo, Link, Page, Footer, Row, Column, Image, Copyright, OptimizeLogo, Display, Padding, Modal } from '../../fwt/'
import { FiLogOut } from 'solid-icons/fi' import { FiLogOut } from 'solid-icons/fi'
import { ofetch } from 'ofetch'
import Table from '../components/Table/Table'
--- ---
<script> <script>
@ -32,7 +34,7 @@ import { FiLogOut } from 'solid-icons/fi'
<Row content="split"> <Row content="split">
<Display desktop tablet> <Display desktop tablet>
<Row content="left" gap={2}> <Row content="left" gap={2}>
<Logo size={140} /> <Logo size={200} />
<h1>OCBO e-Sign</h1> <h1>OCBO e-Sign</h1>
</Row> </Row>
</Display> </Display>
@ -47,7 +49,9 @@ import { FiLogOut } from 'solid-icons/fi'
<h2>List of Ready to Approve and Sign OP (Order of Payments)</h2> <h2>List of Ready to Approve and Sign OP (Order of Payments)</h2>
</Row> </Row>
<table class="table"> <Table client:load />
<!-- <table class="table">
<thead> <thead>
<tr> <tr>
<th>Application Number</th> <th>Application Number</th>
@ -57,7 +61,7 @@ import { FiLogOut } from 'solid-icons/fi'
<tbody> <tbody>
<tr> <tr>
<td>25-000011</td> <td>25-000011</td>
<td>Some Name</td> <td>123</td>
<td id="modal-button"><Button label="Show Details" design="bu-ghost" /></td> <td id="modal-button"><Button label="Show Details" design="bu-ghost" /></td>
</tr> </tr>
<tr> <tr>
@ -66,7 +70,7 @@ import { FiLogOut } from 'solid-icons/fi'
<td><Button label="Show Details" design="bu-ghost" /></td> <td><Button label="Show Details" design="bu-ghost" /></td>
</tr> </tr>
</tbody> </tbody>
</table> </table> -->
</Padding> </Padding>
</Page> </Page>
@ -94,25 +98,4 @@ import { FiLogOut } from 'solid-icons/fi'
.name .name
font-size: 1.25rem font-size: 1.25rem
.table
width: 100%
border-collapse: collapse
margin: 2rem
th, td
border: 1px solid vars.$tableBorderColor
padding: 0.75rem
text-align: left
font-size: 1.1rem
td:nth-child(1)
width: 12rem
td:nth-child(3)
width: 9rem
th
background-color: vars.$tableHeaderBackground
color: white
</style> </style>

View file

@ -9,7 +9,7 @@ import { Button, Logo, Link, Page, Footer, Row, Column, Image, Copyright, Optimi
<Display desktop tablet> <Display desktop tablet>
<Row content="split"> <Row content="split">
<Row content="left" gap={2}> <Row content="left" gap={2}>
<Logo size={140} /> <Logo size={200} />
<h1>OCBO e-Sign</h1> <h1>OCBO e-Sign</h1>
</Row> </Row>