You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

174 lines
5.1 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: string;
  23. TotalFees: string;
  24. TotalBudget: string;
  25. TotalCumulative: string;
  26. TotalInvoicedAmount: string;
  27. TotalReceivedAmount: string;
  28. CashFlowStatus: string;
  29. CostPerformanceIndex: string;
  30. ClickedIndex: number;
  31. Index: number;
  32. }
  33. const ProjectFinancialCard: React.FC<Props> = ({
  34. Title,
  35. TotalActiveProjectNumber,
  36. TotalFees,
  37. TotalBudget,
  38. TotalCumulative,
  39. TotalInvoicedAmount,
  40. TotalReceivedAmount,
  41. CashFlowStatus,
  42. CostPerformanceIndex,
  43. ClickedIndex,
  44. Index,
  45. }) => {
  46. const [SearchCriteria, setSearchCriteria] = React.useState({});
  47. const { t } = useTranslation("dashboard");
  48. const borderColor =
  49. CashFlowStatus === "Negative"
  50. ? "border-red-300 border-solid"
  51. : "border-green-200 border-solid";
  52. const selectedBackgroundColor =
  53. ClickedIndex === Index ? "rgb(235 235 235)" : "rgb(255 255 255)";
  54. console.log(ClickedIndex);
  55. console.log(Index);
  56. return (
  57. <Card
  58. style={{
  59. maxWidth: "25%",
  60. minWidth: "280px",
  61. boxShadow:
  62. "0 0px 10px 0 rgba(0, 0, 0, 0.08), 0 0px 10px 0 rgba(0, 0, 0, 0.08)",
  63. backgroundColor: selectedBackgroundColor,
  64. }}
  65. className={`${borderColor}`}
  66. >
  67. <div
  68. className="text-xl mt-2 font-medium"
  69. style={{ width: "100%", textAlign: "center", color: "#898d8d" }}
  70. >
  71. {Title}
  72. </div>
  73. <hr />
  74. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  75. Total Active Project
  76. </div>
  77. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  78. {TotalActiveProjectNumber}
  79. </div>
  80. <hr />
  81. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  82. Total Fees
  83. </div>
  84. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  85. {TotalFees}
  86. </div>
  87. <hr />
  88. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  89. Total Budget
  90. </div>
  91. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  92. {TotalBudget}
  93. </div>
  94. <hr />
  95. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  96. Total Cumulative Expenditure
  97. </div>
  98. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  99. {TotalCumulative}
  100. </div>
  101. <hr />
  102. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  103. Total Invoiced Amount
  104. </div>
  105. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  106. {TotalInvoicedAmount}
  107. </div>
  108. <hr />
  109. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  110. Total Received Amount
  111. </div>
  112. <div className="text-lg font-medium ml-5" style={{ color: "#6b87cf" }}>
  113. {TotalReceivedAmount}
  114. </div>
  115. <hr />
  116. <div className="text-sm font-medium ml-5" style={{ color: "#898d8d" }}>
  117. Cash Flow Status
  118. </div>
  119. {CashFlowStatus === "Negative" && (
  120. <>
  121. <div
  122. className="text-lg font-medium ml-5"
  123. style={{ color: "#f896aa" }}
  124. >
  125. {CashFlowStatus}
  126. </div>
  127. <hr />
  128. </>
  129. )}
  130. {CashFlowStatus === "Positive" && (
  131. <>
  132. <div
  133. className="text-lg font-medium ml-5"
  134. style={{ color: "#71d19e" }}
  135. >
  136. {CashFlowStatus}
  137. </div>
  138. <hr />
  139. </>
  140. )}
  141. <div
  142. className="text-sm mt-2 font-medium ml-5"
  143. style={{ color: "#898d8d" }}
  144. >
  145. Cost Performance Index (CPI)
  146. </div>
  147. {Number(CostPerformanceIndex) < 1 && (
  148. <>
  149. <div
  150. className="text-lg font-medium ml-5 mb-2"
  151. style={{ color: "#f896aa" }}
  152. >
  153. {CostPerformanceIndex}
  154. </div>
  155. </>
  156. )}
  157. {Number(CostPerformanceIndex) >= 1 && (
  158. <>
  159. <div
  160. className="text-lg font-medium ml-5 mb-2"
  161. style={{ color: "#71d19e" }}
  162. >
  163. {CostPerformanceIndex}
  164. </div>
  165. </>
  166. )}
  167. </Card>
  168. );
  169. };
  170. export default ProjectFinancialCard;