import './Main.sass' import { Logo, Link, Page, Row, Padding, ModalButton, Box, Button } from '../../components/' import { FiLogOut } from 'solid-icons/fi' import { Tabs } from '@kobalte/core/tabs' import { ofetch } from 'ofetch' import { onMount, createSignal } from 'solid-js' import dayjs from 'dayjs' const API = import.meta.env.VITE_BACKEND const PESO = import.meta.env.VITE_PESO export default () => { const [updatedList, setUpdatedList] = createSignal([]) const [totalOp, setTotalOp] = createSignal(0) const [assessor, setAssessor] = createSignal('') const [approver, setApprover] = createSignal('') const [dateOp, setDateOp] = createSignal('') const [client, setClient] = createSignal('') const [location, setLocation] = createSignal('') const [type, setType] = createSignal('') const [applicationNo, setApplicationNo] = 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 }) setApplicationNo(op.result[0]) setAssessor(op.result7[0]) setLocation(op.result5[0]) setType(op.result6[0]) setDateOp(dayjs(op.result5[0]).format('MMMM DD, YYYY')) setClient(displayFullname(op.result2[0], op.result3[0], op.result4[0])) setTotalOp(calculateTotal(op.result9)) } 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 '' } } const displayFullname = (firstname: string, middleinitial: string, lastname: string) => { let result if (firstname.length > 0) { if (middleinitial.length > 0) { result = `${firstname} ${middleinitial}. ${lastname}` } else { result = `${firstname} ${lastname}` } } else { result = lastname } return result } onMount(async () => { await load() }) return ( <>

OCBO e-Sign

Login Name
Building Occupancy Electrical

List of Ready to Approve and Sign Building Order of Payments

List of Ready to Approve and Sign Occupancy Order of Payments

List of Ready to Approve and Sign Electrical Order of Payments

Application Number Name
111 11 {applicationNo()}
) }