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",