diff --git a/backend/main.go b/backend/main.go index 25248e2..5b692b6 100644 --- a/backend/main.go +++ b/backend/main.go @@ -96,7 +96,7 @@ func connect() { case "get-listopapproval-electrical": array := []string{} - results, err := db.Query("SELECT DISTINCT IFNULL(electricalid, 0) AS result FROM electricaldocflowtxn WHERE remarks = ?", "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL") + results, err := db.Query("SELECT DISTINCT IFNULL(electricalid, '') 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()) @@ -178,39 +178,7 @@ 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 = ? LIMIT 20", "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, - }) - } - }) router.GET("/api/:method/:data", func(c *gin.Context) { @@ -533,7 +501,7 @@ func connect() { "result": result, }) - case "get-employeename": + case "get-employeename": err := db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE employeeid = ?", data).Scan(&result) if err != nil { c.AbortWithError(http.StatusBadRequest, err) @@ -543,50 +511,6 @@ func connect() { "result": result, }) - case "get-opdetails-electrical": - var result2, result3, result4, result5 string - array := []string{} - array2 := []string{} - array3 := []string{} - array4 := []string{} - array5 := []string{} - - results, err := db.Query("SELECT IFNULL(assessedbyid, 0) AS result, IFNULL(reviewedbyid, 0) AS result2, IFNULL(ref_bldgcomputationsheetid, 0) AS result3, IFNULL(amount, 0) AS result4, IFNULL(opDate, '') AS result5 FROM electrical_orderofpayment_new WHERE electricalid = ?", 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) - 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) - - } - c.JSON(http.StatusOK, gin.H{ - "result": array, - "result2": array2, - "result3": array3, - "result4": array4, - "result5": array5, - }) - - case "get-paymentname": - err := db.QueryRow("SELECT IFNULL(accountdescription, '') AS result FROM ref_bldgcomputationsheet WHERE ref_bldgcomputationsheetid = ?", data).Scan(&result) - if err != nil { - c.AbortWithError(http.StatusBadRequest, err) - c.String(http.StatusBadRequest, err.Error()) - } - c.JSON(http.StatusOK, gin.H{ - "result": result, - }) - } }) diff --git a/src/components/Column/Column.sass b/src/components/Column/Column.sass index 20969b2..b26f108 100644 --- a/src/components/Column/Column.sass +++ b/src/components/Column/Column.sass @@ -14,7 +14,7 @@ align-items: center align-content: center -.column-bottom +.column-right display: flex flex-direction: column flex-wrap: wrap diff --git a/src/components/Column/Column.tsx b/src/components/Column/Column.tsx index aec3d3e..73a19c3 100644 --- a/src/components/Column/Column.tsx +++ b/src/components/Column/Column.tsx @@ -3,7 +3,7 @@ import type { JSXElement } from 'solid-js' interface Props { children: JSXElement - content?: 'top' | 'center' | 'bottom' | 'split' | 'spaced' + content?: 'top' | 'center' | 'right' | 'split' | 'spaced' gap?: number } diff --git a/src/components/Modal/ModalButton.tsx b/src/components/Modal/ModalButton.tsx index 7153a17..e83f82f 100644 --- a/src/components/Modal/ModalButton.tsx +++ b/src/components/Modal/ModalButton.tsx @@ -13,7 +13,6 @@ interface Props { design?: 'bu-primary' | 'bu-link' | 'bu-info' | 'bu-success' | 'bu-warning' | 'bu-danger' | 'bu-dark' | 'bu-light' | 'bu-text' | 'bu-ghost' | 'bo-primary' | 'bo-secondary' | 'bo-success' | 'bo-danger' | 'bo-warning' | 'bo-info' | 'bo-light' | 'bo-dark' | 'bo-link' width?: number wide?: boolean - class?: string } export default (props: Props) => { diff --git a/src/pages/LoginPage/Login.tsx b/src/pages/LoginPage/Login.tsx index 7916775..e5346cf 100644 --- a/src/pages/LoginPage/Login.tsx +++ b/src/pages/LoginPage/Login.tsx @@ -138,7 +138,7 @@ export default () => { - Click anywhere to proceed + Click anywhere to close diff --git a/src/pages/MainPage/Main.sass b/src/pages/MainPage/Main.sass index 7e66e00..f52d846 100644 --- a/src/pages/MainPage/Main.sass +++ b/src/pages/MainPage/Main.sass @@ -14,101 +14,3 @@ h1 .name font-size: 1.25rem - -.tabs - width: 100% - - &[data-orientation="vertical"] - display: flex - - &__list - position: relative - display: flex - - &__list[data-orientation="horizontal"] - align-items: center - - &__list[data-orientation="vertical"] - flex-direction: column - align-items: stretch - - &__indicator - position: absolute - background-color: hsl(200 98% 39%) - transition: all 250ms - - &__indicator[data-orientation="horizontal"] - bottom: -1px - height: 2px - - &__indicator[data-orientation="vertical"] - right: -1px - width: 2px - - &__trigger - display: inline-block - padding: 8px 16px - outline: none - cursor: pointer - - &__trigger:hover - background-color: hsl(0 0% 98%) - color: hsl(240 5% 34%) - - &__trigger:focus-visible - background-color: hsl(240 5% 96%) - -.tabs__trigger[data-disabled], -.tabs__trigger[data-disabled]:hover - opacity: 0.5 - background-color: transparent - -.tabs__content - padding: 16px - -.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 - - td:nth-child(1) - width: 12rem - - td:nth-child(3) - width: 9rem - - th - background-color: vars.$tableHeaderBackground - color: white - -.modal - font-weight: 500 - - &__application-number - font-size: 1.75rem - - &__name - padding: 1rem 0 0 0 - font-size: 1rem - - &__row - display: flex - flex-direction: column - flex-wrap: wrap - justify-content: flex-start - align-items: flex-start - gap: 0.5rem - padding: 2rem 0 0 0 - - &__label - font-size: 0.75rem - - &__detail - font-size: 1rem - diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 3543735..6d60518 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -1,102 +1,9 @@ import './Main.sass' -import { Logo, Link, Page, Row, Padding, ModalButton, Box, Column } from '../../components/' +import { Logo, Link, Page, Row, Padding, Table } from '../../components/' import { FiLogOut } from 'solid-icons/fi' -import { Tabs } from '@kobalte/core/tabs' -import { ofetch } from 'ofetch' -import { onMount, createSignal } from 'solid-js' -import dayjs from 'dayjs' - -const API = import.meta.env.VITE_BACKEND +// import { ofetch } from 'ofetch' export default () => { - const [updatedList, setUpdatedList] = createSignal([]) - const [totalOp, setTotalOp] = createSignal(0) - const [assessor, setAssessor] = createSignal('') - const [approver, setApprover] = createSignal('') - const [dateOp, setDateOp] = createSignal('') - - const getListForApproval = async () => { - try { - const response = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse }) - return response.result - } catch (error) { - console.error(error) - } - } - - 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 getopdetails() - } - - const getopdetails = async () => { - const op = await ofetch(API + 'get-opdetails-electrical/23512', { parseResponse: JSON.parse }) - setTotalOp(calculateTotal(op.result4)) - setAssessor(await getEmployeeName(op.result[0])) - setApprover(await getEmployeeName(op.result2[0])) - setDateOp(dayjs(op.result5[0]).format('MMMM DD, YYYY')) - } - - const calculateTotal = (list: number[]) => { - let total = 0 - for (let i = 0; i < list.length; i++) { - total += parseInt(list[i].toString()) - } - return total - } - - const getEmployeeName = async (id: string) => { - try { - const response = await ofetch(API + 'get-employeename/' + id, { parseResponse: JSON.parse }) - const result = response.result - return result - } catch { - return '' - } - } - - const getPaymentName = async (id: string) => { - try { - const response = await ofetch(API + 'get-paymentname/' + id, { parseResponse: JSON.parse }) - const result = response.result - return result - } catch { - return '' - } - } - - onMount(async () => { - await load() - }) - return ( <> @@ -117,72 +24,10 @@ export default () => { - - - - Building - - - Occupancy - - - Electrical - - - - - -

List of Ready to Approve and Sign Building Order of Payments

-
-
- - -

List of Ready to Approve and Sign Occupancy Order of Payments

-
-
- - -

List of Ready to Approve and Sign Electrical Order of Payments

-
- - - - - - - - - - - - - - -
Application NumberName
11111 - - - - - 25-0000000123 - - Sample Name - - - - - - - -
-
-
+

List of Ready to Approve and Sign OP (Order of Payments)

+ + diff --git a/src/pages/RegisterPage/Register.tsx b/src/pages/RegisterPage/Register.tsx index b837073..43ddf86 100644 --- a/src/pages/RegisterPage/Register.tsx +++ b/src/pages/RegisterPage/Register.tsx @@ -233,9 +233,6 @@ export default () => {

Name of Approver

{APPROVERNAME} -

Password

- -

Upload Signature

setFile(data)} accept=".png"> @@ -256,29 +253,17 @@ export default () => { - +