Compare commits
2 commits
577066c9ea
...
96ab531432
| Author | SHA1 | Date | |
|---|---|---|---|
| 96ab531432 | |||
| 28cea3241b |
2 changed files with 64 additions and 42 deletions
|
|
@ -18,12 +18,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// DEV
|
// DEV
|
||||||
var connection string = "root:superuser@tcp(localhost:3306)/iips"
|
// var connection string = "root:superuser@tcp(localhost:3306)/iips"
|
||||||
var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
// var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
||||||
|
|
||||||
// SERVER
|
// SERVER
|
||||||
// var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips"
|
var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips"
|
||||||
// var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
connect()
|
connect()
|
||||||
|
|
@ -44,23 +44,23 @@ func connect() {
|
||||||
router.Use(cors.Default())
|
router.Use(cors.Default())
|
||||||
|
|
||||||
//DEV
|
//DEV
|
||||||
router.Use(cors.New(cors.Config{
|
|
||||||
AllowOrigins: []string{"http://localhost:5173"},
|
|
||||||
AllowMethods: []string{"GET", "POST"},
|
|
||||||
AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"},
|
|
||||||
ExposeHeaders: []string{"Content-Length"},
|
|
||||||
AllowCredentials: true,
|
|
||||||
}))
|
|
||||||
|
|
||||||
//SERVER
|
|
||||||
// router.Use(cors.New(cors.Config{
|
// router.Use(cors.New(cors.Config{
|
||||||
// AllowAllOrigins: true,
|
// AllowOrigins: []string{"http://localhost:5173"},
|
||||||
// AllowMethods: []string{"GET", "POST"},
|
// AllowMethods: []string{"GET", "POST"},
|
||||||
// AllowHeaders: []string{"Origin"},
|
// AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"},
|
||||||
// ExposeHeaders: []string{"Content-Length"},
|
// ExposeHeaders: []string{"Content-Length"},
|
||||||
// AllowCredentials: true,
|
// AllowCredentials: true,
|
||||||
// }))
|
// }))
|
||||||
|
|
||||||
|
//SERVER
|
||||||
|
router.Use(cors.New(cors.Config{
|
||||||
|
AllowAllOrigins: true,
|
||||||
|
AllowMethods: []string{"GET", "POST"},
|
||||||
|
AllowHeaders: []string{"Origin"},
|
||||||
|
ExposeHeaders: []string{"Content-Length"},
|
||||||
|
AllowCredentials: true,
|
||||||
|
}))
|
||||||
|
|
||||||
router.StaticFile("/", "static/index.html")
|
router.StaticFile("/", "static/index.html")
|
||||||
|
|
||||||
// shield := "inquiry"
|
// shield := "inquiry"
|
||||||
|
|
@ -612,8 +612,8 @@ func connect() {
|
||||||
array11 := []string{}
|
array11 := []string{}
|
||||||
array12 := []string{}
|
array12 := []string{}
|
||||||
|
|
||||||
results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.firstName, '') AS result2, IFNULL(c.middleInitial, '') AS result3, IFNULL(c.lastName, '') AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(re.type, '') AS result6, IFNULL(em.employeename, '') AS result7, IFNULL(rb.accountdescription, '') AS result8, IFNULL(o.amount, '') AS result9, IFNULL(o.opDate, '') AS result10, IFNULL(e.electricalid, 0) AS result11, IFNULL(o.assessedbyid, 0) AS result12
|
results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.firstName, '') AS result2, IFNULL(c.middleInitial, '') AS result3, IFNULL(c.lastName, '') AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(re.occupancyoruse, '') AS result6, IFNULL(em.employeename, '') AS result7, IFNULL(rb.accountdescription, '') AS result8, IFNULL(o.amount, '') AS result9, IFNULL(o.opDate, '') AS result10, IFNULL(e.electricalid, 0) AS result11, IFNULL(o.assessedbyid, 0) AS result12
|
||||||
FROM electrical e, customer c, electrical_orderofpayment_new o, ref_electrical_type re, ref_bldgcomputationsheet rb, employee em WHERE e.customerid = c.customerid AND e.electricalid = o.electricalid AND e.ref_electrical_typeid = re.ref_electrical_typeid AND o.ref_bldgcomputationsheetid = rb.ref_bldgcomputationsheetid AND o.assessedbyid = em.employeeid AND e.electricalNo = ?`, data)
|
FROM electrical e, customer c, electrical_orderofpayment_new o, ref_elec_occupancy re, ref_bldgcomputationsheet rb, employee em WHERE e.customerid = c.customerid AND e.electricalid = o.electricalid AND e.ref_elec_occupancyid = re.ref_elec_occupancyid AND o.ref_bldgcomputationsheetid = rb.ref_bldgcomputationsheetid AND o.assessedbyid = em.employeeid AND e.electricalNo = ?`, data)
|
||||||
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())
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import './Assessor.sass'
|
import './Assessor.sass'
|
||||||
import { Logo, Page, Row, Padding, ModalButton, Button, Clickable, Link, Modal, Column, Box } from '../../components'
|
import { Logo, Page, Row, Padding, ModalButton, Button, Clickable, Link, Modal, Column, Box, Input } from '../../components'
|
||||||
import { FiLogOut } from 'solid-icons/fi'
|
import { FiLogOut } from 'solid-icons/fi'
|
||||||
import { Tabs } from '@kobalte/core/tabs'
|
import { Tabs } from '@kobalte/core/tabs'
|
||||||
import { ofetch } from 'ofetch'
|
import { ofetch } from 'ofetch'
|
||||||
|
|
@ -10,6 +10,7 @@ import { FaSolidThumbsUp } from 'solid-icons/fa'
|
||||||
import { _employeeName, _employeeId } from '../../stores/employee'
|
import { _employeeName, _employeeId } from '../../stores/employee'
|
||||||
import { useNavigate } from '@solidjs/router'
|
import { useNavigate } from '@solidjs/router'
|
||||||
import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate, _assessedDate } from '../../stores/pdfinfo'
|
import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeList, _codeList, _amountList, _signatureAssessor, _signatureApprover, _assessorid, _approvedDate, _assessedDate } from '../../stores/pdfinfo'
|
||||||
|
import { VsRefresh } from 'solid-icons/vs'
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
const PESO = import.meta.env.VITE_PESO
|
const PESO = import.meta.env.VITE_PESO
|
||||||
|
|
@ -23,15 +24,6 @@ export default () => {
|
||||||
const [location, setLocation] = createSignal('')
|
const [location, setLocation] = createSignal('')
|
||||||
const [type, setType] = createSignal('')
|
const [type, setType] = createSignal('')
|
||||||
const [applicationId, setApplicationId] = createSignal(0)
|
const [applicationId, setApplicationId] = createSignal(0)
|
||||||
// const [assessorId, setAssessorId] = createSignal(0)
|
|
||||||
|
|
||||||
// const [gflgu, setGflgu] = createSignal<number[]>([])
|
|
||||||
// const [gfdpwh, setGfdpwh] = createSignal<number[]>([])
|
|
||||||
// const [tfbo, setTfbo] = createSignal<number[]>([])
|
|
||||||
|
|
||||||
// const [descriptionList, setDescriptionList] = createSignal<string[]>([])
|
|
||||||
// const [amountList, setAmountList] = createSignal<string[]>([])
|
|
||||||
// const [dateOpList, setDateOpList] = createSignal<string[]>([])
|
|
||||||
|
|
||||||
const [applicationList, setApplicationList] = createSignal<string[]>([])
|
const [applicationList, setApplicationList] = createSignal<string[]>([])
|
||||||
const [nameList, setNameList] = createSignal<string[]>([])
|
const [nameList, setNameList] = createSignal<string[]>([])
|
||||||
|
|
@ -48,9 +40,9 @@ export default () => {
|
||||||
const [employeeId, setEmployeeId] = createSignal(0)
|
const [employeeId, setEmployeeId] = createSignal(0)
|
||||||
const [employeeName, setEmployeeName] = createSignal('')
|
const [employeeName, setEmployeeName] = createSignal('')
|
||||||
|
|
||||||
// const [docApplicationNo, setDocApplicationNo] = createSignal('')
|
const [filter, setFilter] = createSignal('')
|
||||||
// const [docDate, setDocDate] = createSignal('')
|
const [fullIDList, setFullIDList] = createSignal<string[]>([])
|
||||||
// const [docLocation, setDocLocation] = createSignal('')
|
const [fullNameList, setFullNameList] = createSignal<string[]>([])
|
||||||
|
|
||||||
const checkAccess = async (access: string) => {
|
const checkAccess = async (access: string) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -63,6 +55,19 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleFilterChange = (value: string) => {
|
||||||
|
// setFilter(value)
|
||||||
|
if (value.trim() === '') {
|
||||||
|
setApplicationList(fullIDList())
|
||||||
|
setNameList(fullNameList())
|
||||||
|
} else {
|
||||||
|
const filteredApplications = fullIDList().filter((app) => app.toLowerCase().includes(value.toLowerCase()))
|
||||||
|
const filteredNames = fullNameList().slice(0, filteredApplications.length)
|
||||||
|
setApplicationList(filteredApplications)
|
||||||
|
setNameList(filteredNames)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getPrintDetails = async (id: number) => {
|
const getPrintDetails = async (id: number) => {
|
||||||
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
||||||
const applicationno = response.result
|
const applicationno = response.result
|
||||||
|
|
@ -159,11 +164,6 @@ export default () => {
|
||||||
const assessorId = await getEmployeeId(op.result7[0])
|
const assessorId = await getEmployeeId(op.result7[0])
|
||||||
const assessorsignId = await geteSignId(assessorId)
|
const assessorsignId = await geteSignId(assessorId)
|
||||||
getAssessedDate(op.result11[0])
|
getAssessedDate(op.result11[0])
|
||||||
|
|
||||||
console.log('name', op.result7[0])
|
|
||||||
console.log('id', assessorId)
|
|
||||||
console.log('esignid', assessorsignId)
|
|
||||||
console.log('aaaa', op.result11[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateTotal = (list: number[]) => {
|
const calculateTotal = (list: number[]) => {
|
||||||
|
|
@ -171,11 +171,22 @@ export default () => {
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
const getListForPrinting = async () => {
|
const getListForPrinting = async (query?: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await ofetch(API + 'get-listopprinting-electrical', { parseResponse: JSON.parse })
|
const response = await ofetch(API + 'get-listopprinting-electrical', { parseResponse: JSON.parse })
|
||||||
setApplicationList(response.result)
|
const filteredApplications = response.result.filter((item: any) =>
|
||||||
setNameList(response.result2)
|
item
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.includes((query ?? '').toLowerCase())
|
||||||
|
)
|
||||||
|
const filteredNames = response.result2.filter((item: any) =>
|
||||||
|
item.toString().toLowerCase().includes((query ?? '').toLowerCase())
|
||||||
|
)
|
||||||
|
// setApplicationList(response.result)
|
||||||
|
// setNameList(response.result2)
|
||||||
|
setApplicationList(filteredApplications)
|
||||||
|
setNameList(filteredNames)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|
@ -211,10 +222,10 @@ export default () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED')
|
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED', 1)
|
||||||
if (!signed) return
|
if (!signed) return
|
||||||
|
|
||||||
forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE')
|
forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE', 0)
|
||||||
if (!forprinting) return
|
if (!forprinting) return
|
||||||
|
|
||||||
updateOrderofpayment = await updateOp()
|
updateOrderofpayment = await updateOp()
|
||||||
|
|
@ -240,7 +251,7 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const setNewStatus = async (status: string, tag: string, tagword: string) => {
|
const setNewStatus = async (status: string, tag: string, tagword: string, approved: number) => {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
const formattedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
const formattedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||||
const statusid = parseInt(applicationId().toString())
|
const statusid = parseInt(applicationId().toString())
|
||||||
|
|
@ -248,7 +259,7 @@ export default () => {
|
||||||
try {
|
try {
|
||||||
await ofetch(API + 'post-newstatus-electrical', {
|
await ofetch(API + 'post-newstatus-electrical', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { data: statusid, data2: formattedDate, data3: status, data4: tag, data5: tagword, data6: parseInt(employeeId().toString()) },
|
body: { data: statusid, data2: formattedDate, data3: status, data4: tag, data5: tagword, data6: parseInt(approved.toString()), data7: parseInt(employeeId().toString()) },
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -323,6 +334,10 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const refresh = async () => {
|
||||||
|
await getListForPrinting()
|
||||||
|
}
|
||||||
|
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
removeEmployee()
|
removeEmployee()
|
||||||
navigate('/')
|
navigate('/')
|
||||||
|
|
@ -434,6 +449,13 @@ export default () => {
|
||||||
</Clickable>
|
</Clickable>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
<Padding top={0} bottom={0} right={10} left={10}>
|
||||||
|
<Row content="split">
|
||||||
|
<Input label="aa" value={filter()} onChange={getListForPrinting} />
|
||||||
|
<Button label="Refresh Data" edges="curved" design="bo-primary" icon={VsRefresh} onClick={refresh}></Button>
|
||||||
|
</Row>
|
||||||
|
</Padding>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue