Commit 2eb7878c authored by EKSAD's avatar EKSAD

permission button user & user role

parent 6903d5b6
...@@ -112,7 +112,7 @@ class Login extends Component { ...@@ -112,7 +112,7 @@ class Login extends Component {
} }
this.props.history.push('/home/beranda') this.props.history.push('/home/beranda')
} else { } else {
if (response.data.message == 'Incorrect password.') { if (response.data.message == 'Password is Not Correct') {
this.setState({ errorPassword: true, msgPassword: response.data.message }) this.setState({ errorPassword: true, msgPassword: response.data.message })
} else { } else {
this.setState({ errorEmail: true, msgEmail: response.data.message }) this.setState({ errorEmail: true, msgEmail: response.data.message })
......
...@@ -838,7 +838,7 @@ export default class ReportItems extends Component { ...@@ -838,7 +838,7 @@ export default class ReportItems extends Component {
<img src={Images.download} /> <img src={Images.download} />
</button> </button>
</a> </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"> <a data-tip={'Visualization'} data-for="visualisasi">
<button <button
style={{ style={{
...@@ -852,7 +852,7 @@ export default class ReportItems extends Component { ...@@ -852,7 +852,7 @@ export default class ReportItems extends Component {
<img src={Images.visualisasi} /> <img src={Images.visualisasi} />
</button> </button>
</a> </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 && ( {this.state.buttonCreate && (
<a data-tip={'Add New'} data-for="tambah"> <a data-tip={'Add New'} data-for="tambah">
<button <button
......
This diff is collapsed.
...@@ -32,12 +32,16 @@ class UserRole extends Component { ...@@ -32,12 +32,16 @@ class UserRole extends Component {
search: '', search: '',
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
buttonCreate: false,
buttonEdit: false,
load: false
} }
} }
componentDidMount() { componentDidMount() {
this.getRole() this.getRole()
this.getPermission()
} }
closeEdit() { closeEdit() {
...@@ -75,6 +79,26 @@ class UserRole extends Component { ...@@ -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() { searchRole() {
let payload = { let payload = {
"keyword": this.state.search "keyword": this.state.search
...@@ -130,23 +154,25 @@ class UserRole extends Component { ...@@ -130,23 +154,25 @@ class UserRole extends Component {
console.log(tableMeta); console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<button {this.state.buttonEdit && (
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
}} borderColor: 'transparent',
// onClick={() => console.log(tableMeta.rowData[1])} }}
onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })} // onClick={() => console.log(tableMeta.rowData[1])}
> onClick={() => this.setState({ edit: true, indexData: tableMeta.rowData[1] })}
<div style={{ display: 'flex' }}> >
{tableMeta.rowData[2] !== "superadmin" ? <div style={{ display: 'flex' }}>
<img src={Images.editCopy} /> : {tableMeta.rowData[2] !== "superadmin" ?
null <img src={Images.editCopy} /> :
} null
</div > }
</div >
</button> </button>
)}
</div > </div >
); );
} }
...@@ -228,19 +254,21 @@ class UserRole extends Component { ...@@ -228,19 +254,21 @@ class UserRole extends Component {
</div> </div>
{/* <label style={{ color: 'white', width: '60%', justifyContent: 'center', display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center' }}>Search</label> */} {/* <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' }}> <div style={{ width: '20%', justifyContent: 'flex-end', display: 'flex' }}>
<a data-tip={'Create'} data-for="create"> {this.state.buttonCreate && (
<button <a data-tip={'Create'} data-for="create">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.setState({ add: true })} }}
> onClick={() => this.setState({ add: true })}
<img src={Images.add} /> >
</button> <img src={Images.add} />
</a> </button>
</a>
)}
<ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="create" place="bottom" type="light" effect="solid" />
</div> </div>
</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