Commit 853ed80c authored by Deni Rinaldi's avatar Deni Rinaldi

login + isu user

parent a2e7d408
...@@ -46,7 +46,9 @@ const Images = { ...@@ -46,7 +46,9 @@ const Images = {
failedCopy: require('./failed-copy.svg'), failedCopy: require('./failed-copy.svg'),
triputraLogo: require('./triputra-logo.png'), triputraLogo: require('./triputra-logo.png'),
photo: require('./photo.svg'), photo: require('./photo.svg'),
camera: require('./camera.svg') camera: require('./camera.svg'),
meeting: require('./meeting.jpg'),
triputraBlack: require('./triputra-black.jpg'),
} }
......
This diff is collapsed.
...@@ -36,7 +36,9 @@ class Login extends Component { ...@@ -36,7 +36,9 @@ class Login extends Component {
rememberMe: false, rememberMe: false,
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
width: 0,
height: 0
} }
} }
...@@ -47,6 +49,14 @@ class Login extends Component { ...@@ -47,6 +49,14 @@ class Login extends Component {
console.log(email) console.log(email)
} }
getWindowDimensions() {
const { innerWidth: width, innerHeight: height } = window;
this.setState({
width,
height
})
}
handleChange(e) { handleChange(e) {
let data = this.state let data = this.state
this.setState({ ...data, [e.target.name]: e.target.value }) this.setState({ ...data, [e.target.name]: e.target.value })
...@@ -136,19 +146,19 @@ class Login extends Component { ...@@ -136,19 +146,19 @@ class Login extends Component {
{this.state.messageAlert} {this.state.messageAlert}
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{ width: '50%', height: '100vh', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}> <div style={{ width: '50%', display: 'grid' }}>
<img src={Images.tia} /> <img src={Images.meeting} style={{ objectFit: 'fill', width: '100%', height: '100%' }}/>
<img src={Images.imageLogin} style={{ marginTop: 30 }} /> {/* <img src={Images.imageLogin} style={{ marginTop: 30 }} /> */}
</div> </div>
<div style={{ width: '50%', height: '100vh', backgroundColor: '#152d40', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}> <div style={{ width: '50%', height: '100vh', backgroundColor: '#263b80', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column' }}>
<form onSubmit={(e) => { <form onSubmit={(e) => {
e.preventDefault() e.preventDefault()
this.validateLogin() this.validateLogin()
}} }}
> >
<div style={{ paddingTop: 56, paddingLeft: 54, paddingRight: 54, display: 'flex', flexDirection: 'column', width: 388, height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}> <div style={{ paddingTop: 56, padding: 65, display: 'flex', flexDirection: 'column', height: (this.state.msgEmail.length > 45 ? 466 : 441), borderRadius: 12, boxShadow: '0 2 4 0 rgba(0, 0, 0, 0.2)', backgroundColor: '#ffffff' }}>
<img src={Images.tia} /> <img src={Images.triputraBlack} style={{ height: 59, width: 175, alignSelf: 'center'}} />
<TextField <TextField
label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Email *</Typography>} label={<Typography style={{ fontSize: 12, fontFamily: 'Nunito Sans, sans-serif' }}>Email *</Typography>}
...@@ -207,6 +217,7 @@ class Login extends Component { ...@@ -207,6 +217,7 @@ class Login extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none'
}} }}
disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false} disabled={this.state.email.trim() == '' && this.state.password.trim() == '' ? true : false}
// onClick={() => this.validateLogin()} // onClick={() => this.validateLogin()}
......
...@@ -292,6 +292,27 @@ export default class UserRole extends Component { ...@@ -292,6 +292,27 @@ export default class UserRole extends Component {
} }
} }
updateUser(payload) {
api.create().updateUser(payload).then((response) => {
console.log(response.data.message)
console.log(response.data.status)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.closeEdit()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
}
_handleKeyDown(e) { _handleKeyDown(e) {
if (e.key === 'Enter') { if (e.key === 'Enter') {
if (this.state.search.length > 0) { if (this.state.search.length > 0) {
...@@ -308,7 +329,6 @@ export default class UserRole extends Component { ...@@ -308,7 +329,6 @@ export default class UserRole extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
console.log(response) console.log(response)
alert(response.data.message)
this.getUser() this.getUser()
this.setState({ visibleUser: true }) this.setState({ visibleUser: true })
} else { } else {
...@@ -598,6 +618,7 @@ export default class UserRole extends Component { ...@@ -598,6 +618,7 @@ export default class UserRole extends Component {
<EditUser <EditUser
onClickClose={this.closeEdit.bind(this)} onClickClose={this.closeEdit.bind(this)}
refresh={this.getUser.bind(this)} refresh={this.getUser.bind(this)}
updateUser={this.updateUser.bind(this)}
data={this.state.indexData} data={this.state.indexData}
/> />
)} )}
......
...@@ -186,7 +186,7 @@ export default class EditUser extends Component { ...@@ -186,7 +186,7 @@ export default class EditUser extends Component {
} }
} }
updateUser() { updateUser(){
let payload = { let payload = {
"user_id": this.state.tempData.user_id, "user_id": this.state.tempData.user_id,
"role_id": this.state.role.role_id, "role_id": this.state.role.role_id,
...@@ -196,28 +196,7 @@ export default class EditUser extends Component { ...@@ -196,28 +196,7 @@ export default class EditUser extends Component {
"start_date": this.state.tempData.start_date, "start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date "end_date": this.state.tempData.end_date
} }
this.props.updateUser(payload)
api.create().updateUser(payload).then((response) => {
console.log(response.data.message)
console.log(response.data.status)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
}
})
} }
getRole() { getRole() {
......
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