diff --git a/backend/main.go b/backend/main.go index 25761e0..45a02be 100644 --- a/backend/main.go +++ b/backend/main.go @@ -205,35 +205,6 @@ func connect() { "result2": array2, }) - case "get-listopprinting-building": - var result2 string - - array := []string{} - array2 := []string{} - - results, err := db.Query(`SELECT IFNULL(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 - FROM receiving r JOIN customer c ON r.customerid = c.customerid JOIN ref_occupancy_type rot ON r.ref_occupancy_typeid = rot.ref_occupancy_typeid JOIN ref_occupancy ro ON rot.ref_occupancyid = ro.ref_occupancyid JOIN docflowtxn d ON r.receivingid = d.receivingid - WHERE d.remarks = "FOR ORDER OF PAYMENT PRINT" AND d.is_approve = 0 ORDER BY r.applicationNo ASC LIMIT 10`) - if err != nil { - c.AbortWithError(http.StatusBadRequest, err) - c.String(http.StatusBadRequest, err.Error()) - return - } - for results.Next() { - err = results.Scan(&result, &result2) - if err != nil { - c.AbortWithError(http.StatusBadRequest, err) - c.String(http.StatusBadRequest, err.Error()) - return - } - array = append(array, result) - array2 = append(array2, result2) - } - c.JSON(http.StatusOK, gin.H{ - "result": array, - "result2": array2, - }) - case "get-listopprinting-occupancy": var result2 string diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index 2e1ea32..bea34cc 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -2,8 +2,7 @@ import './Assessor.sass' import { Logo, Page, Row, Padding, ModalButton, Button, Clickable, Link, Modal, Column, Box, Input } from '../../components' import { FiLogOut } from 'solid-icons/fi' import { Tabs } from '@kobalte/core/tabs' -import { onMount, createSignal, createEffect } from 'solid-js' -import { Show } from 'solid-js/web' +import { onMount, createSignal, Show, createEffect } from 'solid-js' import dayjs from 'dayjs' import { checkConnection, createPdfOccupancy, createPdfElectrical } from '../../utils/functions' import { FaSolidThumbsUp } from 'solid-icons/fa' @@ -28,13 +27,6 @@ export default () => { const [applicationList, setApplicationList] = createSignal([]) const [nameList, setNameList] = createSignal([]) - const [applicationListElectrical, setApplicationListElectrical] = createSignal([]) - const [nameListElectrical, setNameListElectrical] = createSignal([]) - const [applicationListOccupancy, setApplicationListOccupancy] = createSignal([]) - const [nameListOccupancy, setNameListOccupancy] = createSignal([]) - const [applicationListBuilding, setApplicationListBuilding] = createSignal([]) - const [nameListBuilding, setNameListBuilding] = createSignal([]) - const [errorMessage, setErrorMessage] = createSignal('') const [connected, setConnected] = createSignal(true) const [printed, setPrinted] = createSignal(false) @@ -210,31 +202,12 @@ export default () => { const filteredApplications = response.result.filter((item: string) => item.includes(filter())) const filteredIndices = response.result.map((item: string, index: number) => (item.includes(filter()) ? index : -1)).filter((index: number) => index !== -1) const filteredNames = filteredIndices.map((index: number) => response.result2[index]) - - if (division === 'electrical') { - setApplicationListElectrical(filteredApplications) - setNameListElectrical(filteredNames) - } else if (division === 'occupancy') { - setApplicationListOccupancy(filteredApplications) - setNameListOccupancy(filteredNames) - } else { - setApplicationlistBuilding(filteredApplications) - setNameListBuilding(filteredNames) - } + setApplicationList(filteredApplications) + setNameList(filteredNames) return } - - if (division === 'electrical') { - setApplicationListElectrical(response.result) - setNameListElectrical(response.result2) - } else if (division === 'occupancy') { - setApplicationListOccupancy(response.result) - setNameListOccupancy(response.result2) - } else { - setApplicationListBuilding(response.result) - setNameListBuilding(response.result2) - } - + setApplicationList(response.result) + setNameList(response.result2) } catch (error) { console.error(error) } @@ -406,21 +379,22 @@ export default () => { await checkDivision() if (isBuilding()) await getListForPrinting('building') if (isOccupancy()) await getListForPrinting('occupancy') - // if (isElectrical()) await getListForPrinting('electrical') + if (isElectrical()) await getListForPrinting('electrical') } }) - // createEffect(async () => { - // if (filter() !== '') { - // if (isBuilding()) await getListForPrinting('building') - // if (isOccupancy()) await getListForPrinting('occupancy') - // if (isElectrical()) await getListForPrinting('electrical') - // } else if (filter() === '') { - // if (isBuilding()) await getListForPrinting('building') - // if (isOccupancy()) await getListForPrinting('occupancy') - // if (isElectrical()) await getListForPrinting('electrical') - // } - // }) + createEffect(async () => { + if (filter() !== '') { + console.log('empty') + if (isBuilding()) await getListForPrinting('building') + if (isOccupancy()) await getListForPrinting('occupancy') + if (isElectrical()) await getListForPrinting('electrical') + } else if (filter() === '') { + if (isBuilding()) await getListForPrinting('building') + if (isOccupancy()) await getListForPrinting('occupancy') + if (isElectrical()) await getListForPrinting('electrical') + } + }) return ( <> @@ -474,97 +448,32 @@ export default () => { -

List of Ready to Approve and Sign Building Order of Payments

+ {/*

List of Ready to Approve and Sign Building Order of Payments

*/} + + +

Under Development

+
+
- - - - - - - - + {/* - + */} - - {applicationListBuilding().map((item: string, index: number) => ( - - - - - - - ))} - +
Application Number Name Show Details
{item}{nameList()[index]} - { - await getopdetails('building', item) - }} - > - - {item} - - - - - - - - - - - - - - - - - - Click anywhere to cancel - - - -
+ {/* +

Under Development

+
*/}{' '}

List of Ready to Print in Occupancy Order of Payments

@@ -585,7 +494,7 @@ export default () => { - {applicationListOccupancy().map((item: string, index: number) => ( + {applicationList().map((item, index) => ( {item} {nameList()[index]} @@ -676,7 +585,7 @@ export default () => { - {applicationListElectrical().map((item: string, index: number) => ( + {applicationList().map((item, index) => ( {item} {nameList()[index]} diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index a18044b..727e2c4 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -403,7 +403,7 @@ export default () => { - {applicationListOccupancy().map((item: string, index: number) => ( + {applicationListOccupancy().map((item, index) => ( {item} {nameListOccupancy()[index]} @@ -492,7 +492,7 @@ export default () => { - {applicationListElectrical().map((item: string, index: number) => ( + {applicationListElectrical().map((item, index) => ( {item} {nameListElectrical()[index]}