Commit 1c3cf56c authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'syadziy' into 'master'

update permission

See merge request !173
parents d05b5115 cd16493d
......@@ -39,7 +39,9 @@ export default class ReportItems extends Component {
popupError: false,
alert: false,
tipeAlert: '',
messageAlert: ''
messageAlert: '',
create: false,
edit: false
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -452,6 +454,24 @@ export default class ReportItems extends Component {
componentDidMount() {
this.getData()
// this.getPermission()
}
getPermission() {
let payload = {
menu: "report items"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
create: response.data.data.create,
edit: response.data.data.edit
})
}
}
})
}
getData() {
......@@ -599,6 +619,7 @@ export default class ReportItems extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
{this.state.edit && (
<button
style={{
backgroundColor: 'transparent',
......@@ -610,6 +631,7 @@ export default class ReportItems extends Component {
>
<img src={Images.editCopy} />
</button>
)}
</div >
);
}
......@@ -782,6 +804,7 @@ export default class ReportItems extends Component {
</button>
</a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{this.state.create && (
<a data-tip={'Upload'} data-for="upload">
<button
style={{
......@@ -795,6 +818,7 @@ export default class ReportItems extends Component {
<img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} />
</button>
</a>
)}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download">
<button
......@@ -824,6 +848,7 @@ export default class ReportItems extends Component {
</button>
</a>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
{this.state.create && (
<a data-tip={'Add New'} data-for="tambah">
<button
style={{
......@@ -836,6 +861,7 @@ export default class ReportItems extends Component {
<img src={Images.add} onClick={() => this.setState({ add: true })} />
</button>
</a>
)}
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" />
</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