Compare commits

..

8 commits

9 changed files with 178 additions and 788 deletions

View file

@ -4,8 +4,6 @@ import (
"database/sql"
"net/http"
"strings"
// "crypto/rand"
// "crypto/rsa"
// "crypto/x509"
@ -116,28 +114,23 @@ func connect() {
})
case "get-list-assessors":
var result2 string
array := []string{}
array2 := []string{}
results, err := db.Query("SELECT IFNULL(employeeid, '') AS result, IFNULL(employeename, '') AS result2 FROM employee WHERE is_assessment = ? AND is_delete = ? AND employeename NOT LIKE ? AND employeename NOT LIKE ? AND employeename NOT LIKE ?", 1, 0, "%OFFICE%", "%TEST%", "%SAMPLE%")
results, err := db.Query("SELECT IFNULL(employeename, '') AS result FROM employee WHERE is_assessment = ? AND is_delete = ? AND NOT (employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ?) AND employeeid NOT IN (?, ?, ?, ?, ?, ?, ?, ?, ?)", 1, 0, "%OFFICE%", "%TEST%", "%SAMPLE%", 55, 68, 120, 136, 103, 233, 235, 243, 310)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result, &result2)
err = results.Scan(&result)
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,
"result": array,
})
case "get-list-approvers":
@ -146,7 +139,7 @@ func connect() {
array := []string{}
array2 := []string{}
results, err := db.Query("SELECT IFNULL(employeeid, '') AS result, IFNULL(employeename, '') AS result2 FROM employee WHERE is_finalapprover = ? AND is_delete = ? AND NOT (employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ?)", 1, 0, "%OFFICE%", "%TEST%", "%SAMPLE%", "%BUILDING%", "%OCCUPANCY%")
results, err := db.Query("SELECT IFNULL(employeeid, '') AS result, IFNULL(employeename, '') AS result2 FROM employee WHERE is_finalapprover = ? AND is_delete = ? AND NOT (employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ? OR employeename LIKE ?) AND employeeid NOT IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", 1, 0, "%OFFICE%", "%TEST%", "%SAMPLE%", "%BUILDING%", "%OCCUPANCY%", 124, 141, 178, 14, 77, 82, 83, 129, 137, 144, 169, 233, 247, 267, 282)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
@ -446,776 +439,8 @@ func connect() {
c.JSON(http.StatusOK, gin.H{
"result": result,
})
case "GetFeesBuilding":
var result2, result3 string
array := []string{}
array2 := []string{}
array3 := []string{}
results, err := db.Query(`SELECT r.accountdescription AS result, bo.amount AS result2, bo.is_paid AS result3 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)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
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 "GetFeesOccupancy":
var result2, result3 string
array := []string{}
array2 := []string{}
array3 := []string{}
results, err := db.Query(`SELECT r.accountdescription AS result, oo.amount AS result2, oo.is_paid AS result3 FROM occupancy_orderofpayment oo, ref_bldgcomputationsheet r WHERE oo.ref_bldgcomputationsheetid = r.ref_bldgcomputationsheetid AND oo.occupancyid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?)`, data)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result, &result2, &result3)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
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 "GetFeesElectrical":
var result2, result3 string
array := []string{}
array2 := []string{}
array3 := []string{}
results, err := db.Query(`SELECT r.accountdescription AS result, eo.amount AS result2, eo.is_paid AS result3 FROM electrical_orderofpayment_new eo, ref_bldgcomputationsheet r WHERE eo.ref_bldgcomputationsheetid = r.ref_bldgcomputationsheetid AND eo.electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?)`, data)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result, &result2, &result3)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
array2 = append(array2, result2)
array3 = append(array3, result3)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
"result3": array3,
})
// } else if method == "GetProgressFlowBuilding" {
// var result2, result3, result4 string
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// array4 := []string{}
// results, err := db.Query(`SELECT IFNULL(rp.progressflow, '') AS result, IFNULL(p.dateIn, '') AS result2, IFNULL(p.dateReturn, '') AS result3, IFNULL(p.accomplish, '') AS result4 FROM progressflow p, ref_progressflow rp WHERE p.bldgApplicationNo = ? AND p.ref_progressflowid BETWEEN 2 AND 9 AND p.ref_progressflowid = rp.ref_progressflowid`, 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)
// 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)
// array = append(array, result)
// array2 = append(array2, result2)
// array3 = append(array3, result3)
// array4 = append(array4, result4)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// "result3": array3,
// "result4": array4,
// })
// } else if method == "GetProgressFlowOccupancy" {
// var result2, result3, result4 string
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// array4 := []string{}
// results, err := db.Query(`SELECT IFNULL(rp.progressflow, '') AS result, IFNULL(p.datetimeStart, '') AS result2, IFNULL(p.datetimeEnd, '') AS result3, IFNULL(p.accomplish, '') AS result4 FROM occupancyprogressflow p, ref_progressflow rp WHERE p.ref_progressflowid BETWEEN 2 AND 9 AND p.ref_progressflowid = rp.ref_progressflowid AND p.occupancyid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?)`, 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)
// 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)
// array = append(array, result)
// array2 = append(array2, result2)
// array3 = append(array3, result3)
// array4 = append(array4, result4)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// "result3": array3,
// "result4": array4,
// })
// } else if method == "GetProgressFlowElectrical" {
// var result2, result3 string
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// results, err := db.Query(`SELECT IFNULL(rp.progressflow, '') AS result, IFNULL(p.dateStart, '') AS result2, IFNULL(p.dateEnd, '') AS result3 FROM electricalprogressflow p, ref_progressflow rp WHERE p.ref_progressflowid = rp.ref_progressflowid AND p.electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?)`, data)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// for results.Next() {
// err = results.Scan(&result, &result2, &result3)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// result, _ := encrypt(result)
// result2, _ := encrypt(result2)
// result3, _ := encrypt(result3)
// 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 "GetPermitsBuilding":
var result2, result3, result4 string
array := []string{}
array2 := []string{}
array3 := []string{}
array4 := []string{}
results, err := db.Query(`SELECT IFNULL(p.permitNo, '') AS result, IFNULL(rp.block, '') AS result2, IFNULL(rp.lot, '') AS result3, IFNULL(rp.address, '') AS result4 FROM receiving_permitnoaddress rp, permitnos p WHERE p.receiving_permitnoaddressid = rp.receiving_permitnoaddressid AND rp.receivingid = (SELECT receivingid FROM receiving WHERE applicationNo = ?)`, 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)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
array2 = append(array2, result2)
array3 = append(array3, result3)
array4 = append(array4, result4)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
"result3": array3,
"result4": array4,
})
case "GetPermitsOccupancy":
var result2, result3, result4, result5, result6, result7 string
array := []string{}
array2 := []string{}
array3 := []string{}
array4 := []string{}
array5 := []string{}
array6 := []string{}
array7 := []string{}
results, err := db.Query(`SELECT IFNULL(p.occupancyPermitNo, '') AS result, IFNULL(rp.block, '') AS result2, IFNULL(rp.lot, '') AS result3, IFNULL(rp.address, '') AS result4, IFNULL(rp.occblock, '') AS result5, IFNULL(rp.occlot, '') AS result6, IFNULL(rp.occaddress, '') AS result7 FROM occupancypermitnos p, receiving_permitnoaddress rp, receiving r, occupancy o WHERE p.occupancyid = o.occupancyid AND o.bldgApplicationNo = r.applicationNo AND r.receivingid = rp.receivingid AND o.occupancyid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?)`, 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, &result7)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
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)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
"result3": array3,
"result4": array4,
"result5": array5,
"result6": array6,
"result7": array7,
})
case "GetPermitsElectrical":
var result2 string
array := []string{}
array2 := []string{}
results, err := db.Query(`SELECT IFNULL(ceiNo, '') AS result, IFNULL(dateRelease,'') AS result2 FROM electrical_certificate WHERE electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?)`, 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 "GetDailyReceived":
var result2, result3, result4 string
decodedString := strings.Replace(data, "~", "/", -1)
array := []string{}
array2 := []string{}
array3 := []string{}
array4 := []string{}
results, err := db.Query(`SELECT r.applicationNo 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, IFNULL(r.locationofconstruction, '') AS result3, IFNULL(CONCAT(ro.occupancy, ' - ', rot.occupancyType), '') AS result4
FROM receiving r, customer c, ref_occupancy ro, ref_occupancy_type rot
WHERE (r.receivedate LIKE ? OR r.receivezoning LIKE ?) AND r.customerid = c.customerid AND r.ref_occupancy_typeid = rot.ref_occupancy_typeid AND rot.ref_occupancyid = ro.ref_occupancyid`, decodedString+"%", decodedString+"%")
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result, &result2, &result3, &result4)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
array2 = append(array2, result2)
array3 = append(array3, result3)
array4 = append(array4, result4)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
"result3": array3,
"result4": array4,
})
// } else if method == "GetDailyReceivedOccupancy" {
// var result2, result3, result4 string
// decodedString := strings.Replace(data, "~", "-", -1)
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// array4 := []string{}
// results, err := db.Query(`SELECT 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, IFNULL(r.locationofconstruction, '') AS result3, IFNULL(CONCAT(ro.occupancy, ' - ', rot.occupancyType), '') AS result4
// FROM occupancy o, receiving r, customer c, ref_occupancy ro, ref_occupancy_type rot
// WHERE o.dateEntered LIKE ? AND o.bldgApplicationNo = r.applicationNo AND r.customerid = c.customerid AND o.ref_occupancy_typeid = rot.ref_occupancy_typeid AND rot.ref_occupancyid = ro.ref_occupancyid`, decodedString+"%")
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// for results.Next() {
// err = results.Scan(&result, &result2, &result3, &result4)
// 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)
// array = append(array, result)
// array2 = append(array2, result2)
// array3 = append(array3, result3)
// array4 = append(array4, result4)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// "result3": array3,
// "result4": array4,
// })
// } else if method == "GetDailyReceivedElectrical" {
// var result2, result3, result4 string
// decodedString := strings.Replace(data, "~", "-", -1)
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// array4 := []string{}
// results, err := db.Query(`SELECT 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, IFNULL(e.locationofinstallation, '') AS result3, IFNULL(ro.occupancyoruse, '') AS result4
// FROM electrical e, customer c, ref_elec_occupancy ro, electricaldocflowtxn ed
// WHERE e.customerid = c.customerid AND e.ref_elec_occupancyid = ro.ref_elec_occupancyid AND e.electricalid = ed.electricalid AND ed.remarks = 'RECEIVED FOR ELECTRICAL APPLICATION' AND ed.txndate LIKE ?`, decodedString+"%")
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// for results.Next() {
// err = results.Scan(&result, &result2, &result3, &result4)
// 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)
// array = append(array, result)
// array2 = append(array2, result2)
// array3 = append(array3, result3)
// array4 = append(array4, result4)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// "result3": array3,
// "result4": array4,
// })
// } else if method == "GetLatestStatusBuilding" {
// err = db.QueryRow("SELECT d.remarks AS result FROM docflowtxn d, receiving r WHERE 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())
// }
// result, err := encrypt(result)
// if err != nil {
// c.AbortWithError(http.StatusServiceUnavailable, err)
// c.String(http.StatusServiceUnavailable, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetLatestStatusOccupancy" {
// err = db.QueryRow("SELECT d.remarks AS result FROM occupancydocflowtxn d, occupancy o WHERE d.occupancyreceivingid = o.occupancyid AND d.occupancydocflowtxnid = (SELECT MAX(occupancydocflowtxnid) FROM occupancydocflowtxn WHERE occupancyreceivingid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?))", data).Scan(&result)
// 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())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetLatestStatusElectrical" {
// err = db.QueryRow("SELECT d.remarks AS result FROM electricaldocflowtxn d, electrical e WHERE e.electricalid = d.electricalid AND d.electricaldocflowtxnid = (SELECT MAX(electricaldocflowtxnid) FROM electricaldocflowtxn WHERE electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?))", data).Scan(&result)
// 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())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetSumPaid" {
// err = db.QueryRow("SELECT IFNULL(SUM(amount), 0) AS result FROM building_orderofpayment WHERE bldgApplicationNo = ? AND is_paid = 1", data).Scan(&result)
// 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())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetSumPaidOccupancy" {
// err = db.QueryRow("SELECT IFNULL(SUM(amount), 0) AS result FROM occupancy_orderofpayment WHERE is_paid = 1 AND occupancyid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?)", data).Scan(&result)
// 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())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetSumPaidElectrical" {
// err = db.QueryRow("SELECT IFNULL(SUM(amount), 0) AS result FROM electrical_orderofpayment_new WHERE is_paid = 1 AND electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?)", data).Scan(&result)
// 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())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// } else if method == "GetApprovedPermits" {
// var result2 string
// decodedString := strings.Replace(data, "~", "-", -1)
// array := []string{}
// array2 := []string{}
// results, err := db.Query("SELECT IFNULL(receivingid, '') AS result, IFNULL(datetransac, '') AS result2 FROM docflowtxn WHERE datetransac LIKE ? AND remarks = 'PERMIT ALREADY RELEASE'", decodedString+"%")
// 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, _ := encrypt(result)
// result2, _ := encrypt(result2)
// array = append(array, result)
// array2 = append(array2, result2)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// })
// } else if method == "GetApprovedPermitsOccupancy" {
// var result2 string
// decodedString := strings.Replace(data, "~", "-", -1)
// array := []string{}
// array2 := []string{}
// results, err := db.Query("SELECT IFNULL(occupancyreceivingid, '') AS result, IFNULL(txndate, '') AS result2 FROM occupancydocflowtxn WHERE txndate LIKE ? AND remarks LIKE 'OCCUPANCY PERMIT RELEASED%'", decodedString+"%")
// 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, _ := encrypt(result)
// result2, _ := encrypt(result2)
// array = append(array, result)
// array2 = append(array2, result2)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// })
// } else if method == "GetApprovedPermitsElectrical" {
// var result2 string
// decodedString := strings.Replace(data, "~", "-", -1)
// array := []string{}
// array2 := []string{}
// results, err := db.Query("SELECT IFNULL(electricalid, '') AS result, IFNULL(txndate, '') AS result2 FROM electricaldocflowtxn WHERE txndate LIKE ? AND remarks LIKE 'ELECTRICAL PERMIT RELEASED%'", decodedString+"%")
// 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, _ := encrypt(result)
// result2, _ := encrypt(result2)
// array = append(array, result)
// array2 = append(array2, result2)
// }
// c.JSON(http.StatusOK, gin.H{
// "result": array,
// "result2": array2,
// })
// } else if method == "GetApprovedPermitsDetails" {
// var result2, result3, result4, result5, result6 string
// err = db.QueryRow(`SELECT r.applicationNo AS result, IF(c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName)) AS result2, IFNULL(rp.block, '') AS result3, IFNULL(rp.lot, '') AS result4, IFNULL(rp.address, '') AS result5, IFNULL(pn.permitNo, '') AS result6
// FROM receiving r, customer c, receiving_permitnoaddress rp, permitnos pn
// WHERE r.customerid = c.customerid AND r.receivingid = rp.receivingid AND rp.receiving_permitnoaddressid = pn.receiving_permitnoaddressid AND r.receivingid = ? AND pn.permitNo LIKE '%BU'`, data).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)
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// "result5": result5,
// "result6": result6,
// })
// } else if method == "GetApprovedPermitsOccupancyDetails" {
// var result2, result3, result4, result5, result6 string
// err = db.QueryRow(`SELECT o.controlNo AS result, IF(c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName)) AS result2, IFNULL(rp.block, '') AS result3, IFNULL(rp.lot, '') AS result4, IFNULL(rp.address, '') AS result5, IFNULL(pn.occupancyPermitNo, '') AS result6
// FROM occupancy o, receiving r, customer c, receiving_permitnoaddress rp, occupancypermitnos pn
// WHERE o.customerid = c.customerid AND o.bldgApplicationNo = r.applicationNo AND r.receivingid = rp.receivingid AND o.occupancyid = pn.occupancyid AND o.occupancyid = ?`, data).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)
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// "result5": result5,
// "result6": result6,
// })
// } else if method == "GetApprovedPermitsElectricalDetails" {
// var result2, result3, result4, result5, result6 string
// err = db.QueryRow(`SELECT e.electricalNo AS result, IF(c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', c.middleInitial, '. ', c.lastName)) AS result2, '' AS result3, '' AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(ec.ceiNo, '') AS result6
// FROM electrical e, customer c, electrical_certificate ec
// WHERE e.customerid = c.customerid AND e.electricalid = ec.electricalid AND e.electricalid = ?`, data).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)
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// "result2": result2,
// "result3": result3,
// "result4": result4,
// "result5": result5,
// "result6": result6,
// })
}
})
// router.GET("/api/:method/:data/:data2", func(c *gin.Context) {
// var result string
// method := c.Param("method")
// data := c.Param("data")
// data2 := c.Param("data2")
// 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")
// // fixedMethod := strings.Replace(method, "~", "/", -1)
// // fixedData := strings.Replace(data, "~", "/", -1)
// // fixedData2 := strings.Replace(data2, "~", "/", -1)
// // method, err := decrypt(fixedMethod)
// // if err != nil {
// // c.AbortWithError(http.StatusBadGateway, err)
// // c.String(http.StatusBadGateway, err.Error())
// // }
// // data, err := decrypt(fixedData)
// // if err != nil {
// // c.AbortWithError(http.StatusBadGateway, err)
// // c.String(http.StatusBadGateway, err.Error())
// // }
// // data2, err := decrypt(fixedData2)
// // if err != nil {
// // c.AbortWithError(http.StatusBadGateway, err)
// // c.String(http.StatusBadGateway, err.Error())
// // }
// // log.Println("Method", method)
// // log.Println("Data", data)
// // log.Println("Data2", data2)
// if method == "SearchByNameBuilding" {
// var newData string
// if data2 == "empty" {
// newData = ""
// } else {
// newData = data2
// }
// err := db.QueryRow("SELECT IFNULL(b.receivingid, '') AS result FROM receiving b, customer c WHERE c.customerid = b.customerid AND c.lastName LIKE ? AND c.firstName = ?", "%"+data+"%", newData).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 == "SearchByNameOccupancy" {
// var newData string
// if data2 == "empty" {
// newData = ""
// } else {
// newData = data2
// }
// err := db.QueryRow("SELECT IFNULL(b.occupancyid, '') AS result FROM occupancy b, customer c WHERE c.customerid = b.customerid AND c.lastName LIKE ? AND c.firstName = ?", "%"+data+"%", newData).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 == "SearchByNameElectrical" {
// var newData string
// if data2 == "empty" {
// newData = ""
// } else {
// newData = data2
// }
// err := db.QueryRow("SELECT IFNULL(b.electricalid, '') AS result FROM electrical b, customer c WHERE c.customerid = b.customerid AND c.lastName LIKE ? AND c.firstName = ?", "%"+data+"%", newData).Scan(&result)
// if err != nil {
// c.AbortWithError(http.StatusBadRequest, err)
// c.String(http.StatusBadRequest, err.Error())
// }
// c.JSON(http.StatusOK, gin.H{
// "result": result,
// })
// }
// })
router.Run(":4320")
}

View file

@ -1,6 +1,2 @@
.box
padding: 1rem
.curvedbox
@extend .box
border-radius: 8px

View file

@ -0,0 +1,114 @@
@use '/src/styles/variables.sass' as vars
@use 'sass:color'
.filefield
display: flex
flex-direction: column
align-items: center
justify-content: center
height: 250px
width: 100%
row-gap: 5px
border: 1px solid #ffffff6c
border-radius: 8px
&__label
color: white
font-size: 14px
font-weight: 500
user-select: none
&__dropzone
display: flex
flex-direction: column
row-gap: 10px
align-items: center
justify-content: center
width: 100%
height: 100%
color: #5f8ebebf
cursor: pointer
font-size: 1rem
// &__trigger
// background-color: vars.$primaryColor
// border: none
// border-radius: 8px
// color: white
// padding: 0.5rem 1.25rem
// text-align: center
// text-decoration: none
// display: inline-block
// font-size: 1rem
// font-weight: 500
// cursor: pointer
// transition: all 0.2s ease-out
// &:hover
// background-color: color.adjust(vars.$primaryColor, $blackness: 20%)
// &:active
// transform: scale(0.95)
&__itemList
display: flex
flex-direction: column
gap: 3px
width: 100%
&__item
width: 82%
display: grid
// padding: 1rem
column-gap: 10px
border-radius: 8px
grid-template-columns: auto 1fr auto
grid-template-areas: "preview name delete" "preview size delete"
column-gap: 5px
// border: 1px solid rgba(187, 187, 187, 0.706)
padding: 10px
background-color: #2b405542
margin: 0 1rem
&__itemPreview
grid-area: preview
&__itemPreviewImage
width: 6rem
object-fit: scale-down
height: auto
aspect-ratio: 1
&__itemName
font-weight: 500
grid-area: name
font-size: 1rem
color: #fff
&__itemSize
grid-area: size
font-size: 14px
color: rgb(181, 179, 173)
&__itemDeleteTrigger
grid-area: delete
background-color: #a23434
border: none
border-radius: 8px
color: white
padding: 0.5rem 1.25rem
text-align: center
text-decoration: none
display: inline-block
font-size: 1rem
font-weight: 500
cursor: pointer
transition: all 0.2s ease-out
height: max-content
align-self: center
&:hover
background-color: color.adjust(#a23434, $blackness: 20%)
&:active
transform: scale(0.95)

View file

@ -0,0 +1,23 @@
import './File.sass'
import { FileField } from '@kobalte/core/file-field'
export default () => {
return (
<>
<FileField class="filefield" maxFiles={1} onFileAccept={(data) => console.log('data', data)} onFileReject={(data) => console.log('data', data)} onFileChange={(data) => console.log('data', data)}>
<FileField.Dropzone class="filefield__dropzone">Drag and drop or click to upload file</FileField.Dropzone>
<FileField.HiddenInput />
<FileField.ItemList class="filefield__itemList">
{() => (
<FileField.Item class="filefield__item">
<FileField.ItemPreviewImage class="filefield__itemPreviewImage" />
<FileField.ItemName class="filefield__itemName" />
<FileField.ItemSize class="filefield__itemSize" />
<FileField.ItemDeleteTrigger class="filefield__itemDeleteTrigger">Delete</FileField.ItemDeleteTrigger>
</FileField.Item>
)}
</FileField.ItemList>
</FileField>
</>
)
}

View file

@ -16,6 +16,7 @@ export { default as Padding } from './Padding/Padding'
export { default as Modal } from './Modal/Modal'
export { default as Table } from './Table/Table'
export { default as Combobox } from './Combobox/Combobox'
export { default as File } from './File/File'
// export { default as OptimizeBackground } from './Optimizers/OptimizeBackground'
// export { default as OptimizeImage } from './Optimizers/OptimizeImage'

View file

@ -2,7 +2,6 @@
@use '/src/styles/breakpoint.sass' as views
h1
font-size: 3.25rem
color: vars.$textColor
@media only screen and (max-width: views.$mobile)

View file

@ -1,7 +1,26 @@
import './Index.sass'
import { Button, Page, Padding, Display, Row, Logo, Column, Box } from '../../components'
import { onMount } from 'solid-js'
import { ofetch } from 'ofetch'
const API = 'http://localhost:4320/api/'
let assessorsNameList: string[]
export default () => {
const getAssessors = async () => {
try {
const assessors = await ofetch(API + 'get-list-assessors', { parseResponse: JSON.parse })
assessorsNameList = [...assessors.result2]
} catch (error) {
console.error(error)
}
sessionStorage.setItem('assessors', JSON.stringify([...assessorsNameList]))
}
onMount(async () => {
await getAssessors()
})
return (
<>
<Page>

View file

@ -1,2 +1,9 @@
.back-button-text
font-size: 1rem
.approver-name
font-size: 1.25rem
.box-title
font-size: 1.75rem
font-weight: 700

View file

@ -1,11 +1,10 @@
import './Register.sass'
import { Logo, Link, Page, Row, Padding, Form, Combobox, Box } from '../../components'
import { Logo, Link, Page, Row, Padding, Form, Combobox, Box, File } from '../../components'
import { IoChevronBack } from 'solid-icons/io'
import { Show, createSignal } from 'solid-js'
export default () => {
const assessors = JSON.parse(sessionStorage.getItem('assessors')!)
const approvers = JSON.parse(sessionStorage.getItem('approvers')!)
const roles = ['ASSESSOR', 'APPROVER']
const [role, setRole] = createSignal('')
@ -34,16 +33,23 @@ export default () => {
<Padding top={2} left={0} right={0}>
<Row>
<Box curved thickness={2} padding={2} color="#2f465cd7">
<Row>
<span class="box-title">Registration</span>
</Row>
<Form>
<h4>Role</h4>
<Combobox options={roles} placeholder="Select your role" value={role()} onChange={setRole} />
<Show when={role() === 'ASSESSOR'}>
<h4>List of Assessors</h4>
<Combobox options={assessors} placeholder="Select your name" value={name()} onChange={setName} />
<h4>Upload Signature</h4>
<File />
</Show>
<Show when={role() === 'APPROVER'}>
<h4>List of Approvers</h4>
<Combobox options={approvers} placeholder="Select your name" value={name()} onChange={setName} />
<h4>Name of Approver</h4>
<span class="approver-name">ARCH. KHASHAYAR L. TOGHYANI</span>
<h4>Upload Signature</h4>
<File />
</Show>
</Form>
</Box>