Browse Source

Merge branch 'general' of https://git.oslog.id/ordo/adw-frontend

pull/2/head
root 1 year ago
parent
commit
809c669a11
  1. 26
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js

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

@ -21,6 +21,8 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const [openDialogFormAnalysis, setOpenDialogFormAnalysis] = useState(false);
const [dataDetail, setDataDetail] = useState(null);
const [avgActivityHr, setAvgActivityHr] = useState(0);
const [sumVolPlan, setSumVolPlan] = useState(0);
const [sumVolAct, setSumVolAct] = useState(0);
const [avgActivity, setAvgActivity] = useState(0);
const [dataTable, setDatatable] = useState([]);
const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]);
@ -57,6 +59,20 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const columns = [
{title: "Gantt", dataIndex: "name_version", key: "name_version"},
{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: "Assign HR", dataIndex: "user_name", key: "user_name"},
{title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning",
render: (text, record) =>
@ -352,8 +368,12 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const getDataActivity = async () => {
setAvgActivity(0);
setSumVolPlan(0);
setSumVolAct(0);
setDatatable([]);
let sum = 0;
let sumPlan = 0;
let sumAct = 0;
const payload = {
columns: [
{
@ -383,8 +403,12 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
dataRes.forEach(element => {
element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0;
element.qty_planning ? sumPlan += parseInt(element.qty_planning) : sumPlan += 0;
element.qty ? sumAct += parseInt(element.qty) : sumAct += 0;
});
setAvgActivity(sum / dataRes.length);
setSumVolPlan(sumPlan);
setSumVolAct(sumAct);
setDatatable(dataRes);
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
@ -438,7 +462,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
<div style={{ textAlign: 'center' }}>
<h1>
{
search && avgActivity ? `Activity ${search} adalah ${avgActivity.toFixed(2)} %` : null
search ? `Activity ${search} Plan : ${sumVolPlan ? sumVolPlan.toFixed(0) : 0}, Actual : ${sumVolAct ? sumVolAct.toFixed(0) : 0}` : null
}
</h1>
</div>

Loading…
Cancel
Save