Updated asseessors page
This commit is contained in:
parent
e05719c284
commit
c9f787ad39
2 changed files with 144 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<>
|
||||
<Page alignment="column">
|
||||
|
|
@ -51,13 +116,13 @@ export default () => {
|
|||
</Link>
|
||||
|
||||
<Row content="left" gap={1}>
|
||||
<span class="name">{_employeeName.get()}</span>
|
||||
<Link to="/">
|
||||
<span class="name">{employeeName()}</span>
|
||||
<Clickable onClick={logout}>
|
||||
<Row gap={0.5}>
|
||||
<FiLogOut size={25} />
|
||||
<span>Logout</span>
|
||||
</Row>
|
||||
</Link>
|
||||
</Clickable>
|
||||
</Row>
|
||||
</Row>
|
||||
|
||||
|
|
@ -65,15 +130,21 @@ export default () => {
|
|||
<Tabs aria-label="Main navigation" class="tabs">
|
||||
<Row>
|
||||
<Tabs.List class="tabs__list">
|
||||
<Tabs.Trigger class="tabs__trigger" value="building">
|
||||
Building
|
||||
</Tabs.Trigger>
|
||||
<Tabs.Trigger class="tabs__trigger" value="occupancy">
|
||||
Occupancy
|
||||
</Tabs.Trigger>
|
||||
<Tabs.Trigger class="tabs__trigger" value="electrical">
|
||||
Electrical
|
||||
</Tabs.Trigger>
|
||||
<Show when={isBuilding()}>
|
||||
<Tabs.Trigger class="tabs__trigger" value="building">
|
||||
Building
|
||||
</Tabs.Trigger>
|
||||
</Show>
|
||||
<Show when={isOccupancy()}>
|
||||
<Tabs.Trigger class="tabs__trigger" value="occupancy">
|
||||
Occupancy
|
||||
</Tabs.Trigger>
|
||||
</Show>
|
||||
<Show when={isElectrical()}>
|
||||
<Tabs.Trigger class="tabs__trigger" value="electrical">
|
||||
Electrical
|
||||
</Tabs.Trigger>
|
||||
</Show>
|
||||
<Tabs.Indicator class="tabs__indicator" />
|
||||
</Tabs.List>
|
||||
</Row>
|
||||
|
|
@ -116,7 +187,7 @@ export default () => {
|
|||
</Tabs.Content>
|
||||
<Tabs.Content class="tabs__content" value="electrical">
|
||||
<Row>
|
||||
<h2>List of Ready to Approve and Sign Electrical Order of Payments</h2>
|
||||
<h2>List of Ready to Print in Electrical Order of Payments</h2>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
|
|
@ -183,7 +254,7 @@ export default () => {
|
|||
</Padding>
|
||||
|
||||
<Row padding="2rem 0 0 0">
|
||||
<Button wide label="Approve" edges="curved" design="bo-primary"></Button>
|
||||
<Button wide label="Print" edges="curved" design="bo-primary"></Button>
|
||||
<span class="modal__cancel">Click anywhere to cancel</span>
|
||||
</Row>
|
||||
</Padding>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue