From 206c653ba1d6cca4c26f6aad9bef960b33bf9679 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 7 Jan 2026 10:08:09 +0800 Subject: [PATCH] Updated main page --- src/pages/MainPage/Main.tsx | 68 ++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/src/pages/MainPage/Main.tsx b/src/pages/MainPage/Main.tsx index 71bc716..f690ea7 100644 --- a/src/pages/MainPage/Main.tsx +++ b/src/pages/MainPage/Main.tsx @@ -1,7 +1,6 @@ import { Tabs } from '@kobalte/core/tabs' import { useNavigate } from '@solidjs/router' import dayjs from 'dayjs' -import { BiRegularErrorAlt } from 'solid-icons/bi' import { FaSolidThumbsUp } from 'solid-icons/fa' import { FiLogOut } from 'solid-icons/fi' import { VsRefresh } from 'solid-icons/vs' @@ -13,7 +12,7 @@ import { Show } from 'solid-js/web' import './Main.sass' const PESO = import.meta.env.VITE_PESO -const ID = sessionStorage.get('headid') +const ID = sessionStorage.getItem('id')! const PUBLICIP = import.meta.env.VITE_PUBLICIP export default () => { @@ -25,6 +24,7 @@ export default () => { const [location, setLocation] = createSignal('') const [type, setType] = createSignal('') const [applicationId, setApplicationId] = createSignal(0) + // const [assessorId, setAssessorId] = createSignal(0) // const [gflgu, setGflgu] = createSignal([]) @@ -48,7 +48,7 @@ export default () => { const [employeeId, setEmployeeId] = createSignal(0) const [employeeName, setEmployeeName] = createSignal('') - const [apology, setApology] = createSignal(false) + // const [apology, setApology] = createSignal(false) const [openConfig, setOpenConfig] = createSignal(false) const [configEncPassword, setConfigEncPassword] = createSignal('') const [configNewName, setConfigNewName] = createSignal('') @@ -279,6 +279,11 @@ export default () => { return true } + const deleteHeadName = async () => { + sessionStorage.removeItem('head') + sessionStorage.removeItem('headid') + } + const geteSignId = async () => { try { const response = await getApi('get-esignid', ID) @@ -321,8 +326,10 @@ export default () => { } const checkCurrentPassword = async () => { - const encCurrentPassword = await securePassword(configPassword(), 'v2') - if (encCurrentPassword === configEncPassword()) { + const encCurrentPasswordV1 = await securePassword(configPassword(), 'v1') + const encCurrentPasswordV2 = await securePassword(configPassword(), 'v2') + + if (encCurrentPasswordV1 === configEncPassword() || encCurrentPasswordV2 === configEncPassword()) { if (configNewPassword() === '') { setConfigError('New Password not provided') setConfigNewEncPassword('') @@ -372,7 +379,20 @@ export default () => { // navigate('/profile') // } + const closeConfig = () => { + setConfigNotification(false) + setOpenConfig(false) + + setConfigEncPassword('') + setConfigNewName('') + setConfigPassword('') + setConfigNewPassword('') + setConfigNewEncPassword('') + setConfigError('') + } + onMount(async () => { + await deleteHeadName() const logged = await checkLogged() if (logged) { @@ -381,7 +401,9 @@ export default () => { }) createEffect(() => { - if (configPassword !== '') { + if (configPassword() !== '') { + checkCurrentPassword() + } else { checkCurrentPassword() } @@ -404,19 +426,19 @@ export default () => { - + {employeeName()} setOpenConfig(true)}> - - + + Config - - + + Logout @@ -496,8 +518,6 @@ export default () => { background="#121e2acc" color="#ffffffec" function={async () => { - // setApology(true) - // setErrorMessage('Modification of Occupancy Printing has not yet finished') await getopdetails('occupancy', item) }} > @@ -709,7 +729,7 @@ export default () => { -
setApology(false)}> + {/*
setApology(false)}> @@ -736,9 +756,9 @@ export default () => { -
+
*/} - +
@@ -746,10 +766,7 @@ export default () => { {employeeName()}
-
- Encrypted Password: - {configEncPassword()} -
+
Change Displayed Name @@ -759,11 +776,14 @@ export default () => {
Change Password - - + + - New Encrypted Password: + Current Encrypted Password: + {configEncPassword()} + + New Encrypted Password: {configNewEncPassword()}
@@ -783,7 +803,7 @@ export default () => { -
+