import * as React from "react"; import Grid from "@mui/material/Grid"; import { useState, useEffect, useMemo } from "react"; import Paper from "@mui/material/Paper"; import { TFunction } from "i18next"; import { useTranslation } from "react-i18next"; import { Card, CardHeader } from "@mui/material"; import CustomSearchForm from "../CustomSearchForm/CustomSearchForm"; import CustomDatagrid from "../CustomDatagrid/CustomDatagrid"; import ReactApexChart from "react-apexcharts"; import { ApexOptions } from "apexcharts"; import { GridColDef, GridRowSelectionModel } from "@mui/x-data-grid"; import ReportProblemIcon from "@mui/icons-material/ReportProblem"; import dynamic from "next/dynamic"; import "../../app/global.css"; import { AnyARecord, AnyCnameRecord } from "dns"; import SearchBox, { Criterion } from "../SearchBox"; import ProgressByClientSearch from "@/components/ProgressByClientSearch"; import { Suspense } from "react"; interface Props { Title: string; TotalActiveProjectNumber: number; TotalFees: number; TotalBudget: number; TotalCumulative: number; TotalInvoicedAmount: number; TotalUnInvoicedAmount: number; TotalReceivedAmount: number; CashFlowStatus: string; CostPerformanceIndex: number; ClickedIndex: number; ProjectedCPI: number; ProjectedCashFlowStatus: string; Index: number; } const ProjectFinancialCard: React.FC = ({ Title, TotalActiveProjectNumber, TotalFees, TotalBudget, TotalCumulative, TotalInvoicedAmount, TotalUnInvoicedAmount, TotalReceivedAmount, CashFlowStatus, CostPerformanceIndex, ClickedIndex, ProjectedCPI, ProjectedCashFlowStatus, Index, }) => { const [SearchCriteria, setSearchCriteria] = React.useState({}); const { t } = useTranslation("dashboard"); const borderColor = CashFlowStatus === "Negative" ? "border-red-300 border-solid" : "border-green-200 border-solid"; const selectedBackgroundColor = ClickedIndex === Index ? "rgb(235 235 235)" : "rgb(255 255 255)"; return (
{Title}

Total Active Project
{TotalActiveProjectNumber.toLocaleString()}

Total Fees
{TotalFees.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

Total Budget
{TotalBudget.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}

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

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

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

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

Cash Flow Status
{CashFlowStatus === "Negative" && ( <>
{CashFlowStatus}

)} {CashFlowStatus === "Positive" && ( <>
{CashFlowStatus}

)}
Cost Performance Index (CPI)
{Number(CostPerformanceIndex) < 1 && ( <>
{CostPerformanceIndex}

)} {Number(CostPerformanceIndex) >= 1 && ( <>
{CostPerformanceIndex}

)}
Projected Cash Flow Status
{ProjectedCashFlowStatus === "Negative" && ( <>
{ProjectedCashFlowStatus}

)} {ProjectedCashFlowStatus === "Positive" && ( <>
{ProjectedCashFlowStatus}

)}
Projected Cost Performance Index (CPI)
{Number(ProjectedCPI) < 1 && ( <>
{ProjectedCPI}
)} {Number(ProjectedCPI) >= 1 && ( <>
{ProjectedCPI}
)}
); }; export default ProjectFinancialCard;