From f8fbcebcb4539baf2be9cc0027efbd3cb85a02c7 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Fri, 6 Mar 2026 16:54:35 +0800 Subject: [PATCH 1/4] Updated main page --- src/pages/MainPage/Main.tsx | 275 ++++++++++++++++++++---------------- 1 file changed, 151 insertions(+), 124 deletions(-) diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 94371b1..cc9dd7d 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -9,6 +9,7 @@ import { Show } from 'solid-js/web' import { Box, Button, Clickable, Column, Input, Link, Logo, Modal, ModalButton, Padding, Page, Row } from '../../components/' import { checkConnection, deleteApi, getApi, getApiMulti, getDateTime, lockData, postApi, saveNewName, saveNewPassword, securePassword, voidPopsApi, voidApi, statusPopsApi } from '../../utils/functions' import { AiOutlineLoading3Quarters } from 'solid-icons/ai' +import { RiDocumentFileCloseFill } from 'solid-icons/ri' import './Main.sass' const PESO = import.meta.env.VITE_PESO @@ -77,19 +78,15 @@ export default () => { } const getListForApprovalElectrical = async () => { - // setIsLoading(true) const responseE = await getApiMulti('get-listopapproval-electrical') setApplicationListElectrical(responseE.result) setNameListElectrical(responseE.result2) - // setIsLoading(false) } const getListForApprovalOccupancy = async () => { - // setIsLoading(true) const responseO = await getApiMulti('get-listopapproval-occupancy') setApplicationListOccupancy(responseO.result) setNameListOccupancy(responseO.result2) - // setIsLoading(false) } const load = async (division: string) => { @@ -98,8 +95,9 @@ export default () => { setErrorMessage('Could not gather list of applications') return } + setIsLoading(true) - setLoadingText('Downloading Data') + setLoadingText('Getting List to Approve') await getPassword() @@ -169,7 +167,7 @@ export default () => { } setIsLoading(true) - setLoadingText('Processing Data') + setLoadingText('Checking POPS record') if (division === 'electrical') { if (BACKEND.includes('localhost')) { @@ -184,6 +182,7 @@ export default () => { if (popsExist) { if (popsPaid) { + setIsLoading(false) setPostError(true) setErrorMessage('Application Already Paid') return @@ -192,14 +191,17 @@ export default () => { const voidOP = await voidPopsOpLocal(application) if (!voidOP) { + setIsLoading(false) setPostError(true) setErrorMessage('POPS Record found but failed to void') return } } else { + setLoadingText('Clearing unpaid POPS record') const voidOP = await voidPopsOp(application) if (voidOP.toUpper().includes('ERROR')) { + setIsLoading(false) setPostError(true) setErrorMessage('POPS Record found but failed to void') return @@ -208,11 +210,14 @@ export default () => { } } + setLoadingText('Posting new record to POPS') await postPops(division, application) // const popsResult = await checkPops(application) + setLoadingText(`Approving ${application}`) const dataLocked = await lockOpData(division, application) if (dataLocked) { + setLoadingText(`Pushing ${application} for printing`) signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED', 1) updateDocflow(division, application, 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL') if (!signed) return @@ -228,6 +233,7 @@ export default () => { setApproved(true) } } else { + setIsLoading(false) setPostError(true) setErrorMessage('Error on posting on POPS Server, please try again') return @@ -641,24 +647,28 @@ export default () => { - - - - Building - - - Occupancy - - - Electrical - - - - + + + + + Building + + + Occupancy + + + Electrical + + + + + - {/*

List of Ready to Approve and Sign Building Order of Payments

*/} + {/* +

Ready for Approval and Signing Building Order of Payments

+
*/}

Under Development

@@ -681,10 +691,12 @@ export default () => {
-

List of Ready to Approve and Sign in Occupancy Order of Payments

+ +

Ready for Approval and Signing Occupancy Order of Payments

+
- + @@ -768,10 +780,12 @@ export default () => {
-

List of Ready to Approve and Sign in Electrical Order of Payments

+ +

Ready for Approval and Signing Electrical Order of Payments

+
- + @@ -787,107 +801,120 @@ export default () => { - - - - - - - - - - {applicationListElectrical().map((item: string, index: number) => ( + 0}> +
Application NumberNameShow Details
+ - - - - + + + - ))} - -
{item}{nameListElectrical()[index]} - { - await getopdetails('electrical', item) - }} - > - - - {item} - - - - -

Signing Error

-
-

Missing Data Detected

-
- -
- - Some required information is missing from the application details - Please return to Assessment to complete the required fields - -
-
- -
Application NumberNameShow Details
+ + + {applicationListElectrical().map((item: string, index: number) => ( + + {item} + {nameListElectrical()[index]} + + + { + await getopdetails('electrical', item) + }} + > + + + {item} + + + + +

Signing Error

+
+

Missing Data Detected

+
+ +
+ + Some required information is missing from the application details + Please return to Assessment to complete the required fields + +
+
+ +