From d95c95ca5a4dde6cd6d514734a6b51ec63ecce47 Mon Sep 17 00:00:00 2001 From: ardhi Date: Wed, 19 Oct 2022 12:34:11 +0700 Subject: [PATCH] fix NAN outstanding_balance, change route customer --- src/views/Dashboard/DashboardBOD.js | 17 +++++++++++++++-- src/views/Pages/Login/Login.js | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 08735c7..f22d136 100644 --- a/src/views/Dashboard/DashboardBOD.js +++ b/src/views/Dashboard/DashboardBOD.js @@ -301,7 +301,20 @@ const DashboardBOD = () => { if (result.data.data.length > 0) { let tableData = []; result.data.data.map((item, idx) => { - let outstanding_balance = item.invoice?.invoiced - item.invoice?.paid; + let outstanding_balance = 0; + if (item.invoice) { + outstanding_balance = item.invoice.invoiced - item.invoice.paid; + if (outstanding_balance < 1) { + outstanding_balance = '-' + } + else { + outstanding_balance = toRupiah(outstanding_balance); + } + } + else { + outstanding_balance = '-'; + } + tableData.push({ "id": item.id, "last_gantt_id": item.lastGanttId?.last_gantt_id, @@ -312,7 +325,7 @@ const DashboardBOD = () => { "project_budget": item.rencana_biaya ? toRupiah(item.rencana_biaya) : '-' , "invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-', "cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-', - "outstanding_balance": toRupiah(outstanding_balance), + "outstanding_balance": outstanding_balance, "progress": `${item.scurve?.progress ? item.scurve.progress : 0}%` }) }); diff --git a/src/views/Pages/Login/Login.js b/src/views/Pages/Login/Login.js index 9b1dc91..58526be 100644 --- a/src/views/Pages/Login/Login.js +++ b/src/views/Pages/Login/Login.js @@ -110,7 +110,7 @@ class Login extends Component { this.setState({ loader: false }) // custom redirect home after login if (role_id == 28) { - this.props.history.push("/dashboard-customer/48/50"); + this.props.history.push("/dashboard-customer/58/63"); } else { this.props.history.push("/dashboard");