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 { ...@@ -39,7 +39,9 @@ export default class ReportItems extends Component {
popupError: false, popupError: false,
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
messageAlert: '' messageAlert: '',
create: false,
edit: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -452,6 +454,24 @@ export default class ReportItems extends Component { ...@@ -452,6 +454,24 @@ export default class ReportItems extends Component {
componentDidMount() { componentDidMount() {
this.getData() 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() { getData() {
...@@ -599,17 +619,19 @@ export default class ReportItems extends Component { ...@@ -599,17 +619,19 @@ export default class ReportItems extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<button {this.state.edit && (
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent' cursor: 'pointer',
}} borderColor: 'transparent'
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
> >
<img src={Images.editCopy} /> <img src={Images.editCopy} />
</button> </button>
)}
</div > </div >
); );
} }
...@@ -782,6 +804,7 @@ export default class ReportItems extends Component { ...@@ -782,6 +804,7 @@ export default class ReportItems extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
{this.state.create && (
<a data-tip={'Upload'} data-for="upload"> <a data-tip={'Upload'} data-for="upload">
<button <button
style={{ style={{
...@@ -795,6 +818,7 @@ export default class ReportItems extends Component { ...@@ -795,6 +818,7 @@ export default class ReportItems extends Component {
<img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} /> <img src={Images.upload} onClick={() => this.setState({ visibleUpload: true })} />
</button> </button>
</a> </a>
)}
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download'} data-for="download"> <a data-tip={'Download'} data-for="download">
<button <button
...@@ -824,6 +848,7 @@ export default class ReportItems extends Component { ...@@ -824,6 +848,7 @@ export default class ReportItems extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="visualisasi" place="bottom" type="light" effect="solid" />
{this.state.create && (
<a data-tip={'Add New'} data-for="tambah"> <a data-tip={'Add New'} data-for="tambah">
<button <button
style={{ style={{
...@@ -836,6 +861,7 @@ export default class ReportItems extends Component { ...@@ -836,6 +861,7 @@ export default class ReportItems extends Component {
<img src={Images.add} onClick={() => this.setState({ add: true })} /> <img src={Images.add} onClick={() => this.setState({ add: true })} />
</button> </button>
</a> </a>
)}
<ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="tambah" place="bottom" type="light" effect="solid" />
</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