diff --git a/src/components/Charts/ProgressDonutChart.jsx b/src/components/Charts/ProgressDonutChart.jsx new file mode 100644 index 00000000..04cd8a22 --- /dev/null +++ b/src/components/Charts/ProgressDonutChart.jsx @@ -0,0 +1,79 @@ +import React from "react"; +import ReactApexChart from "react-apexcharts"; + +const ProgressDonutChart = ({ completed = 0, planned = 1 }) => { + const percentage = planned > 0 ? Math.round((completed / planned) * 100) : 0; + + const options = { + chart: { + height: 10, + type: "radialBar", + toolbar: { show: false }, + }, + plotOptions: { + radialBar: { + startAngle: 0, + endAngle: 360, + hollow: { + margin: 0, + size: "10%", + background: "#fff", + dropShadow: { + enabled: true, + top: 0, + left: 0, + blur: 3, + opacity: 0.45, + }, + }, + track: { + background: "#f5f5f5", + strokeWidth: "10%", + dropShadow: { enabled: false }, + }, + dataLabels: { + show: true, + name: { + offsetY: -10, + color: "#888", + fontSize: "14px", + }, + value: { + formatter: (val) => `${val}%`, + color: "#111", + fontSize: "11px", + show: true, + }, + }, + }, + }, + fill: { + type: "gradient", + gradient: { + shade: "dark", + type: "horizontal", + shadeIntensity: 0.5, + gradientToColors: ["#ABE5A1"], + opacityFrom: 1, + opacityTo: 1, + stops: [0, 100], + }, + }, + stroke: { + lineCap: "round", + }, + }; + + return ( +
+ +
+ ); +}; + +export default ProgressDonutChart; diff --git a/src/components/Project/Infrastructure/Floor.jsx b/src/components/Project/Infrastructure/Floor.jsx index 316391dd..5288ce16 100644 --- a/src/components/Project/Infrastructure/Floor.jsx +++ b/src/components/Project/Infrastructure/Floor.jsx @@ -13,10 +13,10 @@ const Floor = ({ floor, workAreas, forBuilding }) => { /> )) ) : ( - + -
- {/*
+
+ {/*
*/}
-
+
{" "} Floor:  @@ -34,6 +34,13 @@ const Floor = ({ floor, workAreas, forBuilding }) => { {floor.floorName}
+
+ {" "} + + Work Area:  + {" "} + Not Available +
diff --git a/src/components/Project/Infrastructure/InfraTable.jsx b/src/components/Project/Infrastructure/InfraTable.jsx index 30410c6c..4b1e863f 100644 --- a/src/components/Project/Infrastructure/InfraTable.jsx +++ b/src/components/Project/Infrastructure/InfraTable.jsx @@ -68,7 +68,6 @@ const InfraTable = ({ buildings }) => { showToast("Failed to save floor", "error"); } } catch (err) { - showToast("Error occurred while saving floor", "error"); } }; @@ -95,14 +94,14 @@ const InfraTable = ({ buildings }) => { No floors have been added yet. Start by adding floors to manage this building.

- + */}
diff --git a/src/components/Project/Infrastructure/WorkArea.jsx b/src/components/Project/Infrastructure/WorkArea.jsx index 65c9e04b..d9fc3580 100644 --- a/src/components/Project/Infrastructure/WorkArea.jsx +++ b/src/components/Project/Infrastructure/WorkArea.jsx @@ -13,6 +13,9 @@ import { MANAGE_TASK, } from "../../../utils/constants"; import { useParams } from "react-router-dom"; +import ProgressDonutChart from "../../Charts/ProgressDonutChart"; +import ProgressBar from "../../common/ProgressBar"; +import { componentsToColor } from "pdf-lib"; const WorkArea = ({ workArea, floor, forBuilding }) => { const [workItems, setWorkItems] = useState([]); @@ -24,7 +27,10 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { const ManageInfra = useHasUserPermission(MANAGE_PROJECT_INFRA); const ManageAndAssignTak = useHasUserPermission(ASSIGN_REPORT_TASK); - const [percentComplete, setPercentComplete] = useState(0); + const [workAreaStatus, setWorkAreaStatus] = useState({ + completed: 0, + planned: 100, + }); useEffect(() => { const totalCompleted = workItems.reduce( @@ -37,7 +43,8 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { ); const percent = totalPlanned > 0 ? (totalCompleted / totalPlanned) * 100 : 0; - setPercentComplete(Math.min(percent, 100)); // cap at 100% + //setPercentComplete(Math.min(percent, 100)); // cap at 100% + setWorkAreaStatus({ completed: totalCompleted, planned: totalPlanned }); }, [workItems]); useEffect(() => { @@ -172,26 +179,32 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { }} > -
-
- Floor:  - +
+
+ + Floor: + + {floor.floorName}
-
+
- Work Area:  + Work Area: - + {workArea.areaName} - {workArea?.workItems?.length > 0 && ( - - {percentComplete.toFixed(2) + "%"} - - )}
+ {workArea?.workItems?.length > 0 && ( +
+ +
+ )}