|
|
|
@ -25,6 +25,9 @@ import {
|
|
|
|
|
PROJECT_APPROVAL_ADD, |
|
|
|
|
PROJECT_APPROVAL_EDIT, |
|
|
|
|
PROJECT_PARTICIPANT_ADD, |
|
|
|
|
PROJECT_CHECKLIST_ADD, |
|
|
|
|
PROJECT_ISSUE_ADD, |
|
|
|
|
PROJECT_RISK_ADD, |
|
|
|
|
PROJECT_PARTICIPANT_EDIT, |
|
|
|
|
PROJECT_MILESTONE_ADD, |
|
|
|
|
PROJECT_MILESTONE_EDIT, |
|
|
|
@ -38,12 +41,18 @@ import {
|
|
|
|
|
PROYEK_SEARCH_BY_USER, |
|
|
|
|
PROYEK_EDIT, |
|
|
|
|
ASSIGN_HR_PROJECT_SEARCH, |
|
|
|
|
PROJECT_CHECKLIST_SEARCH, |
|
|
|
|
PROYEK_DELETE, |
|
|
|
|
TOOLS_RESOURCE_SEARCH, |
|
|
|
|
MATERIAL_RESOURCE_SEARCH, |
|
|
|
|
USER_SEARCH, |
|
|
|
|
PROJECT_CHARTER_SEARCH, |
|
|
|
|
HIERARCHY_FTTH_SEARCH, |
|
|
|
|
PROJECT_ISSUE_SEARCH, |
|
|
|
|
PROJECT_RISK_SEARCH, |
|
|
|
|
PROJECT_CHECKLIST_DELETE_BY_PROYEK, |
|
|
|
|
PROJECT_ISSUE_DELETE_BY_PROYEK, |
|
|
|
|
PROJECT_RISK_DELETE_BY_PROYEK, |
|
|
|
|
TOOLS_RESOURCE_LIST, |
|
|
|
|
MATERIAL_RESOURCE_LIST, |
|
|
|
|
PROYEK_GET_ID, |
|
|
|
@ -141,6 +150,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
// project charter
|
|
|
|
|
const [projectCharter, setProjectCharter] = useState(null); |
|
|
|
|
const [projectParticipant, setProjectParticipant] = useState(null); |
|
|
|
|
const [projectChecklist, setProjectChecklist] = useState(null); |
|
|
|
|
const [projectIssue, setProjectIssue] = useState(null); |
|
|
|
|
const [projectRisk, setProjectRisk] = useState(null); |
|
|
|
|
const [projectMilestone, setProjectMilestone] = useState(null); |
|
|
|
|
const [projectApproval, setProjectApproval] = useState(null); |
|
|
|
|
const [projectPM, setPM] = useState(null); |
|
|
|
@ -513,6 +525,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
await getDataProject(data.id); |
|
|
|
|
await getProjectMilestone(data.id); |
|
|
|
|
await getProjectParticipant(data.id); |
|
|
|
|
await getProjectChecklist(data.id); |
|
|
|
|
await getProjectIssue(data.id); |
|
|
|
|
await getProjectRisk(data.id); |
|
|
|
|
await getProjectApproval(data.id); |
|
|
|
|
await getK3toProject(data.id); |
|
|
|
|
await getProjectAssignHR(data.id); |
|
|
|
@ -684,7 +699,6 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
orders: { columns: ["id"], ascending: true }, |
|
|
|
|
paging: { start: 0, length: -1 }, |
|
|
|
|
}; |
|
|
|
|
// const url = PROJECT_MI(proyek_id)
|
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROJECT_PARTICIPANT_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
@ -699,6 +713,88 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getProjectChecklist = async (id) => { |
|
|
|
|
const payload = { |
|
|
|
|
select: [ |
|
|
|
|
"id", |
|
|
|
|
"proyek_id", |
|
|
|
|
"item", |
|
|
|
|
"status_exist" |
|
|
|
|
], |
|
|
|
|
columns: [{ name: "proyek_id", logic_operator: "=", value: parseInt(id) }], |
|
|
|
|
joins: [], |
|
|
|
|
orders: { columns: ["id"], ascending: true }, |
|
|
|
|
paging: { start: 0, length: -1 }, |
|
|
|
|
}; |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROJECT_CHECKLIST_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let dataRes = result.data.data; |
|
|
|
|
const filteredData = dataRes.filter(item => item.proyek_id === parseInt(id)); |
|
|
|
|
setProjectChecklist(filteredData); |
|
|
|
|
} else { |
|
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getProjectIssue = async (id) => { |
|
|
|
|
const payload = { |
|
|
|
|
select: [ |
|
|
|
|
"id", |
|
|
|
|
"proyek_id", |
|
|
|
|
"description", |
|
|
|
|
"level_issue" |
|
|
|
|
], |
|
|
|
|
columns: [{ name: "proyek_id", logic_operator: "=", value: parseInt(id) }], |
|
|
|
|
joins: [], |
|
|
|
|
orders: { columns: ["id"], ascending: true }, |
|
|
|
|
paging: { start: 0, length: -1 }, |
|
|
|
|
}; |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROJECT_ISSUE_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let dataRes = result.data.data; |
|
|
|
|
const filteredData = dataRes.filter(item => item.proyek_id === parseInt(id)); |
|
|
|
|
setProjectIssue(filteredData); |
|
|
|
|
} else { |
|
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getProjectRisk = async (id) => { |
|
|
|
|
const payload = { |
|
|
|
|
select: [ |
|
|
|
|
"id", |
|
|
|
|
"proyek_id", |
|
|
|
|
"description", |
|
|
|
|
"preventive_risk", |
|
|
|
|
"level_risk" |
|
|
|
|
], |
|
|
|
|
columns: [{ name: "proyek_id", logic_operator: "=", value: parseInt(id) }], |
|
|
|
|
joins: [], |
|
|
|
|
orders: { columns: ["id"], ascending: true }, |
|
|
|
|
paging: { start: 0, length: -1 }, |
|
|
|
|
}; |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROJECT_RISK_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let dataRes = result.data.data; |
|
|
|
|
const filteredData = dataRes.filter(item => item.proyek_id === parseInt(id)); |
|
|
|
|
setProjectRisk(filteredData); |
|
|
|
|
} else { |
|
|
|
|
NotificationManager.error("Gagal Mengambil Data!!", "Failed"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const getProjectApproval = async (id) => { |
|
|
|
|
const payload = { |
|
|
|
|
columns: [{ name: "proyek_id", logic_operator: "=", value: id }], |
|
|
|
@ -740,6 +836,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const handleCloseDialogView = () => { |
|
|
|
|
setProjectApproval(null); |
|
|
|
|
setProjectParticipant(null); |
|
|
|
|
setProjectChecklist(null); |
|
|
|
|
setProjectIssue(null); |
|
|
|
|
setProjectRisk(null); |
|
|
|
|
setProjectMilestone(null); |
|
|
|
|
setProjectCharter(null); |
|
|
|
|
setK3Search(null); |
|
|
|
@ -754,6 +853,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
if (openDialogViewDetail) { |
|
|
|
|
setProjectApproval(null); |
|
|
|
|
setProjectParticipant(null); |
|
|
|
|
setProjectChecklist(null); |
|
|
|
|
setProjectIssue(null); |
|
|
|
|
setProjectRisk(null); |
|
|
|
|
setProjectMilestone(null); |
|
|
|
|
setProjectCharter(null); |
|
|
|
|
setK3Search(null); |
|
|
|
@ -792,12 +894,25 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
if (result && result.data && result.data.code === 200) { |
|
|
|
|
const { participants, milestones, approval } = data.projectCharter; |
|
|
|
|
const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter; |
|
|
|
|
const imageObject = data.imageStructureOrg; |
|
|
|
|
const resultParticipant = await saveParticipant( |
|
|
|
|
result.data.data_result.id, |
|
|
|
|
participants |
|
|
|
|
); |
|
|
|
|
const resultChecklist = await saveChecklist( |
|
|
|
|
result.data.data_result.id, |
|
|
|
|
checklist |
|
|
|
|
); |
|
|
|
|
const resultIssue = await saveIssue( |
|
|
|
|
result.data.data_result.id, |
|
|
|
|
issue |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const resultRisk = await saveRisk( |
|
|
|
|
result.data.data_result.id, |
|
|
|
|
potentialRisks |
|
|
|
|
); |
|
|
|
|
const resultMilestone = await saveMilestone( |
|
|
|
|
result.data.data_result.id, |
|
|
|
|
milestones |
|
|
|
@ -814,6 +929,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
resultChecklist === "berhasil" && |
|
|
|
|
resultIssue === "berhasil" && |
|
|
|
|
resultRisk === "berhasil" && |
|
|
|
|
resultParticipant === "berhasil" && |
|
|
|
|
resultMilestone === "berhasil" && |
|
|
|
|
resultApproval === "berhasil" |
|
|
|
@ -852,6 +970,67 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const saveChecklist = async (id, data) => { |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
item: res.item, |
|
|
|
|
status_exist: res.status_exist, |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_CHECKLIST_ADD, payload, HEADER); |
|
|
|
|
}); |
|
|
|
|
const arr = await Promise.all(request) |
|
|
|
|
.then((values) => values) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const result = arr.map((res) => res.data.code == 200); |
|
|
|
|
if (result.length > 0) { |
|
|
|
|
return "gagal"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const saveIssue = async (id, data) => { |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
description: res.description, |
|
|
|
|
level_issue: res.level_issue, |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_ISSUE_ADD, payload, HEADER); |
|
|
|
|
}); |
|
|
|
|
const arr = await Promise.all(request) |
|
|
|
|
.then((values) => values) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const result = arr.map((res) => res.data.code == 200); |
|
|
|
|
if (result.length > 0) { |
|
|
|
|
return "gagal"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const saveRisk = async (id, data) => { |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
level_risk: res.level_risk, |
|
|
|
|
description: res.description, |
|
|
|
|
preventive_risk: res.preventive_risk, |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_RISK_ADD, payload, HEADER); |
|
|
|
|
}); |
|
|
|
|
const arr = await Promise.all(request) |
|
|
|
|
.then((values) => values) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const result = arr.map((res) => res.data.code == 200); |
|
|
|
|
if (result.length > 0) { |
|
|
|
|
return "gagal"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const saveMilestone = async (id, data) => { |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
@ -918,7 +1097,7 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const editProyek = async (data) => { |
|
|
|
|
const { participants, milestones, approval } = data.projectCharter; |
|
|
|
|
const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter; |
|
|
|
|
const imageObject = data.imageStructureOrg; |
|
|
|
|
|
|
|
|
|
let urlEdit = PROYEK_EDIT(data.id); |
|
|
|
@ -931,6 +1110,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
const resultParticipant = await editParticipant(data.id, participants); |
|
|
|
|
const resultMilestone = await editMilestone(data.id, milestones); |
|
|
|
|
const resultApproval = await editApproval(data.id, approval); |
|
|
|
|
const resultChecklist = await editChecklist(data.id, checklist); |
|
|
|
|
const resultIssue = await editIssue(data.id, issue); |
|
|
|
|
const resultRisk = await editRisk(data.id, potentialRisks); |
|
|
|
|
if (imageObject) { |
|
|
|
|
await deleteImage( |
|
|
|
|
data.id |
|
|
|
@ -948,12 +1130,76 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const editChecklist = async (id, data) => { |
|
|
|
|
await axios.delete(PROJECT_CHECKLIST_DELETE_BY_PROYEK(id), HEADER); |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
item: res.item ? res.item : res.item, |
|
|
|
|
status_exist: res.status_exist, |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_CHECKLIST_ADD, payload, HEADER); |
|
|
|
|
}); |
|
|
|
|
const arr = await Promise.all(request) |
|
|
|
|
.then((values) => values) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const result = arr.map((res) => res.data.code !== 200); |
|
|
|
|
if (result.length > 0) { |
|
|
|
|
return "gagal"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const editIssue = async (id, data) => { |
|
|
|
|
await axios.delete(PROJECT_ISSUE_DELETE_BY_PROYEK(id), HEADER); |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
description: res.description ? res.description : res.description, |
|
|
|
|
level_issue: res.level_issue, |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_ISSUE_ADD, payload, HEADER); |
|
|
|
|
}); |
|
|
|
|
const arr = await Promise.all(request) |
|
|
|
|
.then((values) => values) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const result = arr.map((res) => res.data.code !== 200); |
|
|
|
|
if (result.length > 0) { |
|
|
|
|
return "gagal"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const editRisk = async (id, data) => { |
|
|
|
|
await axios.delete(PROJECT_RISK_DELETE_BY_PROYEK(id), HEADER); |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
level_risk: res.level_risk, |
|
|
|
|
description: res.description ? res.description : res.description, |
|
|
|
|
preventive_risk: res.preventive_risk ? res.preventive_risk : res.preventive_risk |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_RISK_ADD, payload, HEADER); |
|
|
|
|
}); |
|
|
|
|
const arr = await Promise.all(request) |
|
|
|
|
.then((values) => values) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
const result = arr.map((res) => res.data.code !== 200); |
|
|
|
|
if (result.length > 0) { |
|
|
|
|
return "gagal"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "berhasil"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const editParticipant = async (id, data) => { |
|
|
|
|
await axios.delete(PROJECT_PARTICIPANT_DELETE_BY_PROYEK(id), HEADER); |
|
|
|
|
const request = data.map((res) => { |
|
|
|
|
const payload = { |
|
|
|
|
proyek_id: parseInt(id), |
|
|
|
|
tittle: res.tittle ? res.tittle : res.title, |
|
|
|
|
tittle: res.tittle ? res.tittle : res.tittle, |
|
|
|
|
name: res.name, |
|
|
|
|
}; |
|
|
|
|
return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER); |
|
|
|
@ -1623,6 +1869,9 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
toggleDialog={toggleAddDialogView} |
|
|
|
|
projectCharter={projectCharter} |
|
|
|
|
projectParticipant={projectParticipant} |
|
|
|
|
projectChecklist={projectChecklist} |
|
|
|
|
projectIssue={projectIssue} |
|
|
|
|
projectRisk={projectRisk} |
|
|
|
|
projectMilestone={projectMilestone} |
|
|
|
|
projectApproval={projectApproval} |
|
|
|
|
projectManager={projectPM} |
|
|
|
|