FPSMS-frontend
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.
 
 

139 lines
3.6 KiB

  1. "use client";
  2. import React, { useState } from "react";
  3. import dynamic from "next/dynamic";
  4. const ApexCharts = dynamic(() => import("react-apexcharts"), { ssr: false });
  5. import { useTranslation } from "react-i18next";
  6. const ApplicationCompletionChart: React.FC = () => {
  7. const { t } = useTranslation();
  8. const [tab, setTab] = useState(t("Store Management"));
  9. const percent = 0;
  10. const options = {
  11. chart: { type: "donut" as const },
  12. labels: [],
  13. colors: ["#42A5F5", "#e0e0e0"],
  14. dataLabels: {
  15. enabled: true,
  16. formatter: () => `${percent}%`,
  17. style: { fontSize: "32px", fontWeight: 600, color: "#1976d2" },
  18. },
  19. legend: { show: false },
  20. plotOptions: {
  21. pie: {
  22. donut: {
  23. size: "70%",
  24. labels: {
  25. show: false,
  26. },
  27. },
  28. },
  29. },
  30. stroke: { show: true, width: 2, colors: ["#fff"] },
  31. };
  32. return (
  33. <div
  34. style={{
  35. border: "1px solid #e0e0e0",
  36. borderRadius: 12,
  37. padding: 24,
  38. background: "#fff",
  39. boxShadow: "0 2px 8px rgba(0,0,0,0.04)",
  40. display: "flex",
  41. flexDirection: "column",
  42. alignItems: "center",
  43. }}
  44. >
  45. <div
  46. style={{
  47. width: "100%",
  48. fontWeight: 600,
  49. fontSize: 18,
  50. marginBottom: 12,
  51. display: "flex",
  52. alignItems: "center",
  53. }}
  54. >
  55. <span
  56. style={{
  57. flex: 1,
  58. whiteSpace: "nowrap",
  59. overflow: "hidden",
  60. textOverflow: "ellipsis",
  61. textAlign: "left",
  62. }}
  63. >
  64. {t("Application completion")}
  65. </span>
  66. <div>
  67. <button
  68. style={{
  69. border:
  70. tab === t("Raw MA")
  71. ? "1px solid #1976d2"
  72. : "1px solid #e0e0e0",
  73. background: tab === t("Store Management") ? "#fff" : "#f5f5f5",
  74. color: tab === t("Store Management") ? "#1976d2" : "#333",
  75. borderRadius: 4,
  76. padding: "2px 12px",
  77. marginRight: 4,
  78. cursor: "pointer",
  79. }}
  80. onClick={() => setTab(t("Store Management"))}
  81. >
  82. {t("Store Management")}
  83. </button>
  84. <button
  85. style={{
  86. border:
  87. tab === t("Shipment")
  88. ? "1px solid #1976d2"
  89. : "1px solid #e0e0e0",
  90. background: tab === t("Shipment") ? "#fff" : "#f5f5f5",
  91. color: tab === t("Shipment") ? "#1976d2" : "#333",
  92. borderRadius: 4,
  93. padding: "2px 12px",
  94. cursor: "pointer",
  95. }}
  96. onClick={() => setTab(t("Shipment"))}
  97. >
  98. {t("Shipment")}
  99. </button>
  100. </div>
  101. </div>
  102. <div
  103. style={{
  104. width: "100%",
  105. height: 320,
  106. display: "flex",
  107. alignItems: "center",
  108. justifyContent: "center",
  109. margin: "0 auto",
  110. }}
  111. >
  112. <ApexCharts
  113. options={options}
  114. series={[0, 100]}
  115. type="donut"
  116. width="100%"
  117. height={280}
  118. />
  119. </div>
  120. <div
  121. style={{
  122. marginTop: 16,
  123. textAlign: "left",
  124. border: "1px solid #e0e0e0",
  125. borderRadius: 8,
  126. padding: 12,
  127. background: "#fafafa",
  128. }}
  129. >
  130. <div>{t("Processed application")}: 0</div>
  131. <div>{t("Pending application")}: 0</div>
  132. </div>
  133. </div>
  134. );
  135. };
  136. export default ApplicationCompletionChart;