From 7be79529df12a185eedb92592f94e3a1ca4da6ac Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 1 Oct 2025 16:33:34 +0800 Subject: [PATCH 1/2] Added post-newstatus-electrical --- backend/main.go | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/backend/main.go b/backend/main.go index 1de5863..9ec2c37 100644 --- a/backend/main.go +++ b/backend/main.go @@ -660,5 +660,55 @@ func connect() { }) + router.POST("/api/post-newstatus-electrical", func(c *gin.Context) { + type RegistrationData struct { + Data int `json:"data"` + Data2 string `json:"data2"` + Data3 string `json:"data3"` + Data4 string `json:"data4"` + Data5 string `json:"data5"` + Data6 string `json:"data6"` + Data7 string `json:"data7"` + Data8 string `json:"data8"` + Data9 string `json:"data9"` + } + var registrationData RegistrationData + if err := c.ShouldBindJSON(®istrationData); err != nil { + c.String(http.StatusBadRequest, "Invalid request body") + return + } + + c.Writer.Header().Set("X-XSS-Protection", "1; mode=block") + c.Writer.Header().Set("X-Content-Type-Options", "nosniff") + c.Writer.Header().Set("X-DNS-Prefetch-Control", "off") + c.Writer.Header().Set("X-Frame-Options", "DENY") + c.Writer.Header().Set("X-Download-Options", "noopen") + c.Writer.Header().Set("Referrer-Policy", "no-referrer") + + dbpost, err := db.Prepare(`INSERT INTO electrical_orderofpayment_new (electrical_orderofpayment_newid, electricalid, assessedbyid, reviewedbyid, ref_bldgcomputationsheetid, amount, orNo, is_approve, for_approval, is_release, is_paid, popstransmitted, opDate, amt_Gflgu, amt_Gfdpwh, amt_Tfbo, optn, datePaid, is_delete, securitycode, barcode) + VALUES (NULL, ?, ?, ?, ?, ?, NULL, 1, 1, 0, 0, 0, ?, ?, ?, ?, NULL, NULL, 0, NULL, NULL)`) + if err != nil { + panic(err.Error()) + } + defer dbpost.Close() + + exec, err := dbpost.Exec(registrationData.Data, registrationData.Data2, registrationData.Data3, registrationData.Data4, registrationData.Data5, registrationData.Data6, registrationData.Data7, registrationData.Data8, registrationData.Data9) + if err != nil { + panic(err.Error()) + } + + affect, err := exec.RowsAffected() + if err != nil { + panic(err.Error()) + } + + if affect > 0 { + c.String(http.StatusOK, "Success on Registrating e-Sign") + } else { + c.String(http.StatusInternalServerError, "Failed on Registrating e-Sign") + } + + }) + router.Run(":4320") } From 153278d579a55b5a19f2eac99abbdb0f8278a475 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 1 Oct 2025 16:33:41 +0800 Subject: [PATCH 2/2] Cleanup --- src/pages/MainPage/Main.tsx | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 49b7943..c11faaf 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -32,36 +32,7 @@ export default () => { } } - // const getListOfReadyForApprovalFiltered = async (list: number[]) => { - // let newList: number[] = [] - - // for (let i = 0; i < list.length; 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]) - // } - // } - - // 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 listForApproval = await getListForApproval() - // const listOfReadyForApprovalFiltered = await getListOfReadyForApprovalFiltered(listForApproval) - // await getApplicationById(listOfReadyForApprovalFiltered) - - // console.log(listOfReadyForApprovalFiltered) await getListForApproval() }