diff --git a/src/components/Dashboard/ProjectCompletionChart.jsx b/src/components/Dashboard/ProjectCompletionChart.jsx index 98ee1d3b..baeb370c 100644 --- a/src/components/Dashboard/ProjectCompletionChart.jsx +++ b/src/components/Dashboard/ProjectCompletionChart.jsx @@ -3,11 +3,16 @@ import HorizontalBarChart from "../Charts/HorizontalBarChart"; import { useProjects } from "../../hooks/useProjects"; const ProjectCompletionChart = () => { - const { data: projects = [], isLoading: loading, isError, error } = useProjects(); + const { data, isLoading: loading } = useProjects(); + const projects = Array.isArray(data) + ? data + : data?.data && Array.isArray(data.data) + ? data.data + : []; // Bar chart logic - const projectNames = projects?.map((p) => p.name) || []; + const projectNames = projects?.map((p) => p.name) ?? []; const projectProgress = projects?.map((p) => { const completed = p.completedWork || 0; diff --git a/src/components/reports/ActivitiesTable.jsx b/src/components/reports/ActivitiesTable.jsx new file mode 100644 index 00000000..ba2cc629 --- /dev/null +++ b/src/components/reports/ActivitiesTable.jsx @@ -0,0 +1,31 @@ +const ActivitiesTable = ({ date, rows }) => { + return ( +
+

Activities (Tasks) Performed {date}

+ + + + + + + + + + + + + {rows.map((row, i) => ( + + + + + + + ))} + +
NAMEJOB ROLECHECK INCHECK OUT
{row.name}{row.role}{row.in}{row.out}
+
+ ); +}; + +export default ActivitiesTable; diff --git a/src/components/reports/Progress.jsx b/src/components/reports/Progress.jsx new file mode 100644 index 00000000..d620ac11 --- /dev/null +++ b/src/components/reports/Progress.jsx @@ -0,0 +1,52 @@ +import React from "react"; +import Chart from "react-apexcharts"; + +const Progress = ({ + color = "#00aaff", + series = 40, + progress_variant = "success", + height = 130, +}) => { + const options = { + chart: { + type: "radialBar", + }, + colors: [color], + + plotOptions: { + radialBar: { + hollow: { + size: "55%", + }, + track: { + background: "#f1f1f1", + }, + + dataLabels: { + name: { show: false }, + value: { + show: true, + fontSize: "18px", + fontWeight: 600, + offsetY: 7, + offsetY:7, + formatter: () => `${series}%`, + }, + }, + }, + }, + + stroke: { lineCap: "round" }, + }; + + return ( + + ); +}; + +export default Progress; diff --git a/src/components/reports/ReportsDonutCard.jsx b/src/components/reports/ReportsDonutCard.jsx new file mode 100644 index 00000000..61f61382 --- /dev/null +++ b/src/components/reports/ReportsDonutCard.jsx @@ -0,0 +1,41 @@ +import ReportsLegend from "./ReportsLegend"; + +const ReportsDonutCard = ({ + title, + percentage, + value, + donutClass = "", + footer = "Team members present on the site" +}) => { + return ( +
+

{title}

+ +
+
+
+ {value} +
+
+ + +
+ +
+

{footer}

+
+
+ ); +}; + +export default ReportsDonutCard; diff --git a/src/components/reports/ReportsLegend.jsx b/src/components/reports/ReportsLegend.jsx new file mode 100644 index 00000000..45eecde7 --- /dev/null +++ b/src/components/reports/ReportsLegend.jsx @@ -0,0 +1,22 @@ +const ReportsLegend = () => { + return ( +
+
+ + Completed +
+ +
+ + In Progress +
+ +
+ + Pending +
+
+ ); +}; + +export default ReportsLegend; diff --git a/src/components/reports/TeamStrengthCard.jsx b/src/components/reports/TeamStrengthCard.jsx new file mode 100644 index 00000000..0b025f01 --- /dev/null +++ b/src/components/reports/TeamStrengthCard.jsx @@ -0,0 +1,20 @@ +const TeamStrengthCard = ({ data }) => { + return ( +
+

Team Strength on Site

+ + + + {data.map((item, i) => ( + + + + + ))} + +
{item.role}{item.count}
+
+ ); +}; + +export default TeamStrengthCard; diff --git a/src/components/reports/report-dpr.jsx b/src/components/reports/report-dpr.jsx index 8b1d76ca..6dc8dedf 100644 --- a/src/components/reports/report-dpr.jsx +++ b/src/components/reports/report-dpr.jsx @@ -1,12 +1,19 @@ import React from "react"; +import { useProjectReportByProject } from "../../hooks/useReports"; +import Progress from "./Progress"; +import { formatUTCToLocalTime } from "../../utils/dateUtils"; -const ReportDPR = () => { +const ReportDPR = ({ project, day }) => { + const { data, isLoading, isError, error } = + useProjectReportByProject(project); + console.log(data); return ( <> {" "} -
+
+ {/*
*/} {/*