From a740e777aec98ac1b8ab3c7979d660f059a3570d Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 18 Nov 2025 17:08:22 +0800 Subject: [PATCH] Updated assessor page --- src/pages/AssessorPage/Assessor.tsx | 155 ++++++++++++++++++++++------ 1 file changed, 123 insertions(+), 32 deletions(-) diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index bea34cc..2e1ea32 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -2,7 +2,8 @@ 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, Show, createEffect } from 'solid-js' +import { onMount, createSignal, createEffect } from 'solid-js' +import { Show } from 'solid-js/web' import dayjs from 'dayjs' import { checkConnection, createPdfOccupancy, createPdfElectrical } from '../../utils/functions' import { FaSolidThumbsUp } from 'solid-icons/fa' @@ -27,6 +28,13 @@ 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) @@ -202,12 +210,31 @@ 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]) - setApplicationList(filteredApplications) - setNameList(filteredNames) + + if (division === 'electrical') { + setApplicationListElectrical(filteredApplications) + setNameListElectrical(filteredNames) + } else if (division === 'occupancy') { + setApplicationListOccupancy(filteredApplications) + setNameListOccupancy(filteredNames) + } else { + setApplicationlistBuilding(filteredApplications) + setNameListBuilding(filteredNames) + } return } - setApplicationList(response.result) - setNameList(response.result2) + + 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) + } + } catch (error) { console.error(error) } @@ -379,22 +406,21 @@ 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() !== '') { - 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') - } - }) + // 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') + // } + // }) return ( <> @@ -448,32 +474,97 @@ export default () => { - {/*

List of Ready to Approve and Sign Building Order of Payments

*/} - - -

Under Development

-
-
+

List of Ready to Approve and Sign Building Order of Payments

+ + + + + + + - {/* + - */} + - + + {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

@@ -494,7 +585,7 @@ export default () => { - {applicationList().map((item, index) => ( + {applicationListOccupancy().map((item: string, index: number) => ( {item} {nameList()[index]} @@ -585,7 +676,7 @@ export default () => { - {applicationList().map((item, index) => ( + {applicationListElectrical().map((item: string, index: number) => ( {item} {nameList()[index]}