Browse Source

update report analysis

pull/1/head
farhantock 7 months ago
parent
commit
29c620d242
  1. 97
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js

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

@ -1,4 +1,4 @@
import React, {useState, useEffect} from 'react' import React, { useState, useEffect } from 'react'
import { import {
Modal, Modal,
ModalHeader, ModalHeader,
@ -73,51 +73,58 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
}; };
const columns = [ const columns = [
{title: "Gantt", dataIndex: "name_version", key: "name_version"}, { title: "Gantt", dataIndex: "name_version", key: "name_version" },
{title: "Baseline Start", dataIndex: "planned_start", key: "planned_start", {
title: "Baseline Start", dataIndex: "planned_start", key: "planned_start",
render: (text, record) => ( render: (text, record) => (
<> <>
{record.planned_start ? moment(record.planned_start).format("DD-MM-YY") : ''} {record.planned_start ? moment(record.planned_start).format("DD-MM-YY") : ''}
</> </>
), ),
}, },
{title: "Baseline Finish", dataIndex: "planned_end", key: "planned_end", {
title: "Baseline Finish", dataIndex: "planned_end", key: "planned_end",
render: (text, record) => ( render: (text, record) => (
<> <>
{record.planned_end ? moment(record.planned_end).format("DD-MM-YY") : ''} {record.planned_end ? moment(record.planned_end).format("DD-MM-YY") : ''}
</> </>
), ),
}, },
{title: "Early Start", dataIndex: "start_date", key: "start_date", {
title: "Early Start", dataIndex: "start_date", key: "start_date",
render: (text, record) => ( render: (text, record) => (
<> <>
{moment(record.start_date).format("DD-MM-YY")} {moment(record.start_date).format("DD-MM-YY")}
</> </>
), ),
}, },
{title: "Early Finish", dataIndex: "end_date", key: "end_date", {
title: "Early Finish", dataIndex: "end_date", key: "end_date",
render: (text, record) => ( render: (text, record) => (
<> <>
{moment(record.end_date).format("DD-MM-YY")} {moment(record.end_date).format("DD-MM-YY")}
</> </>
), ),
}, },
{title: "Actual Start", dataIndex: "actual_start", key: "actual_start", {
title: "Actual Start", dataIndex: "actual_start", key: "actual_start",
render: (text, record) => ( render: (text, record) => (
<> <>
{record.actual_start ? moment(record.actual_start).format("DD-MM-YY") : ""} {record.actual_start ? moment(record.actual_start).format("DD-MM-YY") : ""}
</> </>
), ),
}, },
{title: "Actual Finish", dataIndex: "actual_end", key: "actual_end", {
title: "Actual Finish", dataIndex: "actual_end", key: "actual_end",
render: (text, record) => ( render: (text, record) => (
<> <>
{record.actual_end ? moment(record.actual_end).format("DD-MM-YY") : ""} {record.actual_end ? moment(record.actual_end).format("DD-MM-YY") : ""}
</> </>
), ),
}, },
{title: "Assign HR", dataIndex: "user_name", key: "user_name", width: "8%", {
ellipsis:{ title: "Assign HR", dataIndex: "user_name", key: "user_name", width: "8%",
ellipsis: {
showTitle: true showTitle: true
}, },
render: (text) => render: (text) =>
@ -125,14 +132,16 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
{text} {text}
</Tooltip> </Tooltip>
}, },
{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 ? text : 0}
</> </>
}, },
{title: "Volume Actual", dataIndex: "qty", key: "qty"}, { 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) => {
const startDate = moment(record.start_date); const startDate = moment(record.start_date);
const duration = record.duration; const duration = record.duration;
@ -148,7 +157,7 @@ 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%" },
{ {
title: 'Action', title: 'Action',
dataIndex: '', dataIndex: '',
@ -165,58 +174,66 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
] ]
const columnActivityToHr = [ const columnActivityToHr = [
{title: "Activity", dataIndex: "join_second_name", key: "join_second_name"}, { title: "Activity", dataIndex: "join_second_name", key: "join_second_name" },
{title: "Gantt", dataIndex: "join_fourth_name_version", key: "join_fourth_name_version"}, { title: "Gantt", dataIndex: "join_fourth_name_version", key: "join_fourth_name_version" },
{title: "Baseline Start", dataIndex: "join_second_planned_start", key: "join_second_planned_start", {
title: "Baseline Start", dataIndex: "join_second_planned_start", key: "join_second_planned_start",
render: (text, record) => ( render: (text, record) => (
<> <>
{moment(record.join_second_planned_start).format("DD-MM-YY")} {moment(record.join_second_planned_start).format("DD-MM-YY")}
</> </>
), ),
}, },
{title: "Baseline Finish", dataIndex: "join_second_planned_end", key: "join_second_planned_end", {
title: "Baseline Finish", dataIndex: "join_second_planned_end", key: "join_second_planned_end",
render: (text, record) => ( render: (text, record) => (
<> <>
{moment(record.join_second_planned_end).format("DD-MM-YY")} {moment(record.join_second_planned_end).format("DD-MM-YY")}
</> </>
), ),
}, },
{title: "Early Start", dataIndex: "join_second_start_date", key: "join_second_start_date", {
title: "Early Start", dataIndex: "join_second_start_date", key: "join_second_start_date",
render: (text, record) => ( render: (text, record) => (
<> <>
{moment(record.join_second_start_date).format("DD-MM-YY")} {moment(record.join_second_start_date).format("DD-MM-YY")}
</> </>
), ),
}, },
{title: "Early Finish", dataIndex: "join_second_end_date", key: "join_second_end_date", {
title: "Early Finish", dataIndex: "join_second_end_date", key: "join_second_end_date",
render: (text, record) => ( render: (text, record) => (
<> <>
{moment(record.join_second_end_date).format("DD-MM-YY")} {moment(record.join_second_end_date).format("DD-MM-YY")}
</> </>
), ),
}, },
{title: "Actual Start", dataIndex: "join_second_actual_start", key: "join_second_actual_start", {
title: "Actual Start", dataIndex: "join_second_actual_start", key: "join_second_actual_start",
render: (text, record) => ( render: (text, record) => (
<> <>
{record.join_second_actual_start ? moment(record.join_second_actual_start).format("DD-MM-YY") : ""} {record.join_second_actual_start ? moment(record.join_second_actual_start).format("DD-MM-YY") : ""}
</> </>
), ),
}, },
{title: "Actual Finish", dataIndex: "join_second_actual_end", key: "join_second_actual_end", {
title: "Actual Finish", dataIndex: "join_second_actual_end", key: "join_second_actual_end",
render: (text, record) => ( render: (text, record) => (
<> <>
{record.join_second_actual_end ? moment(record.join_second_actual_end).format("DD-MM-YY") : ""} {record.join_second_actual_end ? moment(record.join_second_actual_end).format("DD-MM-YY") : ""}
</> </>
), ),
}, },
{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 ? text : 0}
</> </>
}, },
{title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual"}, { title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual" },
{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) => {
const startDate = moment(record.join_second_start_date); const startDate = moment(record.join_second_start_date);
const duration = record.join_second_duration; const duration = record.join_second_duration;
@ -232,7 +249,7 @@ 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" },
{ {
title: 'Action', title: 'Action',
dataIndex: '', dataIndex: '',
@ -297,10 +314,10 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
if (status == "Save") { if (status == "Save") {
// getdataGantt() // getdataGantt()
NotificationManager.success(`Gantt berhasil dibuat!`, 'Success!!'); NotificationManager.success(`Gantt berhasil dibuat!`, 'Success!!');
}else if (status == "Edit") { } else if (status == "Edit") {
// getdataGantt() // getdataGantt()
NotificationManager.success(`Gantt berhasil dibubah!`, 'Failed!!'); NotificationManager.success(`Gantt berhasil dibubah!`, 'Failed!!');
}else if (status == "failed") { } else if (status == "failed") {
NotificationManager.error(`Gantt gagal dibuat!`, 'Failed!!'); NotificationManager.error(`Gantt gagal dibuat!`, 'Failed!!');
} }
setDataDetail(null) setDataDetail(null)
@ -338,7 +355,21 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || []; let dataRes = result.data.data || [];
setHrList(dataRes); let groupedData = {};
dataRes.forEach(data => {
if (groupedData[data.join_first_name]) {
groupedData[data.join_first_name].join_first_id = Math.min(groupedData[data.join_first_name].join_first_id, data.join_first_id);
} else {
groupedData[data.join_first_name] = {
join_first_id: data.join_first_id,
join_first_name: data.join_first_name
};
}
});
let dataFiltered = Object.values(groupedData);
setHrList(dataFiltered);
} else { } else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); NotificationManager.error("Gagal Mengambil Data!!", "Failed");
} }
@ -382,21 +413,21 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
name1: "m_activity", name1: "m_activity",
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: ["id", "qty_planning"] column_results: ["qty_planning"]
}, },
{ {
name1: "m_activity", name1: "m_activity",
name: "m_version_gantt", name: "m_version_gantt",
column_join: "version_gantt_id", column_join: "version_gantt_id",
column_self:"id", column_self: "id",
column_results: ["name_version"] column_results: ["name_version"]
}, },
{ {
name1: "m_activity", name1: "m_activity",
name: "report_activity_material", name: "report_activity_material",
column_join: "id", column_join: "id",
column_self:"activity_id", column_self: "activity_id",
}, },
], ],
orders: { columns: ["id"], ascending: false }, orders: { columns: ["id"], ascending: false },

Loading…
Cancel
Save