diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 4e1122e..26530b4 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)} diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index fde62f7..ebe52eb 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -73,6 +73,7 @@ const DashboardProject = () => { const [isSendingComment, setIsSendingComment] = useState(false); const [isReadyProjectDetail, setIsReadyProjectDetail] = useState(false); const [isReadySCurve, setIsReadySCurve] = useState(false); + const [isReadyGantt, setIsReadyGantt] = useState(false); const [isReadyOverdueActivities, setIsReadyOverdueActivities] = useState(false); const [isReadyIntegrationInvoice, setIsReadyIntegrationInvoice] = useState(false); const [isReadyReportDistribution, setIsReadyReportDistribution] = useState(false); @@ -84,6 +85,7 @@ const DashboardProject = () => { const [assignedHr, setAssignedHr] = useState([]); const [assignedHrCount, setAssignedHrCount] = useState(0); const [actualHrCount, setActualHrCount] = useState(0); + const [dataGantt, setDataGantt] = useState({}); let history = useHistory(); @@ -93,6 +95,7 @@ const DashboardProject = () => { getOverdueActivities() getReportDistribution() getComments() + getGantt() return () => { console.log('unmount RenderMap'); } @@ -138,6 +141,19 @@ const DashboardProject = () => { } } + const getGantt = async () => { + setIsReadyGantt(false) + const url = `${BASE_OSPRO}/api/version-gantt/edit/${GANTT_ID}` + try { + const response = await axios.get(url, HEADER) + setDataGantt(response) + setIsReadyGantt(true) + } catch (error) { + console.error('Failed to get gantt data:', error) + setIsReadyGantt(true) + } + } + const getAssignedHR = async () => { const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}` try { @@ -648,8 +664,8 @@ const DashboardProject = () => { Add Cost to Complete - {isReadySCurve ? - addCostToComplete ? renderFormatRupiah(addCostToComplete, 'Rp.') : '-' + {isReadyGantt ? + dataGantt.data.data.cost_to_complete ? renderFormatRupiah(dataGantt.data.data.cost_to_complete.toString(), 'Rp.') : '-' : } @@ -698,6 +714,12 @@ const DashboardProject = () => { } Committed Cost + + {isReadyGantt ? + dataGantt.data.data.committed_cost ? renderFormatRupiah(dataGantt.data.data.committed_cost.toString(), 'Rp.') : '-' + : + } + diff --git a/src/views/SimproV2/CreatedProyek/DialogFormGantt.js b/src/views/SimproV2/CreatedProyek/DialogFormGantt.js index 307e487..d1d5d3d 100644 --- a/src/views/SimproV2/CreatedProyek/DialogFormGantt.js +++ b/src/views/SimproV2/CreatedProyek/DialogFormGantt.js @@ -23,7 +23,6 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask }) => { setId(0) setName("") setDesctription("") - setCalculationType("") } useEffect(() => {