diff --git a/src/components/common/DatePicker.jsx b/src/components/common/DatePicker.jsx
index 9a3890fa..ddff1991 100644
--- a/src/components/common/DatePicker.jsx
+++ b/src/components/common/DatePicker.jsx
@@ -3,6 +3,7 @@ import { useController } from "react-hook-form";
const DatePicker = ({
name,
+ defaultDate,
control,
placeholder = "DD-MM-YYYY",
className = "",
diff --git a/src/components/reports/Progress.jsx b/src/components/reports/Progress.jsx
index d620ac11..882c97df 100644
--- a/src/components/reports/Progress.jsx
+++ b/src/components/reports/Progress.jsx
@@ -1,52 +1,114 @@
import React from "react";
import Chart from "react-apexcharts";
+import { formatFigure } from "../../utils/appUtils";
const Progress = ({
color = "#00aaff",
- series = 40,
- progress_variant = "success",
- height = 130,
+ series = 0,
+ total = 0,
+ height = 100,
+ width = 100,
+ completed =0,
}) => {
const options = {
chart: {
type: "radialBar",
},
colors: [color],
-
plotOptions: {
radialBar: {
- hollow: {
- size: "55%",
- },
- track: {
- background: "#f1f1f1",
- },
-
+ hollow: { size: "55%" },
+ track: { background: "#f1f1f1" },
dataLabels: {
name: { show: false },
value: {
show: true,
- fontSize: "18px",
+ fontSize: "13px",
+ color: color,
fontWeight: 600,
offsetY: 7,
- offsetY:7,
- formatter: () => `${series}%`,
+ formatter: () => `${formatFigure(completed,{notation:"compact"})} / ${formatFigure(total,{notation:"compact"})}`,
},
},
},
},
-
stroke: { lineCap: "round" },
};
return (
-
+
+
+
);
};
-
export default Progress;
+
+
+// const Progress = ({
+// completed = 0,
+// inProgress = 0,
+// total = 100,
+// height = 140,
+// width = 140,
+// }) => {
+// const completedPercent =
+// total > 0 ? Math.round((completed / total) * 100) : 0;
+
+// const progressPercent =
+// total > 0 ? Math.round((completed / total) * 100) : 0;
+
+// const options = {
+// chart: {
+// type: "radialBar",
+// },
+
+// colors: ["#28a745", "#0d6efd"],
+
+// plotOptions: {
+// radialBar: {
+// hollow: {
+// size: "35%",
+// },
+
+// track: {
+// margin: 4,
+// },
+
+// dataLabels: {
+// name: { show: false },
+
+// value: {
+// show: true,
+// fontSize: "14px",
+// fontWeight: 600,
+// offsetY: 5,
+// formatter: () => `${completed + inProgress}/${total}`,
+// },
+// },
+// },
+// },
+
+// labels: ["Completed", "In Progress"],
+// stroke: {
+// lineCap: "round",
+// },
+// };
+
+// return (
+//
+//
+//
+// );
+// };
diff --git a/src/components/reports/ReportsDonutCard.jsx b/src/components/reports/ReportsDonutCard.jsx
index 61f61382..d922c4cc 100644
--- a/src/components/reports/ReportsDonutCard.jsx
+++ b/src/components/reports/ReportsDonutCard.jsx
@@ -1,41 +1,66 @@
+import { getCompletionPercentage } from "../../utils/dateUtils";
+import Progress from "./Progress";
import ReportsLegend from "./ReportsLegend";
const ReportsDonutCard = ({
title,
- percentage,
value,
+ total,
donutClass = "",
- footer = "Team members present on the site"
+ footer = "Team members present on the site",
+ chartColor,
}) => {
return (
-
+
{title}
-
-
-
- {value}
-
+
-
);
};
export default ReportsDonutCard;
+
+export const ReportsCard = ({
+ title,
+ value,
+ total,
+ donutClass = "",
+ footer = "Team members present on the site",
+ chartColor,
+}) => {
+ return (
+
+ );
+};
+
+
diff --git a/src/components/reports/ReportsLegend.jsx b/src/components/reports/ReportsLegend.jsx
index 45eecde7..cd2a533c 100644
--- a/src/components/reports/ReportsLegend.jsx
+++ b/src/components/reports/ReportsLegend.jsx
@@ -1,19 +1,19 @@
const ReportsLegend = () => {
return (
-
-
-
- Completed
+
+
+
+ Completed
-
-
- In Progress
+
+
+ In Progress
-
-
- Pending
+
+
+ Pending
);
diff --git a/src/components/reports/report-dpr.jsx b/src/components/reports/report-dpr.jsx
index 6dc8dedf..c9f7f66d 100644
--- a/src/components/reports/report-dpr.jsx
+++ b/src/components/reports/report-dpr.jsx
@@ -2,794 +2,69 @@ import React from "react";
import { useProjectReportByProject } from "../../hooks/useReports";
import Progress from "./Progress";
import { formatUTCToLocalTime } from "../../utils/dateUtils";
+import { localToUtc } from "../../utils/appUtils";
+import ReportsDonutCard, { ReportsCard } from "./ReportsDonutCard";
-const ReportDPR = ({ project, day }) => {
- const { data, isLoading, isError, error } =
- useProjectReportByProject(project);
- console.log(data);
+const ReportDPR = ({ project, date }) => {
+ const { data, isLoading, isError, error } = useProjectReportByProject(
+ project,
+ localToUtc(date)
+ );
return (
<>
- {" "}