No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

238 líneas
7.3 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 ProjectFinancialCard: React.FC<Props> = ({
  37. Title,
  38. TotalActiveProjectNumber,
  39. TotalFees,
  40. TotalBudget,
  41. TotalCumulative,
  42. TotalInvoicedAmount,
  43. TotalUnInvoicedAmount,
  44. TotalReceivedAmount,
  45. CashFlowStatus,
  46. CostPerformanceIndex,
  47. ClickedIndex,
  48. ProjectedCPI,
  49. ProjectedCashFlowStatus,
  50. Index,
  51. }) => {
  52. const [SearchCriteria, setSearchCriteria] = React.useState({});
  53. const { t } = useTranslation("dashboard");
  54. const borderColor =
  55. CashFlowStatus === "Negative"
  56. ? "border-red-300 border-solid"
  57. : "border-green-200 border-solid";
  58. const selectedBackgroundColor =
  59. ClickedIndex === Index ? "rgb(235 235 235)" : "rgb(255 255 255)";
  60. return (
  61. <Card
  62. style={{
  63. maxWidth: "25%",
  64. minWidth: "280px",
  65. boxShadow:
  66. "0 0px 10px 0 rgba(0, 0, 0, 0.08), 0 0px 10px 0 rgba(0, 0, 0, 0.08)",
  67. backgroundColor: selectedBackgroundColor,
  68. }}
  69. className={`${borderColor}`}
  70. >
  71. <div
  72. className="text-xl mt-2 font-medium"
  73. style={{ width: "100%", textAlign: "center", color: "#898d8d" }}
  74. >
  75. {Title}
  76. </div>
  77. <hr />
  78. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  79. Total Active Project
  80. </div>
  81. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  82. {TotalActiveProjectNumber.toLocaleString()}
  83. </div>
  84. <hr />
  85. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  86. Total Fees
  87. </div>
  88. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  89. {TotalFees.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  90. </div>
  91. <hr />
  92. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  93. Total Budget
  94. </div>
  95. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  96. {TotalBudget.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  97. </div>
  98. <hr />
  99. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  100. Total Cumulative Expenditure
  101. </div>
  102. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  103. {TotalCumulative.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  104. </div>
  105. <hr />
  106. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  107. Total Invoiced Amount
  108. </div>
  109. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  110. {TotalInvoicedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  111. </div>
  112. <hr />
  113. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  114. Total Un-Invoiced Amount
  115. </div>
  116. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  117. {TotalUnInvoicedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  118. </div>
  119. <hr />
  120. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  121. Total Received Amount
  122. </div>
  123. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  124. {TotalReceivedAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
  125. </div>
  126. <hr />
  127. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  128. Cash Flow Status
  129. </div>
  130. {CashFlowStatus === "Negative" && (
  131. <>
  132. <div
  133. className="text-lg font-medium ml-5"
  134. style={{ color: "#f896aa" }}
  135. >
  136. {CashFlowStatus}
  137. </div>
  138. <hr />
  139. </>
  140. )}
  141. {CashFlowStatus === "Positive" && (
  142. <>
  143. <div
  144. className="text-lg font-medium ml-5"
  145. style={{ color: "#71d19e" }}
  146. >
  147. {CashFlowStatus}
  148. </div>
  149. <hr />
  150. </>
  151. )}
  152. <div
  153. className="text-sm mt-2 font-medium ml-5"
  154. style={{ color: "#898d8d" }}
  155. >
  156. Cost Performance Index (CPI)
  157. </div>
  158. {Number(CostPerformanceIndex) < 1 && (
  159. <>
  160. <div
  161. className="text-lg font-medium ml-5 mb-2"
  162. style={{ color: "#f896aa" }}
  163. >
  164. {CostPerformanceIndex}
  165. </div>
  166. <hr />
  167. </>
  168. )}
  169. {Number(CostPerformanceIndex) >= 1 && (
  170. <>
  171. <div
  172. className="text-lg font-medium ml-5 mb-2"
  173. style={{ color: "#71d19e" }}
  174. >
  175. {CostPerformanceIndex}
  176. </div>
  177. <hr />
  178. </>
  179. )}
  180. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  181. Projected Cash Flow Status
  182. </div>
  183. {ProjectedCashFlowStatus === "Negative" && (
  184. <>
  185. <div
  186. className="text-lg font-medium ml-5"
  187. style={{ color: "#f896aa" }}
  188. >
  189. {ProjectedCashFlowStatus}
  190. </div>
  191. <hr />
  192. </>
  193. )}
  194. {ProjectedCashFlowStatus === "Positive" && (
  195. <>
  196. <div
  197. className="text-lg font-medium ml-5"
  198. style={{ color: "#71d19e" }}
  199. >
  200. {ProjectedCashFlowStatus}
  201. </div>
  202. <hr />
  203. </>
  204. )}
  205. <div
  206. className="text-sm mt-2 font-medium ml-5"
  207. style={{ color: "#898d8d" }}
  208. >
  209. Projected Cost Performance Index (CPI)
  210. </div>
  211. {Number(ProjectedCPI) < 1 && (
  212. <>
  213. <div
  214. className="text-lg font-medium ml-5 mb-2"
  215. style={{ color: "#f896aa" }}
  216. >
  217. {ProjectedCPI}
  218. </div>
  219. </>
  220. )}
  221. {Number(ProjectedCPI) >= 1 && (
  222. <>
  223. <div
  224. className="text-lg font-medium ml-5 mb-2"
  225. style={{ color: "#71d19e" }}
  226. >
  227. {ProjectedCPI}
  228. </div>
  229. </>
  230. )}
  231. </Card>
  232. );
  233. };
  234. export default ProjectFinancialCard;