Browse Source

update file input

pull/1/head
wahyun 7 months ago
parent
commit
2c4b8a48d1
  1. 15
      src/views/SimproV2/CreatedProyek/FormDocument.js
  2. 4
      src/views/SimproV2/CreatedProyek/FormFolderDocument.js

15
src/views/SimproV2/CreatedProyek/FormDocument.js

@ -6,9 +6,8 @@ import { DOCUMENT_ADD } from '../../../const/ApiConst';
import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications';
const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder }) => {
const token = localStorage.getItem("token");
const role = window.localStorage.getItem('role_name');
const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder, token, role_name, companyId }) => {
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -34,12 +33,9 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
}
const uploadDokumen = async () => {
let configApp = ''
const formData = new FormData;
if (role !== 'Super Admin') {
configApp = JSON.parse(window.localStorage.getItem('configApp'));
formData.append('company_name',configApp.company_name);
}
formData.append('company_id', parseInt(companyId));
formData.append('dokumen', file, file.name);
if (parentIdNewFolder > 0) {
formData.append('ref_id', parentIdNewFolder); // folder_id
@ -73,8 +69,9 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
return (
<Form>
<FormGroup>
<Label className="capitalize">Upload File</Label>
<Label className="capitalize">Upload File<span style={{ color:'red' }}>*</span></Label>
<Input type="file" onChange={(e) => setFile(e.target.files[0])}/>
<small><span style={{ color:'red' }}>*</span>All Type File Accepted</small>
</FormGroup>
</Form>
)

4
src/views/SimproV2/CreatedProyek/FormFolderDocument.js

@ -33,10 +33,6 @@ const DialogRequestFolder = ({ openDialog, closeDialog, toggleDialog, idTask, pa
}
const saveFolder = async () => {
let payload = {
"proyek_id": idTask,
"name_folder": folderName

Loading…
Cancel
Save