Updated main page

This commit is contained in:
Patrick Alvin Alcala 2026-01-05 17:32:49 +08:00
parent 83a92ad3c1
commit 279e4e7bdc
2 changed files with 23 additions and 23 deletions

View file

@ -95,7 +95,7 @@ h1
&__button &__button
padding: 1rem 0 0 0 padding: 1rem 0 0 0
.required .required-config
padding: 0.75rem 1rem padding: 0.75rem 1rem
border-radius: 8px border-radius: 8px
background-color: color.adjust(#0D64E4, $blackness: 20%) background-color: color.adjust(#0D64E4, $blackness: 20%)

View file

@ -7,7 +7,7 @@ import { FiLogOut } from 'solid-icons/fi'
import { VsRefresh } from 'solid-icons/vs' import { VsRefresh } from 'solid-icons/vs'
import { createSignal, onMount, createEffect } from 'solid-js' import { createSignal, onMount, createEffect } from 'solid-js'
import { Box, Button, Clickable, Column, Link, Logo, Modal, ModalButton, Padding, Page, Row, Input } from '../../components/' import { Box, Button, Clickable, Column, Link, Logo, Modal, ModalButton, Padding, Page, Row, Input } from '../../components/'
import { checkConnection, getApi, getApiMulti, postApi, securePassword } from '../../utils/functions' import { checkConnection, getApi, getApiMulti, postApi, saveNewName, saveNewPassword, securePassword } from '../../utils/functions'
import { FaSolidUserGear } from 'solid-icons/fa' import { FaSolidUserGear } from 'solid-icons/fa'
import { Show } from 'solid-js/web' import { Show } from 'solid-js/web'
import './Main.sass' import './Main.sass'
@ -322,7 +322,7 @@ export default () => {
} }
const checkCurrentPassword = async () => { const checkCurrentPassword = async () => {
const encCurrentPassword = await securePassword(configPassword()) const encCurrentPassword = await securePassword(configPassword(), 'v2')
if (encCurrentPassword === configEncPassword()) { if (encCurrentPassword === configEncPassword()) {
if (configNewPassword() === '') { if (configNewPassword() === '') {
setConfigError('New Password not provided') setConfigError('New Password not provided')
@ -339,39 +339,39 @@ export default () => {
} }
const encryptNewPassword = async () => { const encryptNewPassword = async () => {
const encNewPassword = await securePassword(configNewPassword()) const encNewPassword = await securePassword(configNewPassword(), 'v2')
setConfigNewEncPassword(encNewPassword) setConfigNewEncPassword(encNewPassword)
} }
const saveConfig = async () => { const saveConfig = async () => {
if (configNewName() !== '') await saveNewName(configNewName()) if (configNewName() !== '') await saveNewName(parseInt(ID), configNewName())
if (configNewPassword() !== '') await saveNewPassword(configNewEncPassword()) if (configNewPassword() !== '') await saveNewPassword(parseInt(ID), configNewEncPassword())
setConfigNotification(true) setConfigNotification(true)
} }
const saveNewName = async (name: string) => { // const saveNewName = async (name: string) => {
await postApi('update-name', { // await postApi('update-name', {
data: parseInt(ID), // data: parseInt(ID),
data2: name // data2: name
}) // })
} // }
const saveNewPassword = async (password: string) => { // const saveNewPassword = async (password: string) => {
await postApi('update-password', { // await postApi('update-password', {
data: parseInt(ID), // data: parseInt(ID),
data2: password // data2: password
}) // })
} // }
const logout = async () => { const logout = async () => {
removeEmployee() removeEmployee()
navigate('/') navigate('/')
} }
const gotoProfile = () => { // const gotoProfile = () => {
navigate('/profile') // navigate('/profile')
} // }
onMount(async () => { onMount(async () => {
const logged = await checkLogged() const logged = await checkLogged()
@ -407,7 +407,7 @@ export default () => {
<Row content="left" gap={1.5}> <Row content="left" gap={1.5}>
<Box curved thickness={0} padding="1.25rem 2.25rem" background="#0f131d56"> <Box curved thickness={0} padding="1.25rem 2.25rem" background="#0f131d56">
<span onClick={gotoProfile} class="name">{employeeName()}</span> <span class="name">{employeeName()}</span>
</Box> </Box>
<Clickable onClick={() => setOpenConfig(true)}> <Clickable onClick={() => setOpenConfig(true)}>
<Row gap={0.5}> <Row gap={0.5}>
@ -770,7 +770,7 @@ export default () => {
</div> </div>
<Show when={configError() !== ''}> <Show when={configError() !== ''}>
<span class="required">{configError()}</span> <span class="required-config">{configError()}</span>
<Button label='Cancel' edges='curved' design='bo-danger' onClick={() => setOpenConfig(false)} wide /> <Button label='Cancel' edges='curved' design='bo-danger' onClick={() => setOpenConfig(false)} wide />
</Show> </Show>