Commit 6fb1eefd authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

update permission approval matrix

See merge request !203
parents 535cc7f6 e9996a7c
...@@ -37,7 +37,10 @@ export default class ApprovalMatrix extends Component { ...@@ -37,7 +37,10 @@ export default class ApprovalMatrix extends Component {
cols: null, cols: null,
rows: null, rows: null,
dataLoaded: false, dataLoaded: false,
popupError: false popupError: false,
btncreate: false,
btnedit: false,
load: false,
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -264,6 +267,29 @@ export default class ApprovalMatrix extends Component { ...@@ -264,6 +267,29 @@ export default class ApprovalMatrix extends Component {
componentDidMount() { componentDidMount() {
this.getData() this.getData()
this.getPermission()
}
getPermission() {
let payload = {
menu: "approval matrix"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btncreate: response.data.data.create,
btnedit: response.data.data.edit,
load: true
})
} else {
this.setState({
load: true
})
}
}
})
} }
getData() { getData() {
...@@ -427,17 +453,19 @@ export default class ApprovalMatrix extends Component { ...@@ -427,17 +453,19 @@ export default class ApprovalMatrix extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<button {this.state.btnedit && (
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent' cursor: 'pointer',
}} borderColor: 'transparent'
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} }}
// onClick={() => this.setState({ visibleEdit: true })} onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
> // onClick={() => this.setState({ visibleEdit: true })}
<img src={Images.editCopy} /> >
</button> <img src={Images.editCopy} />
</button>
)}
</div > </div >
); );
} }
...@@ -519,6 +547,7 @@ export default class ApprovalMatrix extends Component { ...@@ -519,6 +547,7 @@ export default class ApprovalMatrix extends Component {
return ( return (
<div> <div>
{this.state.visibleAM === true ? {this.state.visibleAM === true ?
this.state.load && (
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}> <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
...@@ -555,21 +584,23 @@ export default class ApprovalMatrix extends Component { ...@@ -555,21 +584,23 @@ export default class ApprovalMatrix 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" />
<a data-tip={'Upload'} data-for="upload"> {this.state.btncreate && (
<button <a data-tip={'Upload'} data-for="upload">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
marginLeft: 16, borderColor: 'transparent',
padding: 0, marginLeft: 16,
margin: 5 padding: 0,
}} margin: 5
onClick={() => this.setState({ visibleUpload: true })} }}
> onClick={() => this.setState({ visibleUpload: true })}
<img src={Images.upload} /> >
</button> <img src={Images.upload} />
</a> </button>
</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
...@@ -587,37 +618,39 @@ export default class ApprovalMatrix extends Component { ...@@ -587,37 +618,39 @@ export default class ApprovalMatrix extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
<a data-tip={'Visualization'} data-for="visualisasi"> <a data-tip={'Visualization'} data-for="visualisasi">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
marginLeft: 16, marginLeft: 16,
padding: 0, padding: 0,
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleVisual: true, visibleAM: false })} onClick={() => this.setState({ visibleVisual: true, visibleAM: false })}
> >
<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="visualisasi" place="bottom" type="light" effect="solid" />
<a data-tip={'Add'} data-for="create"> {this.state.btncreate && (
<button <a data-tip={'Add'} data-for="create">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
marginLeft: 16, borderColor: 'transparent',
padding: 0, marginLeft: 16,
margin: 5 padding: 0,
}} margin: 5
onClick={() => this.setState({ visibleCreate: true })} }}
> onClick={() => this.setState({ visibleCreate: 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>
...@@ -633,9 +666,12 @@ export default class ApprovalMatrix extends Component { ...@@ -633,9 +666,12 @@ export default class ApprovalMatrix extends Component {
</div> </div>
</div> </div>
</div> </div>
)
: :
this.state.visibleVisual == true ? this.state.visibleVisual == true ?
<VisualisasiAM <VisualisasiAM
btncreate={this.state.btncreate}
btnedit={this.state.btnedit}
onClickClose={() => this.setState({ visibleVisual: false, visibleAM: true })} onClickClose={() => this.setState({ visibleVisual: false, visibleAM: true })}
height={this.props.height} height={this.props.height}
updateVAM={this.updateVAM.bind(this)} updateVAM={this.updateVAM.bind(this)}
......
...@@ -269,11 +269,19 @@ export default class CreateApprovalMatrix extends Component { ...@@ -269,11 +269,19 @@ export default class CreateApprovalMatrix extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="order"
label="Order" label="Order"
type={"number"} // type={"number"}
value={this.state.order} value={this.state.order === null ? '' : this.state.order}
error={this.state.errorOrder} error={this.state.errorOrder}
helperText={this.state.msgErrOrder} helperText={this.state.msgErrOrder}
onChange={(e) => this.setState({ order: e.target.value }, () => this.clearError())} // onChange={(e) => this.setState({ order: e.target.value }, () => this.clearError())}
onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
order: coba
},
() => this.clearError())}
// this.handleChange(coba, 'value')}
}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
......
...@@ -288,11 +288,18 @@ export default class EditApprovalMatrix extends Component { ...@@ -288,11 +288,18 @@ export default class EditApprovalMatrix extends Component {
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="order"
label="Order" label="Order"
type={"number"} value={this.state.order === null ? '' : this.state.order}
value={this.state.order}
error={this.state.errorOrder} error={this.state.errorOrder}
helperText={this.state.msgErrOrder} helperText={this.state.msgErrOrder}
onChange={(e) => this.setState({ order: e.target.value }, () => this.clearError())} // onChange={(e) => this.setState({ order: e.target.value }, () => this.clearError())}
onChange={(e) => {
let coba = String(e.target.value).replace(/[^\d]/g,'');
this.setState({
order: coba
},
() => this.clearError())}
// this.handleChange(coba, 'value')}
}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11 fontSize: 11
......
...@@ -204,6 +204,7 @@ export default class VisualisasiAM extends Component { ...@@ -204,6 +204,7 @@ export default class VisualisasiAM extends Component {
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: 'dodgerblue', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}> <div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, marginLeft: 25, backgroundColor: 'dodgerblue', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<span style={{ color: '#fff', fontSize: 11 }}>Back</span> <span style={{ color: '#fff', fontSize: 11 }}>Back</span>
</div> </div>
{this.props.btnedit && (
<div className="row" style={{ float: 'right', marginRight: 25 }}> <div className="row" style={{ float: 'right', marginRight: 25 }}>
<div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}> <div onClick={() => this.props.onClickClose()} style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center', cursor:"pointer" }}>
<span style={{ color: '#354960', fontSize: 11 }} >Cancel</span> <span style={{ color: '#354960', fontSize: 11 }} >Cancel</span>
...@@ -212,6 +213,7 @@ export default class VisualisasiAM extends Component { ...@@ -212,6 +213,7 @@ export default class VisualisasiAM extends Component {
<span style={{ color: '#fff', fontSize: 11 }}>Save</span> <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
</div> </div>
</div> </div>
)}
</div> </div>
</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