Commit 09c7a158 authored by faisalhamdi's avatar faisalhamdi

invalid template

parent 66044314
......@@ -46,7 +46,8 @@ export default class Perusahaan extends Component {
messageAlert: '',
create: false,
edit: false,
load: false
load: false,
judul: ''
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -58,7 +59,6 @@ export default class Perusahaan extends Component {
console.log(err);
}
else {
let judul = resp.rows[2]
let isi = resp.rows.slice(3)
let payload = []
isi.map((item, index) => {
......@@ -76,7 +76,8 @@ export default class Perusahaan extends Component {
let body = {
company: payload
}
this.setState({ payload: body, buttonError: false })
console.log(resp.rows[1])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
api.create().checkUploadPerusahaan(body).then(response => {
console.log(response);
if (response.data) {
......@@ -715,7 +716,9 @@ export default class Perusahaan extends Component {
</button>
<button
type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadPerusahaan()}
disabled={this.state.buttonError == true ? true : false}
onClick={() => this.uploadPerusahaan()}
// onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadPerusahaan()}
style={{}}
>
<div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
......@@ -784,7 +787,11 @@ export default class Perusahaan extends Component {
this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => this.setState({ visibleUpload: false, visiblePerusahaan: false })}
onUpload={() => {
this.state.judul === "MASTER DATA - COMPANY" ?
this.setState({ visibleUpload: false, visiblePerusahaan: false }) :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'})
}}
/>
</div>
</div>
......
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