Compare commits
No commits in common. "ab2ba8bb207891188ab230460e0a10a9894c0c3f" and "67512d85100dde593000da82b45eda230cf4cfb1" have entirely different histories.
ab2ba8bb20
...
67512d8510
8 changed files with 12 additions and 357 deletions
|
|
@ -96,7 +96,7 @@ func connect() {
|
||||||
case "get-listopapproval-electrical":
|
case "get-listopapproval-electrical":
|
||||||
array := []string{}
|
array := []string{}
|
||||||
|
|
||||||
results, err := db.Query("SELECT DISTINCT IFNULL(electricalid, 0) AS result FROM electricaldocflowtxn WHERE remarks = ?", "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL")
|
results, err := db.Query("SELECT DISTINCT IFNULL(electricalid, '') as result FROM electricaldocflowtxn WHERE remarks = ?", "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
c.String(http.StatusBadRequest, err.Error())
|
||||||
|
|
@ -178,39 +178,7 @@ func connect() {
|
||||||
"result": array,
|
"result": array,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-listopapproval-electrical2":
|
|
||||||
var status string
|
|
||||||
array := []string{}
|
|
||||||
|
|
||||||
results, err := db.Query("SELECT DISTINCT IFNULL(electricalid, 0) AS result FROM electricaldocflowtxn WHERE remarks = ? LIMIT 20", "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL")
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
for results.Next() {
|
|
||||||
var result string
|
|
||||||
err = results.Scan(&result)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
err = db.QueryRow("SELECT IFNULL(remarks, '') AS status FROM electricaldocflowtxn WHERE electricaldocflowtxnid = (SELECT MAX(electricaldocflowtxnid) FROM electricaldocflowtxn WHERE electricalid = ?)", result).Scan(&status)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if status == "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL" {
|
|
||||||
array = append(array, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": array,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.GET("/api/:method/:data", func(c *gin.Context) {
|
router.GET("/api/:method/:data", func(c *gin.Context) {
|
||||||
|
|
@ -533,7 +501,7 @@ func connect() {
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-employeename":
|
case "get-employeename":
|
||||||
err := db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE employeeid = ?", data).Scan(&result)
|
err := db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE employeeid = ?", data).Scan(&result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
|
|
@ -543,50 +511,6 @@ func connect() {
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-opdetails-electrical":
|
|
||||||
var result2, result3, result4, result5 string
|
|
||||||
array := []string{}
|
|
||||||
array2 := []string{}
|
|
||||||
array3 := []string{}
|
|
||||||
array4 := []string{}
|
|
||||||
array5 := []string{}
|
|
||||||
|
|
||||||
results, err := db.Query("SELECT IFNULL(assessedbyid, 0) AS result, IFNULL(reviewedbyid, 0) AS result2, IFNULL(ref_bldgcomputationsheetid, 0) AS result3, IFNULL(amount, 0) AS result4, IFNULL(opDate, '') AS result5 FROM electrical_orderofpayment_new WHERE electricalid = ?", data)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
for results.Next() {
|
|
||||||
err = results.Scan(&result, &result2, &result3, &result4, &result5)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
}
|
|
||||||
array = append(array, result)
|
|
||||||
array2 = append(array2, result2)
|
|
||||||
array3 = append(array3, result3)
|
|
||||||
array4 = append(array4, result4)
|
|
||||||
array5 = append(array5, result5)
|
|
||||||
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": array,
|
|
||||||
"result2": array2,
|
|
||||||
"result3": array3,
|
|
||||||
"result4": array4,
|
|
||||||
"result5": array5,
|
|
||||||
})
|
|
||||||
|
|
||||||
case "get-paymentname":
|
|
||||||
err := db.QueryRow("SELECT IFNULL(accountdescription, '') AS result FROM ref_bldgcomputationsheet WHERE ref_bldgcomputationsheetid = ?", 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,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
align-items: center
|
align-items: center
|
||||||
align-content: center
|
align-content: center
|
||||||
|
|
||||||
.column-bottom
|
.column-right
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
flex-wrap: wrap
|
flex-wrap: wrap
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { JSXElement } from 'solid-js'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: JSXElement
|
children: JSXElement
|
||||||
content?: 'top' | 'center' | 'bottom' | 'split' | 'spaced'
|
content?: 'top' | 'center' | 'right' | 'split' | 'spaced'
|
||||||
gap?: number
|
gap?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ interface Props {
|
||||||
design?: 'bu-primary' | 'bu-link' | 'bu-info' | 'bu-success' | 'bu-warning' | 'bu-danger' | 'bu-dark' | 'bu-light' | 'bu-text' | 'bu-ghost' | 'bo-primary' | 'bo-secondary' | 'bo-success' | 'bo-danger' | 'bo-warning' | 'bo-info' | 'bo-light' | 'bo-dark' | 'bo-link'
|
design?: 'bu-primary' | 'bu-link' | 'bu-info' | 'bu-success' | 'bu-warning' | 'bu-danger' | 'bu-dark' | 'bu-light' | 'bu-text' | 'bu-ghost' | 'bo-primary' | 'bo-secondary' | 'bo-success' | 'bo-danger' | 'bo-warning' | 'bo-info' | 'bo-light' | 'bo-dark' | 'bo-link'
|
||||||
width?: number
|
width?: number
|
||||||
wide?: boolean
|
wide?: boolean
|
||||||
class?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (props: Props) => {
|
export default (props: Props) => {
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ export default () => {
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<span class="close-text">Click anywhere to proceed</span>
|
<span class="close-text">Click anywhere to close</span>
|
||||||
</Row>
|
</Row>
|
||||||
</Column>
|
</Column>
|
||||||
</Padding>
|
</Padding>
|
||||||
|
|
|
||||||
|
|
@ -14,101 +14,3 @@ h1
|
||||||
|
|
||||||
.name
|
.name
|
||||||
font-size: 1.25rem
|
font-size: 1.25rem
|
||||||
|
|
||||||
.tabs
|
|
||||||
width: 100%
|
|
||||||
|
|
||||||
&[data-orientation="vertical"]
|
|
||||||
display: flex
|
|
||||||
|
|
||||||
&__list
|
|
||||||
position: relative
|
|
||||||
display: flex
|
|
||||||
|
|
||||||
&__list[data-orientation="horizontal"]
|
|
||||||
align-items: center
|
|
||||||
|
|
||||||
&__list[data-orientation="vertical"]
|
|
||||||
flex-direction: column
|
|
||||||
align-items: stretch
|
|
||||||
|
|
||||||
&__indicator
|
|
||||||
position: absolute
|
|
||||||
background-color: hsl(200 98% 39%)
|
|
||||||
transition: all 250ms
|
|
||||||
|
|
||||||
&__indicator[data-orientation="horizontal"]
|
|
||||||
bottom: -1px
|
|
||||||
height: 2px
|
|
||||||
|
|
||||||
&__indicator[data-orientation="vertical"]
|
|
||||||
right: -1px
|
|
||||||
width: 2px
|
|
||||||
|
|
||||||
&__trigger
|
|
||||||
display: inline-block
|
|
||||||
padding: 8px 16px
|
|
||||||
outline: none
|
|
||||||
cursor: pointer
|
|
||||||
|
|
||||||
&__trigger:hover
|
|
||||||
background-color: hsl(0 0% 98%)
|
|
||||||
color: hsl(240 5% 34%)
|
|
||||||
|
|
||||||
&__trigger:focus-visible
|
|
||||||
background-color: hsl(240 5% 96%)
|
|
||||||
|
|
||||||
.tabs__trigger[data-disabled],
|
|
||||||
.tabs__trigger[data-disabled]:hover
|
|
||||||
opacity: 0.5
|
|
||||||
background-color: transparent
|
|
||||||
|
|
||||||
.tabs__content
|
|
||||||
padding: 16px
|
|
||||||
|
|
||||||
.table
|
|
||||||
width: 100%
|
|
||||||
border-collapse: collapse
|
|
||||||
margin: 2rem
|
|
||||||
|
|
||||||
th, td
|
|
||||||
border: 1px solid vars.$tableBorderColor
|
|
||||||
padding: 0.75rem
|
|
||||||
text-align: left
|
|
||||||
font-size: 1.1rem
|
|
||||||
|
|
||||||
td:nth-child(1)
|
|
||||||
width: 12rem
|
|
||||||
|
|
||||||
td:nth-child(3)
|
|
||||||
width: 9rem
|
|
||||||
|
|
||||||
th
|
|
||||||
background-color: vars.$tableHeaderBackground
|
|
||||||
color: white
|
|
||||||
|
|
||||||
.modal
|
|
||||||
font-weight: 500
|
|
||||||
|
|
||||||
&__application-number
|
|
||||||
font-size: 1.75rem
|
|
||||||
|
|
||||||
&__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: 2rem 0 0 0
|
|
||||||
|
|
||||||
&__label
|
|
||||||
font-size: 0.75rem
|
|
||||||
|
|
||||||
&__detail
|
|
||||||
font-size: 1rem
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,102 +1,9 @@
|
||||||
import './Main.sass'
|
import './Main.sass'
|
||||||
import { Logo, Link, Page, Row, Padding, ModalButton, Box, Column } from '../../components/'
|
import { Logo, Link, Page, Row, Padding, Table } from '../../components/'
|
||||||
import { FiLogOut } from 'solid-icons/fi'
|
import { FiLogOut } from 'solid-icons/fi'
|
||||||
import { Tabs } from '@kobalte/core/tabs'
|
// import { ofetch } from 'ofetch'
|
||||||
import { ofetch } from 'ofetch'
|
|
||||||
import { onMount, createSignal } from 'solid-js'
|
|
||||||
import dayjs from 'dayjs'
|
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [updatedList, setUpdatedList] = createSignal<string[]>([])
|
|
||||||
const [totalOp, setTotalOp] = createSignal(0)
|
|
||||||
const [assessor, setAssessor] = createSignal('')
|
|
||||||
const [approver, setApprover] = createSignal('')
|
|
||||||
const [dateOp, setDateOp] = createSignal('')
|
|
||||||
|
|
||||||
const getListForApproval = async () => {
|
|
||||||
try {
|
|
||||||
const response = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
|
||||||
return response.result
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getListOfReadyForApprovalFiltered = async (list: number[]) => {
|
|
||||||
let newList: number[] = []
|
|
||||||
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
|
||||||
const response = await ofetch(API + 'get-laststatus-electrical/' + list[i], { parseResponse: JSON.parse })
|
|
||||||
if (response.result === 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL') {
|
|
||||||
newList.push(list[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [...newList]
|
|
||||||
}
|
|
||||||
|
|
||||||
const getApplicationById = async (list: number[]) => {
|
|
||||||
let applicationList: string[] = []
|
|
||||||
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
|
||||||
const response = await ofetch(API + 'get-applicationbyid-electrical/' + list[i], { parseResponse: JSON.parse })
|
|
||||||
applicationList.push(response.result)
|
|
||||||
}
|
|
||||||
|
|
||||||
setUpdatedList([...applicationList])
|
|
||||||
}
|
|
||||||
|
|
||||||
const load = async () => {
|
|
||||||
// const listForApproval = await getListForApproval()
|
|
||||||
// const listOfReadyForApprovalFiltered = await getListOfReadyForApprovalFiltered(listForApproval)
|
|
||||||
// await getApplicationById(listOfReadyForApprovalFiltered)
|
|
||||||
|
|
||||||
// console.log(listOfReadyForApprovalFiltered)
|
|
||||||
await getopdetails()
|
|
||||||
}
|
|
||||||
|
|
||||||
const getopdetails = async () => {
|
|
||||||
const op = await ofetch(API + 'get-opdetails-electrical/23512', { parseResponse: JSON.parse })
|
|
||||||
setTotalOp(calculateTotal(op.result4))
|
|
||||||
setAssessor(await getEmployeeName(op.result[0]))
|
|
||||||
setApprover(await getEmployeeName(op.result2[0]))
|
|
||||||
setDateOp(dayjs(op.result5[0]).format('MMMM DD, YYYY'))
|
|
||||||
}
|
|
||||||
|
|
||||||
const calculateTotal = (list: number[]) => {
|
|
||||||
let total = 0
|
|
||||||
for (let i = 0; i < list.length; i++) {
|
|
||||||
total += parseInt(list[i].toString())
|
|
||||||
}
|
|
||||||
return total
|
|
||||||
}
|
|
||||||
|
|
||||||
const getEmployeeName = async (id: string) => {
|
|
||||||
try {
|
|
||||||
const response = await ofetch(API + 'get-employeename/' + id, { parseResponse: JSON.parse })
|
|
||||||
const result = response.result
|
|
||||||
return result
|
|
||||||
} catch {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getPaymentName = async (id: string) => {
|
|
||||||
try {
|
|
||||||
const response = await ofetch(API + 'get-paymentname/' + id, { parseResponse: JSON.parse })
|
|
||||||
const result = response.result
|
|
||||||
return result
|
|
||||||
} catch {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
await load()
|
|
||||||
})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Page alignment="column">
|
<Page alignment="column">
|
||||||
|
|
@ -117,72 +24,10 @@ export default () => {
|
||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Row>
|
||||||
<Row content="center">
|
<Row content="center">
|
||||||
<Tabs aria-label="Main navigation" class="tabs">
|
<h2>List of Ready to Approve and Sign OP (Order of Payments)</h2>
|
||||||
<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>
|
|
||||||
<Tabs.Indicator class="tabs__indicator" />
|
|
||||||
</Tabs.List>
|
|
||||||
<Tabs.Content class="tabs__content" value="building">
|
|
||||||
<Row>
|
|
||||||
<h2>List of Ready to Approve and Sign Building Order of Payments</h2>
|
|
||||||
</Row>
|
|
||||||
</Tabs.Content>
|
|
||||||
<Tabs.Content class="tabs__content" value="occupancy">
|
|
||||||
<Row>
|
|
||||||
<h2>List of Ready to Approve and Sign Occupancy Order of Payments</h2>
|
|
||||||
</Row>
|
|
||||||
</Tabs.Content>
|
|
||||||
<Tabs.Content class="tabs__content" value="electrical">
|
|
||||||
<Row>
|
|
||||||
<h2>List of Ready to Approve and Sign Electrical Order of Payments</h2>
|
|
||||||
</Row>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Application Number</th>
|
|
||||||
<th>Name</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>111</td>
|
|
||||||
<td>11</td>
|
|
||||||
<td>
|
|
||||||
<ModalButton class="modal" label="Show Details" design="bo-link" background="#111d29e1" color="#ffffffec">
|
|
||||||
<Padding top={0} left={2} right={2} bottom={0}>
|
|
||||||
<Column>
|
|
||||||
<Box curved thickness={1} padding={1}>
|
|
||||||
<span class="modal__application-number">25-0000000123</span>
|
|
||||||
</Box>
|
|
||||||
<span class="modal__name">Sample Name</span>
|
|
||||||
|
|
||||||
<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">Total Fee:</span>
|
|
||||||
<span class="modal__row__detail">P {totalOp().toFixed(2)}</span>
|
|
||||||
</section>
|
|
||||||
</Column>
|
|
||||||
</Padding>
|
|
||||||
</ModalButton>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</Tabs.Content>
|
|
||||||
</Tabs>
|
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
<Table />
|
||||||
</Padding>
|
</Padding>
|
||||||
</Page>
|
</Page>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -233,9 +233,6 @@ export default () => {
|
||||||
<h4>Name of Approver</h4>
|
<h4>Name of Approver</h4>
|
||||||
<span class="approver-name">{APPROVERNAME}</span>
|
<span class="approver-name">{APPROVERNAME}</span>
|
||||||
|
|
||||||
<h4>Password</h4>
|
|
||||||
<Input value={password()} onChange={setPassword}></Input>
|
|
||||||
|
|
||||||
<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=".png">
|
||||||
|
|
@ -256,29 +253,17 @@ export default () => {
|
||||||
</FileField>
|
</FileField>
|
||||||
|
|
||||||
<Padding top={2} bottom={0} left={0} right={0}>
|
<Padding top={2} bottom={0} left={0} right={0}>
|
||||||
<Show when={file() && password()}>
|
<Show when={file()}>
|
||||||
<Row>
|
<Row>
|
||||||
<Button edges="curved" design="bo-primary" label="Register" onClick={generateSignature} wide />
|
<Button edges="curved" design="bo-primary" label="Register" onClick={generateSignature} wide />
|
||||||
</Row>
|
</Row>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={file() && !password()}>
|
<Show when={!file()}>
|
||||||
<Row>
|
|
||||||
<span class="already-registered">Required password</span>
|
|
||||||
</Row>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={!file() && password()}>
|
|
||||||
<Row>
|
<Row>
|
||||||
<span class="already-registered">Required signature</span>
|
<span class="already-registered">Required signature</span>
|
||||||
</Row>
|
</Row>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={!file() && !password()}>
|
|
||||||
<Row>
|
|
||||||
<span class="already-registered">Required password and signature</span>
|
|
||||||
</Row>
|
|
||||||
</Show>
|
|
||||||
</Padding>
|
</Padding>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue