Browse Source

fix NAN outstanding_balance, change route customer

pull/2/head
ardhi 2 years ago
parent
commit
d95c95ca5a
  1. 17
      src/views/Dashboard/DashboardBOD.js
  2. 2
      src/views/Pages/Login/Login.js

17
src/views/Dashboard/DashboardBOD.js

@ -301,7 +301,20 @@ const DashboardBOD = () => {
if (result.data.data.length > 0) { if (result.data.data.length > 0) {
let tableData = []; let tableData = [];
result.data.data.map((item, idx) => { 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({ tableData.push({
"id": item.id, "id": item.id,
"last_gantt_id": item.lastGanttId?.last_gantt_id, "last_gantt_id": item.lastGanttId?.last_gantt_id,
@ -312,7 +325,7 @@ const DashboardBOD = () => {
"project_budget": item.rencana_biaya ? toRupiah(item.rencana_biaya) : '-' , "project_budget": item.rencana_biaya ? toRupiah(item.rencana_biaya) : '-' ,
"invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-', "invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-',
"cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-', "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}%` "progress": `${item.scurve?.progress ? item.scurve.progress : 0}%`
}) })
}); });

2
src/views/Pages/Login/Login.js

@ -110,7 +110,7 @@ class Login extends Component {
this.setState({ loader: false }) this.setState({ loader: false })
// custom redirect home after login // custom redirect home after login
if (role_id == 28) { if (role_id == 28) {
this.props.history.push("/dashboard-customer/48/50"); this.props.history.push("/dashboard-customer/58/63");
} }
else { else {
this.props.history.push("/dashboard"); this.props.history.push("/dashboard");

Loading…
Cancel
Save