Browse Source

Temp

pull/2/head
Wahyu Ramadhan 2 years ago
parent
commit
f35198cccc
  1. 24
      src/views/Dashboard/DashboardBOD.js

24
src/views/Dashboard/DashboardBOD.js

@ -11,6 +11,7 @@ import { capitalizeFirstLetter, sortBy } from '../../const/CustomFunc';
import ContentLoader from 'react-content-loader'; import ContentLoader from 'react-content-loader';
import toRupiah from '@develoka/angka-rupiah-js'; import toRupiah from '@develoka/angka-rupiah-js';
import Icon from '@iconify/react'; import Icon from '@iconify/react';
import { HealthByBudget, HealthBySchedule } from './Components';
const DashboardBOD = () => { const DashboardBOD = () => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
@ -301,6 +302,23 @@ const DashboardBOD = () => {
if (result.data.data.length > 0) { if (result.data.data.length > 0) {
let tableData = []; let tableData = [];
result.data.data.map((item, idx) => { result.data.data.map((item, idx) => {
let statusHealthBySchedule = 'on-schedule';
let planningProgress = 0;
let actualProgress = 0;
let selisihProgress = 0;
// planningProgress = item.scurve[0].data.percentagePlan[item.scurve[0].data.percentagePlan.length - 1]
// actualProgress = item.scurve[0].data.percentageReal[item.scurve[0].data.percentageReal.length - 1]
selisihProgress = planningProgress - actualProgress
if (selisihProgress > 0 && selisihProgress <= 5) {
statusHealthBySchedule = 'warning'
}
else if (selisihProgress > 5) {
statusHealthBySchedule = 'danger'
}
let outstanding_balance = 0; let outstanding_balance = 0;
if (item.invoice) { if (item.invoice) {
outstanding_balance = item.invoice.invoiced - item.invoice.paid; outstanding_balance = item.invoice.invoiced - item.invoice.paid;
@ -327,7 +345,8 @@ const DashboardBOD = () => {
"invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-', "invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-',
"cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-', "cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-',
"outstanding_balance": outstanding_balance, "outstanding_balance": outstanding_balance,
"progress": `${item.scurve?.progress ? item.scurve.progress : 0}%` "budget": <HealthByBudget status {...item.budget_health} />,
"schedule": <HealthBySchedule status={statusHealthBySchedule} />
}) })
}); });
console.log('tableData', tableData); console.log('tableData', tableData);
@ -354,7 +373,8 @@ const DashboardBOD = () => {
{ title: "Invoice", key: "invoice" }, { title: "Invoice", key: "invoice" },
{ title: "Cash In", key: "cash_in" }, { title: "Cash In", key: "cash_in" },
{ title: "Outstanding Balance", key: "outstanding_balance" }, { title: "Outstanding Balance", key: "outstanding_balance" },
{ title: "Progress", key: "progress" }, { title: "Budget", key: "budget" },
{ title: "Schedule", key: "schedule" },
]} ]}
tableData={DATA_DETAIL_EXPENDITURE} tableData={DATA_DETAIL_EXPENDITURE}
closeModal={() => setOpenDetailedView(false)} closeModal={() => setOpenDetailedView(false)}

Loading…
Cancel
Save