Commit 163b234e authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'riri' into 'master'

permission role & user role

See merge request !201
parents 8d32f088 26ab9b2a
......@@ -112,7 +112,7 @@ class Login extends Component {
}
this.props.history.push('/home/beranda')
} else {
if (response.data.message == 'Incorrect password.') {
if (response.data.message == 'Password is Not Correct') {
this.setState({ errorPassword: true, msgPassword: response.data.message })
} else {
this.setState({ errorEmail: true, msgEmail: response.data.message })
......
......@@ -838,7 +838,7 @@ export default class ReportItems extends Component {
<img src={Images.download} />
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualization'} data-for="visualisasi">
<button
style={{
......@@ -852,7 +852,7 @@ export default class ReportItems extends Component {
<img src={Images.visualisasi} />
</button>
</a>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" />
{this.state.buttonCreate && (
<a data-tip={'Add New'} data-for="tambah">
<button
......
......@@ -34,12 +34,16 @@ export default class UserRole extends Component {
buttonError: false,
alert: false,
tipeAlert: '',
messageAlert: ''
messageAlert: '',
buttonCreate: false,
buttonEdit: false,
load: false
}
}
componentDidMount() {
this.getUser()
this.getPermission()
}
closeEdit() {
......@@ -72,6 +76,26 @@ export default class UserRole extends Component {
})
}
getPermission() {
let payload = {
menu: "user"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit,
load: true
})
} else {
this.setState({ load: true })
}
}
})
}
searchUser() {
let payload = {
"keyword": this.state.search
......@@ -355,6 +379,7 @@ export default class UserRole extends Component {
return (
<div style={{ display: 'flex' }}>
{/* {tableMeta.rowData[6] === "Active" ? */}
{this.state.buttonEdit && (
<button
style={{
backgroundColor: 'transparent',
......@@ -366,6 +391,7 @@ export default class UserRole extends Component {
>
<img src={Images.editCopy} />
</button>
)}
{/* :
null
} */}
......@@ -450,6 +476,7 @@ export default class UserRole extends Component {
</Alert>
</Snackbar>
{this.state.visibleUser ? <div>
{this.state.load && (
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - User</label>
{/* <div style={{ width: '60%', justifyContent: 'center', display: 'flex', borderWidth: 2, alignItems: 'center' }}>
......@@ -515,6 +542,7 @@ export default class UserRole extends Component {
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{this.state.buttonCreate && (
<a data-tip={'Upload'} data-for="upload">
<button
style={{
......@@ -528,6 +556,7 @@ export default class UserRole extends Component {
<img src={Images.upload} />
</button>
</a>
)}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
......@@ -543,6 +572,7 @@ export default class UserRole extends Component {
</button>
</a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
{this.state.buttonCreate && (
<a data-tip={'Create'} data-for="create">
<button
style={{
......@@ -556,9 +586,11 @@ export default class UserRole extends Component {
<img src={Images.add} />
</button>
</a>
)}
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" />
</div>
</div>
)}
<div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
......
......@@ -32,12 +32,16 @@ class UserRole extends Component {
search: '',
alert: false,
tipeAlert: '',
messageAlert: ''
messageAlert: '',
buttonCreate: false,
buttonEdit: false,
load: false
}
}
componentDidMount() {
this.getRole()
this.getPermission()
}
closeEdit() {
......@@ -75,6 +79,26 @@ class UserRole extends Component {
})
}
getPermission() {
let payload = {
menu: "user role"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
buttonCreate: response.data.data.create,
buttonEdit: response.data.data.edit,
load: true
})
} else {
this.setState({ load: true })
}
}
})
}
searchRole() {
let payload = {
"keyword": this.state.search
......@@ -130,6 +154,7 @@ class UserRole extends Component {
console.log(tableMeta);
return (
<div style={{ display: 'flex' }}>
{this.state.buttonEdit && (
<button
style={{
backgroundColor: 'transparent',
......@@ -147,6 +172,7 @@ class UserRole extends Component {
</div >
</button>
)}
</div >
);
}
......@@ -206,6 +232,8 @@ class UserRole extends Component {
</Alert>
</Snackbar>
<div>
{this.state.load && (
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -118 }}>
<label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Role & Authorization</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
......@@ -228,6 +256,7 @@ class UserRole extends Component {
</div>
{/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */}
<div style={{ width: '20%', justifyContent: 'flex-end', display: 'flex' }}>
{this.state.buttonCreate && (
<a data-tip={'Create'} data-for="create">
<button
style={{
......@@ -241,9 +270,11 @@ class UserRole extends Component {
<img src={Images.add} />
</button>
</a>
)}
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" />
</div>
</div>
)}
<div style={{ padding: 25 }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
......
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