From f35198cccc61e9178b450f563ee80712625103ed Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 23 Mar 2023 10:42:50 +0700 Subject: [PATCH 1/3] Temp --- src/views/Dashboard/DashboardBOD.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) 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)} From cefb82263b76a660cc650ef52447ecd16a7c90fa Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 28 Mar 2023 14:31:06 +0700 Subject: [PATCH 2/3] Task #860q0ub3p update dashboard --- src/views/Dashboard/DashboardProject.js | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) 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.') : '-' + : + } + From 8e4b65026efe14b7735bbf3c8da7d499486cb9ee Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 29 Mar 2023 10:22:19 +0700 Subject: [PATCH 3/3] Fix calculation type --- src/views/SimproV2/CreatedProyek/DialogFormGantt.js | 1 - 1 file changed, 1 deletion(-) 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(() => {