diff --git a/src/components/CreateProject/ResourceAllocation.tsx b/src/components/CreateProject/ResourceAllocation.tsx index b56ced8..c342ab5 100644 --- a/src/components/CreateProject/ResourceAllocation.tsx +++ b/src/components/CreateProject/ResourceAllocation.tsx @@ -63,10 +63,14 @@ const ResourceAllocationByGrade: React.FC = ({ grades }) => { const manhourPercentageByGrade = watch("manhourPercentageByGrade"); const totalManhour = watch("totalManhour"); - const totalPercentage = Math.round(Object.values(manhourPercentageByGrade).reduce( + const totalPercentage = Object.values(manhourPercentageByGrade).reduce( (acc, percent) => acc + percent, 0, - ) * 100) / 100; + ); + // const totalPercentage = Math.round(Object.values(manhourPercentageByGrade).reduce( + // (acc, percent) => acc + percent, + // 0, + // ) * 100) / 100; const makeUpdatePercentage = useCallback( (gradeId: Grade["id"]) => (percentage?: number) => { @@ -152,7 +156,7 @@ const ResourceAllocationByGrade: React.FC = ({ grades }) => { val + "%"} + renderValue={((val) => (val.toString().includes(".")? val.toString() : val.toFixed(1)) + "%")} // renderValue={(val) => percentFormatter.format(val)} onChange={makeUpdatePercentage(column.id)} convertValue={(inputValue) => Number(inputValue)} @@ -162,7 +166,7 @@ const ResourceAllocationByGrade: React.FC = ({ grades }) => { /> ))} - {totalPercentage + "%"} + {((totalPercentage.toString().includes(".") && totalPercentage.toString() || totalPercentage.toFixed(1)) + "%")} {/* {percentFormatter.format(totalPercentage)} */} @@ -271,7 +275,7 @@ const ResourceAllocationByStage: React.FC = ({ grades, allTasks }) => { percentFormatter.format(val)} - renderValue={(val) => val + "%"} + renderValue={(val) => ((val.toString().includes(".")? val.toString() : val.toFixed(1)) + "%")} onChange={makeUpdatePercentage(tg.id)} convertValue={(inputValue) => Number(inputValue)} cellSx={{ @@ -311,12 +315,27 @@ const ResourceAllocationByStage: React.FC = ({ grades, allTasks }) => { ...(Object.values(currentTaskGroups).reduce((acc, tg) => acc + tg.percentAllocation, 0,) !== 100 && errorCellSx) }} > - {percentFormatter.format( - Object.values(currentTaskGroups).reduce( - (acc, tg) => acc + tg.percentAllocation / 100, + {((Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation, 0, - ), - )} + ).toString().includes(".") && Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation, + 0,) || Object.values(currentTaskGroups).reduce( + (acc, tg) => (acc + tg.percentAllocation), + 0, + ).toFixed(1)) + "%" )} + {/* {percentFormatter.format( + Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation / 100, + 0, + ), + ).includes(".") && percentFormatter.format(Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation / 100, + 0,), + ) || Object.values(currentTaskGroups).reduce( + (acc, tg) => (acc + tg.percentAllocation), + 0, + ).toFixed(1) + "%" } */} {manhourFormatter.format( diff --git a/src/components/CreateTaskTemplate/ResourceAllocation.tsx b/src/components/CreateTaskTemplate/ResourceAllocation.tsx index 5e529f0..ddc0594 100644 --- a/src/components/CreateTaskTemplate/ResourceAllocation.tsx +++ b/src/components/CreateTaskTemplate/ResourceAllocation.tsx @@ -53,10 +53,14 @@ const ResourceAllocationByGrade: React.FC = ({ grades }) => { const { watch, register, setValue, formState: { errors }, setError, clearErrors } = useFormContext(); const manhourPercentageByGrade = watch("manhourPercentageByGrade"); - const totalPercentage = Math.round(Object.values(manhourPercentageByGrade).reduce( + const totalPercentage = Object.values(manhourPercentageByGrade).reduce( (acc, percent) => acc + percent, 0, - ) * 100) / 100; + ); + // const totalPercentage = Math.round(Object.values(manhourPercentageByGrade).reduce( + // (acc, percent) => acc + percent, + // 0, + // ) * 100) / 100; const makeUpdatePercentage = useCallback( (gradeId: Grade["id"]) => (percentage?: number) => { @@ -114,7 +118,8 @@ const ResourceAllocationByGrade: React.FC = ({ grades }) => { val + "%"} + renderValue={(val) => ((val.toString().includes(".")? val.toString() : val.toFixed(1)) + "%")} + // renderValue={(val) => val.toFixed(1) + "%"} onChange={makeUpdatePercentage(column.id)} convertValue={(inputValue) => Number(inputValue)} cellSx={{ backgroundColor: "primary.lightest" }} @@ -123,7 +128,8 @@ const ResourceAllocationByGrade: React.FC = ({ grades }) => { /> ))} - {totalPercentage + "%"} + {((totalPercentage.toString().includes(".") && totalPercentage.toString() || totalPercentage.toFixed(1) )+ "%")} + {/* {totalPercentage.toFixed(1) + "%"} */} @@ -214,7 +220,7 @@ const ResourceAllocationByStage: React.FC = ({ grades, allTasks }) => { percentFormatter.format(val)} - renderValue={(val) => val + "%"} + renderValue={(val) => ((val.toString().includes(".")? val.toString() : val.toFixed(1)) + "%")} onChange={makeUpdatePercentage(tg.id)} convertValue={(inputValue) => Number(inputValue)} cellSx={{ @@ -239,12 +245,27 @@ const ResourceAllocationByStage: React.FC = ({ grades, allTasks }) => { ...(Object.values(currentTaskGroups).reduce((acc, tg) => acc + tg.percentAllocation, 0,) !== 100 && { ...errorCellSx, borderRight: "1px solid", borderColor: "error.main"}) }} > - {percentFormatter.format( + {((Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation, + 0, + ).toString().includes(".") && Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation, + 0,) || Object.values(currentTaskGroups).reduce( + (acc, tg) => (acc + tg.percentAllocation), + 0, + ).toFixed(1)) + "%" )} + {/* {percentFormatter.format( Object.values(currentTaskGroups).reduce( (acc, tg) => acc + tg.percentAllocation / 100, 0, ), - )} + ).includes(".") && percentFormatter.format(Object.values(currentTaskGroups).reduce( + (acc, tg) => acc + tg.percentAllocation / 100, + 0,), + ) || Object.values(currentTaskGroups).reduce( + (acc, tg) => (acc + tg.percentAllocation), + 0, + ).toFixed(1) + "%" } */} diff --git a/src/components/ProgressByClient/ProgressByClient.tsx b/src/components/ProgressByClient/ProgressByClient.tsx index 8856446..e7c429b 100644 --- a/src/components/ProgressByClient/ProgressByClient.tsx +++ b/src/components/ProgressByClient/ProgressByClient.tsx @@ -385,7 +385,7 @@ const ProgressByClient: React.FC = () => { enabled: true, y: { formatter: function (val) { - return val.toFixed(1) + "%"; + return (val.toString().includes(".") ? val.toString() : val.toFixed(1)) + "%"; } } }, @@ -427,7 +427,7 @@ const ProgressByClient: React.FC = () => {
${t("Spent Manhours")}: ${spentManhours.toFixed(2)} hours
- Percentage: ${value.toFixed(1)}% + Percentage: ${value.toString().includes(".") ? value.toString() : value.toFixed(1)}% `; diff --git a/src/components/ProgressByTeam/ProgressByTeam.tsx b/src/components/ProgressByTeam/ProgressByTeam.tsx index 9e1e3ba..03d739c 100644 --- a/src/components/ProgressByTeam/ProgressByTeam.tsx +++ b/src/components/ProgressByTeam/ProgressByTeam.tsx @@ -468,7 +468,7 @@ const ProgressByTeam: React.FC = () => { enabled: true, y: { formatter: function (val) { - return val.toFixed(1) + "%"; + return (val.toString().includes(".") ? val.toString() : val.toFixed(1)) + "%"; } } }, @@ -505,9 +505,9 @@ const ProgressByTeam: React.FC = () => { const tooltipContent = `
${projectCode} - ${projectName} -
${t("Budget Manhours")}:${budgetManhours.toFixed(2)} hours -
${t("Spent Manhours")}:${spentManhours.toFixed(2)} hours -
Percentage:${value.toFixed(1)}% +
${t("Budget Manhours")}: ${budgetManhours.toFixed(2)} hours +
${t("Spent Manhours")}: ${spentManhours.toFixed(2)} hours +
Percentage: ${value.toString().includes(".") ? value.toString() : value.toFixed(1)}%
`; diff --git a/src/components/ProjectFinancialSummary/ProjectFinancialCard.tsx b/src/components/ProjectFinancialSummary/ProjectFinancialCard.tsx index c6e007f..c5c6158 100644 --- a/src/components/ProjectFinancialSummary/ProjectFinancialCard.tsx +++ b/src/components/ProjectFinancialSummary/ProjectFinancialCard.tsx @@ -35,6 +35,10 @@ interface Props { Index: number; } +const dataBaseStyle:any = { color: "#6b87cf", textAlign: "right" } +const dataNegativeStyle:any = { color: "#f896aa", textAlign: "right" } +const dataPositiveStyle:any = { color: "#71d19e", textAlign: "right" } + const ProjectFinancialCard: React.FC = ({ Title, TotalActiveProjectNumber, @@ -77,74 +81,63 @@ const ProjectFinancialCard: React.FC = ({ {Title}
-
+
{t("Total Active Project")}
-
+
{TotalActiveProjectNumber.toLocaleString()}

-
+
{t("Total Fees")}
-
+
{TotalFees.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

-
+
{t("Total Budget")}
-
+
{TotalBudget.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

-
+
{t("Total Cumulative Expenditure")}
-
+
{TotalCumulative.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

-
+
{t("Total Invoiced Amount")}
-
+
{TotalInvoicedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

-
+
{t("Total Un-Invoiced Amount")}
-
+
{TotalUnInvoicedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

-
+
{t("Total Received Amount")}
-
+
{TotalReceivedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

-
+
{t("Cash Flow Status")}
{CashFlowStatus === "Negative" && ( <>
- {t(CashFlowStatus)} -
-
- - )} - {CashFlowStatus === "Positive" && ( - <> -
{t(CashFlowStatus)}
@@ -152,52 +145,30 @@ const ProjectFinancialCard: React.FC = ({ )}
{t("Cost Performance Index") + " (CPI)"}
- {Number(CostPerformanceIndex) < 1 && ( - <> -
- {CostPerformanceIndex} -
-
- - )} - {Number(CostPerformanceIndex) >= 1 && ( + { ( <>
{CostPerformanceIndex}

)} -
+
{t("Projected Cash Flow Status")}
{ProjectedCashFlowStatus === "Negative" && ( <>
- {t(ProjectedCashFlowStatus)} -
-
- - )} - {ProjectedCashFlowStatus === "Positive" && ( - <> -
{t(ProjectedCashFlowStatus)}
@@ -205,7 +176,7 @@ const ProjectFinancialCard: React.FC = ({ )}
{t("Projected Cost Performance Index") + " (CPI)"} @@ -213,18 +184,8 @@ const ProjectFinancialCard: React.FC = ({ {Number(ProjectedCPI) < 1 && ( <>
- {ProjectedCPI} -
- - )} - {Number(ProjectedCPI) >= 1 && ( - <> -
{ProjectedCPI}
diff --git a/src/components/ProjectResourceConsumptionRanking/ProjectResourceConsumptionRanking.tsx b/src/components/ProjectResourceConsumptionRanking/ProjectResourceConsumptionRanking.tsx index d282a49..3b70fae 100644 --- a/src/components/ProjectResourceConsumptionRanking/ProjectResourceConsumptionRanking.tsx +++ b/src/components/ProjectResourceConsumptionRanking/ProjectResourceConsumptionRanking.tsx @@ -554,7 +554,7 @@ const ProjectResourceConsumptionRanking: React.FC = () => { enabled: true, y: { formatter: function (val) { - return val.toFixed(1) + "%"; + return (val.toString().includes(".") ? val.toString() : val.toFixed(1)) + "%"; } } }, @@ -596,7 +596,7 @@ const ProjectResourceConsumptionRanking: React.FC = () => {
${t("Spent Manhours")}: ${spentManhours.toFixed(2)} ${t("hours")}
- Percentage: ${value.toFixed(1)}% + Percentage: ${value.toString().includes(".") ? value.toString() : value.toFixed(1)}%
`;