Commit ed408605 authored by syadziy's avatar syadziy

update fixing UAT

parent 1281c5dc
......@@ -19,10 +19,13 @@ export default class CreateCarfmDoc extends Component {
super(props)
this.state = {
perusahaan: null,
perusahaanData: null,
getPerusahaan: null,
errorPerusahaan: false,
msgErrorPerusahaan: '',
document: null,
documentData: null,
getDocument: null,
errorDocument: false,
msgErrorDocument: '',
listPeriode: null,
......@@ -43,8 +46,7 @@ export default class CreateCarfmDoc extends Component {
fileType: '',
docId: '',
sizeUpload: "1",
saveDisable: false,
submitVal: 0
isClickSave: 0
}
}
......@@ -224,28 +226,29 @@ export default class CreateCarfmDoc extends Component {
}
validasi() {
if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty', saveDisable: false })
}else if (R.isNil(this.state.periode)) {
this.setState({ errorPeriode: true, msgErrorPeriode: 'Period Cannot be Empty', saveDisable: false })
} else if (R.isNil(this.state.monthId)) {
this.setState({ errorMonth: true, msgErrorMonth: 'Month Cannot be Empty', saveDisable: false })
}
else 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", this.state.getPerusahaan.company_id);
formData.append("submenuId", this.props.submenu_id);
formData.append("description", this.state.description);
formData.append("extension", this.state.fileType);
formData.append("documentPeriode", this.state.periode.periode);
formData.append("documentMonth", this.state.monthId.month_id);
this.setState({ formData }, () => {
this.props.createDocument(this.state.formData)
})
}
if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty', saveDisable: false })
}else if (R.isNil(this.state.periode)) {
this.setState({ errorPeriode: true, msgErrorPeriode: 'Period Cannot be Empty', saveDisable: false })
} else if (R.isNil(this.state.monthId)) {
this.setState({ errorMonth: true, msgErrorMonth: 'Month Cannot be Empty', saveDisable: false })
}
else if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning', saveDisable: false })
} else {
console.log(this.state.isClickSave + " ===> di luar");
const formData = new FormData();
formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("submenuId", this.props.submenu_id);
formData.append("description", this.state.description);
formData.append("extension", this.state.fileType);
formData.append("documentPeriode", this.state.periode.periode);
formData.append("documentMonth", this.state.monthId.month_id);
this.setState({ formData }, () => {
this.props.createDocument(this.state.formData)
})
}
}
deleteFile(e) {
......@@ -430,21 +433,10 @@ export default class CreateCarfmDoc extends Component {
disabled={this.state.saveDisable}
type="button"
onClick={() =>
{
this.props.handleLoading(1);
this.setState({
saveDisable: true,
submitVal : this.state.submitVal + 1
}, console.log());
setTimeout(() => {
this.state.isClickSave == 1 ? null :
this.setState({ isClickSave: 1 }, () => {
this.validasi()
console.log("vlidasi " + this.validasi());
}, 100)
this.props.handleLoading(0);
}
})
}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......
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