Commit ed408605 authored by syadziy's avatar syadziy

update fixing UAT

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