From 861852e0359d2cde0b5614d5eca95fc9e0463f8a Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 30 Oct 2023 12:44:04 +0700 Subject: [PATCH 1/3] update report analysis --- .../CreatedProyek/DialogFormAnalysis.js | 9 ++- .../SimproV2/CreatedProyek/ReportAnalysis.js | 60 ++++++++++++++++--- 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js index 471b8c0..4f7ab96 100644 --- a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js @@ -8,6 +8,7 @@ import { import { BASE_SIMPRO_LUMEN } from "../../../const/ApiConst"; import { Table } from 'antd'; import "antd/dist/antd.css"; +import moment from "moment"; const DialogFormAnalysis = ({ openDialog, @@ -32,7 +33,13 @@ const DialogFormAnalysis = ({ const columns = [ {title: "Human Resource", dataIndex: "join_first_name", key: "join_first_name"}, - {title: "Report Date", dataIndex: "report_date", key: "report_date"}, + {title: "Report Date", dataIndex: "report_date", key: "report_date", + render: (text, record) => ( + <> + {moment(record.report_date).format("DD-MM-YYYY")} + + ), + }, {title: "Volume Plan", dataIndex: "join_second_qty_planning", key: "join_second_qty_planning"}, {title: "Volume Actual", dataIndex: "qty", key: "qty"}, {title: "Keterangan", dataIndex: "description", key: "description"}, diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index 7661047..65ed27a 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -11,6 +11,7 @@ import 'antd/dist/antd.css'; import './style.css' import { Select, Table, Tooltip } from 'antd'; import DialogFormAnalysis from './DialogFormAnalysis'; +import moment from "moment"; const { Option } = Select const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => { @@ -55,7 +56,6 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => }; const columns = [ - {title: "Activity", dataIndex: "name", key: "name"}, {title: "Gantt", dataIndex: "name_version", key: "name_version"}, {title: "Assign HR", dataIndex: "user_name", key: "user_name"}, {title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning", @@ -65,7 +65,23 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => }, {title: "Volume Actual", dataIndex: "qty", key: "qty"}, - {title: "Progress (%)", dataIndex: "persentase_progress", key: "persentase_progress"}, + {title: "Progress Plan (%)", dataIndex: "persentase_progress", key: "persentase_progress", + render: (text, record) => { + const startDate = moment(record.start_date); + const duration = record.duration; + + const currentDate = moment(); + const daysElapsed = Math.max(0, currentDate.diff(startDate, 'days')); + const progressPercentage = Math.min(100, (daysElapsed / duration) * 100); + + return ( + <> + {progressPercentage.toFixed(0)} + + ); + }, + }, + {title: "Progress Actual (%)", dataIndex: "persentase_progress", key: "persentase_progress"}, { title: 'Action', dataIndex: '', @@ -84,7 +100,20 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => const columnActivityToHr = [ {title: "Activity", dataIndex: "join_second_name", key: "join_second_name"}, {title: "Gantt", dataIndex: "join_fourth_name_version", key: "join_fourth_name_version"}, - {title: "Assign HR", dataIndex: "join_first_name", key: "join_first_name"}, + {title: "Start Date", dataIndex: "start_date", key: "start_date", + render: (text, record) => ( + <> + {moment(record.start_date).format("DD-MM-YYYY")} + + ), + }, + {title: "End Date", dataIndex: "end_date", key: "end_date", + render: (text, record) => ( + <> + {moment(record.end_date).format("DD-MM-YYYY")} + + ), + }, {title: "Volume Plan", dataIndex: "join_third_qty_planning", key: "join_third_qty_planning", render: (text, record) => <> @@ -92,7 +121,23 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => }, {title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual"}, - {title: "Progress (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress"}, + {title: "Progress Plan (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress", + render: (text, record) => { + const startDate = moment(record.join_second_start_date); + const duration = record.join_second_duration; + + const currentDate = moment(); + const daysElapsed = Math.max(0, currentDate.diff(startDate, 'days')); + const progressPercentage = Math.min(100, (daysElapsed / duration) * 100); + + return ( + <> + {progressPercentage.toFixed(0)} + + ); + }, + }, + {title: "Progress Actual (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress"}, { title: 'Action', dataIndex: '', @@ -222,18 +267,19 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => } ], select: [ - 'id' + 'id', + 'start_date', + 'end_date' ], joins: [ { name: "m_users", column_join: "user_id", - column_results: ["name"] }, { name: "m_activity", column_join: "activity_id", - column_results: ["name", "persentase_progress"] + column_results: ["name", "persentase_progress", "start_date", "end_date", "duration"] }, { name1: "m_activity", From a60ef4bc8f1b8bcc887dd059695c9a988391584c Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 30 Oct 2023 14:28:59 +0700 Subject: [PATCH 2/3] update plan bar --- src/views/Dashboard/DashboardProject.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index 8cc40ee..5aa6ce6 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -424,14 +424,7 @@ const DashboardProject = () => { result.data.data[0].data?.percentagePlan && result.data.data[0].data?.percentagePlan.length > 0 ) { - if (SCURVE && SCURVE == "1") { - planningProgress = - result.data.data[0].data?.percentagePlan[ - result.data.data[0].data?.percentagePlan.length - 1 - ]; - } else { - planningProgress = result.data.data[0].data?.percentagePlan[n]; - } + planningProgress = result.data.data[0].data?.percentagePlan[n]; setPlanningProgress(planningProgress); } if ( From d272fdafac0d9ed268d6b1e1954bd33377a94a03 Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 30 Oct 2023 14:34:37 +0700 Subject: [PATCH 3/3] check hierarchy --- src/views/Dashboard/DashboardProject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index 5aa6ce6..ae1e41c 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -357,7 +357,7 @@ const DashboardProject = () => { const getSCurve = async () => { setIsReadySCurve(false); let URL = `${BASE_OSPRO}/api/project/get-s-curve`; - if (SCURVE && SCURVE == "1") { + if (SCURVE && SCURVE == "1" && isHierarchy) { URL = `${BASE_OSPRO}/api/project/calculate-s-curve`; }