|
|
@ -81,7 +81,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
setAlertDeleteFolder(true) |
|
|
|
setAlertDeleteFolder(true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleDownload = (id) => { |
|
|
|
const handleDownload = (id, file) => { |
|
|
|
fetch(DOCUMENT_DOWNLOAD(id), { |
|
|
|
fetch(DOCUMENT_DOWNLOAD(id), { |
|
|
|
headers: new Headers({ |
|
|
|
headers: new Headers({ |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Content-Type': 'application/json', |
|
|
@ -90,11 +90,12 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(response => { |
|
|
|
.then(response => { |
|
|
|
response.blob().then(blob => { |
|
|
|
response.blob().then(blob => { |
|
|
|
let url = window.URL.createObjectURL(blob); |
|
|
|
const url = window.URL.createObjectURL(new Blob([blob])); |
|
|
|
let a = document.createElement('a'); |
|
|
|
let a = document.createElement('a'); |
|
|
|
a.href = url; |
|
|
|
a.href = url; |
|
|
|
a.download = 'Project Documents'; |
|
|
|
a.download = file; |
|
|
|
a.click(); |
|
|
|
a.click(); |
|
|
|
|
|
|
|
a.remove(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
//window.location.href = response.url;
|
|
|
|
//window.location.href = response.url;
|
|
|
|
}); |
|
|
|
}); |
|
|
@ -156,7 +157,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN |
|
|
|
<Button size={"sm"} color='danger' onClick={() => handleDeleteFolder(text.id)}><i className="fa fa-trash"></i></Button> |
|
|
|
<Button size={"sm"} color='danger' onClick={() => handleDeleteFolder(text.id)}><i className="fa fa-trash"></i></Button> |
|
|
|
</Tooltip>}{" "} |
|
|
|
</Tooltip>}{" "} |
|
|
|
{!record.isDir && <Tooltip title="Download Document"> |
|
|
|
{!record.isDir && <Tooltip title="Download Document"> |
|
|
|
<Button size={"sm"} color='primary' onClick={() => handleDownload(text.id)}><i className="fa fa-download"></i></Button> |
|
|
|
<Button size={"sm"} color='primary' onClick={() => handleDownload(text.id, text.file)}><i className="fa fa-download"></i></Button> |
|
|
|
</Tooltip>}{" "} |
|
|
|
</Tooltip>}{" "} |
|
|
|
{record.isDir && <Tooltip title="New Folder"> |
|
|
|
{record.isDir && <Tooltip title="New Folder"> |
|
|
|
<Button size="sm" color="success" onClick={() => handleNewFolderParent(record.id)}><i className="fa fa-folder"></i></Button> |
|
|
|
<Button size="sm" color="success" onClick={() => handleNewFolderParent(record.id)}><i className="fa fa-folder"></i></Button> |
|
|
|