Commit 65e0d81f authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'faisal' into 'master'

validasi company

See merge request !226
parents 32966a92 25593e5a
...@@ -78,7 +78,12 @@ export default class Perusahaan extends Component { ...@@ -78,7 +78,12 @@ export default class Perusahaan extends Component {
} }
console.log(resp.rows[1]) console.log(resp.rows[1])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
api.create().checkUploadPerusahaan(body).then(response => { }
});
}
checkUpload() {
api.create().checkUploadPerusahaan(this.state.payload).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
...@@ -147,7 +152,7 @@ export default class Perusahaan extends Component { ...@@ -147,7 +152,7 @@ export default class Perusahaan extends Component {
} }
}, },
{ {
name: "Unit Bisnis", name: "Business Unit",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -172,7 +177,7 @@ export default class Perusahaan extends Component { ...@@ -172,7 +177,7 @@ export default class Perusahaan extends Component {
} }
}, },
{ {
name: "Start Date", name: "Valid From",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -197,7 +202,7 @@ export default class Perusahaan extends Component { ...@@ -197,7 +202,7 @@ export default class Perusahaan extends Component {
} }
}, },
{ {
name: "End Date", name: "Valid To",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
...@@ -229,11 +234,12 @@ export default class Perusahaan extends Component { ...@@ -229,11 +234,12 @@ export default class Perusahaan extends Component {
} }
] ]
console.log(dataRow); // console.log(dataRow);
this.setState({ this.setState({
dataLoaded: true, dataLoaded: true,
cols: columns, cols: columns,
rows: dataRow rows: dataRow, visibleUpload: false,
visiblePerusahaan: false
}); });
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -251,11 +257,7 @@ export default class Perusahaan extends Component { ...@@ -251,11 +257,7 @@ export default class Perusahaan extends Component {
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
console.log(response);
}) })
}
});
} }
componentDidMount() { componentDidMount() {
...@@ -287,7 +289,7 @@ export default class Perusahaan extends Component { ...@@ -287,7 +289,7 @@ export default class Perusahaan extends Component {
getData() { getData() {
api.create().getPerusahaan().then((response) => { api.create().getPerusahaan().then((response) => {
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -307,10 +309,10 @@ export default class Perusahaan extends Component { ...@@ -307,10 +309,10 @@ export default class Perusahaan extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', dataTable: [] }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', dataTable: [] }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
} }
}) })
} }
...@@ -789,7 +791,7 @@ export default class Perusahaan extends Component { ...@@ -789,7 +791,7 @@ export default class Perusahaan extends Component {
}} }}
onUpload={() => { onUpload={() => {
this.state.judul === "MASTER DATA - COMPANY" ? this.state.judul === "MASTER DATA - COMPANY" ?
this.setState({ visibleUpload: false, visiblePerusahaan: false }) : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'}) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'})
}} }}
/> />
......
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