diff --git a/.env b/.env index 8075f55..0247276 100644 --- a/.env +++ b/.env @@ -1,4 +1,3 @@ VITE_BACKEND=http://localhost:4320/api/ VITE_HEAD=ARCH. KHASHAYAR L. TOGHYANI -VITE_PESO=₱ -VITE_HEADID=276 \ No newline at end of file +VITE_PESO=₱ \ No newline at end of file diff --git a/backend/main.go b/backend/main.go index 2b30339..9ec2c37 100644 --- a/backend/main.go +++ b/backend/main.go @@ -100,7 +100,7 @@ func connect() { array2 := []string{} results, err := db.Query(`SELECT IFNULL(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 - FROM iips.electrical e JOIN iips.customer c ON e.customerid = c.customerid JOIN iips.ref_elec_occupancy ec ON e.ref_elec_occupancyid = ec.ref_elec_occupancyid JOIN iips.electricaldocflowtxn ed ON e.electricalid = ed.electricalid JOIN (SELECT electricalid, MAX(electricaldocflowtxnid) AS latest_electricaldocflowtxnid FROM electricaldocflowtxn GROUP BY electricalid) latest_doc ON ed.electricalid = latest_doc.electricalid AND ed.electricaldocflowtxnid = latest_doc.latest_electricaldocflowtxnid WHERE remarks = ? AND is_approve = 0 ORDER BY e.electricalno ASC`, "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL") + FROM iips.electrical e JOIN iips.customer c ON e.customerid = c.customerid JOIN iips.ref_elec_occupancy ec ON e.ref_elec_occupancyid = ec.ref_elec_occupancyid JOIN iips.electricaldocflowtxn ed ON e.electricalid = ed.electricalid JOIN (SELECT electricalid, MAX(electricaldocflowtxnid) AS latest_electricaldocflowtxnid FROM electricaldocflowtxn GROUP BY electricalid) latest_doc ON ed.electricalid = latest_doc.electricalid AND ed.electricaldocflowtxnid = latest_doc.latest_electricaldocflowtxnid WHERE remarks = ? ORDER BY e.electricalno ASC`, "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL") if err != nil { c.AbortWithError(http.StatusBadRequest, err) c.String(http.StatusBadRequest, err.Error()) @@ -184,6 +184,37 @@ func connect() { "result": array, }) + case "get-listopapproval-electrical2": + var status string + array := []string{} + + results, err := db.Query("SELECT DISTINCT IFNULL(electricalid, 0) AS result 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() { + var result string + err = results.Scan(&result) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + } + err = db.QueryRow("SELECT IFNULL(remarks, '') AS status FROM electricaldocflowtxn WHERE electricaldocflowtxnid = (SELECT MAX(electricaldocflowtxnid) FROM electricaldocflowtxn WHERE electricalid = ?)", result).Scan(&status) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + return + } + + if status == "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL" { + array = append(array, result) + } + } + c.JSON(http.StatusOK, gin.H{ + "result": array, + }) + } }) @@ -523,7 +554,7 @@ func connect() { }) case "get-opdetails-electrical": - var result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12 string + var result2, result3, result4, result5, result6, result7, result8, result9, result10 string array := []string{} array2 := []string{} array3 := []string{} @@ -534,17 +565,15 @@ func connect() { array8 := []string{} array9 := []string{} array10 := []string{} - array11 := []string{} - array12 := []string{} - results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.firstName, '') AS result2, IFNULL(c.middleInitial, '') AS result3, IFNULL(c.lastName, '') AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(re.type, '') AS result6, IFNULL(em.employeename, '') AS result7, IFNULL(rb.accountdescription, '') AS result8, IFNULL(o.amount, '') AS result9, IFNULL(o.opDate, '') AS result10, IFNULL(e.electricalid, 0) AS result11, IFNULL(o.assessedbyid, 0) AS result12 + results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.firstName, '') AS result2, IFNULL(c.middleInitial, '') AS result3, IFNULL(c.lastName, '') AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(re.type, '') AS result6, IFNULL(em.employeename, '') AS result7, IFNULL(rb.accountdescription, '') AS result8, IFNULL(o.amount, '') AS result9, IFNULL(o.opDate, '') AS result10 FROM electrical e, customer c, electrical_orderofpayment_new o, ref_electrical_type re, ref_bldgcomputationsheet rb, employee em WHERE e.customerid = c.customerid AND e.electricalid = o.electricalid AND e.ref_electrical_typeid = re.ref_electrical_typeid AND o.ref_bldgcomputationsheetid = rb.ref_bldgcomputationsheetid AND o.assessedbyid = em.employeeid AND e.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, &result4, &result5, &result6, &result7, &result8, &result9, &result10, &result11, &result12) + err = results.Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8, &result9, &result10) if err != nil { c.AbortWithError(http.StatusBadRequest, err) c.String(http.StatusBadRequest, err.Error()) @@ -559,8 +588,6 @@ func connect() { array8 = append(array8, result8) array9 = append(array9, result9) array10 = append(array10, result10) - array11 = append(array11, result11) - array12 = append(array12, result12) } c.JSON(http.StatusOK, gin.H{ @@ -574,8 +601,6 @@ func connect() { "result8": array8, "result9": array9, "result10": array10, - "result11": array11, - "result12": array12, }) case "get-paymentname": @@ -642,6 +667,10 @@ func connect() { 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 { @@ -656,14 +685,14 @@ func connect() { c.Writer.Header().Set("X-Download-Options", "noopen") c.Writer.Header().Set("Referrer-Policy", "no-referrer") - dbpost, err := db.Prepare(`INSERT INTO electricaldocflowtxn (electricaldocflowtxnid, electricalid, txndate, remarks, comments, is_tag, tagword, is_approve, employeeid, is_delete) - VALUES (NULL, ?, ?, NULL, ?, ?, 0, ?, 0)`) + 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) + 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()) } diff --git a/public/favicon.png b/public/favicon.png index eabbfaf..b995ebd 100644 Binary files a/public/favicon.png and b/public/favicon.png differ diff --git a/src/assets/images/logo.png b/src/assets/images/logo.png index ce61865..fccdf9b 100644 Binary files a/src/assets/images/logo.png and b/src/assets/images/logo.png differ diff --git a/src/assets/images/optimized/background.png b/src/assets/images/optimized/background.png deleted file mode 100644 index e8e5404..0000000 Binary files a/src/assets/images/optimized/background.png and /dev/null differ diff --git a/src/assets/images/optimized/logo.avif b/src/assets/images/optimized/logo.avif index b30bbdd..019df1d 100644 Binary files a/src/assets/images/optimized/logo.avif and b/src/assets/images/optimized/logo.avif differ diff --git a/src/assets/images/optimized/logo.webp b/src/assets/images/optimized/logo.webp index 7204298..cc106d8 100644 Binary files a/src/assets/images/optimized/logo.webp and b/src/assets/images/optimized/logo.webp differ diff --git a/src/assets/images/svg/background.svg b/src/assets/images/svg/background.svg index 4c49b38..2230978 100644 --- a/src/assets/images/svg/background.svg +++ b/src/assets/images/svg/background.svg @@ -18,24 +18,22 @@ height="1734.7687" x="-313.60806" y="-317.57779" />Office of the City Building OfficialsOffice of the City Building Officialse-Sign Application + x="966.625" + y="777.97443" + style="fill:#334d66;fill-opacity:1;stroke-width:17.7313">e-Sign Application diff --git a/src/components/Table/Table.sass b/src/components/Table/Table.sass index 8a0a78d..44763cc 100644 --- a/src/components/Table/Table.sass +++ b/src/components/Table/Table.sass @@ -1,23 +1,23 @@ -// @use '/src/styles/variables.sass' as vars -// @use 'sass:color' +@use '/src/styles/variables.sass' as vars +@use 'sass:color' -// .table -// width: 10% -// border-collapse: collapse -// margin: 2rem +.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 + 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(1) + width: 12rem -// td:nth-child(3) -// width: 9rem + td:nth-child(3) + width: 9rem -// th -// background-color: vars.$tableHeaderBackground -// color: white + th + background-color: vars.$tableHeaderBackground + color: white diff --git a/src/index.sass b/src/index.sass index 8f962fb..329dc78 100644 --- a/src/index.sass +++ b/src/index.sass @@ -9,12 +9,11 @@ position: absolute top: 0 left: 0 - min-width: 99vw + min-width: 90vw min-height: 90vh object-fit: cover z-index: -1 opacity: 1 - background-attachment: fixed .close-text padding: 3rem 0 0 0 diff --git a/src/pages/MainPage/Main.sass b/src/pages/MainPage/Main.sass index 60c32a6..e3a9cc8 100644 --- a/src/pages/MainPage/Main.sass +++ b/src/pages/MainPage/Main.sass @@ -24,8 +24,6 @@ h1 &__list position: relative display: flex - gap: 5rem - &__list[data-orientation="horizontal"] align-items: center @@ -36,42 +34,29 @@ h1 &__indicator position: absolute - background-color: color.adjust(vars.$background, $lightness: 20%) + background-color: hsl(200 98% 39%) transition: all 250ms &__indicator[data-orientation="horizontal"] bottom: -1px - height: 3px + height: 2px &__indicator[data-orientation="vertical"] right: -1px width: 2px &__trigger - // display: inline-block - // padding: 8px 16px - // outline: none - // cursor: pointer - background-color: vars.$background - border: none - border-radius: 6px 6px 0 0 - color: vars.$textColor - padding: 0.75rem 1.75rem - width: 10rem - text-align: center - text-decoration: none display: inline-block - font-size: 1rem - font-weight: 500 + padding: 8px 16px + outline: none cursor: pointer - // transition: all 0.2s ease-out &__trigger:hover - background-color: color.adjust(vars.$background, $lightness: 20%) - // color: hsl(240 5% 34%) + background-color: hsl(0 0% 98%) + color: hsl(240 5% 34%) &__trigger:focus-visible - // background-color: hsl(240 5% 96%) + background-color: hsl(240 5% 96%) .tabs__trigger[data-disabled], .tabs__trigger[data-disabled]:hover @@ -82,40 +67,25 @@ h1 padding: 16px .table - width: 90% + width: 100% border-collapse: collapse margin: 2rem th, td - // border: 1px solid vars.$tableBorderColor + border: 1px solid vars.$tableBorderColor padding: 0.75rem text-align: left - font-size: 1rem + font-size: 1.1rem + + td:nth-child(1) + width: 12rem + + td:nth-child(3) + width: 9rem th background-color: vars.$tableHeaderBackground - color: vars.$textColor - padding: 1rem - - th:nth-child(1) - text-align: center - border-radius: 1rem 0 0 0 - - th:nth-child(3) - border-radius: 0 1rem 0 0 - - td - background-color: rgba(color.adjust(vars.$background, $blackness: 5%), 0.8) - - td:nth-child(1) - width: 10rem - text-align: center - - td:nth-child(3) - width: 8.75rem - - tbody tr:nth-child(even) - background-color: rgba(color.adjust(vars.$background, $lightness: 10%), 0.8) + color: white .modal font-weight: 500 diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 83570d5..c11faaf 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -8,24 +8,16 @@ import dayjs from 'dayjs' const API = import.meta.env.VITE_BACKEND const PESO = import.meta.env.VITE_PESO -const ID = import.meta.env.VITE_ID export default () => { + const [updatedList, setUpdatedList] = createSignal([]) const [totalOp, setTotalOp] = createSignal(0) const [assessor, setAssessor] = createSignal('') + const [approver, setApprover] = createSignal('') const [dateOp, setDateOp] = createSignal('') + const [client, setClient] = createSignal('') const [location, setLocation] = createSignal('') const [type, setType] = createSignal('') - const [applicationId, setApplicationId] = createSignal(0) - const [assessorId, setAssessorId] = createSignal(0) - - const [gflgu, setGflgu] = createSignal([]) - const [gfdpwh, setGfdpwh] = createSignal([]) - const [tfbo, setTfbo] = createSignal([]) - - const [descriptionList, setDescriptionList] = createSignal([]) - const [amountList, setAmountList] = createSignal([]) - const [dateOpList, setDateOpList] = createSignal([]) const [applicationList, setApplicationList] = createSignal([]) const [nameList, setNameList] = createSignal([]) @@ -49,16 +41,9 @@ export default () => { setAssessor(op.result7[0]) setLocation(op.result5[0]) setType(op.result6[0]) - setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY')) - // setClient(displayFullname(op.result2[0], op.result3[0], op.result4[0])) - setApplicationId(op.result11[0]) - setAssessorId(op.result12[0]) + setDateOp(dayjs(op.result5[0]).format('MMMM DD, YYYY')) + setClient(displayFullname(op.result2[0], op.result3[0], op.result4[0])) setTotalOp(calculateTotal(op.result9)) - - setDescriptionList(op.result8) - setAmountList(op.result9) - setDateOpList(op.result10) - calculateAmounts() } const calculateTotal = (list: number[]) => { @@ -66,55 +51,18 @@ export default () => { return total } - // const displayFullname = (firstname: string, middleinitial: string, lastname: string) => { - // let result - // if (firstname.length > 0) { - // if (middleinitial.length > 0) { - // result = `${firstname} ${middleinitial}. ${lastname}` - // } else { - // result = `${firstname} ${lastname}` - // } - // } else { - // result = lastname - // } - // return result - // } - - const approveHandler = async () => { - const today = new Date() - const formattedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss') - - for (let i = 0; i < applicationList().length; i++) { - await ofetch(API + 'post-newstatus-electrical', { - method: 'POST', - body: { data: applicationId(), data2: formattedDate, data3: ID, data4: descriptionList()[i], data5: 'json' }, - }) + const displayFullname = (firstname: string, middleinitial: string, lastname: string) => { + let result + if (firstname.length > 0) { + if (middleinitial.length > 0) { + result = `${firstname} ${middleinitial}. ${lastname}` + } else { + result = `${firstname} ${lastname}` + } + } else { + result = lastname } - } - - const calculateAmounts = () => { - const amounts: string[] = amountList() - let gflguList: number[] = [] - let gfdpwhList: number[] = [] - let tfboList: number[] = [] - - for (let i = 0; i < amounts.length; i++) { - const gflgu = parseFloat(amounts[i]) * 0.8 - const gfdpwh = parseFloat(amounts[i]) * 0.05 - const tfbo = parseFloat(amounts[i]) * 0.15 - - const roundedGflgu = parseFloat(gflgu.toFixed(2)) - const roundedGfdpwh = parseFloat(gfdpwh.toFixed(2)) - const roundedTfbo = parseFloat(tfbo.toFixed(2)) - - gflguList.push(roundedGflgu) - gfdpwhList.push(roundedGfdpwh) - tfboList.push(roundedTfbo) - } - - setGflgu(gflguList) - setGfdpwh(gfdpwhList) - setTfbo(tfboList) + return result } onMount(async () => { @@ -142,21 +90,18 @@ export default () => { - - - - Building - - - Occupancy - - - Electrical - - - - - + + + Building + + + Occupancy + + + Electrical + + +

List of Ready to Approve and Sign Building Order of Payments

@@ -171,81 +116,72 @@ export default () => {

List of Ready to Approve and Sign Electrical Order of Payments

- - - - +
+ + + + + + + + {applicationList().map((item, index) => ( - - - + + + + - - - {applicationList().map((item, index) => ( - - - - - - - ))} - -
Application NumberName
Application NumberNameShow Details{item}{nameList()[index]} + { + await getopdetails(item) + }} + > + + + {item} + + + + + + + + + + + + + + + + + +
{item}{nameList()[index]} - { - await getopdetails(item) - }} - > - - - {item} - - - - - - - - - - - - - - - - - - - -
-
+ ))} + +