Browse Source

fix(report analysis): update header modal & tofixed value column

pull/1/head
Watiah11 8 months ago
parent
commit
5890b487a6
  1. 5
      src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
  2. 57
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js

5
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 = ({
<>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>
Detail Report Analysis
Detail Report Analysis - {typeDialogName}
</ModalHeader>
<ModalBody>
<Card>

57
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) {
@ -136,10 +137,17 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning",
render: (text, record) =>
<>
{text ? text : 0}
{text ? Math.round(text).toFixed(0) : 0}
</>
},
{ title: "Volume Actual", dataIndex: "qty", key: "qty" },
{
title: "Volume Actual", dataIndex: "qty", key: "qty",
render: (text, record)=> {
return (
<span>{Math.round(record.qty).toFixed(0)}</span>
)
}
},
{
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 (
<span>{Math.round(record?.persentase_progress).toFixed(0)}</span>
)
}
},
{
title: 'Action',
dataIndex: '',
@ -166,7 +181,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
render: (text, record) =>
<>
<Tooltip title="Detail Activity">
<Button size={"sm"} color='primary' onClick={() => handleDetail(text)}><i className="fa fa-eye"></i></Button>
<Button size={"sm"} color='primary' onClick={() => handleDetail(text,'activity')}><i className="fa fa-eye"></i></Button>
</Tooltip>{" "}
</>
,
@ -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",
render: (text, record) =>
<>
{text ? Math.round(record.volume_actual).toFixed(0) : 0}
</>
},
{ title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual" },
{
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 (
<span>{Math.round(record?.join_second_persentase_progress).toFixed(0)}</span>
)
}
},
{
title: 'Action',
dataIndex: '',
@ -258,7 +284,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
render: (text, record) =>
<>
<Tooltip title="Detail Activity">
<Button size={"sm"} color='primary' onClick={() => handleDetail(text)}><i className="fa fa-eye"></i></Button>
<Button size={"sm"} color='primary' onClick={() => handleDetail(text,'hr')}><i className="fa fa-eye"></i></Button>
</Tooltip>{" "}
</>
,
@ -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 (
<>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={handleClose}>Report Analysis</ModalHeader>
<ModalHeader className="capitalize" toggle={handleClose}>Report Analysis - {proyekName}</ModalHeader>
<ModalBody>
<div>
<Nav tabs>
@ -638,6 +668,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
toggleDialog={toggleDialogForm}
closeDialog={closeDialogForm}
dataDetail={dataDetail}
typeDialogName={typeDialogName}
/>
</>
)

Loading…
Cancel
Save