From c9f787ad39a6b54931e81129d6c9dffcc85e5477 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 7 Oct 2025 16:28:21 +0800 Subject: [PATCH] Updated asseessors page --- src/pages/AssessorPage/Assessor.sass | 52 ++++++++++++ src/pages/AssessorPage/Assessor.tsx | 113 ++++++++++++++++++++++----- 2 files changed, 144 insertions(+), 21 deletions(-) diff --git a/src/pages/AssessorPage/Assessor.sass b/src/pages/AssessorPage/Assessor.sass index 1e0b5bc..66e84ad 100644 --- a/src/pages/AssessorPage/Assessor.sass +++ b/src/pages/AssessorPage/Assessor.sass @@ -1 +1,53 @@ @use '/src/styles/classes.sass' + +.modal + font-weight: 500 + + &__application-number + padding: 1rem 0 + border-radius: 8px + font-size: 1.75rem + font-weight: 800 + display: flex + flex-direction: column + flex-wrap: wrap + align-items: center + background: #16212C + box-shadow: 8px 8px 28px #0d141b, -8px -8px 28px #1f2e3d + + &__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: 1.25rem 1rem + // box-shadow: 5px 5px 10px #10171f, -5px -5px 10px #1c2b39 + // border: 1px solid white + // border-radius: 8px + // margin: 0.5rem + + &__label + font-size: 0.75rem + + &__detail + font-size: 1rem + + &__price + font-size: 1.75rem + font-weight: 700 + + &__cancel + font-size: 0.75rem + padding: 0.5rem 0 0 0 + font-weight: 400 + +.approval + font-size: 1.75rem + font-weight: 700 + padding: 0.5rem 1rem diff --git a/src/pages/AssessorPage/Assessor.tsx b/src/pages/AssessorPage/Assessor.tsx index be4b469..1c5a406 100644 --- a/src/pages/AssessorPage/Assessor.tsx +++ b/src/pages/AssessorPage/Assessor.tsx @@ -1,19 +1,21 @@ import './Assessor.sass' -import { Logo, Link, Page, Row, Padding, ModalButton, Box, Button, Modal, Column } from '../../components' +import { Logo, Page, Row, Padding, ModalButton, Button, Clickable, Link } 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' -import { checkConnection, createPdf } from '../../utils/functions' -import { FaSolidThumbsUp } from 'solid-icons/fa' -import { _employeeName } from '../../stores/employee' +import { onMount, createSignal, Show } from 'solid-js' +// import dayjs from 'dayjs' +// import { checkConnection, createPdf } from '../../utils/functions' +// import { FaSolidThumbsUp } from 'solid-icons/fa' +import { _employeeName, _employeeId } from '../../stores/employee' +import { useNavigate } from '@solidjs/router' const API = import.meta.env.VITE_BACKEND const PESO = import.meta.env.VITE_PESO -const ID = import.meta.env.VITE_HEADID export default () => { + const navigate = useNavigate() + const [totalOp, setTotalOp] = createSignal(0) const [assessor, setAssessor] = createSignal('') const [dateOp, setDateOp] = createSignal('') @@ -38,6 +40,69 @@ export default () => { const [approved, setApproved] = createSignal(false) const [approvedApplication, setApprovedApplication] = createSignal('') + const [isBuilding, setIsBuilding] = createSignal(false) + const [isOccupancy, setIsOccupancy] = createSignal(false) + const [isElectrical, setIsElectrical] = createSignal(false) + + const [employeeId, setEmployeeId] = createSignal(0) + const [employeeName, setEmployeeName] = createSignal('') + + const checkAccess = async (access: string) => { + try { + const response = await ofetch(`${API}check-access/${access}/${employeeId()}`) + const result = response.result + if (result > 0) return true + else return false + } catch { + return false + } + } + + const checkDivision = async () => { + const building = await checkAccess('BUILDING ORDER OF PAYMENT') + setIsBuilding(building) + + const occupancy = await checkAccess('OCCUPANCY ORDER OF PAYMENT') + setIsOccupancy(occupancy) + + const electrical = await checkAccess('ELECTRICAL ASSESSMENT') + setIsElectrical(electrical) + } + + const getListForPrinting = async () => { + try { + const response = await ofetch(API + 'get-listopprinting-electrical', { parseResponse: JSON.parse }) + setApplicationList(response.result) + setNameList(response.result2) + } catch (error) { + console.error(error) + } + } + + const removeEmployee = () => { + sessionStorage.removeItem('id') + sessionStorage.removeItem('name') + } + + const checkLogged = async () => { + const idStore = sessionStorage.getItem('id') + const nameStore = sessionStorage.getItem('name') + setEmployeeId(parseInt(idStore!)) + setEmployeeName(nameStore!) + } + + const logout = async () => { + removeEmployee() + navigate('/') + // console.log('yeah') + } + + onMount(async () => { + checkLogged() + await checkDivision() + await getListForPrinting() + }) + return ( <> @@ -51,13 +116,13 @@ export default () => { - {_employeeName.get()} - + {employeeName()} + Logout - + @@ -65,15 +130,21 @@ export default () => { - - Building - - - Occupancy - - - Electrical - + + + Building + + + + + Occupancy + + + + + Electrical + + @@ -116,7 +187,7 @@ export default () => { -

List of Ready to Approve and Sign Electrical Order of Payments

+

List of Ready to Print in Electrical Order of Payments

@@ -183,7 +254,7 @@ export default () => { - + Click anywhere to cancel