Added view of occupancy approval list
This commit is contained in:
parent
500d138339
commit
d8296d9c0e
1 changed files with 161 additions and 56 deletions
|
|
@ -37,8 +37,10 @@ export default () => {
|
||||||
// const [amountList, setAmountList] = createSignal<string[]>([])
|
// const [amountList, setAmountList] = createSignal<string[]>([])
|
||||||
// const [dateOpList, setDateOpList] = createSignal<string[]>([])
|
// const [dateOpList, setDateOpList] = createSignal<string[]>([])
|
||||||
|
|
||||||
const [applicationList, setApplicationList] = createSignal<string[]>([])
|
const [applicationListElectrical, setApplicationListElectrical] = createSignal<string[]>([])
|
||||||
const [nameList, setNameList] = createSignal<string[]>([])
|
const [nameListElectrical, setNameListElectrical] = createSignal<string[]>([])
|
||||||
|
const [applicationListOccupancy, setApplicationListOccupancy] = createSignal<string[]>([])
|
||||||
|
const [nameListOccupancy, setNameListOccupancy] = createSignal<string[]>([])
|
||||||
|
|
||||||
const [errorMessage, setErrorMessage] = createSignal('')
|
const [errorMessage, setErrorMessage] = createSignal('')
|
||||||
const [connected, setConnected] = createSignal(true)
|
const [connected, setConnected] = createSignal(true)
|
||||||
|
|
@ -50,38 +52,73 @@ export default () => {
|
||||||
|
|
||||||
const getListForApproval = async () => {
|
const getListForApproval = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
const responseE = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
||||||
setApplicationList(response.result)
|
setApplicationListElectrical(responseE.result)
|
||||||
setNameList(response.result2)
|
setNameListElectrical(responseE.result2)
|
||||||
|
|
||||||
|
const responseO = await ofetch(API + 'get-listopapproval-occupancy', { parseResponse: JSON.parse })
|
||||||
|
setApplicationListOccupancy(responseO.result)
|
||||||
|
setNameListOccupancy(responseO.result2)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const load = async () => {
|
const getListForApprovalElectrical = async () => {
|
||||||
|
try {
|
||||||
|
const responseE = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
||||||
|
setApplicationListElectrical(responseE.result)
|
||||||
|
setNameListElectrical(responseE.result2)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getListForApprovalOccupancy = async () => {
|
||||||
|
try {
|
||||||
|
const responseO = await ofetch(API + 'get-listopapproval-occupancy', { parseResponse: JSON.parse })
|
||||||
|
setApplicationListOccupancy(responseO.result)
|
||||||
|
setNameListOccupancy(responseO.result2)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const load = async (division: string) => {
|
||||||
setConnected(await checkConnection())
|
setConnected(await checkConnection())
|
||||||
if (connected() === false) {
|
if (connected() === false) {
|
||||||
setErrorMessage('Could not gather list of applicaitons')
|
setErrorMessage('Could not gather list of applicaitons')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await getListForApproval()
|
if (division === 'electrical') {
|
||||||
|
await getListForApprovalElectrical()
|
||||||
|
}
|
||||||
|
if (division === 'occupancy') {
|
||||||
|
await getListForApprovalOccupancy()
|
||||||
|
} else {
|
||||||
|
await getListForApproval()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getopdetails = async (applicationNo: string) => {
|
const getopdetails = async (division: string, applicationNo: string) => {
|
||||||
const op = await ofetch(API + 'get-opdetails-electrical/' + applicationNo, { parseResponse: JSON.parse })
|
if (division === 'electrical') {
|
||||||
setAssessor(op.result7[0])
|
const op = await ofetch(API + 'get-opdetails-electrical/' + applicationNo, { parseResponse: JSON.parse })
|
||||||
setLocation(op.result5[0])
|
setAssessor(op.result7[0])
|
||||||
setType(op.result6[0])
|
setLocation(op.result5[0])
|
||||||
setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY'))
|
setType(op.result6[0])
|
||||||
setApplicationId(op.result11[0])
|
setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY'))
|
||||||
// setAssessorId(op.result12[0])
|
setApplicationId(op.result11[0])
|
||||||
setTotalOp(calculateTotal(op.result9))
|
setTotalOp(calculateTotal(op.result9))
|
||||||
|
} else if (division === 'occupancy') {
|
||||||
// setDescriptionList(op.result8)
|
const op = await ofetch(API + 'get-opdetails-occupancy/' + applicationNo, { parseResponse: JSON.parse })
|
||||||
// setAmountList(op.result9)
|
setAssessor(op.result7[0])
|
||||||
// setDateOpList(op.result10)
|
setLocation(op.result5[0])
|
||||||
// calculateAmounts()
|
setType(op.result6[0])
|
||||||
|
setDateOp(dayjs(op.result10[0]).format('MMMM DD, YYYY'))
|
||||||
|
setApplicationId(op.result11[0])
|
||||||
|
setTotalOp(calculateTotal(op.result9))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateTotal = (list: number[]) => {
|
const calculateTotal = (list: number[]) => {
|
||||||
|
|
@ -217,11 +254,7 @@ export default () => {
|
||||||
|
|
||||||
const closeNotification = async () => {
|
const closeNotification = async () => {
|
||||||
setApproved(false)
|
setApproved(false)
|
||||||
await load()
|
await load('all')
|
||||||
}
|
|
||||||
|
|
||||||
const openPDF = () => {
|
|
||||||
createPdf()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeEmployee = () => {
|
const removeEmployee = () => {
|
||||||
|
|
@ -280,8 +313,14 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const refresh = async () => {
|
const refresh = async (division: string) => {
|
||||||
await load()
|
if (division === 'electrical') {
|
||||||
|
await load('electrical')
|
||||||
|
} else if (division === 'occupancy') {
|
||||||
|
await load('occupancy')
|
||||||
|
} else {
|
||||||
|
await load('all')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
|
|
@ -293,7 +332,7 @@ export default () => {
|
||||||
const logged = await checkLogged()
|
const logged = await checkLogged()
|
||||||
|
|
||||||
if (logged) {
|
if (logged) {
|
||||||
await load()
|
await load('all')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -361,33 +400,12 @@ export default () => {
|
||||||
</Tabs.Content>
|
</Tabs.Content>
|
||||||
<Tabs.Content class="tabs__content" value="occupancy">
|
<Tabs.Content class="tabs__content" value="occupancy">
|
||||||
<Row>
|
<Row>
|
||||||
{/* <h2>List of Ready to Approve and Sign Occupancy Order of Payments</h2> */}
|
<h2>List of Ready to Approve and Sign Occupancy Order of Payments</h2>
|
||||||
<Box curved thickness={0} background="#602a2abf" padding="1rem 2rem">
|
|
||||||
<h2>Under Development</h2>
|
|
||||||
</Box>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Row>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
{/* <tr>
|
|
||||||
<th>Application Number</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th style="text-align: center">Show Details</th>
|
|
||||||
</tr> */}
|
|
||||||
</thead>
|
|
||||||
<tbody></tbody>
|
|
||||||
</table>
|
|
||||||
</Row>
|
|
||||||
</Tabs.Content>
|
|
||||||
<Tabs.Content class="tabs__content" value="electrical">
|
|
||||||
<Row>
|
|
||||||
<h2 onClick={openPDF}>List of Ready to Approve and Sign in Electrical Order of Payments</h2>
|
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Padding top={0} bottom={0} right={10} left={0}>
|
<Padding top={0} bottom={0} right={10} left={0}>
|
||||||
<Row content="right">
|
<Row content="right">
|
||||||
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={refresh}></Button>
|
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={() => refresh('occupancy')}></Button>
|
||||||
</Row>
|
</Row>
|
||||||
</Padding>
|
</Padding>
|
||||||
|
|
||||||
|
|
@ -401,10 +419,10 @@ export default () => {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{applicationList().map((item, index) => (
|
{applicationListOccupancy().map((item, index) => (
|
||||||
<tr>
|
<tr>
|
||||||
<td>{item}</td>
|
<td>{item}</td>
|
||||||
<td>{nameList()[index]}</td>
|
<td>{nameListOccupancy()[index]}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<ModalButton
|
<ModalButton
|
||||||
|
|
@ -414,7 +432,7 @@ export default () => {
|
||||||
background="#121e2acc"
|
background="#121e2acc"
|
||||||
color="#ffffffec"
|
color="#ffffffec"
|
||||||
function={async () => {
|
function={async () => {
|
||||||
await getopdetails(item)
|
await getopdetails('occupancy', item)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Padding top={0} left={2} right={2} bottom={0}>
|
<Padding top={0} left={2} right={2} bottom={0}>
|
||||||
|
|
@ -423,7 +441,94 @@ export default () => {
|
||||||
<Padding top={1} left={0} right={0} bottom={0}>
|
<Padding top={1} left={0} right={0} bottom={0}>
|
||||||
<section class="modal__row">
|
<section class="modal__row">
|
||||||
<span class="modal__row__label">Name of Applicant:</span>
|
<span class="modal__row__label">Name of Applicant:</span>
|
||||||
<span class="modal__row__detail">{nameList()[index]}</span>
|
<span class="modal__row__detail">{nameListOccupancy()[index]}</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="modal__row">
|
||||||
|
<span class="modal__row__label">Location:</span>
|
||||||
|
<span class="modal__row__detail">{location()}</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="modal__row">
|
||||||
|
<span class="modal__row__label">Type:</span>
|
||||||
|
<span class="modal__row__detail">{type().toUpperCase()}</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="modal__row">
|
||||||
|
<span class="modal__row__label">Assessed By:</span>
|
||||||
|
<span class="modal__row__detail">{assessor()}</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="modal__row">
|
||||||
|
<span class="modal__row__label">Date Assessed:</span>
|
||||||
|
<span class="modal__row__detail">{dateOp().toUpperCase()}</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="modal__row">
|
||||||
|
<span class="modal__row__label">Total Fee:</span>
|
||||||
|
<span class="modal__row__detail__price">
|
||||||
|
{PESO} {totalOp().toFixed(2)}
|
||||||
|
</span>
|
||||||
|
</section>
|
||||||
|
</Padding>
|
||||||
|
|
||||||
|
<Row padding="2rem 0 0 0">
|
||||||
|
<Button wide label="Approve" edges="curved" design="bo-primary" onClick={() => approveHandler(item)}></Button>
|
||||||
|
<span class="modal__cancel">Click anywhere to cancel</span>
|
||||||
|
</Row>
|
||||||
|
</Padding>
|
||||||
|
</ModalButton>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</Row>
|
||||||
|
</Tabs.Content>
|
||||||
|
<Tabs.Content class="tabs__content" value="electrical">
|
||||||
|
<Row>
|
||||||
|
<h2>List of Ready to Approve and Sign in Electrical Order of Payments</h2>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
<Padding top={0} bottom={0} right={10} left={0}>
|
||||||
|
<Row content="right">
|
||||||
|
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={() => refresh('electrical')}></Button>
|
||||||
|
</Row>
|
||||||
|
</Padding>
|
||||||
|
|
||||||
|
<Row>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Application Number</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th style="text-align: center">Show Details</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{applicationListElectrical().map((item, index) => (
|
||||||
|
<tr>
|
||||||
|
<td>{item}</td>
|
||||||
|
<td>{nameListElectrical()[index]}</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<ModalButton
|
||||||
|
class="modal"
|
||||||
|
label="Show Details"
|
||||||
|
design="bo-link"
|
||||||
|
background="#121e2acc"
|
||||||
|
color="#ffffffec"
|
||||||
|
function={async () => {
|
||||||
|
await getopdetails('electrical', item)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Padding top={0} left={2} right={2} bottom={0}>
|
||||||
|
<span class="modal__application-number">{item}</span>
|
||||||
|
|
||||||
|
<Padding top={1} left={0} right={0} bottom={0}>
|
||||||
|
<section class="modal__row">
|
||||||
|
<span class="modal__row__label">Name of Applicant:</span>
|
||||||
|
<span class="modal__row__detail">{nameListElectrical()[index]}</span>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="modal__row">
|
<section class="modal__row">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue