Compare commits
No commits in common. "a5a49e478f4f3f364c14632f1e7b6206d91038ef" and "79a3e508dcd331e56f616fddb8f50ef1e199928d" have entirely different histories.
a5a49e478f
...
79a3e508dc
9 changed files with 126 additions and 345 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -27,7 +27,6 @@ dist-ssr
|
||||||
# environment variables
|
# environment variables
|
||||||
.env.local
|
.env.local
|
||||||
/backend/.env
|
/backend/.env
|
||||||
/backend/tmp
|
|
||||||
|
|
||||||
# jetbrains setting folder
|
# jetbrains setting folder
|
||||||
.idea/
|
.idea/
|
||||||
|
|
|
||||||
162
backend/main.go
162
backend/main.go
|
|
@ -158,35 +158,6 @@ func connect() {
|
||||||
"result2": array2,
|
"result2": array2,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-listopprinting-occupancy":
|
|
||||||
var result2 string
|
|
||||||
|
|
||||||
array := []string{}
|
|
||||||
array2 := []string{}
|
|
||||||
|
|
||||||
results, err := db.Query(`SELECT IFNULL(o.controlNo, '') AS result, IF(c.firstName IS NULL OR c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', IF(c.middleInitial IS NULL OR c.middleInitial = '', '', CONCAT(c.middleInitial, '. ')), c.lastName) ) AS result2
|
|
||||||
FROM occupancy o JOIN customer c ON o.customerid = c.customerid JOIN ref_occupancy_type rot ON o.ref_occupancy_typeid = rot.ref_occupancy_typeid JOIN ref_occupancy ro ON rot.ref_occupancyid = ro.ref_occupancyid JOIN occupancydocflowtxn od ON o.occupancyid = od.occupancyreceivingid JOIN (SELECT occupancyreceivingid, MAX(occupancydocflowtxnid) AS latest_occupancydocflowtxnid FROM occupancydocflowtxn GROUP BY occupancyreceivingid) latest_doc ON od.occupancyreceivingid = latest_doc.occupancyreceivingid AND od.occupancydocflowtxnid = latest_doc.latest_occupancydocflowtxnid
|
|
||||||
WHERE remarks = ? AND is_approve = 0 ORDER BY o.controlNo ASC`, "APPROVED FOR PRINTING OF BUREAU OF FIRE AND ORDER OF PAYMENT")
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": array,
|
|
||||||
"result2": array2,
|
|
||||||
})
|
|
||||||
|
|
||||||
case "get-listopprinting-electrical":
|
case "get-listopprinting-electrical":
|
||||||
var result2 string
|
var result2 string
|
||||||
|
|
||||||
|
|
@ -291,7 +262,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.GET("/api/:method/:data/fetch-data", func(c *gin.Context) {
|
router.GET("/api/:method/:data", func(c *gin.Context) {
|
||||||
var result string
|
var result string
|
||||||
method := c.Param("method")
|
method := c.Param("method")
|
||||||
data := c.Param("data")
|
data := c.Param("data")
|
||||||
|
|
@ -778,29 +749,6 @@ func connect() {
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-printdetails-occupancy":
|
|
||||||
var result2, result3, result4, result5, result6, result7, result8 string
|
|
||||||
|
|
||||||
err := db.QueryRow(`SELECT DISTINCT IFNULL(o.controlNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(r.locationofconstruction, '') AS result3, IFNULL(ro.occupancy, '') AS result4, IFNULL(rot.occupancyType, '') AS result5, IFNULL(o.noOfPermitsApplied, '') AS result6, IFNULL(e.employeename, '') AS result7,
|
|
||||||
IF(cu.firstName IS NULL OR cu.firstName = '', cu.lastName, CONCAT(cu.firstName, ' ', IF(cu.middleInitial IS NULL OR cu.middleInitial = '', '', CONCAT(cu.middleInitial, '. ')), cu.lastName) ) AS result8
|
|
||||||
FROM occupancy o LEFT JOIN receiving r on o.bldgApplicationNo = r.applicationNo JOIN occupancy_orderofpayment op ON o.occupancyid = op.occupancyid JOIN ref_occupancy_type rot ON o.ref_occupancy_typeid = rot.ref_occupancy_typeid JOIN ref_occupancy ro ON rot.ref_occupancyid = ro.ref_occupancyid JOIN customer cu ON o.customerid = cu.customerid JOIN employee e ON op.assessedbyid = e.employeeid
|
|
||||||
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND o.occupancyid = ?`, data).Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": result,
|
|
||||||
"result2": result2,
|
|
||||||
"result3": result3,
|
|
||||||
"result4": result4,
|
|
||||||
"result5": result5,
|
|
||||||
"result6": result6,
|
|
||||||
"result7": result7,
|
|
||||||
"result8": result8,
|
|
||||||
})
|
|
||||||
|
|
||||||
case "get-printdetails-electrical":
|
case "get-printdetails-electrical":
|
||||||
var result2, result3, result4, result5, result6, result7, result8 string
|
var result2, result3, result4, result5, result6, result7, result8 string
|
||||||
|
|
||||||
|
|
@ -824,46 +772,15 @@ func connect() {
|
||||||
"result8": result8,
|
"result8": result8,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-printdetailsfees-occupancy":
|
|
||||||
var result2, result3 string
|
|
||||||
array := []string{}
|
|
||||||
array2 := []string{}
|
|
||||||
array3 := []string{}
|
|
||||||
|
|
||||||
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3
|
|
||||||
FROM occupancy o JOIN occupancy_orderofpayment op ON o.occupancyid = op.occupancyid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
|
||||||
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.occupancyid = ?`, data)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for results.Next() {
|
|
||||||
err = results.Scan(&result, &result2, &result3)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
array = append(array, result)
|
|
||||||
array2 = append(array2, result2)
|
|
||||||
array3 = append(array3, result3)
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": array,
|
|
||||||
"result2": array2,
|
|
||||||
"result3": array3,
|
|
||||||
})
|
|
||||||
|
|
||||||
case "get-printdetailsfees-electrical":
|
case "get-printdetailsfees-electrical":
|
||||||
var result2, result3 string
|
var result2, result3 string
|
||||||
array := []string{}
|
array := []string{}
|
||||||
array2 := []string{}
|
array2 := []string{}
|
||||||
array3 := []string{}
|
array3 := []string{}
|
||||||
|
|
||||||
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3
|
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3 FROM electrical_orderofpayment_new op, ref_bldgcomputationsheet ref, electrical el
|
||||||
FROM electrical el JOIN electrical_orderofpayment_new op ON el.electricalid = op.electricalid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||||
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.electricalid = ?`, data)
|
AND el.electricalid = op.electricalid AND op.electricalid = ?`, 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())
|
||||||
|
|
@ -908,17 +825,6 @@ func connect() {
|
||||||
"result": result,
|
"result": result,
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-signeddateassessed-occupancy":
|
|
||||||
err := db.QueryRow(`SELECT IFNULL(txndate, '') AS result FROM occupancydocflowtxn WHERE occupancyreceivingid = ? AND remarks = "FOR OCCUPANCY RECOMMENDING APPROVAL"`, data).Scan(&result)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"result": result,
|
|
||||||
})
|
|
||||||
|
|
||||||
case "get-signeddateassessed-electrical":
|
case "get-signeddateassessed-electrical":
|
||||||
err := db.QueryRow(`SELECT IFNULL(txndate, '') AS result FROM electricaldocflowtxn WHERE electricalid = ? AND remarks = "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL"`, data).Scan(&result)
|
err := db.QueryRow(`SELECT IFNULL(txndate, '') AS result FROM electricaldocflowtxn WHERE electricalid = ? AND remarks = "FOR ELECTRICAL ORDER OF PAYMENT APPROVAL"`, data).Scan(&result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -1032,7 +938,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.GET("/api/:method/:data/:data2/fetch-data", func(c *gin.Context) {
|
router.GET("/api/:method/:data/:data2", func(c *gin.Context) {
|
||||||
var result string
|
var result string
|
||||||
method := c.Param("method")
|
method := c.Param("method")
|
||||||
data := c.Param("data")
|
data := c.Param("data")
|
||||||
|
|
@ -1115,7 +1021,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-newstatus-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/post-newstatus-occupancy", func(c *gin.Context) {
|
||||||
type NewstatusData struct {
|
type NewstatusData struct {
|
||||||
Data int `json:"data"` //occuapancyid
|
Data int `json:"data"` //occuapancyid
|
||||||
Data2 string `json:"data2"` //date
|
Data2 string `json:"data2"` //date
|
||||||
|
|
@ -1163,7 +1069,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-newstatus-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/post-newstatus-electrical", func(c *gin.Context) {
|
||||||
type NewstatusData struct {
|
type NewstatusData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1211,7 +1117,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-docflow-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/update-docflow-occupancy", func(c *gin.Context) {
|
||||||
type UpdateDocflowData struct {
|
type UpdateDocflowData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1258,7 +1164,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-docflow-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/update-docflow-electrical", func(c *gin.Context) {
|
||||||
type UpdateDocflowData struct {
|
type UpdateDocflowData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1305,47 +1211,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opprinted-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/update-opprinted-electrical", func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
|
||||||
Data int `json:"data"`
|
|
||||||
}
|
|
||||||
var updateOpData UpdateOpData
|
|
||||||
if err := c.ShouldBindJSON(&updateOpData); err != nil {
|
|
||||||
c.String(http.StatusBadRequest, "Invalid request body")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
|
|
||||||
c.Writer.Header().Set("X-Content-Type-Options", "nosniff")
|
|
||||||
c.Writer.Header().Set("X-DNS-Prefetch-Control", "off")
|
|
||||||
c.Writer.Header().Set("X-Frame-Options", "DENY")
|
|
||||||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
|
||||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
|
||||||
|
|
||||||
dbpost, err := db.Prepare("UPDATE iips.occupancy_orderofpayment SET popstransmitted = 1, is_release = 1 WHERE occupancyid = ? AND for_approval = 1 AND is_paid = 0 AND is_approve = 1")
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
defer dbpost.Close()
|
|
||||||
|
|
||||||
exec, err := dbpost.Exec(updateOpData.Data)
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
affect, err := exec.RowsAffected()
|
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
if affect > 0 {
|
|
||||||
c.String(http.StatusOK, "Success on Updating Order of Payment for Printing")
|
|
||||||
} else {
|
|
||||||
c.String(http.StatusInternalServerError, "Failed on Updating Order of Payment for Printing")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
router.POST("/api/update-opprinted-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -1385,7 +1251,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-esigntransaction", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/post-esigntransaction", func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1427,7 +1293,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-pops", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/post-pops", func(c *gin.Context) {
|
||||||
type PostPopData struct {
|
type PostPopData struct {
|
||||||
Data string `json:"data"` //applicationNo
|
Data string `json:"data"` //applicationNo
|
||||||
Data2 string `json:"data2"` //date
|
Data2 string `json:"data2"` //date
|
||||||
|
|
@ -1480,7 +1346,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opapproved-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/update-opapproved-occupancy", func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -1527,7 +1393,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opapproved-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
router.POST("/api/update-opapproved-electrical", func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,36 +77,21 @@ func TokenChecker() gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
parts := strings.Split(decrypted, "-")
|
parts := strings.Split(decrypted, "-")
|
||||||
partCount := len(parts)
|
requested := parts[2]
|
||||||
var finalRequest int
|
requestedNum, _ := strconv.Atoi(requested)
|
||||||
var finalExpiration int
|
expiration := parts[3]
|
||||||
|
expirationNum, _ := strconv.Atoi(expiration)
|
||||||
if partCount == 4 {
|
|
||||||
requested := parts[2]
|
|
||||||
requestedNum, _ := strconv.Atoi(requested)
|
|
||||||
finalRequest = requestedNum
|
|
||||||
expiration := parts[3]
|
|
||||||
expirationNum, _ := strconv.Atoi(expiration)
|
|
||||||
finalExpiration = expirationNum
|
|
||||||
} else {
|
|
||||||
requested := parts[3]
|
|
||||||
requestedNum, _ := strconv.Atoi(requested)
|
|
||||||
finalRequest = requestedNum
|
|
||||||
expiration := parts[4]
|
|
||||||
expirationNum, _ := strconv.Atoi(expiration)
|
|
||||||
finalExpiration = expirationNum
|
|
||||||
}
|
|
||||||
|
|
||||||
unix := strconv.FormatInt(time.Now().UTC().Unix(), 10)
|
unix := strconv.FormatInt(time.Now().UTC().Unix(), 10)
|
||||||
unixNum, _ := strconv.Atoi(unix)
|
unixNum, _ := strconv.Atoi(unix)
|
||||||
|
|
||||||
if finalRequest > finalExpiration {
|
if requestedNum > expirationNum {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"error": "Invalid OCBO Token Value"})
|
c.JSON(http.StatusUnauthorized, gin.H{"error": "Invalid OCBO Token Value"})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if unixNum > finalExpiration {
|
if unixNum > expirationNum {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"error": "OCBO Token Expired"})
|
c.JSON(http.StatusUnauthorized, gin.H{"error": "OCBO Token Expired"})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import './Assessor.sass'
|
||||||
import { Logo, Page, Row, Padding, ModalButton, Button, Clickable, Link, Modal, Column, Box, Input } 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 { onMount, createSignal, Show, createEffect } from 'solid-js'
|
import { onMount, createSignal, Show, createEffect } from 'solid-js'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { checkConnection, createPdf } from '../../utils/functions'
|
import { checkConnection, createPdf } from '../../utils/functions'
|
||||||
|
|
@ -10,8 +11,8 @@ 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'
|
import { VsRefresh } from 'solid-icons/vs'
|
||||||
import { getApi, getApiMulti, postApi } from '../../utils/functions'
|
|
||||||
|
|
||||||
|
const API = import.meta.env.VITE_BACKEND
|
||||||
const PESO = import.meta.env.VITE_PESO
|
const PESO = import.meta.env.VITE_PESO
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
@ -42,14 +43,18 @@ export default () => {
|
||||||
const [filter, setFilter] = createSignal('')
|
const [filter, setFilter] = createSignal('')
|
||||||
|
|
||||||
const checkAccess = async (access: string) => {
|
const checkAccess = async (access: string) => {
|
||||||
const response = await getApi('check-access', access, employeeId())
|
try {
|
||||||
const result = response
|
const response = await ofetch(`${API}check-access/${access}/${employeeId()}`)
|
||||||
if (result > 0) return true
|
const result = response.result
|
||||||
else return false
|
if (result > 0) return true
|
||||||
|
else return false
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPrintDetails = async (division: string, id: number) => {
|
const getPrintDetails = async (id: number) => {
|
||||||
const response = await getApiMulti(`get-printdetails-${division}`, id)
|
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
||||||
const applicationno = response.result
|
const applicationno = response.result
|
||||||
const date = response.result2
|
const date = response.result2
|
||||||
const location = response.result3
|
const location = response.result3
|
||||||
|
|
@ -67,8 +72,8 @@ export default () => {
|
||||||
_assessorid.set(employeeId())
|
_assessorid.set(employeeId())
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPrintDetailsFees = async (division: string, id: number) => {
|
const getPrintDetailsFees = async (id: number) => {
|
||||||
const response = await getApiMulti(`get-printdetailsfees-${division}`, id)
|
const response = await ofetch(API + 'get-printdetailsfees-electrical/' + id)
|
||||||
const feeList = response.result
|
const feeList = response.result
|
||||||
const accountCodeList = response.result2
|
const accountCodeList = response.result2
|
||||||
const amountList = response.result3
|
const amountList = response.result3
|
||||||
|
|
@ -106,9 +111,7 @@ export default () => {
|
||||||
const closeNotification = async () => {
|
const closeNotification = async () => {
|
||||||
setPrinted(false)
|
setPrinted(false)
|
||||||
await checkDivision()
|
await checkDivision()
|
||||||
if (isBuilding()) await getListForPrinting('building')
|
await getListForPrinting()
|
||||||
if (isOccupancy()) await getListForPrinting('occupancy')
|
|
||||||
if (isElectrical()) await getListForPrinting('electrical')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkDivision = async () => {
|
const checkDivision = async () => {
|
||||||
|
|
@ -122,14 +125,8 @@ export default () => {
|
||||||
setIsElectrical(electrical)
|
setIsElectrical(electrical)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getopdetails = async (division: string, applicationNo: string) => {
|
const getopdetails = async (applicationNo: string) => {
|
||||||
// let op = []
|
const op = await ofetch(API + 'get-opdetails-electrical/' + applicationNo, { parseResponse: JSON.parse })
|
||||||
// if (division === 'building') op = await getApiMulti('get-opdetails-building', applicationNo)
|
|
||||||
// if (division === 'occupancy') op = await getApiMulti('get-opdetails-occupancy', applicationNo)
|
|
||||||
// if (division === 'electrical') op = await getApiMulti('get-opdetails-electrical', applicationNo)
|
|
||||||
|
|
||||||
const op = await getApiMulti(`get-opdetails-${division}`, applicationNo)
|
|
||||||
|
|
||||||
setLocation(op.result[0])
|
setLocation(op.result[0])
|
||||||
setType(op.result2[0])
|
setType(op.result2[0])
|
||||||
setAssessor(op.result3[0])
|
setAssessor(op.result3[0])
|
||||||
|
|
@ -143,16 +140,15 @@ export default () => {
|
||||||
// setDateOpList(op.result10)
|
// setDateOpList(op.result10)
|
||||||
// calculateAmounts()
|
// calculateAmounts()
|
||||||
|
|
||||||
getPrintDetails(division, op.result6[0])
|
getPrintDetails(op.result6[0])
|
||||||
getPrintDetailsFees(division, op.result6[0])
|
getPrintDetailsFees(op.result6[0])
|
||||||
|
|
||||||
getSignatureImage(employeeId())
|
getSignatureImage(employeeId())
|
||||||
|
|
||||||
const approversignId = await geteSignId(276)
|
const approversignId = await geteSignId(276)
|
||||||
getApprovedDate(approversignId, applicationNo)
|
getApprovedDate(approversignId, applicationNo)
|
||||||
// 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(division, op.result6[0])
|
getAssessedDate(op.result6[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateTotal = (list: number[]) => {
|
const calculateTotal = (list: number[]) => {
|
||||||
|
|
@ -160,9 +156,9 @@ export default () => {
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
const getListForPrinting = async (division: string) => {
|
const getListForPrinting = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await getApiMulti(`get-listopprinting-${division}`)
|
const response = await ofetch(API + 'get-listopprinting-electrical', { parseResponse: JSON.parse })
|
||||||
|
|
||||||
if (filter() !== '' && filter().trim().length !== 0) {
|
if (filter() !== '' && filter().trim().length !== 0) {
|
||||||
const filteredApplications = response.result.filter((item: string) => item.includes(filter()))
|
const filteredApplications = response.result.filter((item: string) => item.includes(filter()))
|
||||||
|
|
@ -198,7 +194,7 @@ export default () => {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const printHandler = async (division: string, application: string) => {
|
const printHandler = async (application: string) => {
|
||||||
let signed: boolean = false
|
let signed: boolean = false
|
||||||
let forprinting: boolean = false
|
let forprinting: boolean = false
|
||||||
let updateOrderofpayment: boolean = false
|
let updateOrderofpayment: boolean = false
|
||||||
|
|
@ -209,13 +205,13 @@ export default () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
signed = await setNewStatus(division, 'ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED', 1)
|
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED', 1)
|
||||||
if (!signed) return
|
if (!signed) return
|
||||||
|
|
||||||
forprinting = await setNewStatus(division, 'FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE', 0)
|
forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE', 0)
|
||||||
if (!forprinting) return
|
if (!forprinting) return
|
||||||
|
|
||||||
updateOrderofpayment = await updateOp(division)
|
updateOrderofpayment = await updateOp()
|
||||||
|
|
||||||
if (updateOrderofpayment) {
|
if (updateOrderofpayment) {
|
||||||
postTransaction(application)
|
postTransaction(application)
|
||||||
|
|
@ -225,28 +221,42 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateOp = async (division: string) => {
|
const updateOp = async () => {
|
||||||
const post = await postApi(`update-opprinted-${division}`, { data: parseInt(applicationId().toString()) })
|
try {
|
||||||
return post
|
await ofetch(API + 'update-opprinted-electrical', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { data: parseInt(applicationId().toString()) },
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const setNewStatus = async (division: string, status: string, tag: string, tagword: string, approved: number) => {
|
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())
|
||||||
|
|
||||||
const post = await postApi(`post-newstatus-${division}`, { data: statusid, data2: formattedDate, data3: status, data4: tag, data5: tagword, data6: parseInt(approved.toString()), data7: parseInt(employeeId().toString()) })
|
try {
|
||||||
return post
|
await ofetch(API + 'post-newstatus-electrical', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { data: statusid, data2: formattedDate, data3: status, data4: tag, data5: tagword, data6: parseInt(approved.toString()), data7: parseInt(employeeId().toString()) },
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSignatureImage = async (id: number) => {
|
const getSignatureImage = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
const response = await getApi('get-signatureimage', id)
|
const response = await ofetch(API + 'get-signatureimage/' + id, { parseResponse: JSON.parse })
|
||||||
const image = response
|
const image = response.result
|
||||||
_signatureAssessor.set(image)
|
_signatureAssessor.set(image)
|
||||||
|
|
||||||
const response2 = await getApi('get-signatureimage', 276)
|
const response2 = await ofetch(API + 'get-signatureimage/' + 276, { parseResponse: JSON.parse })
|
||||||
const image2 = response2
|
const image2 = response2.result
|
||||||
_signatureApprover.set(image2)
|
_signatureApprover.set(image2)
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -256,8 +266,8 @@ export default () => {
|
||||||
|
|
||||||
const geteSignId = async (id: number) => {
|
const geteSignId = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
const response = await getApi('get-esignid', id)
|
const response = await ofetch(API + 'get-esignid/' + id, { parseResponse: JSON.parse })
|
||||||
const result = response
|
const result = response.result
|
||||||
return result
|
return result
|
||||||
} catch {
|
} catch {
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -269,17 +279,31 @@ export default () => {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
const formatedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
const formatedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
|
||||||
await postApi('post-esigntransaction', { data: parseInt(id), data2: application, data3: formatedDate })
|
await ofetch(API + 'post-esigntransaction', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { data: parseInt(id), data2: application, data3: formatedDate },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getApprovedDate = async (id: number, application: string) => {
|
const getApprovedDate = async (id: number, application: string) => {
|
||||||
const response = await getApi('get-signeddate', id, application)
|
try {
|
||||||
_approvedDate.set(response)
|
const response = await ofetch(API + `get-signeddate/${id}/${application}`, { parseResponse: JSON.parse })
|
||||||
|
const result = response.result
|
||||||
|
_approvedDate.set(result)
|
||||||
|
} catch (error) {
|
||||||
|
_approvedDate.set('')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAssessedDate = async (division: string, id: number) => {
|
const getAssessedDate = async (electricalid: number) => {
|
||||||
const response = await getApi(`get-signeddateassessed-${division}`, id)
|
try {
|
||||||
_assessedDate.set(response)
|
const response = await ofetch(API + 'get-signeddateassessed-electrical/' + electricalid, { parseResponse: JSON.parse })
|
||||||
|
const result = response.result
|
||||||
|
console.log('date', result)
|
||||||
|
_assessedDate.set(result)
|
||||||
|
} catch (error) {
|
||||||
|
_assessedDate.set('')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const getEmployeeId = async (name: string) => {
|
// const getEmployeeId = async (name: string) => {
|
||||||
|
|
@ -293,9 +317,7 @@ export default () => {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const refresh = async () => {
|
const refresh = async () => {
|
||||||
if (isBuilding()) await getListForPrinting('building')
|
await getListForPrinting()
|
||||||
if (isOccupancy()) await getListForPrinting('occupancy')
|
|
||||||
if (isElectrical()) await getListForPrinting('electrical')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
|
|
@ -313,21 +335,15 @@ export default () => {
|
||||||
|
|
||||||
if (logged) {
|
if (logged) {
|
||||||
await checkDivision()
|
await checkDivision()
|
||||||
if (isBuilding()) await getListForPrinting('building')
|
await getListForPrinting()
|
||||||
if (isOccupancy()) await getListForPrinting('occupancy')
|
|
||||||
if (isElectrical()) await getListForPrinting('electrical')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
createEffect(async () => {
|
createEffect(async () => {
|
||||||
if (filter() !== '') {
|
if (filter() !== '') {
|
||||||
if (isBuilding()) await getListForPrinting('building')
|
await getListForPrinting()
|
||||||
if (isOccupancy()) await getListForPrinting('occupancy')
|
|
||||||
if (isElectrical()) await getListForPrinting('electrical')
|
|
||||||
} else if (filter() === '') {
|
} else if (filter() === '') {
|
||||||
if (isBuilding()) await getListForPrinting('building')
|
await getListForPrinting()
|
||||||
if (isOccupancy()) await getListForPrinting('occupancy')
|
|
||||||
if (isElectrical()) await getListForPrinting('electrical')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -404,98 +420,30 @@ export default () => {
|
||||||
</Tabs.Content>
|
</Tabs.Content>
|
||||||
<Tabs.Content class="tabs__content" value="occupancy">
|
<Tabs.Content class="tabs__content" value="occupancy">
|
||||||
<Row>
|
<Row>
|
||||||
{/* <Box curved thickness={0} background="#602a2abf" padding="1rem 2rem">
|
{/* <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>
|
<h2>Under Development</h2>
|
||||||
</Box> */}{' '}
|
</Box>
|
||||||
<h2>List of Ready to Print in Occupancy Order of Payments</h2>
|
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Padding top={0} bottom={0} right={10} left={10}>
|
|
||||||
<Row content="split">
|
|
||||||
<Input value={filter()} onChange={setFilter} placeholder="Filter Application Number" />
|
|
||||||
<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>
|
||||||
<tr>
|
{/* <tr>
|
||||||
<th>Application Number</th>
|
<th>Application Number</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th style="text-align: center">Show Details</th>
|
<th style="text-align: center">Show Details</th>
|
||||||
</tr>
|
</tr> */}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody></tbody>
|
||||||
{applicationList().map((item, index) => (
|
|
||||||
<tr>
|
|
||||||
<td>{item}</td>
|
|
||||||
<td>{nameList()[index]}</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<ModalButton
|
|
||||||
class="modal"
|
|
||||||
label="Show Details"
|
|
||||||
design="bo-link"
|
|
||||||
background="#121e2acc"
|
|
||||||
color="#ffffffec"
|
|
||||||
function={async () => {
|
|
||||||
await getopdetails('occupancy', 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">{nameList()[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="Print" edges="curved" design="bo-primary" onClick={() => printHandler('occupancy', item)}></Button>
|
|
||||||
<span class="modal__cancel">Click anywhere to cancel</span>
|
|
||||||
</Row>
|
|
||||||
</Padding>
|
|
||||||
</ModalButton>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
</table>
|
||||||
</Row>
|
</Row>
|
||||||
</Tabs.Content>
|
</Tabs.Content>
|
||||||
<Tabs.Content class="tabs__content" value="electrical">
|
<Tabs.Content class="tabs__content" value="electrical">
|
||||||
<Row>
|
<Row>
|
||||||
<h2>List of Ready to Print in Electrical Order of Payments</h2>
|
<Clickable onClick={() => createPdf()}>
|
||||||
|
<h2>List of Ready to Print in Electrical Order of Payments</h2>
|
||||||
|
</Clickable>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
<Padding top={0} bottom={0} right={10} left={10}>
|
<Padding top={0} bottom={0} right={10} left={10}>
|
||||||
|
|
@ -528,7 +476,7 @@ export default () => {
|
||||||
background="#121e2acc"
|
background="#121e2acc"
|
||||||
color="#ffffffec"
|
color="#ffffffec"
|
||||||
function={async () => {
|
function={async () => {
|
||||||
await getopdetails('electrical', item)
|
await getopdetails(item)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Padding top={0} left={2} right={2} bottom={0}>
|
<Padding top={0} left={2} right={2} bottom={0}>
|
||||||
|
|
@ -569,7 +517,7 @@ export default () => {
|
||||||
</Padding>
|
</Padding>
|
||||||
|
|
||||||
<Row padding="2rem 0 0 0">
|
<Row padding="2rem 0 0 0">
|
||||||
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler('electrical', item)}></Button>
|
<Button wide label="Print" edges="curved" design="bo-primary" onClick={() => printHandler(item)}></Button>
|
||||||
<span class="modal__cancel">Click anywhere to cancel</span>
|
<span class="modal__cancel">Click anywhere to cancel</span>
|
||||||
</Row>
|
</Row>
|
||||||
</Padding>
|
</Padding>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import './Main.sass'
|
||||||
import { Logo, Link, Page, Row, Padding, ModalButton, Box, Button, Modal, Column, Clickable } from '../../components/'
|
import { Logo, Link, Page, Row, Padding, ModalButton, Box, Button, Modal, Column, Clickable } 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 { onMount, createSignal } from 'solid-js'
|
import { onMount, createSignal } from 'solid-js'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { checkConnection, getApi, getApiMulti, postApi } from '../../utils/functions'
|
import { checkConnection, getApi, getApiMulti, postApi } from '../../utils/functions'
|
||||||
|
|
@ -12,6 +13,7 @@ import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeL
|
||||||
import { VsRefresh } from 'solid-icons/vs'
|
import { VsRefresh } from 'solid-icons/vs'
|
||||||
import { BiRegularErrorAlt } from 'solid-icons/bi'
|
import { BiRegularErrorAlt } from 'solid-icons/bi'
|
||||||
|
|
||||||
|
const API = import.meta.env.VITE_BACKEND
|
||||||
const PESO = import.meta.env.VITE_PESO
|
const PESO = import.meta.env.VITE_PESO
|
||||||
const ID = import.meta.env.VITE_HEADID
|
const ID = import.meta.env.VITE_HEADID
|
||||||
// const NAME = import.meta.env.VITE_HEAD
|
// const NAME = import.meta.env.VITE_HEAD
|
||||||
|
|
@ -263,7 +265,10 @@ export default () => {
|
||||||
const formattedDatewithTime = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
const formattedDatewithTime = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
|
||||||
for (let i = 0; i < response.result.length; i++) {
|
for (let i = 0; i < response.result.length; i++) {
|
||||||
await postApi('post-pops', { data: application, data2: formattedDate, data3: customerid, data4: customerName, data5: location, data6: codeList[i], data7: amountList[i], data8: assessor(), data9: formattedDatewithTime, data10: lguList[i], data11: dpwhList[i], data12: boList[i], data13: PUBLICIP })
|
await ofetch(API + 'post-pops', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { data: application, data2: formattedDate, data3: customerid, data4: customerName, data5: location, data6: codeList[i], data7: amountList[i], data8: assessor(), data9: formattedDatewithTime, data10: lguList[i], data11: dpwhList[i], data12: boList[i], data13: PUBLICIP },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,7 +335,10 @@ export default () => {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
const formatedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
const formatedDate = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
|
||||||
await postApi('post-esigntransaction', { data: parseInt(id), data2: approvedApplication(), data3: formatedDate })
|
await ofetch(API + 'post-esigntransaction', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { data: parseInt(id), data2: approvedApplication(), data3: formatedDate },
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateDocflow = async (division: string, applicationid: number, status: string) => {
|
const updateDocflow = async (division: string, applicationid: number, status: string) => {
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,14 @@
|
||||||
// import { ofetch } from 'ofetch'
|
|
||||||
|
|
||||||
// const API = import.meta.env.VITE_BACKEND
|
|
||||||
|
|
||||||
// export default async (api: string, value?: any) => {
|
|
||||||
// try {
|
|
||||||
// let fetch
|
|
||||||
// if (!value) {
|
|
||||||
// fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
|
||||||
// } else {
|
|
||||||
// fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
|
||||||
// }
|
|
||||||
// const result = fetch.result
|
|
||||||
// return result
|
|
||||||
// } catch {
|
|
||||||
// return []
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
import { ofetch } from 'ofetch'
|
import { ofetch } from 'ofetch'
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
|
|
||||||
export default async (api: string, value?: any, value2?: any) => {
|
export default async (api: string, value?: any) => {
|
||||||
try {
|
try {
|
||||||
let fetch
|
let fetch
|
||||||
if (!value2) {
|
if (!value) {
|
||||||
if (!value) {
|
fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
||||||
fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
|
||||||
} else {
|
|
||||||
fetch = await ofetch(API + `${api}/${value}/fetch-data`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fetch = await ofetch(API + `${api}/${value}/${value2}/fetch-data`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
||||||
}
|
}
|
||||||
const result = fetch.result
|
const result = fetch.result
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default async (api: string, value?: any) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
fetch = await ofetch(API + api, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
||||||
} else {
|
} else {
|
||||||
fetch = await ofetch(API + `${api}/${value}/fetch-data`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
fetch = await ofetch(API + `${api}/${value}`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch
|
return fetch
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,4 @@ export { default as createPdf } from './createPdf'
|
||||||
export { default as postApi } from './postApi'
|
export { default as postApi } from './postApi'
|
||||||
export { default as getApi } from './getApi'
|
export { default as getApi } from './getApi'
|
||||||
export { default as getApiMulti } from './getApiMulti'
|
export { default as getApiMulti } from './getApiMulti'
|
||||||
|
// export { default as generateFavicon } from './generateFavicon'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { ofetch } from 'ofetch'
|
import { ofetch } from 'ofetch'
|
||||||
|
import encryptAes from './encryptAes'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import encryptRsa from './encryptRsa'
|
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
|
|
||||||
|
|
@ -8,9 +8,9 @@ export default async (api: string, body: Object) => {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
const todayUnix = dayjs(today).unix()
|
const todayUnix = dayjs(today).unix()
|
||||||
const expiration = todayUnix + 9
|
const expiration = todayUnix + 9
|
||||||
const aes = await encryptRsa(`${api.toString()}-${todayUnix.toString()}-${expiration.toString()}`)
|
const aes = await encryptAes(`${todayUnix.toString()}-${expiration.toString()}`)
|
||||||
|
|
||||||
const hash = `ocbo=${aes}token`
|
const hash = `ocbo-${aes}-token`
|
||||||
try {
|
try {
|
||||||
await ofetch(API + api, {
|
await ofetch(API + api, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -18,9 +18,6 @@ export default async (api: string, body: Object) => {
|
||||||
'Cache-Control': 'no-cache',
|
'Cache-Control': 'no-cache',
|
||||||
'OCBO-Token': hash,
|
'OCBO-Token': hash,
|
||||||
},
|
},
|
||||||
retry: 3,
|
|
||||||
retryDelay: 500,
|
|
||||||
retryStatusCodes: [400, 404, 405, 500, 502],
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: body,
|
body: body,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue