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. 63
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js

5
src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js

@ -14,7 +14,8 @@ const DialogFormAnalysis = ({
openDialog, openDialog,
closeDialog, closeDialog,
toggleDialog, toggleDialog,
dataDetail dataDetail,
typeDialogName
}) => { }) => {
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
const [dataTable, setDatatable] = useState([]); const [dataTable, setDatatable] = useState([]);
@ -99,7 +100,7 @@ const DialogFormAnalysis = ({
<> <>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> <Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}> <ModalHeader className="capitalize" toggle={closeDialog}>
Detail Report Analysis Detail Report Analysis - {typeDialogName}
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<Card> <Card>

63
src/views/SimproV2/CreatedProyek/ReportAnalysis.js

@ -28,7 +28,7 @@ import DialogFormAnalysis from './DialogFormAnalysis';
import moment from "moment"; import moment from "moment";
const { Option } = Select const { Option } = Select
const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => { const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName }) => {
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
const [activeTab, setActiveTab] = useState('1'); const [activeTab, setActiveTab] = useState('1');
const [search, setSearch] = useState(''); const [search, setSearch] = useState('');
@ -44,6 +44,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const [groupedActivity, setGroupedActivity] = useState([]); const [groupedActivity, setGroupedActivity] = useState([]);
const [selectedHr, setSelectedHr] = useState(null); const [selectedHr, setSelectedHr] = useState(null);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [typeDialogName, setTypeDialogName] = useState('');
const toggle = (tab) => { const toggle = (tab) => {
if (activeTab !== tab) { if (activeTab !== tab) {
@ -134,12 +135,19 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
}, },
{ {
title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning", title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning",
render: (text, record) => render: (text, record) =>
<> <>
{text ? text : 0} {text ? Math.round(text).toFixed(0) : 0}
</> </>
},
{
title: "Volume Actual", dataIndex: "qty", key: "qty",
render: (text, record)=> {
return (
<span>{Math.round(record.qty).toFixed(0)}</span>
)
}
}, },
{ title: "Volume Actual", dataIndex: "qty", key: "qty" },
{ {
title: "Progress Plan (%)", dataIndex: "persentase_progress", key: "persentase_progress", title: "Progress Plan (%)", dataIndex: "persentase_progress", key: "persentase_progress",
render: (text, record) => { 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', title: 'Action',
dataIndex: '', dataIndex: '',
@ -166,7 +181,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
render: (text, record) => render: (text, record) =>
<> <>
<Tooltip title="Detail Activity"> <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>{" "} </Tooltip>{" "}
</> </>
, ,
@ -228,10 +243,15 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
title: "Volume 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) => 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", title: "Progress Plan (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress",
render: (text, record) => { 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', title: 'Action',
dataIndex: '', dataIndex: '',
@ -258,7 +284,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
render: (text, record) => render: (text, record) =>
<> <>
<Tooltip title="Detail Activity"> <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>{" "} </Tooltip>{" "}
</> </>
, ,
@ -287,8 +313,11 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
if (projectId) { if (projectId) {
getGroupedActivity() getGroupedActivity()
getDataHr() getDataHr()
setSearch('')
setDatatable([])
setDataTableActivityToHr([])
} }
}, [projectId]); }, [openDialog]);
const handleClose = () => { const handleClose = () => {
setAvgActivityHr(0); setAvgActivityHr(0);
@ -305,8 +334,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
setSearch(value); setSearch(value);
}; };
const handleDetail = (data) => { const handleDetail = (data, type) => {
setOpenDialogFormAnalysis(true); setOpenDialogFormAnalysis(true);
setTypeDialogName(type === 'activity' ? data.name_version : data.join_second_name);
setDataDetail(data); setDataDetail(data);
} }
@ -414,7 +444,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
name: "assign_material_to_activity", name: "assign_material_to_activity",
column_join: "id", column_join: "id",
column_self: "activity_id", column_self: "activity_id",
column_results: ["qty_planning"] column_results: ["id","qty_planning"]
}, },
{ {
name1: "m_activity", name1: "m_activity",
@ -533,7 +563,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
return ( return (
<> <>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}> <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> <ModalBody>
<div> <div>
<Nav tabs> <Nav tabs>
@ -638,6 +668,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
toggleDialog={toggleDialogForm} toggleDialog={toggleDialogForm}
closeDialog={closeDialogForm} closeDialog={closeDialogForm}
dataDetail={dataDetail} dataDetail={dataDetail}
typeDialogName={typeDialogName}
/> />
</> </>
) )

Loading…
Cancel
Save