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 { ...@@ -204,8 +204,8 @@ export default class CarfmDocument extends Component {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.message === "Data was Saved Successfully") { 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.setState({ visibleCreate: false, loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success'})
this.getDataCarfm('create')
} }
else { else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
...@@ -329,7 +329,6 @@ export default class CarfmDocument extends Component { ...@@ -329,7 +329,6 @@ export default class CarfmDocument extends Component {
// getDataDocument={this.getDataDocument.bind(this)} // getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)} createDocument={this.createDocument.bind(this)}
handleLoading={this.handleLoading.bind(this)} handleLoading={this.handleLoading.bind(this)}
allsubcoCreate={this.state.btnadd}
submenu_id={this.state.submenu_id} submenu_id={this.state.submenu_id}
/> />
)} )}
......
...@@ -46,7 +46,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -46,7 +46,6 @@ export default class CreateCarfmDoc extends Component {
fileType: '', fileType: '',
docId: '', docId: '',
sizeUpload: "1", sizeUpload: "1",
disabledPeriode: false,
menuName: null, menuName: null,
saveDisable: false saveDisable: false
} }
...@@ -251,30 +250,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -251,30 +250,6 @@ export default class CreateCarfmDoc extends Component {
} }
validasi() { 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)) { 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)) {
...@@ -297,7 +272,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -297,7 +272,6 @@ export default class CreateCarfmDoc extends Component {
this.props.createDocument(this.state.formData, ) this.props.createDocument(this.state.formData, )
}) })
} }
}
this.props.handleLoading(0) this.props.handleLoading(0)
} }
...@@ -342,7 +316,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -342,7 +316,6 @@ export default class CreateCarfmDoc extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}> <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 className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -362,7 +335,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -362,7 +335,6 @@ export default class CreateCarfmDoc extends Component {
/> />
</div> </div>
</div> </div>
: true}
<div className="column-2"> <div className="column-2">
<div style={{ padding: 10, borderRadius: 5, marginTop: "1.2em" }}> <div style={{ padding: 10, borderRadius: 5, marginTop: "1.2em" }}>
...@@ -378,7 +350,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -378,7 +350,6 @@ export default class CreateCarfmDoc extends Component {
</div> </div>
</div> </div>
{this.state.disabledPeriode === false ?
<div className="column-1"> <div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -399,8 +370,7 @@ export default class CreateCarfmDoc extends Component { ...@@ -399,8 +370,7 @@ export default class CreateCarfmDoc extends Component {
/> />
</div> </div>
</div> </div>
: true}
{this.state.disabledPeriode === false ?
<div className="column-2"> <div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -421,7 +391,6 @@ export default class CreateCarfmDoc extends Component { ...@@ -421,7 +391,6 @@ export default class CreateCarfmDoc extends Component {
/> />
</div> </div>
</div> </div>
: true}
</div> </div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}> <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
<UploadFile <UploadFile
...@@ -490,10 +459,11 @@ export default class CreateCarfmDoc extends Component { ...@@ -490,10 +459,11 @@ export default class CreateCarfmDoc extends Component {
type="button" type="button"
onClick={() => onClick={() =>
{ {
this.props.handleLoading(1);
this.setState({ this.setState({
saveDisable: true saveDisable: true
}); });
this.props.handleLoading(1);
setTimeout(() => { setTimeout(() => {
this.validasi() this.validasi()
console.log("vlidasi " + 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