From c0ea395ae19af4c007c884482f367ea2c1f07926 Mon Sep 17 00:00:00 2001 From: "Mac\\David" Date: Tue, 28 May 2024 23:27:58 +0800 Subject: [PATCH] update dashboard --- .../CompanyTeamCashFlow/CompanyTeamCashFlow.tsx | 7 +++++++ .../ProgressByClient/ProgressByClient.tsx | 13 ++++++++----- src/components/ProgressByTeam/ProgressByTeam.tsx | 13 ++++++++----- src/components/ProjectCashFlow/ProjectCashFlow.tsx | 10 ++++++++++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/components/CompanyTeamCashFlow/CompanyTeamCashFlow.tsx b/src/components/CompanyTeamCashFlow/CompanyTeamCashFlow.tsx index 6ae4150..0175ad7 100644 --- a/src/components/CompanyTeamCashFlow/CompanyTeamCashFlow.tsx +++ b/src/components/CompanyTeamCashFlow/CompanyTeamCashFlow.tsx @@ -178,6 +178,13 @@ const CompanyTeamCashFlow: React.FC = () => { ]; const options: ApexOptions = { + tooltip: { + y: { + formatter: function(val) { + return val.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + } + } + }, chart: { height: 350, type: "line", diff --git a/src/components/ProgressByClient/ProgressByClient.tsx b/src/components/ProgressByClient/ProgressByClient.tsx index 3fd7d59..973d511 100644 --- a/src/components/ProgressByClient/ProgressByClient.tsx +++ b/src/components/ProgressByClient/ProgressByClient.tsx @@ -246,7 +246,10 @@ const ProgressByClient: React.FC = () => { id: "budgetedManhour", field: "budgetedManhour", headerName: "Budgeted Manhour", - minWidth: 70 + minWidth: 70, + renderCell: (params: any) => { + return {params.row.budgetedManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}; + } }, { id: "spentManhour", @@ -255,11 +258,11 @@ const ProgressByClient: React.FC = () => { renderCell: (params: any) => { if (params.row.budgetedManhour - params.row.spentManhour <= 0) { return ( - {params.row.spentManhour} + {params.row.spentManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ); } else { console.log(params) - return {params.row.spentManhour}; + return {params.row.spentManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}; } }, minWidth: 70 @@ -271,10 +274,10 @@ const ProgressByClient: React.FC = () => { renderCell: (params: any) => { if (params.row.budgetedManhour - params.row.spentManhour <= 0) { return ( - ({params.row.remainedManhour}) + ({params.row.remainedManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}) ); } else { - return {params.row.remainedManhour}; + return {params.row.remainedManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}; } }, minWidth: 70 diff --git a/src/components/ProgressByTeam/ProgressByTeam.tsx b/src/components/ProgressByTeam/ProgressByTeam.tsx index d58fc37..86d28e1 100644 --- a/src/components/ProgressByTeam/ProgressByTeam.tsx +++ b/src/components/ProgressByTeam/ProgressByTeam.tsx @@ -277,7 +277,10 @@ const ProgressByTeam: React.FC = () => { id: "budgetedManhour", field: "budgetedManhour", headerName: "Budgeted Manhour", - minWidth: 70 + minWidth: 70, + renderCell: (params: any) => { + return {params.row.budgetedManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}; + } }, { id: "spentManhour", @@ -286,10 +289,10 @@ const ProgressByTeam: React.FC = () => { renderCell: (params: any) => { if (params.row.budgetedManhour - params.row.spentManhour <= 0) { return ( - {params.row.spentManhour} + {params.row.spentManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ); } else { - return {params.row.spentManhour}; + return {params.row.spentManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}; } }, minWidth: 70 @@ -301,10 +304,10 @@ const ProgressByTeam: React.FC = () => { renderCell: (params: any) => { if (params.row.budgetedManhour - params.row.spentManhour <= 0) { return ( - ({params.row.remainedManhour}) + ({params.row.remainedManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}) ); } else { - return {params.row.remainedManhour}; + return {params.row.remainedManhour.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}; } }, minWidth: 70 diff --git a/src/components/ProjectCashFlow/ProjectCashFlow.tsx b/src/components/ProjectCashFlow/ProjectCashFlow.tsx index 1961ded..2d0bae8 100644 --- a/src/components/ProjectCashFlow/ProjectCashFlow.tsx +++ b/src/components/ProjectCashFlow/ProjectCashFlow.tsx @@ -146,6 +146,7 @@ const ProjectCashFlow: React.FC = () => { setMonthlyAnticipateExpenditureList([0,0,0,0,0,0,0,0,0,0,0,0]) } setMonthlyAnticipateIncomeList(monthlyAnticipateIncome) + console.log(cashFlowAnticipateData) if(cashFlowAnticipateData.length !== 0){ if (cashFlowAnticipateData[0].anticipateExpenditureList.length !== 0) { const anticipateExpenditureList = [] @@ -157,6 +158,7 @@ const ProjectCashFlow: React.FC = () => { for (var j = 1; j < 13; j++){ if (month === j && duration > 0) { subAnticipateExpenditure.push(anticipateExpenditure) + month = month + 1 duration = duration - 1 } else { subAnticipateExpenditure.push(0) @@ -164,6 +166,7 @@ const ProjectCashFlow: React.FC = () => { } anticipateExpenditureList.push(subAnticipateExpenditure) } + console.log(anticipateExpenditureList) const result = new Array(anticipateExpenditureList[0].length).fill(0); for (const arr of anticipateExpenditureList) { for (let i = 0; i < arr.length; i++) { @@ -306,6 +309,13 @@ const ProjectCashFlow: React.FC = () => { ]; const options: ApexOptions = { + tooltip: { + y: { + formatter: function(val) { + return val.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + } + } + }, chart: { height: 350, type: "line",