Commit c6b54dea authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

upload edit managdoc

See merge request !362
parents ec7b4016 3f526095
...@@ -63,9 +63,15 @@ export default class CreateManagementDoc extends Component { ...@@ -63,9 +63,15 @@ export default class CreateManagementDoc extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ if (response.data.data.length == 0){
sizeUpload: response.data.data[0].value this.setState({
}) sizeUpload: 1
})
} else {
this.setState({
sizeUpload: response.data.data[0].value
})
}
} }
} }
}) })
......
...@@ -65,9 +65,15 @@ export default class EditManagementDoc extends Component { ...@@ -65,9 +65,15 @@ export default class EditManagementDoc extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ if (response.data.data.length == 0){
sizeUpload: response.data.data[0].value this.setState({
}) sizeUpload: 1
})
} else {
this.setState({
sizeUpload: response.data.data[0].value
})
}
} }
} }
}) })
...@@ -88,6 +94,7 @@ export default class EditManagementDoc extends Component { ...@@ -88,6 +94,7 @@ export default class EditManagementDoc extends Component {
period: data.document_periode, period: data.document_periode,
getMonthName: data.document_month, getMonthName: data.document_month,
description: data.description, description: data.description,
filePath: data.document_filepath,
file: data.document_filepath, file: data.document_filepath,
document_name: data.document_name, document_name: data.document_name,
document_size: data.document_size, document_size: data.document_size,
...@@ -279,6 +286,10 @@ export default class EditManagementDoc extends Component { ...@@ -279,6 +286,10 @@ export default class EditManagementDoc extends Component {
// this.setState({ errorDocument: true, msgErrorDocument: 'File Cannot be Empty' }) // this.setState({ errorDocument: true, msgErrorDocument: 'File Cannot be Empty' })
} else { } else {
const formData = new FormData(); const formData = new FormData();
if (this.state.file == this.state.filePath){
formData.append("updated", 0);
}
formData.append("updated", 1);
formData.append("file", this.state.file); formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id); formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("settingId", this.state.getDocument.document_category_id); formData.append("settingId", this.state.getDocument.document_category_id);
...@@ -290,6 +301,7 @@ export default class EditManagementDoc extends Component { ...@@ -290,6 +301,7 @@ export default class EditManagementDoc extends Component {
this.setState({ formData }, () => { this.setState({ formData }, () => {
this.props.updateDocument(this.state.formData) this.props.updateDocument(this.state.formData)
}) })
console.log(JSON.stringify(formData))
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment