|
|
@ -55,6 +55,9 @@ import { |
|
|
|
PHASE_PROYEK, |
|
|
|
PHASE_PROYEK, |
|
|
|
DIVISI_LIST, |
|
|
|
DIVISI_LIST, |
|
|
|
BASE_OSPRO, |
|
|
|
BASE_OSPRO, |
|
|
|
|
|
|
|
IMAGE_UPLOAD, |
|
|
|
|
|
|
|
IMAGE_GET_BY_ID, |
|
|
|
|
|
|
|
IMAGE_DELETE, |
|
|
|
} from "../../../const/ApiConst"; |
|
|
|
} from "../../../const/ApiConst"; |
|
|
|
import { |
|
|
|
import { |
|
|
|
formatNumber, |
|
|
|
formatNumber, |
|
|
@ -96,6 +99,13 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const HEADER_MULTIPART = { |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
"Content-Type": "multipart/form-data", |
|
|
|
|
|
|
|
Authorization: `Bearer ${token}`, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const [idTask, setidTask] = useState(0); |
|
|
|
const [idTask, setidTask] = useState(0); |
|
|
|
const [dataTable, setDatatable] = useState([]); |
|
|
|
const [dataTable, setDatatable] = useState([]); |
|
|
|
const [search, setSearch] = useState(""); |
|
|
|
const [search, setSearch] = useState(""); |
|
|
@ -136,6 +146,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const [projectPM, setPM] = useState(null); |
|
|
|
const [projectPM, setPM] = useState(null); |
|
|
|
const [projectK3Search, setK3Search] = useState(null); |
|
|
|
const [projectK3Search, setK3Search] = useState(null); |
|
|
|
const [projectAssignHR, setProjectAssignHR] = useState(null); |
|
|
|
const [projectAssignHR, setProjectAssignHR] = useState(null); |
|
|
|
|
|
|
|
const [image, setProjectImage] = useState(null); |
|
|
|
|
|
|
|
|
|
|
|
const [loadVersionGantt, setLoadVersionGantt] = useState(false); |
|
|
|
const [loadVersionGantt, setLoadVersionGantt] = useState(false); |
|
|
|
const [loadHierarchy, setLoadHierarchy] = useState(false); |
|
|
|
const [loadHierarchy, setLoadHierarchy] = useState(false); |
|
|
@ -431,9 +442,10 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
setidTask(id); |
|
|
|
setidTask(id); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleOpenDialogProyek = (id) => { |
|
|
|
const handleOpenDialogProyek = async (id) => { |
|
|
|
setOpenDialogProyek(true); |
|
|
|
setOpenDialogProyek(true); |
|
|
|
setidTask(id); |
|
|
|
setidTask(id); |
|
|
|
|
|
|
|
await getProjectImage(id); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleOpenDialogGantt = (data) => { |
|
|
|
const handleOpenDialogGantt = (data) => { |
|
|
@ -504,6 +516,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
await getProjectApproval(data.id); |
|
|
|
await getProjectApproval(data.id); |
|
|
|
await getK3toProject(data.id); |
|
|
|
await getK3toProject(data.id); |
|
|
|
await getProjectAssignHR(data.id); |
|
|
|
await getProjectAssignHR(data.id); |
|
|
|
|
|
|
|
await getProjectImage(data.id); |
|
|
|
// await handleGetDataPm(data.id);
|
|
|
|
// await handleGetDataPm(data.id);
|
|
|
|
setPM(data.join_first_name); |
|
|
|
setPM(data.join_first_name); |
|
|
|
setOpenDialogViewDetail(true); |
|
|
|
setOpenDialogViewDetail(true); |
|
|
@ -571,8 +584,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) { |
|
|
|
const {kode_sortname,nama,mulai_proyek,rencana_biaya,keterangan,durasi_proyek,project_objectives,potential_risk,currency_symbol} = result.data.data; |
|
|
|
const {kode_sortname,nama,mulai_proyek,rencana_biaya,keterangan,durasi_proyek,project_objectives,potential_risk,currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when} = result.data.data; |
|
|
|
const dataToSend = { kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol }; |
|
|
|
const dataToSend = { kode_sortname, nama, mulai_proyek, rencana_biaya, keterangan, durasi_proyek, project_objectives, potential_risk, currency_symbol, nama_divisi, late_consequence, assumtion, considered_success_when}; |
|
|
|
setProjectCharter(dataToSend); |
|
|
|
setProjectCharter(dataToSend); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
@ -647,6 +660,17 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getProjectImage = async (id) => { |
|
|
|
|
|
|
|
const url = IMAGE_GET_BY_ID(id, "project_structure_organization"); |
|
|
|
|
|
|
|
const result = await axios |
|
|
|
|
|
|
|
.get(url, HEADER) |
|
|
|
|
|
|
|
.then((res) => res) |
|
|
|
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
|
|
|
|
setProjectImage(result.data.data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getProjectParticipant = async (id) => { |
|
|
|
const getProjectParticipant = async (id) => { |
|
|
|
const payload = { |
|
|
|
const payload = { |
|
|
|
select: [ |
|
|
|
select: [ |
|
|
@ -720,6 +744,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
setProjectCharter(null); |
|
|
|
setProjectCharter(null); |
|
|
|
setK3Search(null); |
|
|
|
setK3Search(null); |
|
|
|
setProjectAssignHR(null); |
|
|
|
setProjectAssignHR(null); |
|
|
|
|
|
|
|
setProjectImage(null); |
|
|
|
setOpenDialogViewDetail(false); |
|
|
|
setOpenDialogViewDetail(false); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -733,6 +758,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
setProjectCharter(null); |
|
|
|
setProjectCharter(null); |
|
|
|
setK3Search(null); |
|
|
|
setK3Search(null); |
|
|
|
setProjectAssignHR(null); |
|
|
|
setProjectAssignHR(null); |
|
|
|
|
|
|
|
setProjectImage(null); |
|
|
|
} |
|
|
|
} |
|
|
|
setOpenDialogViewDetail(!openDialogViewDetail); |
|
|
|
setOpenDialogViewDetail(!openDialogViewDetail); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -746,7 +772,8 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
|
|
|
|
getProjectImage(idDelete); |
|
|
|
|
|
|
|
deleteImage(idDelete); |
|
|
|
setIdDelete(0); |
|
|
|
setIdDelete(0); |
|
|
|
setAlertDelete(false); |
|
|
|
setAlertDelete(false); |
|
|
|
NotificationManager.success(`Data proyek berhasil dihapus`, "Success!!"); |
|
|
|
NotificationManager.success(`Data proyek berhasil dihapus`, "Success!!"); |
|
|
@ -766,6 +793,7 @@ 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) { |
|
|
|
const { participants, milestones, approval } = data.projectCharter; |
|
|
|
const { participants, milestones, approval } = data.projectCharter; |
|
|
|
|
|
|
|
const imageObject = data.imageStructureOrg; |
|
|
|
const resultParticipant = await saveParticipant( |
|
|
|
const resultParticipant = await saveParticipant( |
|
|
|
result.data.data_result.id, |
|
|
|
result.data.data_result.id, |
|
|
|
participants |
|
|
|
participants |
|
|
@ -778,12 +806,18 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
result.data.data_result.id, |
|
|
|
result.data.data_result.id, |
|
|
|
approval |
|
|
|
approval |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
if (imageObject) { |
|
|
|
|
|
|
|
await saveImage( |
|
|
|
|
|
|
|
result.data.data_result.id, |
|
|
|
|
|
|
|
imageObject |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
resultParticipant === "berhasil" && |
|
|
|
resultParticipant === "berhasil" && |
|
|
|
resultMilestone === "berhasil" && |
|
|
|
resultMilestone === "berhasil" && |
|
|
|
resultApproval === "berhasil" |
|
|
|
resultApproval === "berhasil" |
|
|
|
) { |
|
|
|
) { |
|
|
|
// getDataProyek();
|
|
|
|
|
|
|
|
NotificationManager.success( |
|
|
|
NotificationManager.success( |
|
|
|
`Data proyek berhasil ditambah`, |
|
|
|
`Data proyek berhasil ditambah`, |
|
|
|
"Success!!" |
|
|
|
"Success!!" |
|
|
@ -860,8 +894,33 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
return "berhasil"; |
|
|
|
return "berhasil"; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const saveImage = async (id, data) => { |
|
|
|
|
|
|
|
const formData = new FormData; |
|
|
|
|
|
|
|
formData.append('ref_id', id); |
|
|
|
|
|
|
|
formData.append('category', 'project_structure_organization'); |
|
|
|
|
|
|
|
formData.append('files', data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await axios |
|
|
|
|
|
|
|
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) |
|
|
|
|
|
|
|
.then(res => res) |
|
|
|
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deleteImage = async (id) => { |
|
|
|
|
|
|
|
const URL = IMAGE_DELETE(id, 'project_structure_organization'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await axios |
|
|
|
|
|
|
|
.delete(URL, HEADER) |
|
|
|
|
|
|
|
.then(res => res) |
|
|
|
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const editProyek = async (data) => { |
|
|
|
const editProyek = async (data) => { |
|
|
|
const { participants, milestones, approval } = data.projectCharter; |
|
|
|
const { participants, milestones, approval } = data.projectCharter; |
|
|
|
|
|
|
|
const imageObject = data.imageStructureOrg; |
|
|
|
|
|
|
|
|
|
|
|
let urlEdit = PROYEK_EDIT(data.id); |
|
|
|
let urlEdit = PROYEK_EDIT(data.id); |
|
|
|
const formData = data; |
|
|
|
const formData = data; |
|
|
|
|
|
|
|
|
|
|
@ -872,6 +931,15 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
const resultParticipant = await editParticipant(data.id, participants); |
|
|
|
const resultParticipant = await editParticipant(data.id, participants); |
|
|
|
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 (imageObject) { |
|
|
|
|
|
|
|
await deleteImage( |
|
|
|
|
|
|
|
data.id |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
await saveImage( |
|
|
|
|
|
|
|
data.id, |
|
|
|
|
|
|
|
imageObject |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
if (result && result.status === 200) { |
|
|
|
if (result && result.status === 200) { |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
role_id !== "44" ? getDataProyek() : getDataProyekByCustomer(); |
|
|
|
NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!"); |
|
|
|
NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!"); |
|
|
@ -882,7 +950,6 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
|
|
|
|
|
|
|
|
const editParticipant = async (id, data) => { |
|
|
|
const editParticipant = async (id, data) => { |
|
|
|
await axios.delete(PROJECT_PARTICIPANT_DELETE_BY_PROYEK(id), HEADER); |
|
|
|
await axios.delete(PROJECT_PARTICIPANT_DELETE_BY_PROYEK(id), HEADER); |
|
|
|
// if (restDelete){
|
|
|
|
|
|
|
|
const request = data.map((res) => { |
|
|
|
const request = data.map((res) => { |
|
|
|
const payload = { |
|
|
|
const payload = { |
|
|
|
proyek_id: parseInt(id), |
|
|
|
proyek_id: parseInt(id), |
|
|
@ -1432,6 +1499,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
dataPhaseProject={dataPhaseProject} |
|
|
|
dataPhaseProject={dataPhaseProject} |
|
|
|
dataDivisions={dataDivisions} |
|
|
|
dataDivisions={dataDivisions} |
|
|
|
dataPM={dataPm} |
|
|
|
dataPM={dataPm} |
|
|
|
|
|
|
|
projectImage={image} |
|
|
|
/> |
|
|
|
/> |
|
|
|
), |
|
|
|
), |
|
|
|
[ |
|
|
|
[ |
|
|
@ -1441,6 +1509,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
dataPhaseProject, |
|
|
|
dataPhaseProject, |
|
|
|
dataTypeProyek, |
|
|
|
dataTypeProyek, |
|
|
|
idTask, |
|
|
|
idTask, |
|
|
|
|
|
|
|
image |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -1559,6 +1628,7 @@ const CreatedProyek = ({ params, ...props }) => { |
|
|
|
projectManager={projectPM} |
|
|
|
projectManager={projectPM} |
|
|
|
projectK3={projectK3Search} |
|
|
|
projectK3={projectK3Search} |
|
|
|
assignHR={projectAssignHR} |
|
|
|
assignHR={projectAssignHR} |
|
|
|
|
|
|
|
projectImage={image} |
|
|
|
/> |
|
|
|
/> |
|
|
|
), |
|
|
|
), |
|
|
|
[openDialogViewDetail] |
|
|
|
[openDialogViewDetail] |
|
|
|