Compare commits
5 commits
44cde5e63f
...
58eb2cb472
| Author | SHA1 | Date | |
|---|---|---|---|
| 58eb2cb472 | |||
| 060741fcba | |||
| d4814a6449 | |||
| 6511b7352d | |||
| eb0fa84e6d |
12 changed files with 132 additions and 9 deletions
|
|
@ -79,18 +79,16 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.String(http.StatusOK, "Connection is OK")
|
||||
|
||||
case "check-connection":
|
||||
err = db.QueryRow("SELECT 1 AS result").Scan(&result)
|
||||
if err != nil {
|
||||
// c.AbortWithError(http.StatusBadRequest, err)
|
||||
// c.String(http.StatusBadRequest, err.Error())
|
||||
// c.String(http.StatusBadGateway, "false")
|
||||
c.AbortWithError(http.StatusBadGateway, err)
|
||||
c.JSON(http.StatusBadGateway, gin.H{"result": false})
|
||||
return
|
||||
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"result": true})
|
||||
|
||||
|
|
@ -105,12 +103,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -127,12 +127,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
}
|
||||
|
|
@ -150,12 +152,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -172,12 +176,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
}
|
||||
|
|
@ -207,6 +213,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -217,6 +224,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -227,6 +235,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -237,6 +246,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -247,6 +257,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -259,6 +270,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -276,6 +288,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -291,6 +304,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -310,12 +324,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -336,12 +352,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -362,12 +380,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -389,12 +409,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2, &result3, &result4)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -424,6 +446,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -434,6 +457,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -444,6 +468,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -454,6 +479,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -464,6 +490,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -474,6 +501,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
@ -487,6 +515,7 @@ func connect() {
|
|||
} else {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -502,6 +531,7 @@ func connect() {
|
|||
} else {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -517,6 +547,7 @@ func connect() {
|
|||
} else {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
|
|
@ -543,12 +574,14 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8, &result9, &result10, &result11, &result12)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
|
|
@ -584,6 +617,7 @@ func connect() {
|
|||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": result,
|
||||
|
|
|
|||
BIN
src/assets/images/ocbologo.png
Normal file
BIN
src/assets/images/ocbologo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/images/optimized/ocbologo.avif
Normal file
BIN
src/assets/images/optimized/ocbologo.avif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
src/assets/images/optimized/ocbologo.webp
Normal file
BIN
src/assets/images/optimized/ocbologo.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
14
src/components/Copyright/Copyright.tsx
Normal file
14
src/components/Copyright/Copyright.tsx
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
interface Props {
|
||||
year: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export default (props: Props) => {
|
||||
return (
|
||||
<>
|
||||
<span>
|
||||
Copyright © {props.year} {props.name} All Rights Reserved.
|
||||
</span>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
.footer
|
||||
padding: 1rem 0
|
||||
margin: 0 2rem
|
||||
// margin: 0 2rem 0 0
|
||||
position: fixed
|
||||
bottom: 0
|
||||
width: 100%
|
||||
width: 95vw
|
||||
opacity: 0.8
|
||||
font-size: 1rem
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export { default as File } from './File/File'
|
|||
export { default as QR } from './QR/QR'
|
||||
export { default as Input } from './Input/Input'
|
||||
export { default as Radio } from './Radio/Radio'
|
||||
export { default as Copyright } from './Copyright/Copyright'
|
||||
// export { default as OptimizeBackground } from './Optimizers/OptimizeBackground'
|
||||
// export { default as OptimizeImage } from './Optimizers/OptimizeImage'
|
||||
// export { default as OptimizeLogo } from './Optimizers/OptimizeLogo'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import './Index.sass'
|
||||
import { Button, Page, Padding, Display, Row, Logo } from '../../components'
|
||||
import { Button, Page, Padding, Display, Row, Logo, Footer, Image, Copyright } from '../../components'
|
||||
import { onMount } from 'solid-js'
|
||||
import { ofetch } from 'ofetch'
|
||||
import ocboAvif from '../../assets/images/optimized/ocbologo.avif'
|
||||
import ocboWebp from '../../assets/images/optimized/ocbologo.webp'
|
||||
import patAvif from '../../assets/images/optimized/pat-alcala.avif'
|
||||
import patWebp from '../../assets/images/optimized/pat-alcala.webp'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
let assessorsNameList: string[]
|
||||
|
|
@ -59,6 +63,24 @@ export default () => {
|
|||
</Row>
|
||||
</Display>
|
||||
</Padding>
|
||||
|
||||
<Footer>
|
||||
<Row content="split">
|
||||
<Row gap={0.5}>
|
||||
<Image avif={ocboAvif} webp={ocboWebp} size={30}></Image>
|
||||
<Row gap={0.25}>
|
||||
<Copyright year="2025" name="Office of the City Building Official" />
|
||||
<span>Davao City, Philippines</span>
|
||||
</Row>
|
||||
</Row>
|
||||
|
||||
<Row gap={0.25}>
|
||||
<span>Developed by:</span>
|
||||
<Image avif={patAvif} webp={patWebp} size={90}></Image>
|
||||
<span>Pat Alcala</span>
|
||||
</Row>
|
||||
</Row>
|
||||
</Footer>
|
||||
</Page>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { createSignal, Show, createEffect } from 'solid-js'
|
|||
import { ofetch } from 'ofetch'
|
||||
import { SHA1, SHA3 } from 'crypto-js'
|
||||
import { useNavigate } from '@solidjs/router'
|
||||
import { checkConnection } from '../../utils/functions'
|
||||
|
||||
export default () => {
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
|
|
@ -18,8 +19,15 @@ export default () => {
|
|||
const [password, setPassword] = createSignal('')
|
||||
const [loggedin, setLoggedin] = createSignal(0)
|
||||
const [errorMessage, setErrorMessage] = createSignal('')
|
||||
const [connected, setConnected] = createSignal(true)
|
||||
|
||||
const login = async () => {
|
||||
setConnected(await checkConnection())
|
||||
if (connected() === false) {
|
||||
setErrorMessage('No Connection on Server')
|
||||
return
|
||||
}
|
||||
|
||||
const employeeid = await ofetch(API + 'get-employeeid/' + name(), { parseResponse: JSON.parse })
|
||||
const dbpassword = await ofetch(API + 'get-password/' + employeeid.result, { parseResponse: JSON.parse })
|
||||
const hashPassword = await securePassword()
|
||||
|
|
@ -166,6 +174,28 @@ export default () => {
|
|||
</Padding>
|
||||
</Modal>
|
||||
</div>
|
||||
|
||||
<div onClick={() => setConnected(true)}>
|
||||
<Modal trigger={connected() === false} background="#562020ff" color="#ffebebe6" opacity={0.8}>
|
||||
<Padding top={1} bottom={1} left={4} right={4}>
|
||||
<Column>
|
||||
<Row>
|
||||
<Box curved thickness={3} color="#ffebebe6" padding="1rem">
|
||||
<h2>Connection Error</h2>
|
||||
</Box>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<h3>{errorMessage()}</h3>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<span class="close-text">Click anywhere to close</span>
|
||||
</Row>
|
||||
</Column>
|
||||
</Padding>
|
||||
</Modal>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { Tabs } from '@kobalte/core/tabs'
|
|||
import { ofetch } from 'ofetch'
|
||||
import { onMount, createSignal } from 'solid-js'
|
||||
import dayjs from 'dayjs'
|
||||
import { checkConnection } from '../../utils/functions'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
|
|
@ -30,6 +31,9 @@ export default () => {
|
|||
const [applicationList, setApplicationList] = createSignal<string[]>([])
|
||||
const [nameList, setNameList] = createSignal<string[]>([])
|
||||
|
||||
const [errorMessage, setErrorMessage] = createSignal('')
|
||||
const [connected, setConnected] = createSignal(true)
|
||||
|
||||
const getListForApproval = async () => {
|
||||
try {
|
||||
const response = await ofetch(API + 'get-listopapproval-electrical', { parseResponse: JSON.parse })
|
||||
|
|
@ -41,6 +45,12 @@ export default () => {
|
|||
}
|
||||
|
||||
const load = async () => {
|
||||
setConnected(await checkConnection())
|
||||
if (connected() === false) {
|
||||
setErrorMessage('Could not gather list of applicaitons')
|
||||
return
|
||||
}
|
||||
|
||||
await getListForApproval()
|
||||
}
|
||||
|
||||
|
|
@ -86,11 +96,9 @@ export default () => {
|
|||
|
||||
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT APPROVED AND SIGNED', '170', 'ELECOPAPPROVEDSIGNED')
|
||||
if (signed) {
|
||||
console.log('Signed')
|
||||
forprinting = await setNewStatus('FOR ELECTRICAL ORDER OF PAYMENT PRINTING', '95', 'ELECOPPRINT')
|
||||
}
|
||||
if (forprinting) {
|
||||
console.log('For Printing')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
13
src/utils/functions/checkConnection.ts
Normal file
13
src/utils/functions/checkConnection.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { ofetch } from 'ofetch'
|
||||
|
||||
const API = import.meta.env.VITE_BACKEND
|
||||
|
||||
export default async () => {
|
||||
try {
|
||||
const check = await ofetch(API + 'check-connection')
|
||||
const result = check.result
|
||||
return result
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
1
src/utils/functions/index.ts
Normal file
1
src/utils/functions/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as checkConnection } from './checkConnection'
|
||||
Loading…
Add table
Add a link
Reference in a new issue