Browse Source

Fix s curve

pull/2/head
Wahyu Ramadhan 2 years ago
parent
commit
fe2a4c344d
  1. 15
      src/views/Dashboard/DashboardProject.js

15
src/views/Dashboard/DashboardProject.js

@ -88,6 +88,7 @@ const DashboardProject = () => {
const [dataGantt, setDataGantt] = useState({}); const [dataGantt, setDataGantt] = useState({});
const [dataGanttParents, setDataGanttParents] = useState({}); const [dataGanttParents, setDataGanttParents] = useState({});
const [isReadyGanttParents, setIsReadyGanttParents] = useState(false); const [isReadyGanttParents, setIsReadyGanttParents] = useState(false);
const [calculationStatus, setCalculationStatus] = useState(false);
let history = useHistory(); let history = useHistory();
@ -239,6 +240,7 @@ const DashboardProject = () => {
setEstimatedFinish(result.data.data.header?.end_date ? result.data.data.header.end_date : null) setEstimatedFinish(result.data.data.header?.end_date ? result.data.data.header.end_date : null)
setPlannedCost(result.data.data.rencana_biaya ? result.data.data.rencana_biaya : null) setPlannedCost(result.data.data.rencana_biaya ? result.data.data.rencana_biaya : null)
setIsReadyProjectDetail(true); setIsReadyProjectDetail(true);
setCalculationStatus(result.data.data.calculation_status ? result.data.data.calculation_status : false)
if (result.data.data.kode_sortname && result.data.data.kode_sortname !== '') { if (result.data.data.kode_sortname && result.data.data.kode_sortname !== '') {
getIntegrationInvoice(result.data.data.kode_sortname) getIntegrationInvoice(result.data.data.kode_sortname)
@ -250,7 +252,7 @@ const DashboardProject = () => {
setIsReadySCurve(false); setIsReadySCurve(false);
let URL = `${BASE_OSPRO}/api/project/get-s-curve`; let URL = `${BASE_OSPRO}/api/project/get-s-curve`;
if(SCURVE && SCURVE == "1"){ if(SCURVE && SCURVE == "1"){
URL = `${BASE_OSPRO}/api/project/get-linear-s-curve`; URL = `${BASE_OSPRO}/api/project/calculate-s-curve`;
} }
const payload = { const payload = {
@ -608,7 +610,12 @@ const DashboardProject = () => {
parentNames += " - "; parentNames += " - ";
parentNames += dataGanttParents.data.data[i].name; parentNames += dataGanttParents.data.data[i].name;
} }
return SCURVE && SCURVE == "1" ? projectName return SCURVE && SCURVE == "1"
? projectName
? calculationStatus
? projectName + " - S-Curve Ready"
: projectName + " - S-Curve Loading"
: null
: projectName + parentNames + " - " + dataGantt.data.data.name_version; : projectName + parentNames + " - " + dataGantt.data.data.name_version;
})() })()
: <SingleTextLoader />} : <SingleTextLoader />}
@ -802,13 +809,13 @@ const DashboardProject = () => {
<div style={{ backgroundColor: '#222222', padding: 10, marginBottom: 5 }}> <div style={{ backgroundColor: '#222222', padding: 10, marginBottom: 5 }}>
<div style={{ color: '#FFFFFF', textAlign: 'center', marginBottom: 10, fontWeight: 'bold' }}>Progress</div> <div style={{ color: '#FFFFFF', textAlign: 'center', marginBottom: 10, fontWeight: 'bold' }}>Progress</div>
{isReadySCurve ? {isReadySCurve ?
<ProgressPlanningBar progress={planningProgress} /> <ProgressPlanningBar progress={planningProgress > 100 ? 100 : planningProgress} />
: :
<SingleTextLoader width={"100%"} height={30} /> <SingleTextLoader width={"100%"} height={30} />
} }
<div style={{ marginTop: 10, marginBottom: 10 }}></div> <div style={{ marginTop: 10, marginBottom: 10 }}></div>
{isReadySCurve ? {isReadySCurve ?
<ProgressActualBar progress={actualProgress} /> <ProgressActualBar progress={planningProgress > 100 ? parseFloat(actualProgress / planningProgress * 100).toFixed(2) : actualProgress} />
: :
<SingleTextLoader width={"100%"} height={30} /> <SingleTextLoader width={"100%"} height={30} />
} }

Loading…
Cancel
Save