Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 

193 рядки
6.5 KiB

  1. import * as React from "react";
  2. import Grid from "@mui/material/Grid";
  3. import { useState, useEffect, useMemo } from "react";
  4. import Paper from "@mui/material/Paper";
  5. import { TFunction } from "i18next";
  6. import { useTranslation } from "react-i18next";
  7. import { Card, CardHeader } from "@mui/material";
  8. import CustomSearchForm from "../CustomSearchForm/CustomSearchForm";
  9. import CustomDatagrid from "../CustomDatagrid/CustomDatagrid";
  10. import ReactApexChart from "react-apexcharts";
  11. import { ApexOptions } from "apexcharts";
  12. import { GridColDef, GridRowSelectionModel } from "@mui/x-data-grid";
  13. import ReportProblemIcon from "@mui/icons-material/ReportProblem";
  14. import dynamic from "next/dynamic";
  15. import "../../app/global.css";
  16. import { AnyARecord, AnyCnameRecord } from "dns";
  17. import SearchBox, { Criterion } from "../SearchBox";
  18. import ProgressByClientSearch from "@/components/ProgressByClientSearch";
  19. import { Suspense } from "react";
  20. interface Props {
  21. Title: string;
  22. TotalActiveProjectNumber: number;
  23. TotalFees: number;
  24. TotalBudget: number;
  25. TotalCumulative: number;
  26. TotalInvoicedAmount: number;
  27. TotalUnInvoicedAmount: number;
  28. TotalReceivedAmount: number;
  29. CashFlowStatus: string;
  30. CostPerformanceIndex: number;
  31. ClickedIndex: number;
  32. ProjectedCPI: number;
  33. ProjectedCashFlowStatus: string;
  34. Index: number;
  35. }
  36. const dataBaseStyle:any = { color: "#6b87cf", textAlign: "right" }
  37. const dataNegativeStyle:any = { color: "#f896aa", textAlign: "right" }
  38. const dataPositiveStyle:any = { color: "#71d19e", textAlign: "right" }
  39. const ProjectFinancialCard: React.FC<Props> = ({
  40. Title,
  41. TotalActiveProjectNumber,
  42. TotalFees,
  43. TotalBudget,
  44. TotalCumulative,
  45. TotalInvoicedAmount,
  46. TotalUnInvoicedAmount,
  47. TotalReceivedAmount,
  48. CashFlowStatus,
  49. CostPerformanceIndex,
  50. ClickedIndex,
  51. ProjectedCPI,
  52. ProjectedCashFlowStatus,
  53. Index,
  54. }) => {
  55. const [SearchCriteria, setSearchCriteria] = React.useState({});
  56. const { t } = useTranslation("dashboard");
  57. const borderColor =
  58. CashFlowStatus === "Negative"
  59. ? "border-red-300 border-solid"
  60. : "border-green-200 border-solid";
  61. const selectedBackgroundColor =
  62. ClickedIndex === Index ? "rgb(235 235 235)" : "rgb(255 255 255)";
  63. return (
  64. <Card
  65. style={{
  66. maxWidth: "25%",
  67. minWidth: "280px",
  68. boxShadow:
  69. "0 0px 10px 0 rgba(0, 0, 0, 0.08), 0 0px 10px 0 rgba(0, 0, 0, 0.08)",
  70. backgroundColor: selectedBackgroundColor,
  71. }}
  72. className={`${borderColor}`}
  73. >
  74. <div
  75. className="text-xl mt-2 font-medium"
  76. style={{ width: "100%", textAlign: "center", color: "#898d8d" }}
  77. >
  78. {Title}
  79. </div>
  80. <hr />
  81. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  82. {t("Total Active Project")}
  83. </div>
  84. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  85. {TotalActiveProjectNumber.toLocaleString()}
  86. </div>
  87. <hr />
  88. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  89. {t("Total Fees")}
  90. </div>
  91. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  92. {TotalFees.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  93. </div>
  94. <hr />
  95. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  96. {t("Total Budget")}
  97. </div>
  98. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  99. {TotalBudget.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  100. </div>
  101. <hr />
  102. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  103. {t("Total Cumulative Expenditure")}
  104. </div>
  105. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  106. {TotalCumulative.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  107. </div>
  108. <hr />
  109. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  110. {t("Total Invoiced Amount")}
  111. </div>
  112. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  113. {TotalInvoicedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  114. </div>
  115. <hr />
  116. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  117. {t("Total Un-Invoiced Amount")}
  118. </div>
  119. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  120. {TotalUnInvoicedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  121. </div>
  122. <hr />
  123. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  124. {t("Total Received Amount")}
  125. </div>
  126. <div className="text-lg font-medium mx-5" style={dataBaseStyle}>
  127. {TotalReceivedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  128. </div>
  129. <hr />
  130. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  131. {t("Cash Flow Status")}
  132. </div>
  133. <>
  134. <div
  135. className="text-lg font-medium mx-5"
  136. style={CashFlowStatus === "Negative" && dataNegativeStyle || dataPositiveStyle}
  137. >
  138. {t(CashFlowStatus)}
  139. </div>
  140. <hr />
  141. </>
  142. <div
  143. className="text-sm mt-2 font-medium mx-5"
  144. style={{ color: "#898d8d" }}
  145. >
  146. {t("Cost Performance Index") + " (CPI)"}
  147. </div>
  148. { (
  149. <>
  150. <div
  151. className="text-lg font-medium mx-5 mb-2"
  152. style={Number(CostPerformanceIndex) < 1 && dataNegativeStyle || dataPositiveStyle}
  153. >
  154. {CostPerformanceIndex}
  155. </div>
  156. <hr />
  157. </>
  158. )}
  159. <div className="text-sm font-medium mx-5" style={{ color: "#898d8d" }}>
  160. {t("Projected Cash Flow Status")}
  161. </div>
  162. <>
  163. <div
  164. className="text-lg font-medium mx-5"
  165. style={ProjectedCashFlowStatus === "Negative" && dataNegativeStyle || dataPositiveStyle}
  166. >
  167. {t(ProjectedCashFlowStatus)}
  168. </div>
  169. <hr />
  170. </>
  171. <div
  172. className="text-sm mt-2 font-medium mx-5"
  173. style={{ color: "#898d8d" }}
  174. >
  175. {t("Projected Cost Performance Index") + " (CPI)"}
  176. </div>
  177. <>
  178. <div
  179. className="text-lg font-medium mx-5 mb-2"
  180. style={Number(ProjectedCPI) < 1 && dataNegativeStyle || dataPositiveStyle}
  181. >
  182. {ProjectedCPI}
  183. </div>
  184. </>
  185. </Card>
  186. );
  187. };
  188. export default ProjectFinancialCard;