Commit a1f438a7 authored by r.kurnia's avatar r.kurnia

if else approver

parent bfb82284
...@@ -558,6 +558,10 @@ class HomePage extends Component { ...@@ -558,6 +558,10 @@ class HomePage extends Component {
let rawData = [] let rawData = []
api.create().getDashboard().then((response) => { api.create().getDashboard().then((response) => {
console.log(response); console.log(response);
console.log(this.state.isApproverMB);
console.log(this.state.isApproverMR);
console.log(this.state.isApproverRO);
console.log(this.state.isApproverOL);
if (String(response.data.status).toLocaleLowerCase() == 'success') { if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data let data = response.data.data
data.map((item, index) => { data.map((item, index) => {
...@@ -569,24 +573,37 @@ class HomePage extends Component { ...@@ -569,24 +573,37 @@ class HomePage extends Component {
} else if (String(item.type_report).toLocaleLowerCase().includes("monthly")) { } else if (String(item.type_report).toLocaleLowerCase().includes("monthly")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert]) listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item) rawData.push(item)
} else if (String(item.type_report).toLocaleLowerCase().includes("outlook")) { } else if (String(item.type_report).toLocaleLowerCase().includes("rolling")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert]) listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item) rawData.push(item)
} } else if (String(item.type_report).toLocaleLowerCase().includes("pa")) {
} else if (this.state.isApproverMB) {
if (String(item.type_report).toLocaleLowerCase().includes("master")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item)
}
} else if (this.state.isApproverMR) {
if (String(item.type_report).toLocaleLowerCase().includes("monthly")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert]) listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item) rawData.push(item)
}
} else {
if (this.state.isApproverMB) {
if (String(item.type_report).toLocaleLowerCase().includes("master")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item)
}
}
if (this.state.isApproverMR) {
if (String(item.type_report).toLocaleLowerCase().includes("monthly")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item)
}
}
if (this.state.isApproverRO) {
if (String(item.type_report).toLocaleLowerCase().includes("rolling")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item)
}
} }
} else if (this.state.isApproverRO || this.state.isApproverOL) { if (this.state.isApproverOL) {
if (String(item.type_report).toLocaleLowerCase().includes("outlook")) { if (String(item.type_report).toLocaleLowerCase().includes("pa")) {
listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert]) listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} ${item.periode}`, item.revision, item.status, statusConvert])
rawData.push(item) rawData.push(item)
}
} }
} }
}) })
......
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