|
|
@ -19,7 +19,7 @@ import { |
|
|
|
Tooltip, |
|
|
|
Tooltip, |
|
|
|
Popover, |
|
|
|
Popover, |
|
|
|
Skeleton, |
|
|
|
Skeleton, |
|
|
|
Divider, |
|
|
|
Spin, |
|
|
|
} from "antd"; |
|
|
|
} from "antd"; |
|
|
|
import { |
|
|
|
import { |
|
|
|
PROJECT_APPROVAL_ADD, |
|
|
|
PROJECT_APPROVAL_ADD, |
|
|
@ -136,6 +136,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const [dataVersionGantt, setDataVersionGantt] = useState([]); |
|
|
|
const [dataVersionGantt, setDataVersionGantt] = useState([]); |
|
|
|
const [dataHierarchy, setDataHierarchy] = useState([]); |
|
|
|
const [dataHierarchy, setDataHierarchy] = useState([]); |
|
|
|
const [dataDetail, setDataDetail] = useState(null); |
|
|
|
const [dataDetail, setDataDetail] = useState(null); |
|
|
|
|
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
|
|
|
|
|
|
|
|
const pageName = params.name; |
|
|
|
const pageName = params.name; |
|
|
|
|
|
|
|
|
|
|
@ -167,7 +168,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
}, [openDialogProyek]); |
|
|
|
}, [openDialogProyek]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
getDataProyek(); |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
}, [search, rowsPerPage, currentPage]); |
|
|
|
}, [search, rowsPerPage, currentPage]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -230,6 +231,30 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleDashboard = async (text) => { |
|
|
|
|
|
|
|
const URL = `${BASE_OSPRO}/api/project/detail/${text.id}`; |
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
|
|
|
.get(URL, HEADER) |
|
|
|
|
|
|
|
.then((res) => res) |
|
|
|
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
|
|
|
if (!result) { |
|
|
|
|
|
|
|
NotificationManager.error(`Could not connect to internet.`, "Failed"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.status !== 200) { |
|
|
|
|
|
|
|
NotificationManager.error( |
|
|
|
|
|
|
|
`Get project detail failed, ${result.data.message}`, |
|
|
|
|
|
|
|
"Failed" |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else if (result.status == 200 && result.data.data) { |
|
|
|
|
|
|
|
history.push( |
|
|
|
|
|
|
|
`dashboard-customer/${text.id}/${result.data.gantt.last_gantt_id}/1` |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const getDataProyek = async () => { |
|
|
|
const getDataProyek = async () => { |
|
|
|
let start = 0; |
|
|
|
let start = 0; |
|
|
|
|
|
|
|
|
|
|
@ -246,6 +271,80 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
operator: "AND", |
|
|
|
operator: "AND", |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
select: [ |
|
|
|
|
|
|
|
"id", |
|
|
|
|
|
|
|
"nama", |
|
|
|
|
|
|
|
"rencana_biaya", |
|
|
|
|
|
|
|
"type_proyek_id", |
|
|
|
|
|
|
|
"currency_symbol", |
|
|
|
|
|
|
|
"mulai_proyek", |
|
|
|
|
|
|
|
"akhir_proyek", |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
joins: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "m_users", |
|
|
|
|
|
|
|
column_join: "pm_id", |
|
|
|
|
|
|
|
column_results: ["name", "username"], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "m_type_proyek", |
|
|
|
|
|
|
|
column_join: "type_proyek_id", |
|
|
|
|
|
|
|
column_results: ["name", "description"], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
|
|
|
|
paging: { start: start, length: rowsPerPage }, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parseInt(role_id) !== 1) { |
|
|
|
|
|
|
|
payload["columns"] = [ |
|
|
|
|
|
|
|
{ name: "id", logic_operator: "=", value: proyek_id, operator: "AND" }, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
|
|
|
.post(PROYEK_SEARCH, payload, HEADER) |
|
|
|
|
|
|
|
.then((res) => res) |
|
|
|
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
|
|
|
let dataRes = result.data.data || []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setDatatable(dataRes); |
|
|
|
|
|
|
|
setTotalPage(result.data.totalRecord); |
|
|
|
|
|
|
|
setLoading(false); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
setLoading(false); |
|
|
|
|
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getDataProyekByCustomer = async () => { |
|
|
|
|
|
|
|
let start = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentPage !== 1 && currentPage > 1) { |
|
|
|
|
|
|
|
start = currentPage * rowsPerPage - rowsPerPage; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
|
|
|
|
columns: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
name: "nama", |
|
|
|
|
|
|
|
logic_operator: "ilike", |
|
|
|
|
|
|
|
value: search, |
|
|
|
|
|
|
|
operator: "AND", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
select: [ |
|
|
|
|
|
|
|
"id", |
|
|
|
|
|
|
|
"nama", |
|
|
|
|
|
|
|
"rencana_biaya", |
|
|
|
|
|
|
|
"type_proyek_id", |
|
|
|
|
|
|
|
"currency_symbol", |
|
|
|
|
|
|
|
"mulai_proyek", |
|
|
|
|
|
|
|
"akhir_proyek", |
|
|
|
|
|
|
|
], |
|
|
|
joins: [ |
|
|
|
joins: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
name: "m_users", |
|
|
|
name: "m_users", |
|
|
@ -257,11 +356,10 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
column_join: "proyek_id", |
|
|
|
column_join: "proyek_id", |
|
|
|
column_results: ["type_proyek_id"], |
|
|
|
column_results: ["type_proyek_id"], |
|
|
|
}, |
|
|
|
}, |
|
|
|
// { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
|
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
user_id: { user_id: user_id }, |
|
|
|
|
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
paging: { start: start, length: rowsPerPage }, |
|
|
|
paging: { start: start, length: rowsPerPage }, |
|
|
|
|
|
|
|
user_id: { user_id: user_id } |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (parseInt(role_id) !== 1) { |
|
|
|
if (parseInt(role_id) !== 1) { |
|
|
@ -277,12 +375,12 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
|
|
|
|
|
|
|
|
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 || []; |
|
|
|
// const filteredData = dataRes.filter(
|
|
|
|
|
|
|
|
// (item) => item.join_first_role_id === parseInt(role_id)
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
setDatatable(dataRes); |
|
|
|
setDatatable(dataRes); |
|
|
|
setTotalPage(result.data.totalRecord); |
|
|
|
setTotalPage(result.data.totalRecord); |
|
|
|
|
|
|
|
setLoading(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
setLoading(false); |
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -304,6 +402,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const getdataGantt = async (idTask) => { |
|
|
|
const getdataGantt = async (idTask) => { |
|
|
|
setLoadVersionGantt(true); |
|
|
|
setLoadVersionGantt(true); |
|
|
|
const payload = { |
|
|
|
const payload = { |
|
|
|
|
|
|
|
select: ["id", "name_version"], |
|
|
|
columns: [ |
|
|
|
columns: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
name: "proyek_id", |
|
|
|
name: "proyek_id", |
|
|
@ -591,7 +690,8 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
getDataProyek(); |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
|
|
|
|
|
|
|
|
setIdDelete(0); |
|
|
|
setIdDelete(0); |
|
|
|
setAlertDelete(false); |
|
|
|
setAlertDelete(false); |
|
|
|
NotificationManager.success(`Data proyek berhasil dihapus`, "Success!!"); |
|
|
|
NotificationManager.success(`Data proyek berhasil dihapus`, "Success!!"); |
|
|
@ -637,7 +737,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
NotificationManager.success(`${result.data.message}`, "Success!!"); |
|
|
|
NotificationManager.success(`${result.data.message}`, "Success!!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getDataProyek(); |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
|
} |
|
|
|
} |
|
|
@ -718,7 +818,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const resultMilestone = await editMilestone(data.id, milestones); |
|
|
|
const resultMilestone = await editMilestone(data.id, milestones); |
|
|
|
const resultApproval = await editApproval(data.id, approval); |
|
|
|
const resultApproval = await editApproval(data.id, approval); |
|
|
|
if (result && result.status === 200) { |
|
|
|
if (result && result.status === 200) { |
|
|
|
getDataProyek(); |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!"); |
|
|
|
NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
|
NotificationManager.error(`${result.data.message}`, "Failed!!"); |
|
|
@ -898,7 +998,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const data = resData.map((elt) => [ |
|
|
|
const data = resData.map((elt) => [ |
|
|
|
elt.nama, |
|
|
|
elt.nama, |
|
|
|
`Rp. ${formatThousand(elt.rencana_biaya)}`, |
|
|
|
`Rp. ${formatThousand(elt.rencana_biaya)}`, |
|
|
|
elt.nama_type_proyek, |
|
|
|
elt.join_second_name, |
|
|
|
elt.join_first_name, |
|
|
|
elt.join_first_name, |
|
|
|
`${moment(elt.mulai_proyek).format(format)} - ${moment( |
|
|
|
`${moment(elt.mulai_proyek).format(format)} - ${moment( |
|
|
|
elt.akhir_proyek |
|
|
|
elt.akhir_proyek |
|
|
@ -1112,7 +1212,21 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
title: "Action", |
|
|
|
title: "Action", |
|
|
|
dataIndex: "", |
|
|
|
dataIndex: "", |
|
|
|
key: "x", |
|
|
|
key: "x", |
|
|
|
render: (text, record) => ( |
|
|
|
render: (text, record) => |
|
|
|
|
|
|
|
role_id == "44" ? ( |
|
|
|
|
|
|
|
<> |
|
|
|
|
|
|
|
<Tooltip title="Dashboard Project"> |
|
|
|
|
|
|
|
<Button |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
onClick={() => handleDashboard(text)} |
|
|
|
|
|
|
|
type="link" |
|
|
|
|
|
|
|
style={{ color: "green" }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<i className="fa fa-line-chart"></i> |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</Tooltip> |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
) : ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<Popover |
|
|
|
<Popover |
|
|
|
placement="rightTop" |
|
|
|
placement="rightTop" |
|
|
@ -1165,7 +1279,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
dataIndex: "color_progress", |
|
|
|
dataIndex: "color_progress", |
|
|
|
key: "color_progress", |
|
|
|
key: "color_progress", |
|
|
|
render: (text, record) => ( |
|
|
|
render: (text, record) => ( |
|
|
|
<>{record.nama_type_proyek ? record.nama_type_proyek : "-"}</> |
|
|
|
<>{record.join_second_name ? record.join_second_name : "-"}</> |
|
|
|
), |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1436,6 +1550,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
<Col> |
|
|
|
<Col> |
|
|
|
|
|
|
|
{role_id == "44" ? null : ( // role kustomer
|
|
|
|
<Tooltip title="Add Project"> |
|
|
|
<Tooltip title="Add Project"> |
|
|
|
<Button |
|
|
|
<Button |
|
|
|
style={{ background: "#4caf50", color: "#fff" }} |
|
|
|
style={{ background: "#4caf50", color: "#fff" }} |
|
|
@ -1444,6 +1559,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
<i className="fa fa-plus"></i> |
|
|
|
<i className="fa fa-plus"></i> |
|
|
|
</Button> |
|
|
|
</Button> |
|
|
|
</Tooltip> |
|
|
|
</Tooltip> |
|
|
|
|
|
|
|
)} |
|
|
|
<Tooltip title="Export Excel"> |
|
|
|
<Tooltip title="Export Excel"> |
|
|
|
<Popover |
|
|
|
<Popover |
|
|
|
// content={<a onClick={hide}>Close</a>}
|
|
|
|
// content={<a onClick={hide}>Close</a>}
|
|
|
@ -1486,7 +1602,10 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
</CardHeader> |
|
|
|
</CardHeader> |
|
|
|
<CardBody> |
|
|
|
<CardBody> |
|
|
|
|
|
|
|
<Spin tip="Loading..." spinning={loading}> |
|
|
|
{RenderTable} |
|
|
|
{RenderTable} |
|
|
|
|
|
|
|
</Spin> |
|
|
|
|
|
|
|
|
|
|
|
<Pagination |
|
|
|
<Pagination |
|
|
|
style={{ marginTop: "25px" }} |
|
|
|
style={{ marginTop: "25px" }} |
|
|
|
showSizeChanger |
|
|
|
showSizeChanger |
|
|
|