|
|
@ -28,14 +28,13 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
const [dataEdit, setDataEdit] = useState(null) |
|
|
|
const [dataEdit, setDataEdit] = useState(null) |
|
|
|
const [parentIdNewFolder, setParentIdNewFolder] = useState(0) |
|
|
|
const [parentIdNewFolder, setParentIdNewFolder] = useState(0) |
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
const company_id = window.localStorage.getItem('company_id'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (idTask > 0) { |
|
|
|
if (parseInt(idTask) > 0) { |
|
|
|
setLoading(true); |
|
|
|
setLoading(true); |
|
|
|
getDataDocument(); |
|
|
|
getDataDocument(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [idTask, openDialog]) |
|
|
|
}, [parseInt(idTask), openDialog]) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (!openDialog) { |
|
|
|
if (!openDialog) { |
|
|
@ -46,7 +45,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
}, [openDialog]) |
|
|
|
}, [openDialog]) |
|
|
|
|
|
|
|
|
|
|
|
const getDataDocument = async () => { |
|
|
|
const getDataDocument = async () => { |
|
|
|
const url = FOLDER_DOCUMENT_PROYEK_GET_TREE(idTask) |
|
|
|
const url = FOLDER_DOCUMENT_PROYEK_GET_TREE(parseInt(idTask)) |
|
|
|
const result = await axios |
|
|
|
const result = await axios |
|
|
|
.get(url, HEADER) |
|
|
|
.get(url, HEADER) |
|
|
|
.then(res => res) |
|
|
|
.then(res => res) |
|
|
@ -76,7 +75,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleDownload = (id, file) => { |
|
|
|
const handleDownload = (id, file) => { |
|
|
|
fetch(DOCUMENT_DOWNLOAD(id, company_id), { |
|
|
|
fetch(DOCUMENT_DOWNLOAD(id, parseInt(idTask)), { |
|
|
|
headers: new Headers({ |
|
|
|
headers: new Headers({ |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Authorization': `Bearer ${token}` |
|
|
|
'Authorization': `Bearer ${token}` |
|
|
@ -206,7 +205,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onConfirmDelete = async () => { |
|
|
|
const onConfirmDelete = async () => { |
|
|
|
let urlDel = DOCUMENT_DELETE(idDelete, idTask) |
|
|
|
let urlDel = DOCUMENT_DELETE(idDelete, parseInt(idTask)) |
|
|
|
const result = await axios.delete(urlDel, HEADER) |
|
|
|
const result = await axios.delete(urlDel, HEADER) |
|
|
|
.then(res => res) |
|
|
|
.then(res => res) |
|
|
|
.catch((error) => error.response); |
|
|
|
.catch((error) => error.response); |
|
|
@ -317,7 +316,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
openDialog={openDialogReq} |
|
|
|
openDialog={openDialogReq} |
|
|
|
closeDialog={closeDialogReq} |
|
|
|
closeDialog={closeDialogReq} |
|
|
|
toggleDialog={toggleDialogReq} |
|
|
|
toggleDialog={toggleDialogReq} |
|
|
|
idTask={idTask} |
|
|
|
idTask={parseInt(idTask)} |
|
|
|
parentIdNewFolder={parentIdNewFolder} |
|
|
|
parentIdNewFolder={parentIdNewFolder} |
|
|
|
dataEdit={dataEdit} |
|
|
|
dataEdit={dataEdit} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -326,7 +325,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
openDialog={openDialogNewFolder} |
|
|
|
openDialog={openDialogNewFolder} |
|
|
|
closeDialog={closeDialogNewFolder} |
|
|
|
closeDialog={closeDialogNewFolder} |
|
|
|
toggleDialog={toggleDialogNewFolder} |
|
|
|
toggleDialog={toggleDialogNewFolder} |
|
|
|
idTask={idTask} |
|
|
|
idTask={parseInt(idTask)} |
|
|
|
parentIdNewFolder={parentIdNewFolder} |
|
|
|
parentIdNewFolder={parentIdNewFolder} |
|
|
|
dataEdit={dataEdit} |
|
|
|
dataEdit={dataEdit} |
|
|
|
/> |
|
|
|
/> |
|
|
|