Commit 3e52cfd9 authored by rifkaki's avatar rifkaki

home

parent 92769d24
......@@ -31,7 +31,9 @@ class HomePage extends Component {
valueSubmit: 0,
listdmb: [],
dataTableMB: [],
loading: false
loading: false,
accessMB: false,
accessMR: false,
}
}
......@@ -56,6 +58,8 @@ class HomePage extends Component {
// this.setState({ isApprover: false })
// }
// })
this.getPermissionMB()
this.getPermissionMR()
this.getApprMat()
this.getListUserSubco()
this.getDashboardMB()
......@@ -69,6 +73,64 @@ class HomePage extends Component {
}
}
getPermissionMB() {
let payload = {
menu: "Master Budget & CAT"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btnCreateMB: response.data.data.create,
btnEditMB: response.data.data.edit,
load: true
},() => {
if (this.state.btnCreateMB === true && this.state.btnEditMB === true){
this.setState({ accessMB: true })
}
})
} else {
this.setState({
load: true
})
}
} else {
this.setState({ load: true })
}
console.log(this.state.accessMB);
})
}
getPermissionMR() {
let payload = {
menu: "monthly report"
}
api.create().getPermission(payload).then(response => {
console.log(response)
if (response.data) {
if (response.data.status === "success") {
this.setState({
btnCreateMR: response.data.data.create,
btnEditMR: response.data.data.edit,
load: true
},() => {
if (this.state.btnCreateMR === true && this.state.btnEditMR === true){
this.setState({ accessMR: true })
}
})
} else {
this.setState({
load: true
})
}
} else {
this.setState({ load: true })
}
console.log(this.state.accessMR);
})
}
getListUserSubco() {
api.create().getDashboardUser().then(response => {
console.log(response);
......@@ -138,8 +200,6 @@ class HomePage extends Component {
this.setState({loading: true})
let isApproverMR = false
let isApproverMB = false
// let isApproverMRTabel = false
// let isApproverMBTabel = false
api.create().getAM().then((response) => {
console.log(response);
let actAMActive = []
......@@ -163,21 +223,7 @@ class HomePage extends Component {
if (indexId === -1) {
this.setState({ isApprover: false })
this.getListUserSubco()
}
// else if (isApproverMR){
// if (isApproverMBTabel === false){
// this.setState({ isApproverMRTabel: true, isApproverMBList: true })
// } else {
// this.setState({ isApproverMRTabel: true })
// }
// }
// else if (isApproverMB){
// if (isApproverMRTabel === false){
// this.setState({ isApproverMBTabel: true, isApproverMRList: true })
// } else {
// this.setState({ isApproverMBTabel: true })
// }
// }
}
this.setState({ isApproverMB, isApproverMR})
this.getDashboardMB()
// console.log(actAM)
......@@ -474,12 +520,22 @@ class HomePage extends Component {
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null ? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Tasks to be Complete</Typography>
{(this.state.accessMB || this.state.accessMR) &&
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Tasks to be Complete</Typography>
</div>
</div>
</div>
}
{(this.state.accessMB === false && this.state.accessMR === false) &&
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>You don't have pending task</Typography>
</div>
</div>
}
<div style={{ display: 'inline-flex' }}>
{this.state.accessMB &&
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ width: 450, padding: 20, borderRadius: 10 }}>
<Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>{`Master Budget ${this.state.valueSubmit}/${this.state.listSubcoMB.length}`}</Typography>
......@@ -517,7 +573,8 @@ class HomePage extends Component {
})}
</Paper>
</div>
{/* : this.state.isApproverMRList === true || this.state.isApprover === false ? */}
}
{this.state.accessMR &&
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ width: 450, padding: 20, borderRadius: 10 }}>
<Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>{`Monthly Report - ${bulan} ${tahun} ${this.state.valueSubmitMR}/${this.state.listSubcoMR.length}`}</Typography>
......@@ -527,7 +584,7 @@ class HomePage extends Component {
<div style={{ display: 'flex' }}>
<img src={item.is_submit === true ? Images.dotDone : item.is_overdue === true ? Images.dotOverdue : Images.dotOpen} />
<Link to={{
pathname: `/home/master-budget/`,
pathname: `/home/monthly-report/`,
state: {
userType: 'user',
rawData: item
......@@ -555,8 +612,7 @@ class HomePage extends Component {
})}
</Paper>
</div>
{/* : null
} */}
}
</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