diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 13ca274..a88626e 100644 --- a/src/views/Dashboard/DashboardBOD.js +++ b/src/views/Dashboard/DashboardBOD.js @@ -11,6 +11,7 @@ import { capitalizeFirstLetter, sortBy } from '../../const/CustomFunc'; import ContentLoader from 'react-content-loader'; import toRupiah from '@develoka/angka-rupiah-js'; import Icon from '@iconify/react'; +import { HealthByBudget, HealthBySchedule } from './Components'; const DashboardBOD = () => { const token = localStorage.getItem("token") @@ -301,6 +302,23 @@ const DashboardBOD = () => { if (result.data.data.length > 0) { let tableData = []; 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; if (item.invoice) { outstanding_balance = item.invoice.invoiced - item.invoice.paid; @@ -327,7 +345,8 @@ const DashboardBOD = () => { "invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-', "cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-', "outstanding_balance": outstanding_balance, - "progress": `${item.scurve?.progress ? item.scurve.progress : 0}%` + "budget": , + "schedule": }) }); console.log('tableData', tableData); @@ -354,7 +373,8 @@ const DashboardBOD = () => { { title: "Invoice", key: "invoice" }, { title: "Cash In", key: "cash_in" }, { title: "Outstanding Balance", key: "outstanding_balance" }, - { title: "Progress", key: "progress" }, + { title: "Budget", key: "budget" }, + { title: "Schedule", key: "schedule" }, ]} tableData={DATA_DETAIL_EXPENDITURE} closeModal={() => setOpenDetailedView(false)}