Browse Source

add button edit

pull/2/head
wahyuun 1 year ago
parent
commit
4618751b15
  1. 23
      src/views/SimproV2/CreatedProyek/DialogGantt.js

23
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -29,6 +29,8 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
const [idDelete, setIdDelete] = useState(0)
const [idGantt, setIdGantt] = useState(0)
const [humanResource, setHumanResource] = useState([])
const [dataEdit, setDataEdit] = useState([])
const [typeDialog, setTypeDialog] = useState('')
useEffect(() => {
if (openDialog && hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) {
@ -104,6 +106,11 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
setAlertDelete(true)
}
const handleEdit = (data) => {
setDataEdit(data)
handleOpenDialogForm('Edit');
}
const handleUserGant = (id) => {
setIdGantt(id)
setOpenDialogUserGantt(true)
@ -121,6 +128,9 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
<Tooltip title="Delete Gantt">
<Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
</Tooltip>{" "}
<Tooltip title="Edit Gantt">
<Button size={"sm"} color='success' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
</Tooltip>{" "}
<Tooltip title="Gantt Permission">
<Button size={"sm"} color='success' onClick={() => handleUserGant(text.id)}><i className="fa fa-users"></i></Button>
</Tooltip>{" "}
@ -181,8 +191,9 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
}
}
const handleOpenDialogForm = () => {
setOpenDialogForm(true)
const handleOpenDialogForm = async (type) => {
await setTypeDialog(type);
setOpenDialogForm(true);
}
const toggleDialogForm = () => {
@ -190,12 +201,16 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
}
const closeDialogForm = (status) => {
if (status == "success") {
if (status == "Save") {
getdataGantt()
NotificationManager.success(`Gantt berhasil dibuat!`, 'Success!!');
}else if (status == "Edit") {
getdataGantt()
NotificationManager.success(`Gantt berhasil dibubah!`, 'Failed!!');
}else if (status == "failed") {
NotificationManager.error(`Gantt gagal dibuat!`, 'Failed!!');
}
setDataEdit([])
setOpenDialogForm(false)
}
@ -260,6 +275,8 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
openDialog={openDialogForm}
toggleDialog={toggleDialogForm}
closeDialog={closeDialogForm}
typeDialog={typeDialog}
dataEdit={dataEdit}
/>
<DialogUserGantt

Loading…
Cancel
Save