|
|
|
@ -32,15 +32,13 @@ import {
|
|
|
|
|
PROJECT_MILESTONE_DELETE_BY_PROYEK, |
|
|
|
|
PROJECT_APPROVAL_DELETE_BY_PROYEK, |
|
|
|
|
USER_SEARCH, |
|
|
|
|
|
|
|
|
|
PROYEK_DELETE, |
|
|
|
|
PROJECT_TYPE_SEARCH, |
|
|
|
|
PROYEK_ADD, |
|
|
|
|
PROYEK_SEARCH, |
|
|
|
|
COMPANY_MANAGEMENT_LIST, |
|
|
|
|
PROYEK_EDIT, |
|
|
|
|
ASSIGN_HR_PROJECT_SEARCH, |
|
|
|
|
PROJECT_CHECKLIST_SEARCH, |
|
|
|
|
PROYEK_DELETE, |
|
|
|
|
PROJECT_ISSUE_SEARCH, |
|
|
|
|
PROJECT_RISK_SEARCH, |
|
|
|
|
PROJECT_CHECKLIST_DELETE_BY_PROYEK, |
|
|
|
@ -70,10 +68,7 @@ import DialogInitDocument from "./DialogInitDocument";
|
|
|
|
|
import DialogGantt from "./DialogGantt"; |
|
|
|
|
import DialogHierarchy from "./DialogHierarchy"; |
|
|
|
|
import { |
|
|
|
|
formatNumber, |
|
|
|
|
formatRupiah, |
|
|
|
|
formatThousand, |
|
|
|
|
renderFormatRupiah, |
|
|
|
|
checkActMenup, |
|
|
|
|
} from "../../../const/CustomFunc"; |
|
|
|
|
// import DialogAsignHr from './AsignHrProject';
|
|
|
|
@ -92,13 +87,12 @@ const format = "DD-MM-YYYY";
|
|
|
|
|
|
|
|
|
|
const CreatedProyek = ({ params, ...props }) => { |
|
|
|
|
let pageRow = 10; |
|
|
|
|
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {}; |
|
|
|
|
let role_id = 0, user_id = 0, isLogin = false, token = '', all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {}; |
|
|
|
|
if (props && props.role_id && props.user_id) { |
|
|
|
|
role_id = props.role_id; |
|
|
|
|
user_id = props.user_id; |
|
|
|
|
token = props.token; |
|
|
|
|
isLogin = props.isLogin; |
|
|
|
|
company_id = props.company_id; |
|
|
|
|
all_project = props.all_project; |
|
|
|
|
role_name = props.role_name; |
|
|
|
|
isLogin = props.isLogin; |
|
|
|
@ -125,7 +119,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const [idTask, setidTask] = useState(0); |
|
|
|
|
const [projectId, setProjectId] = useState(0); |
|
|
|
|
const [dataTable, setDatatable] = useState([]); |
|
|
|
|
const [companyList, setDataCompany] = useState([]); |
|
|
|
|
const [search, setSearch] = useState(""); |
|
|
|
|
const [currentPage, setCurrentPage] = useState(1); |
|
|
|
|
const [totalPage, setTotalPage] = useState(0); |
|
|
|
@ -159,8 +152,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const [openDialogDoc, setOpenDialogDoc] = useState(false); |
|
|
|
|
const [proyekName, setProyekName] = useState(""); |
|
|
|
|
const [openDialogProyek, setOpenDialogProyek] = useState(false); |
|
|
|
|
const [companyId, setCompanyId] = useState(role_name !== 'Super Admin' ? company_id : 0); |
|
|
|
|
const [companyName, setCompanyName] = useState(''); |
|
|
|
|
// project charter
|
|
|
|
|
const [projectCharter, setProjectCharter] = useState(null); |
|
|
|
|
const [projectParticipant, setProjectParticipant] = useState(null); |
|
|
|
@ -210,12 +201,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
} |
|
|
|
|
}, [openDialogProyek]); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (role_name === 'Super Admin') { |
|
|
|
|
getDataProyekCompany(); |
|
|
|
|
} |
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (parseInt(role_id) === 44) { |
|
|
|
|
getDataProyekByCustomer() |
|
|
|
@ -255,11 +240,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
"joins": [], |
|
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROJECT_TYPE_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -276,11 +256,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
"joins": [], |
|
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROJECT_PHASE_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -297,11 +272,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
"joins": [], |
|
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(DIVISI_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -320,11 +291,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
"joins": [], |
|
|
|
|
"orders": { "columns": ["id"], "ascending": false } |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(USER_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -336,22 +303,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getDataProyekCompany = async () => { |
|
|
|
|
const result = await axios |
|
|
|
|
.get(COMPANY_MANAGEMENT_LIST, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let dataRes = result.data.data || []; |
|
|
|
|
setDataCompany(dataRes); |
|
|
|
|
setLoading(false); |
|
|
|
|
} else { |
|
|
|
|
setLoading(false); |
|
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handleDashboard = async (id) => { |
|
|
|
|
const URL = `${BASE_OSPRO}/api/project/detail/${id}`; |
|
|
|
|
const result = await axios |
|
|
|
@ -426,7 +377,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
"akhir_proyek", |
|
|
|
|
"value_proyek", |
|
|
|
|
"income_year", |
|
|
|
|
"company_id", |
|
|
|
|
"deleted_at", |
|
|
|
|
"deleted_by_id" |
|
|
|
|
], |
|
|
|
@ -446,23 +396,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
paging: { start: start, length: rowsPerPage }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (role_name !== 'Super Admin' && all_project === 'true') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" } |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
payload.joins.push( |
|
|
|
|
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } |
|
|
|
|
) |
|
|
|
|
payload.group_column.where.push( |
|
|
|
|
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROYEK_SEARCH, payload, HEADER) |
|
|
|
@ -582,7 +518,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleOpenDialogProyek = async (text) => { |
|
|
|
|
setCompanyId(text.company_id); |
|
|
|
|
setOpenDialogProyek(true); |
|
|
|
|
setidTask(text.id); |
|
|
|
|
if (text.id !== 0) { |
|
|
|
@ -594,8 +529,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
setDataViewStartDate(data.mulai_proyek) |
|
|
|
|
setidTask(data.id); |
|
|
|
|
setProyekName(data.nama); |
|
|
|
|
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name); |
|
|
|
|
setCompanyId(data.company_id); |
|
|
|
|
setOpenDialogGantt(true); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -630,16 +563,12 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const handleOpenAsignHr = (data) => { |
|
|
|
|
setidTask(data.id); |
|
|
|
|
setProyekName(data.nama); |
|
|
|
|
setCompanyId(data.company_id); |
|
|
|
|
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name); |
|
|
|
|
setOpenDialogAsignHR(true); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handleOpenAsignCust = (data) => { |
|
|
|
|
setidTask(data.id); |
|
|
|
|
setProyekName(data.nama); |
|
|
|
|
setCompanyId(data.company_id); |
|
|
|
|
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name); |
|
|
|
|
setOpenDialogAsignCust(true); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -1009,7 +938,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const onConfirmDelete = async () => { |
|
|
|
|
let urlDel = PROYEK_DELETE(idDelete, company_id); |
|
|
|
|
let urlDel = PROYEK_DELETE(idDelete); |
|
|
|
|
const result = await axios |
|
|
|
|
.delete(urlDel, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -1230,8 +1159,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const deleteImage = async (id) => { |
|
|
|
|
const company_id = localStorage.getItem("company_id"); |
|
|
|
|
const URL = IMAGE_DELETE(id, 'project_structure_organization', company_id); |
|
|
|
|
const URL = IMAGE_DELETE(id, 'project_structure_organization'); |
|
|
|
|
await axios |
|
|
|
|
.delete(URL, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
@ -1435,25 +1363,11 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
joins: [], |
|
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (role_name !== 'Super Admin' && all_project === 'true') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" } |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') { |
|
|
|
|
if (all_project === 'false' || all_project === 'null') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
payload.joins.push( |
|
|
|
|
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } |
|
|
|
|
) |
|
|
|
|
payload.group_column.where.push( |
|
|
|
|
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROYEK_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -1464,9 +1378,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const excelData = []; |
|
|
|
|
resData.map((n, index) => { |
|
|
|
|
let dataRow = {}; |
|
|
|
|
if (role_name === 'Super Admin') { |
|
|
|
|
dataRow.Company = n.join_first_company_name; |
|
|
|
|
} |
|
|
|
|
dataRow.Sortname = n.kode_sortname ? n.kode_sortname : ""; |
|
|
|
|
dataRow["Nama Project"] = n.nama ? n.nama : ""; |
|
|
|
|
dataRow["Tanggal Mulai"] = n.mulai_proyek |
|
|
|
@ -1476,7 +1387,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
? moment(n.akhir_proyek).format(format) |
|
|
|
|
: "-"; |
|
|
|
|
dataRow["Area Kerja"] = n.area_kerja ? n.area_kerja : ""; |
|
|
|
|
dataRow["Perusahaan"] = n.company ? n.company : ""; |
|
|
|
|
dataRow["Keterangan"] = n.keterangan ? n.keterangan : ""; |
|
|
|
|
dataRow["Dianggap sukses ketika"] = n.considered_success_when |
|
|
|
|
? n.considered_success_when |
|
|
|
@ -1501,7 +1411,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const handleExportPdf = async () => { |
|
|
|
|
const doc = new jsPDF(); |
|
|
|
|
let headers = [ |
|
|
|
|
[role_name === 'Super Admin' ? "Company" : null, "Project Name", "Nilai Kontrak", "Pendapatan Pertahun", "Anggaran Biaya", "Project Type", "PM", "Time Project"], |
|
|
|
|
["Project Name", "Nilai Kontrak", "Pendapatan Pertahun", "Anggaran Biaya", "Project Type", "PM", "Time Project"], |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
const payload = { |
|
|
|
@ -1550,25 +1460,11 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
], |
|
|
|
|
orders: { columns: ["nama"], ascending: true }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (role_name !== 'Super Admin' && all_project === 'true') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" } |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') { |
|
|
|
|
if (all_project === 'false' || all_project === 'null') { |
|
|
|
|
payload.columns.push( |
|
|
|
|
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
payload.joins.push( |
|
|
|
|
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] } |
|
|
|
|
) |
|
|
|
|
payload.group_column.where.push( |
|
|
|
|
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" } |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROYEK_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -1576,7 +1472,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let resData = result.data.data; |
|
|
|
|
const data = resData.map((elt) => [ |
|
|
|
|
role_name === 'Super Admin' ? elt.join_third_company_name : null, |
|
|
|
|
elt.nama, |
|
|
|
|
`Rp. ${formatThousand(elt.rencana_biaya)}`, |
|
|
|
|
elt.join_second_name, |
|
|
|
@ -1618,8 +1513,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const handleOpenDokumen = async (data) => { |
|
|
|
|
await setidTask(data.id); |
|
|
|
|
setProyekName(data.nama); |
|
|
|
|
setCompanyId(data.company_id); |
|
|
|
|
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name); |
|
|
|
|
setOpenDialogDoc(true); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -1716,9 +1609,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
role_id, |
|
|
|
|
user_id, |
|
|
|
|
role_name, |
|
|
|
|
company_id: text.company_id, |
|
|
|
|
dataViewStartDate, |
|
|
|
|
companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name), |
|
|
|
|
ganttName : res.name_version |
|
|
|
|
} |
|
|
|
|
}}> |
|
|
|
@ -1836,15 +1727,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
</> |
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
...(role_name === 'Super Admin' ? [ |
|
|
|
|
{ |
|
|
|
|
title: t('company'), |
|
|
|
|
dataIndex: "join_third_company_name", |
|
|
|
|
key: "join_third_company_name", |
|
|
|
|
render: (text, record) => ( |
|
|
|
|
<span>{record.join_third_company_name}</span> |
|
|
|
|
) |
|
|
|
|
}] : []), |
|
|
|
|
{ title: "Project Name", dataIndex: "nama", key: "nama", width: 200 }, |
|
|
|
|
{ |
|
|
|
|
title: "Pendapatan Pertahun", dataIndex: "income_year", |
|
|
|
@ -1974,9 +1856,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
dataDivisions={dataDivisions} |
|
|
|
|
dataPM={dataPm} |
|
|
|
|
projectImage={image} |
|
|
|
|
company_id={company_id} |
|
|
|
|
role_name={role_name} |
|
|
|
|
companyList={companyList} |
|
|
|
|
token={token} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
@ -2039,7 +1919,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
handleClose={handleCloseDialogAsignHr} |
|
|
|
|
idTask={idTask} |
|
|
|
|
proyekName={proyekName} |
|
|
|
|
company_id={companyId} |
|
|
|
|
token={token} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
@ -2056,7 +1935,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
handleClose={handleCloseDialogAsignCust} |
|
|
|
|
idTask={idTask} |
|
|
|
|
proyekName={proyekName} |
|
|
|
|
company_id={companyId} |
|
|
|
|
token={token} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
@ -2093,10 +1971,8 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
handleClose={handleCloseDialogDoc} |
|
|
|
|
idTask={idTask} |
|
|
|
|
proyekName={proyekName} |
|
|
|
|
companyId={companyId} |
|
|
|
|
token={token} |
|
|
|
|
role_name={role_name} |
|
|
|
|
companyName={companyName} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|
[openDialogDoc] |
|
|
|
@ -2148,9 +2024,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
user_id={user_id} |
|
|
|
|
token={token} |
|
|
|
|
isLogin={isLogin} |
|
|
|
|
companyName={companyName} |
|
|
|
|
proyekName={proyekName} |
|
|
|
|
companyId={companyId} |
|
|
|
|
role_name={role_name} |
|
|
|
|
dataViewStartDate={dataViewStartDate} |
|
|
|
|
/> |
|
|
|
@ -2169,9 +2043,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
user_id={user_id} |
|
|
|
|
token={token} |
|
|
|
|
isLogin={isLogin} |
|
|
|
|
companyName={companyName} |
|
|
|
|
proyekName={proyekName} |
|
|
|
|
companyId={companyId} |
|
|
|
|
dataViewStartDate={dataViewStartDate} |
|
|
|
|
/> |
|
|
|
|
), |
|
|
|
|