Commit cd16493d authored by a.bairuha's avatar a.bairuha

update permission

parent d05b5115
......@@ -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,17 +619,19 @@ export default class ReportItems extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ display: 'flex' }}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
{this.state.edit && (
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent'
}}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
>
<img src={Images.editCopy} />
</button>
>
<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