Compare commits
No commits in common. "3ed25c9cee4426114f989601e06508d678e2d557" and "66ff214024a89b731b6fc61a58e3ef276352a86a" have entirely different histories.
3ed25c9cee
...
66ff214024
7 changed files with 60 additions and 192 deletions
|
|
@ -158,26 +158,6 @@ func connect() {
|
||||||
"result2": array2,
|
"result2": array2,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-list-registered":
|
|
||||||
array := []string{}
|
|
||||||
|
|
||||||
results, err := db.Query("SELECT IFNULL(employeeid, 0) AS result FROM esign WHERE employeeid <> ?", 276)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
for results.Next() {
|
|
||||||
err = results.Scan(&result)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
array = append(array, result)
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": array,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -500,17 +480,6 @@ func connect() {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-employeename":
|
|
||||||
err := db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE employeeid = ?", data).Scan(&result)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": result,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,11 @@ interface Props {
|
||||||
color?: string
|
color?: string
|
||||||
border?: string
|
border?: string
|
||||||
opacity?: number
|
opacity?: number
|
||||||
trigger: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (props: Props) => {
|
export default (props: Props) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Show when={props.trigger}>
|
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<Show when={props.border}>
|
<Show when={props.border}>
|
||||||
<div class="modal__content" style={`background-color: ${props.background}; color: ${props.color}; border: 2px solid ${props.border}; opacity: ${props.opacity || 1}`}>
|
<div class="modal__content" style={`background-color: ${props.background}; color: ${props.color}; border: 2px solid ${props.border}; opacity: ${props.opacity || 1}`}>
|
||||||
|
|
@ -27,7 +25,6 @@ export default (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,6 @@
|
||||||
z-index: -1
|
z-index: -1
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
||||||
.close-text
|
|
||||||
padding: 3rem 0 0 0
|
|
||||||
font-size: 0.75rem
|
|
||||||
font-weight: 500
|
|
||||||
|
|
||||||
.inter
|
.inter
|
||||||
@extend .body
|
@extend .body
|
||||||
font-family: fonts.$Inter
|
font-family: fonts.$Inter
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
import './Index.sass'
|
import './Index.sass'
|
||||||
import { Button, Page, Padding, Display, Row, Logo } from '../../components'
|
import { Button, Page, Padding, Display, Row, Logo, Column, Box } from '../../components'
|
||||||
import { onMount } from 'solid-js'
|
import { onMount } from 'solid-js'
|
||||||
import { ofetch } from 'ofetch'
|
import { ofetch } from 'ofetch'
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
let assessorsNameList: string[]
|
let assessorsNameList: string[]
|
||||||
let registeredNameList: string[]
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const getAssessors = async () => {
|
const getAssessors = async () => {
|
||||||
|
|
@ -18,27 +17,8 @@ export default () => {
|
||||||
sessionStorage.setItem('assessors', JSON.stringify([...assessorsNameList]))
|
sessionStorage.setItem('assessors', JSON.stringify([...assessorsNameList]))
|
||||||
}
|
}
|
||||||
|
|
||||||
const getRegistered = async () => {
|
|
||||||
let nameList: string[] = []
|
|
||||||
|
|
||||||
try {
|
|
||||||
const registered = await ofetch(API + 'get-list-registered', { parseResponse: JSON.parse })
|
|
||||||
|
|
||||||
for (let i = 0; i < registered.result.length; i++) {
|
|
||||||
const name = await ofetch(API + 'get-employeename/' + registered.result[i], { parseResponse: JSON.parse })
|
|
||||||
nameList.push(name.result)
|
|
||||||
}
|
|
||||||
|
|
||||||
registeredNameList = [...nameList]
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
sessionStorage.setItem('registered', JSON.stringify([...registeredNameList]))
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await getAssessors()
|
await getAssessors()
|
||||||
await getRegistered()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -58,6 +38,24 @@ export default () => {
|
||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
</Display>
|
</Display>
|
||||||
|
|
||||||
|
<Display mobile>
|
||||||
|
<Column content="center">
|
||||||
|
<Logo size={120} />
|
||||||
|
<h1>OCBO e-Sign</h1>
|
||||||
|
|
||||||
|
<Button label="Register" edges="curved" to="/main" />
|
||||||
|
</Column>
|
||||||
|
</Display>
|
||||||
|
|
||||||
|
<Row content="spaced">
|
||||||
|
<Box thickness={1} curved>
|
||||||
|
<h2>Assessor</h2>
|
||||||
|
</Box>
|
||||||
|
<Box thickness={1} curved>
|
||||||
|
<h2>Approver</h2>
|
||||||
|
</Box>
|
||||||
|
</Row>
|
||||||
</Padding>
|
</Padding>
|
||||||
</Page>
|
</Page>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import './Login.sass'
|
import './Login.sass'
|
||||||
import { Logo, Link, Page, Row, Padding, Box, Radio, Combobox, Input, Button, Modal, Column } from '../../components'
|
import { Logo, Link, Page, Row, Padding, Box, Radio, Combobox, Input, Button } from '../../components'
|
||||||
import { IoChevronBack } from 'solid-icons/io'
|
import { IoChevronBack } from 'solid-icons/io'
|
||||||
import { createSignal, Show, createEffect } from 'solid-js'
|
import { createSignal, Show, createEffect } from 'solid-js'
|
||||||
import { ofetch } from 'ofetch'
|
import { ofetch } from 'ofetch'
|
||||||
|
|
@ -9,31 +9,22 @@ import { useNavigate } from '@solidjs/router'
|
||||||
export default () => {
|
export default () => {
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
const APPROVERNAME = import.meta.env.VITE_HEAD
|
const APPROVERNAME = import.meta.env.VITE_HEAD
|
||||||
const navigate = useNavigate()
|
|
||||||
const assessors = JSON.parse(sessionStorage.getItem('registered')!)
|
const assessors = JSON.parse(sessionStorage.getItem('registered')!)
|
||||||
const roles = ['Assessor', 'Approver']
|
const roles = ['Assessor', 'Approver']
|
||||||
|
|
||||||
const [role, setRole] = createSignal('Assessor')
|
const [role, setRole] = createSignal('Assessor')
|
||||||
const [name, setName] = createSignal('')
|
const [name, setName] = createSignal('')
|
||||||
const [password, setPassword] = createSignal('')
|
const [password, setPassword] = createSignal('')
|
||||||
const [loggedin, setLoggedin] = createSignal(0)
|
|
||||||
const [errorMessage, setErrorMessage] = createSignal('')
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
const employeeid = await ofetch(API + 'get-employeeid/' + name(), { parseResponse: JSON.parse })
|
const employeeid = await ofetch(API + 'get-employeeid/' + name(), { parseResponse: JSON.parse })
|
||||||
const dbpassword = await ofetch(API + 'get-password/' + employeeid.result, { parseResponse: JSON.parse })
|
const dbpassword = await ofetch(API + 'get-password/' + employeeid.result, { parseResponse: JSON.parse })
|
||||||
const hashPassword = await securePassword()
|
const hashPassword = await securePassword()
|
||||||
|
|
||||||
if (dbpassword.result === '0') {
|
|
||||||
setErrorMessage('Not yet registered. Please proceed to Registration.')
|
|
||||||
} else {
|
|
||||||
setErrorMessage('Invalid Password, Try again.')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dbpassword.result === hashPassword) {
|
if (dbpassword.result === hashPassword) {
|
||||||
setLoggedin(2)
|
navigate('/notification')
|
||||||
} else {
|
|
||||||
setLoggedin(1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,10 +36,6 @@ export default () => {
|
||||||
return thirdHashing.toString()
|
return thirdHashing.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
const gotoMain = () => {
|
|
||||||
navigate('/main')
|
|
||||||
}
|
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (role() === 'Approver') setName(APPROVERNAME)
|
if (role() === 'Approver') setName(APPROVERNAME)
|
||||||
else if (role() !== 'Approver' && name() === APPROVERNAME) setName('')
|
else if (role() !== 'Approver' && name() === APPROVERNAME) setName('')
|
||||||
|
|
@ -125,46 +112,6 @@ export default () => {
|
||||||
</Row>
|
</Row>
|
||||||
</Padding>
|
</Padding>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
||||||
<div onClick={gotoMain}>
|
|
||||||
<Modal trigger={loggedin() === 2} background="#18412aff" color="#ffffffe4" opacity={0.6}>
|
|
||||||
<Padding top={1} bottom={1} left={4} right={4}>
|
|
||||||
<Column>
|
|
||||||
<Row>
|
|
||||||
<Box curved thickness={3} color="white" padding={1}>
|
|
||||||
<h2>Login Successful</h2>
|
|
||||||
</Box>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Row>
|
|
||||||
<span class="close-text">Click anywhere to close</span>
|
|
||||||
</Row>
|
|
||||||
</Column>
|
|
||||||
</Padding>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div onClick={() => setLoggedin(0)}>
|
|
||||||
<Modal trigger={loggedin() === 1} background="#562020ff" color="#ffffffe4" opacity={0.6}>
|
|
||||||
<Padding top={1} bottom={1} left={4} right={4}>
|
|
||||||
<Column>
|
|
||||||
<Row>
|
|
||||||
<Box curved thickness={3} color="white" padding={1}>
|
|
||||||
<h2>Login Failed</h2>
|
|
||||||
</Box>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Row>
|
|
||||||
<h3>{errorMessage()}</h3>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Row>
|
|
||||||
<span class="close-text">Click anywhere to close</span>
|
|
||||||
</Row>
|
|
||||||
</Column>
|
|
||||||
</Padding>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,6 @@
|
||||||
width: 100%
|
width: 100%
|
||||||
text-align: center
|
text-align: center
|
||||||
|
|
||||||
.sub-message
|
|
||||||
padding: 3rem 0 0 0
|
|
||||||
font-size: 0.75rem
|
|
||||||
font-weight: 500
|
|
||||||
|
|
||||||
.filefield
|
.filefield
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import { ofetch } from 'ofetch'
|
||||||
import { SHA3, SHA1 } from 'crypto-js'
|
import { SHA3, SHA1 } from 'crypto-js'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { FileField } from '@kobalte/core/file-field'
|
import { FileField } from '@kobalte/core/file-field'
|
||||||
import { useNavigate } from '@solidjs/router'
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
|
|
@ -14,8 +13,6 @@ export default () => {
|
||||||
const assessors = JSON.parse(sessionStorage.getItem('assessors')!)
|
const assessors = JSON.parse(sessionStorage.getItem('assessors')!)
|
||||||
const roles = ['ASSESSOR', 'APPROVER']
|
const roles = ['ASSESSOR', 'APPROVER']
|
||||||
|
|
||||||
const navigate = useNavigate()
|
|
||||||
|
|
||||||
const [role, setRole] = createSignal('')
|
const [role, setRole] = createSignal('')
|
||||||
const [name, setName] = createSignal('')
|
const [name, setName] = createSignal('')
|
||||||
const [password, setPassword] = createSignal('')
|
const [password, setPassword] = createSignal('')
|
||||||
|
|
@ -49,7 +46,6 @@ export default () => {
|
||||||
try {
|
try {
|
||||||
register()
|
register()
|
||||||
setSaved(true)
|
setSaved(true)
|
||||||
updateRegistered()
|
|
||||||
} catch {
|
} catch {
|
||||||
setSaved(false)
|
setSaved(false)
|
||||||
}
|
}
|
||||||
|
|
@ -103,27 +99,6 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAssessors = async (): Promise<string[]> => {
|
|
||||||
let assessorsNameList: string[] = []
|
|
||||||
|
|
||||||
try {
|
|
||||||
const assessors = await ofetch(API + 'get-list-assessors', { parseResponse: JSON.parse })
|
|
||||||
assessorsNameList = [...assessors.result]
|
|
||||||
return [...assessorsNameList]
|
|
||||||
} catch {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateRegistered = async () => {
|
|
||||||
const registered = await getAssessors()
|
|
||||||
sessionStorage.setItem('assessors', JSON.stringify([...registered]))
|
|
||||||
}
|
|
||||||
|
|
||||||
const gotoIndex = () => {
|
|
||||||
navigate('/')
|
|
||||||
}
|
|
||||||
|
|
||||||
createEffect(async () => {
|
createEffect(async () => {
|
||||||
if (role() === 'APPROVER') {
|
if (role() === 'APPROVER') {
|
||||||
try {
|
try {
|
||||||
|
|
@ -235,7 +210,7 @@ export default () => {
|
||||||
|
|
||||||
<Show when={allow() === 2}>
|
<Show when={allow() === 2}>
|
||||||
<h4>Upload Signature</h4>
|
<h4>Upload Signature</h4>
|
||||||
<FileField class="filefield" maxFiles={1} onFileAccept={(data) => setFile(data)} accept=".png">
|
<FileField class="filefield" maxFiles={1} onFileAccept={(data) => setFile(data)} accept=".jpg, .jpeg, .png, .webp, .avif">
|
||||||
<FileField.Dropzone class="filefield__dropzone">Drag and drop or click to upload file</FileField.Dropzone>
|
<FileField.Dropzone class="filefield__dropzone">Drag and drop or click to upload file</FileField.Dropzone>
|
||||||
<FileField.HiddenInput />
|
<FileField.HiddenInput />
|
||||||
<FileField.ItemList class="filefield__itemList">
|
<FileField.ItemList class="filefield__itemList">
|
||||||
|
|
@ -281,17 +256,14 @@ export default () => {
|
||||||
</Padding>
|
</Padding>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
||||||
<div onClick={gotoIndex}>
|
|
||||||
<Modal trigger={saved()} background="#ffffffff" color="#000000e4" opacity={0.6}>
|
<Modal trigger={saved()} background="#ffffffff" color="#000000e4" opacity={0.6}>
|
||||||
<Padding top={1} bottom={1} left={4} right={4}>
|
<Padding top={1} bottom={1} left={4} right={4}>
|
||||||
<Column>
|
<Column>
|
||||||
<Row>
|
<Row>
|
||||||
<Box curved thickness={3} color="black" padding={1}>
|
|
||||||
<h2>e-Sign Registration Completed</h2>
|
<h2>e-Sign Registration Completed</h2>
|
||||||
</Box>
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<h3>Representation of your digital signature</h3>
|
<h3>Your Digital Signature</h3>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row gap={1}>
|
<Row gap={1}>
|
||||||
|
|
@ -305,14 +277,9 @@ export default () => {
|
||||||
<span>Date: {getDate()}</span>
|
<span>Date: {getDate()}</span>
|
||||||
</section>
|
</section>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row>
|
|
||||||
<span class="sub-message">Click anywhere to close</span>
|
|
||||||
</Row>
|
|
||||||
</Column>
|
</Column>
|
||||||
</Padding>
|
</Padding>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue