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"; import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked'; import RadioButtonCheckedIcon from '@mui/icons-material/RadioButtonChecked'; import { useRouter } from "next/navigation"; interface Props { Title: string; TeamId: number; 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 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, TeamId, TotalActiveProjectNumber, TotalFees, TotalBudget, TotalCumulative, TotalInvoicedAmount, TotalUnInvoicedAmount, TotalReceivedAmount, CashFlowStatus, CostPerformanceIndex, ClickedIndex, ProjectedCPI, ProjectedCashFlowStatus, Index, }) => { const router = useRouter(); const [SearchCriteria, setSearchCriteria] = React.useState({}); const { t } = useTranslation("dashboard"); const handleCheckProjectStatusClick = (TeamId:number) => { router.push(`/dashboard/ProjectStatusByTeam?teamLeadId=${TeamId}`); }; 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 (
{ClickedIndex === Index ?
:
} {Title !== t("All Team") ?
{Title}
:
{Title}
}
{Title !== t("All Team") ? <>
handleCheckProjectStatusClick(TeamId)} className="bg-lime-100 mb-2 border-b-2 pt-1 pb-1 hover:bg-lime-200" style={{ width: "100%", textAlign: "center", color: "#898d8d" }}>{t("Check Project Status")}
: <>
}
{"(a) " + t("Total Active Project")}
{TotalActiveProjectNumber.toLocaleString()}

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

{"(c) " + t("Total Budget")}
{TotalBudget.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
{"(c) = (b) * 80%"}

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

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

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

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

{"(h) " + t("Cash Flow Status")}
{CashFlowStatus === "Negative" && ( <>
{t(CashFlowStatus)}
{t("Positive") + ": (e) > or = (d)"}
{t("Negative") + ": (e) < (d)"}

)} {CashFlowStatus === "Positive" && ( <>
{t(CashFlowStatus)}
{t("Positive") + ": (e) > or = (d)"}
{t("Negative") + ": (e) < (d)"}

)}
{"(i) " + t("Cost Performance Index") + " (CPI)"}
{ Number(CostPerformanceIndex) < 1 && ( <>
{CostPerformanceIndex}
{"(i) = (e) / (d)"}

)} {Number(CostPerformanceIndex) >= 1 && ( <>
{CostPerformanceIndex}
{"(i) =(e) / (d)"}

)}
{"(j) " + t("Projected Cash Flow Status")}
{ProjectedCashFlowStatus === "Negative" && ( <>
{t(ProjectedCashFlowStatus)}
{t("Positive") + ": (b) > or = (d)"}
{t("Negative") + ": (b) < (d)"}

)} {ProjectedCashFlowStatus === "Positive" && ( <>
{t(ProjectedCashFlowStatus)}
{t("Positive") + ": (b) > or = (d)"}
{t("Negative") + ": (b) < (d)"}

)}
{"(k) " + t("Projected Cost Performance Index") + " (CPI)"}
{Number(ProjectedCPI) < 1 && ( <>
{ProjectedCPI}
{"(k) = (b) / (d)"}
)} {Number(ProjectedCPI) >= 1 && ( <>
{ProjectedCPI}
{"(k) = (b) / (d)"}
)}
); }; export default ProjectFinancialCard;