From 5890b487a6a2dc3545ce0de736a3e2fe950ec4b1 Mon Sep 17 00:00:00 2001 From: Watiah11 Date: Mon, 6 May 2024 08:07:25 +0700 Subject: [PATCH] fix(report analysis): update header modal & tofixed value column --- .../CreatedProyek/DialogFormAnalysis.js | 5 +- .../SimproV2/CreatedProyek/ReportAnalysis.js | 63 ++++++++++++++----- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js index 9bb6f18..b39f2cc 100644 --- a/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js @@ -14,7 +14,8 @@ const DialogFormAnalysis = ({ openDialog, closeDialog, toggleDialog, - dataDetail + dataDetail, + typeDialogName }) => { const token = localStorage.getItem("token"); const [dataTable, setDatatable] = useState([]); @@ -99,7 +100,7 @@ const DialogFormAnalysis = ({ <> - Detail Report Analysis + Detail Report Analysis - {typeDialogName} diff --git a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js index c46dad4..a141b67 100644 --- a/src/views/SimproV2/CreatedProyek/ReportAnalysis.js +++ b/src/views/SimproV2/CreatedProyek/ReportAnalysis.js @@ -28,7 +28,7 @@ import DialogFormAnalysis from './DialogFormAnalysis'; import moment from "moment"; const { Option } = Select -const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => { +const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName }) => { const token = localStorage.getItem("token"); const [activeTab, setActiveTab] = useState('1'); const [search, setSearch] = useState(''); @@ -44,6 +44,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => const [groupedActivity, setGroupedActivity] = useState([]); const [selectedHr, setSelectedHr] = useState(null); const [loading, setLoading] = useState(false); + const [typeDialogName, setTypeDialogName] = useState(''); const toggle = (tab) => { if (activeTab !== tab) { @@ -134,12 +135,19 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => }, { title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning", - render: (text, record) => - <> - {text ? text : 0} - + render: (text, record) => + <> + {text ? Math.round(text).toFixed(0) : 0} + + }, + { + title: "Volume Actual", dataIndex: "qty", key: "qty", + render: (text, record)=> { + return ( + {Math.round(record.qty).toFixed(0)} + ) + } }, - { title: "Volume Actual", dataIndex: "qty", key: "qty" }, { title: "Progress Plan (%)", dataIndex: "persentase_progress", key: "persentase_progress", render: (text, record) => { @@ -157,7 +165,14 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => ); }, }, - { title: "Progress Actual (%)", dataIndex: "persentase_progress", key: "persentase_progress", width: "8%" }, + { + title: "Progress Actual (%)", dataIndex: "persentase_progress", key: "persentase_progress", width: "8%", + render: (text, record)=>{ + return ( + {Math.round(record?.persentase_progress).toFixed(0)} + ) + } + }, { title: 'Action', dataIndex: '', @@ -166,7 +181,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => render: (text, record) => <> - + {" "} , @@ -228,10 +243,15 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => title: "Volume Plan", dataIndex: "join_third_qty_planning", key: "join_third_qty_planning", render: (text, record) => <> - {text ? text : 0} + {text ? Math.round(text).toFixed(0) : 0} }, - { title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual" }, + { title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual", + render: (text, record) => + <> + {text ? Math.round(record.volume_actual).toFixed(0) : 0} + + }, { title: "Progress Plan (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress", render: (text, record) => { @@ -249,7 +269,13 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => ); }, }, - { title: "Progress Actual (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress" }, + {title: "Progress Actual (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress", width: "8%", + render: (text, record)=>{ + return ( + {Math.round(record?.join_second_persentase_progress).toFixed(0)} + ) + } + }, { title: 'Action', dataIndex: '', @@ -258,7 +284,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => render: (text, record) => <> - + {" "} , @@ -287,8 +313,11 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => if (projectId) { getGroupedActivity() getDataHr() + setSearch('') + setDatatable([]) + setDataTableActivityToHr([]) } - }, [projectId]); + }, [openDialog]); const handleClose = () => { setAvgActivityHr(0); @@ -305,8 +334,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => setSearch(value); }; - const handleDetail = (data) => { + const handleDetail = (data, type) => { setOpenDialogFormAnalysis(true); + setTypeDialogName(type === 'activity' ? data.name_version : data.join_second_name); setDataDetail(data); } @@ -414,7 +444,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => name: "assign_material_to_activity", column_join: "id", column_self: "activity_id", - column_results: ["qty_planning"] + column_results: ["id","qty_planning"] }, { name1: "m_activity", @@ -533,7 +563,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => return ( <> - Report Analysis + Report Analysis - {proyekName}