Commit e95be860 authored by muhammad ridwan's avatar muhammad ridwan

bug fixing v4

parent 26a2efe5
......@@ -204,8 +204,8 @@ export default class CarfmDocument extends Component {
if (response.data) {
if (response.ok) {
if (response.data.message === "Data was Saved Successfully") {
this.getDataCarfm('create')
this.setState({ visibleCreate: false, loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success'})
this.getDataCarfm('create')
}
else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -329,7 +329,6 @@ export default class CarfmDocument extends Component {
// getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id}
/>
)}
......
......@@ -46,7 +46,6 @@ export default class CreateCarfmDoc extends Component {
fileType: '',
docId: '',
sizeUpload: "1",
disabledPeriode: false,
menuName: null,
saveDisable: false
}
......@@ -251,30 +250,6 @@ export default class CreateCarfmDoc extends Component {
}
validasi() {
if (this.state.disabledPeriode === true) {
if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning', saveDisable: false })
} else {
const formData = new FormData();
formData.append("file", this.state.file);
formData.append("companyId", 1);
formData.append("submenuId", this.props.submenu_id);
formData.append("description", this.state.description);
formData.append("extension", this.state.fileType);
formData.append("documentPeriode", null);
formData.append("documentMonth", null);
this.setState({ formData }, () => {
this.props.createDocument(this.state.formData)
})
var object = {};
formData.forEach(function (value, key) {
object[key] = value;
});
var json = JSON.stringify(object);
// console.log(object)
}
} else {
if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty', saveDisable: false })
}else if (R.isNil(this.state.periode)) {
......@@ -297,7 +272,6 @@ export default class CreateCarfmDoc extends Component {
this.props.createDocument(this.state.formData, )
})
}
}
this.props.handleLoading(0)
}
......@@ -342,7 +316,6 @@ export default class CreateCarfmDoc extends Component {
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}>
{this.state.disabledPeriode === false ?
<div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -362,7 +335,6 @@ export default class CreateCarfmDoc extends Component {
/>
</div>
</div>
: true}
<div className="column-2">
<div style={{ padding: 10, borderRadius: 5, marginTop: "1.2em" }}>
......@@ -378,7 +350,6 @@ export default class CreateCarfmDoc extends Component {
</div>
</div>
{this.state.disabledPeriode === false ?
<div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -399,8 +370,7 @@ export default class CreateCarfmDoc extends Component {
/>
</div>
</div>
: true}
{this.state.disabledPeriode === false ?
<div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -421,7 +391,6 @@ export default class CreateCarfmDoc extends Component {
/>
</div>
</div>
: true}
</div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
<UploadFile
......@@ -490,10 +459,11 @@ export default class CreateCarfmDoc extends Component {
type="button"
onClick={() =>
{
this.props.handleLoading(1);
this.setState({
saveDisable: true
});
this.props.handleLoading(1);
setTimeout(() => {
this.validasi()
console.log("vlidasi " + this.validasi());
......
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