From 9f2d80933d3300e2e8844bfaf64fd828bf56ed67 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:06:13 +0800 Subject: [PATCH 1/8] Fixed list of assessors --- backend/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/main.go b/backend/main.go index c962671..16de633 100644 --- a/backend/main.go +++ b/backend/main.go @@ -121,7 +121,7 @@ func connect() { 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(employeeid, '') AS employeeid, IFNULL(employeename, '') AS employeename 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()) @@ -146,7 +146,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()) From 69245a0ea02c99a8dd724ebd13e2d4e31ece2be3 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:12:22 +0800 Subject: [PATCH 2/8] Added file upload component --- src/components/File/File.sass | 114 ++++++++++++++++++++++++++++++++++ src/components/File/File.tsx | 23 +++++++ src/components/index.ts | 1 + 3 files changed, 138 insertions(+) create mode 100644 src/components/File/File.sass create mode 100644 src/components/File/File.tsx diff --git a/src/components/File/File.sass b/src/components/File/File.sass new file mode 100644 index 0000000..743861b --- /dev/null +++ b/src/components/File/File.sass @@ -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: 200px + 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: #5f8ebe9c + 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: #2b4055b7 + 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) diff --git a/src/components/File/File.tsx b/src/components/File/File.tsx new file mode 100644 index 0000000..2139f49 --- /dev/null +++ b/src/components/File/File.tsx @@ -0,0 +1,23 @@ +import './File.sass' +import { FileField } from '@kobalte/core/file-field' + +export default () => { + return ( + <> + console.log('data', data)} onFileReject={(data) => console.log('data', data)} onFileChange={(data) => console.log('data', data)}> + Drag and drop file here or click to upload file + + + {() => ( + + + + + Delete + + )} + + + + ) +} diff --git a/src/components/index.ts b/src/components/index.ts index 42f3b3f..477c6ec 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -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' From 9fce20a0e55083b625a8eeb4e46c9bfbcecbff1e Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:52:16 +0800 Subject: [PATCH 3/8] Cleanup backend --- backend/main.go | 781 +----------------------------------------------- 1 file changed, 3 insertions(+), 778 deletions(-) diff --git a/backend/main.go b/backend/main.go index 16de633..b643734 100644 --- a/backend/main.go +++ b/backend/main.go @@ -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 employeeid, IFNULL(employeename, '') AS employeename 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) + 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": @@ -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") } From 168140e0f6ad0f2ba5e8c296cbb77ec2f95f9045 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:54:10 +0800 Subject: [PATCH 4/8] Added registration title and fixed approver --- src/pages/RegisterPage/Register.sass | 7 +++++++ src/pages/RegisterPage/Register.tsx | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/pages/RegisterPage/Register.sass b/src/pages/RegisterPage/Register.sass index e0f9cfd..c875b7a 100644 --- a/src/pages/RegisterPage/Register.sass +++ b/src/pages/RegisterPage/Register.sass @@ -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 \ No newline at end of file diff --git a/src/pages/RegisterPage/Register.tsx b/src/pages/RegisterPage/Register.tsx index 5ac29d4..bec8c85 100644 --- a/src/pages/RegisterPage/Register.tsx +++ b/src/pages/RegisterPage/Register.tsx @@ -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 () => { + + Registration +

Role

List of Assessors

+

Upload Signature

+
-

List of Approvers

- +

Name of Approver

+ ARCH. KHASHAYAR L. TOGHYANI +

Upload Signature

+
From 418dd23519c21e6d0947b5f6a39632f0c3342822 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:54:31 +0800 Subject: [PATCH 5/8] Removed unnecessary option --- src/components/Box/Box.sass | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/Box/Box.sass b/src/components/Box/Box.sass index 17165bb..7bd9c59 100644 --- a/src/components/Box/Box.sass +++ b/src/components/Box/Box.sass @@ -1,6 +1,2 @@ -.box - padding: 1rem - .curvedbox - @extend .box border-radius: 8px From fe8317ac3dec375434d26b38de3838149d902a41 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:54:50 +0800 Subject: [PATCH 6/8] Fixed ui --- src/components/File/File.sass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/File/File.sass b/src/components/File/File.sass index 743861b..da94001 100644 --- a/src/components/File/File.sass +++ b/src/components/File/File.sass @@ -6,7 +6,7 @@ flex-direction: column align-items: center justify-content: center - height: 200px + height: 250px width: 100% row-gap: 5px border: 1px solid #ffffff6c @@ -26,7 +26,7 @@ justify-content: center width: 100% height: 100% - color: #5f8ebe9c + color: #5f8ebebf cursor: pointer font-size: 1rem @@ -67,7 +67,7 @@ column-gap: 5px // border: 1px solid rgba(187, 187, 187, 0.706) padding: 10px - background-color: #2b4055b7 + background-color: #2b405542 margin: 0 1rem &__itemPreview From 728d77bc146fec2a33f52f050b43fd069bb906fe Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 16:55:02 +0800 Subject: [PATCH 7/8] Removed multiple upload --- src/components/File/File.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/File/File.tsx b/src/components/File/File.tsx index 2139f49..5335f98 100644 --- a/src/components/File/File.tsx +++ b/src/components/File/File.tsx @@ -4,8 +4,8 @@ import { FileField } from '@kobalte/core/file-field' export default () => { return ( <> - console.log('data', data)} onFileReject={(data) => console.log('data', data)} onFileChange={(data) => console.log('data', data)}> - Drag and drop file here or click to upload file + console.log('data', data)} onFileReject={(data) => console.log('data', data)} onFileChange={(data) => console.log('data', data)}> + Drag and drop or click to upload file {() => ( From ff5494402428db93e7574902cab2927c76352782 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 24 Sep 2025 17:00:53 +0800 Subject: [PATCH 8/8] Cleanup --- src/pages/IndexPage/Index.sass | 1 - src/pages/IndexPage/Index.tsx | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/IndexPage/Index.sass b/src/pages/IndexPage/Index.sass index 003a53a..cc97bcc 100644 --- a/src/pages/IndexPage/Index.sass +++ b/src/pages/IndexPage/Index.sass @@ -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) diff --git a/src/pages/IndexPage/Index.tsx b/src/pages/IndexPage/Index.tsx index 2f6b9ed..2e1f1ff 100644 --- a/src/pages/IndexPage/Index.tsx +++ b/src/pages/IndexPage/Index.tsx @@ -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 ( <>