diff --git a/backend/main.go b/backend/main.go index 9ec2c37..1de5863 100644 --- a/backend/main.go +++ b/backend/main.go @@ -660,55 +660,5 @@ 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") } diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index c11faaf..49b7943 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -32,7 +32,36 @@ 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() }