From 3b6ca71202d50cec9a196f103485337763c82ad1 Mon Sep 17 00:00:00 2001 From: satori Date: Wed, 27 Jul 2022 06:18:01 +0700 Subject: [PATCH] add dashboard pmo --- src/const/CustomFunc.js | 5 +++++ src/views/DashboardPMO/index.js | 26 ++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/const/CustomFunc.js b/src/const/CustomFunc.js index 9fdff08..ad8a75a 100644 --- a/src/const/CustomFunc.js +++ b/src/const/CustomFunc.js @@ -340,3 +340,8 @@ export const renderLabelStatus = (text) => { } return label; } + +export const formatRibuanDecimal = (n) => { + let parts=n.toString().split("."); + return "Rp. " + parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".") + (parts[1] ? "," + parts[1] : ""); +} diff --git a/src/views/DashboardPMO/index.js b/src/views/DashboardPMO/index.js index 63d2d24..9e3f8ae 100644 --- a/src/views/DashboardPMO/index.js +++ b/src/views/DashboardPMO/index.js @@ -11,7 +11,8 @@ import numeral from 'numeral'; import { Table, Tree, Row, Col, Space, Card} from 'antd'; import { Pie } from '@ant-design/plots'; import { NotificationContainer, NotificationManager } from 'react-notifications'; -import { formatRupiah, DATE_TIME_FORMAT } from '../../const/CustomFunc.js'; +import { formatRibuanDecimal, DATE_TIME_FORMAT } from '../../const/CustomFunc.js'; +import { Badge } from 'reactstrap'; const token = localStorage.getItem("token") const HEADER = { @@ -39,10 +40,6 @@ const Dashboard = () => { NotificationManager.error('Belum ada data proyek!', 'Failed'); } console.log("res ", result.data.data) -// const arr = result.data.data.map((res) => { -// console.log("insd", res) -// return res -// }); setDataTable(result.data.data); } @@ -62,27 +59,33 @@ const Dashboard = () => { title: 'Planned Cost', dataIndex: 'plannedCost', key: 'plannedCost', + render: (text) => { formatRibuanDecimal(text) }, }, { title: 'Actual Cost', dataIndex: 'actualCost', key: 'actualCost', + render: (text) => { formatRibuanDecimal(text) }, }, { title: 'Cost Variance', dataIndex: 'costVariance', key: 'costVariance', + render: (text) => { formatRibuanDecimal(text) }, }, { title: 'Cost Health', dataIndex: 'costHealth', key: 'costHealth', - }, - - { - title: 'Schedule Health', - dataIndex: 'scheduleHealth', - key: 'scheduleHealth', + render: (text) => { + if(text == "on-budget") { + return On Budget + } else if(text == "warning") { + return Warning + } else { + return Danger + } + } }, { title: 'Progress', @@ -136,7 +139,6 @@ const Dashboard = () => { -