From 8062623fa5476d483a8711d31672512ef1bbe3ba Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 23 Oct 2023 09:10:20 +0700 Subject: [PATCH 1/8] bypass hierarchy check --- 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 2cf31c8..f8e59a3 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" && isHierarchy) { + if (SCURVE && SCURVE == "1") { URL = `${BASE_OSPRO}/api/project/calculate-s-curve`; } From cde93ec08d6ff15c265077cc5b8598a6a63d6961 Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 24 Oct 2023 09:41:42 +0700 Subject: [PATCH 2/8] select activity --- .../SimproV2/CreatedProyek/ReportAnalysis.js | 90 ++++++++++++++++--- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index df7915e..b74c6c8 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -24,6 +24,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => const [dataTable, setDatatable] = useState([]); const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]); const [hrList, setHrList] = useState([]); + const [groupedActivity, setGroupedActivity] = useState([]); const [selectedHr, setSelectedHr] = useState(null); const toggle = (tab) => { @@ -102,6 +103,23 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => getDataHr() }, []); + useEffect(() => { + if (projectId) { + getGroupedActivity() + getDataHr() + } + }, [projectId]); + + const handleClose = () => { + setAvgActivityHr(0); + setSelectedHr(null); + setDataTableActivityToHr([]); + setAvgActivity(0); + setSearch(''); + setDatatable([]) + closeDialog() + } + const handleSearch = (e) => { const value = e.target.value; setSearch(value); @@ -131,8 +149,27 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => } const getDataHr = async () => { + const payload = { + columns: [ + { + name: "proyek_id", + logic_operator: "=", + value: projectId, + operator: "AND", + }, + ], + joins: [ + { + name: "m_users", + column_join: "user_id", + column_results: ["id", "name"] + }, + ], + orders: { columns: ["id"], ascending: false }, + paging: { start: 0, length: -1 }, + }; const result = await axios - .get(`${BASE_SIMPRO_LUMEN}/human-resource/list`, HEADER) + .post(`${BASE_SIMPRO_LUMEN}/user-to-proyek/search`, payload, HEADER) .then((res) => res) .catch((error) => error.response); @@ -209,6 +246,33 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => } }; + const getGroupedActivity = async () => { + const payload = { + columns: [ + { + name: "proyek_id", + logic_operator: "=", + value: projectId, + operator: "AND", + }, + ], + orders: { columns: ["id"], ascending: false }, + paging: { start: 0, length: -1 }, + }; + + const result = await axios + .post(`${BASE_SIMPRO_LUMEN}/activity/search-analysis-prep`, payload, HEADER) + .then((res) => res) + .catch((error) => error.response); + + if (result && result.data && result.data.code == 200) { + let dataRes = result.data.data || []; + setGroupedActivity(dataRes); + } else { + NotificationManager.error("Gagal Mengambil Data!!", "Failed"); + } + }; + const getDataActivity = async () => { setAvgActivity(0); let sum = 0; @@ -216,7 +280,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => columns: [ { name: "name", - logic_operator: "ilike", + logic_operator: "=", value: search, operator: "AND", }, @@ -251,7 +315,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => return ( <> - Report Analysis + Report Analysis
- +
Date: Wed, 25 Oct 2023 11:27:26 +0700 Subject: [PATCH 3/8] update report analysis --- .../CreatedProyek/DialogFormAnalysis.js | 1 + .../SimproV2/CreatedProyek/ReportAnalysis.js | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js index 890a61d..471b8c0 100644 --- a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js @@ -39,6 +39,7 @@ const DialogFormAnalysis = ({ ] const getReportActivityMaterial = async () => { + setDatatable([]); const payload = { columns: [ { diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index b74c6c8..7661047 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -58,19 +58,40 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => {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", + render: (text, record) => + <> + {text ? text : 0} + + }, + {title: "Volume Actual", dataIndex: "qty", key: "qty"}, {title: "Progress (%)", dataIndex: "persentase_progress", key: "persentase_progress"}, + { + title: 'Action', + dataIndex: '', + key: 'id', + className: "nowrap", + render: (text, record) => + <> + + + {" "} + + , + }, ] 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: "Material Plan", dataIndex: "join_third_qty_planning", key: "join_third_qty_planning", + {title: "Volume Plan", dataIndex: "join_third_qty_planning", key: "join_third_qty_planning", render: (text, record) => <> {text ? text : 0} }, + {title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual"}, {title: "Progress (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress"}, { title: 'Action', @@ -182,6 +203,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => } const getDataActivityToHr = async () => { setAvgActivityHr(0); + setDataTableActivityToHr([]); let sum = 0; const payload = { columns: [ @@ -199,6 +221,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => operator: "AND", } ], + select: [ + 'id' + ], joins: [ { name: "m_users", @@ -224,6 +249,12 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => column_self:"id", column_results: ["name_version"] }, + { + name1: "m_activity", + name: "report_activity_material", + column_join: "id", + column_self:"activity_id", + }, ], orders: { columns: ["id"], ascending: false }, paging: { start: 0, length: -1 }, @@ -275,6 +306,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => const getDataActivity = async () => { setAvgActivity(0); + setDatatable([]); let sum = 0; const payload = { columns: [ From de8bf1e88fbd62f86780711df299b34acd6e769e Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 25 Oct 2023 13:07:33 +0700 Subject: [PATCH 4/8] update progress bar --- src/views/Dashboard/DashboardProject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index f8e59a3..8cc40ee 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -1464,10 +1464,10 @@ const DashboardProject = () => { {isReadySCurve ? ( 100 + planningProgress > 100 || actualProgress > 100 ? parseFloat( (actualProgress / planningProgress) * 100 - ).toFixed(2) + ).toFixed(0) : actualProgress } /> From 861852e0359d2cde0b5614d5eca95fc9e0463f8a Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 30 Oct 2023 12:44:04 +0700 Subject: [PATCH 5/8] 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 6/8] 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 7/8] 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`; } From 35366b9cd7c980226be85b5815193762ad3452cd Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 31 Oct 2023 08:10:08 +0700 Subject: [PATCH 8/8] gantt 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 ae1e41c..dbce179 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -710,7 +710,7 @@ const DashboardProject = () => { // Send the URL back to the iframe event.source.postMessage( - { action: "sendUrl", url: childUrl }, + { action: "sendUrl", url: childUrl, isHierarchy: isHierarchy }, event.origin ); }