Commit ad7f6475 authored by Deni Rinaldi's avatar Deni Rinaldi

user + ub

parent a43a3427
...@@ -43,7 +43,8 @@ export default class UnitBisnis extends Component { ...@@ -43,7 +43,8 @@ export default class UnitBisnis extends Component {
messageAlert: '', messageAlert: '',
create: false, create: false,
edit: false, edit: false,
load: false load: false,
judul: ''
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -56,8 +57,6 @@ export default class UnitBisnis extends Component { ...@@ -56,8 +57,6 @@ export default class UnitBisnis extends Component {
console.log(err); console.log(err);
} }
else { else {
let judul = resp.rows[2]
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
...@@ -73,7 +72,8 @@ export default class UnitBisnis extends Component { ...@@ -73,7 +72,8 @@ export default class UnitBisnis extends Component {
let body = { let body = {
business_unit: payload business_unit: 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().checkUploadUnitBisnis(body).then(response => { api.create().checkUploadUnitBisnis(body).then(response => {
console.log(response) console.log(response)
let dataRow = [] let dataRow = []
...@@ -174,7 +174,7 @@ export default class UnitBisnis extends Component { ...@@ -174,7 +174,7 @@ export default class UnitBisnis extends Component {
} }
] ]
console.log(dataRow); // console.log(dataRow);
this.setState({ this.setState({
dataLoaded: true, dataLoaded: true,
cols: columns, cols: columns,
...@@ -623,7 +623,8 @@ export default class UnitBisnis extends Component { ...@@ -623,7 +623,8 @@ export default class UnitBisnis extends Component {
</button> </button>
<button <button
type="button" type="button"
onClick={() => this.state.buttonError ? this.setState({ popupError: true }) : this.uploadUnitBisnis()} disabled={this.state.buttonError == true ? true : false}
onClick={() => this.uploadUnitBisnis()}
style={{}} style={{}}
> >
<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' }}>
...@@ -682,7 +683,11 @@ export default class UnitBisnis extends Component { ...@@ -682,7 +683,11 @@ export default class UnitBisnis extends Component {
this.fileHandler(dt) this.fileHandler(dt)
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => this.setState({ visibleUpload: false, visibleUnitBisnis: false })} onUpload={() => {
this.state.judul === "MASTER DATA - BUSINESS UNIT" ?
this.setState({ visibleUpload: false, visibleUnitBisnis: false }) :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning'})
}}
/> />
</div> </div>
</div> </div>
......
This diff is collapsed.
This diff is collapsed.
...@@ -178,9 +178,9 @@ export default class EditUser extends Component { ...@@ -178,9 +178,9 @@ export default class EditUser extends Component {
} else if (R.isEmpty(this.state.tempData.email)) { } else if (R.isEmpty(this.state.tempData.email)) {
this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty.' }) this.setState({ errorEmail: true, msgErrorEM: 'Email Cannot be Empty.' })
} else if (!isEmail) { } else if (!isEmail) {
this.setState({ errorEmail: true, msgErrorEM: 'Email Format Not Recognized.' }) this.setState({ errorEmail: true, msgErrorEM: 'Please enter a valid email address.' })
} else if (R.isNil(this.state.role)) { } else if (R.isNil(this.state.role)) {
this.setState({ errorRoleName: true, msgErrorRN: 'Role Name Cannot be Empty.' }) this.setState({ errorRoleName: true, msgErrorRN: 'Role Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.start_date)) { } else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' }) this.setState({ errorStartDate: true, msgErrorSD: 'Valid From Cannot be Empty.' })
} else if (R.isNil(this.state.tempData.end_date)) { } else if (R.isNil(this.state.tempData.end_date)) {
......
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