diff --git a/src/components/Project/Infrastructure/WorkArea.jsx b/src/components/Project/Infrastructure/WorkArea.jsx index cbe34dc5..69663630 100644 --- a/src/components/Project/Infrastructure/WorkArea.jsx +++ b/src/components/Project/Infrastructure/WorkArea.jsx @@ -6,11 +6,20 @@ import { useDispatch } from "react-redux"; import { refreshData } from "../../../slices/localVariablesSlice"; import ProjectRepository from "../../../repositories/ProjectRepository"; import showToast from "../../../services/toastService"; +import {useHasUserPermission} from "../../../hooks/useHasUserPermission"; +import {ASSIGN_REPORT_TASK, MANAGE_PROJECT_INFRA, MANAGE_TASK} from "../../../utils/constants"; +import {useParams} from "react-router-dom"; const WorkArea = ({ workArea, floor, forBuilding }) => { const [workItems, setWorkItems] = useState([]); const dispatch = useDispatch(); - const [Project, setProject] = useState(); + const [ Project, setProject ] = useState(); + const {projectId} = useParams(); + + const ManageTasks = useHasUserPermission(MANAGE_TASK); + const ManageInfra = useHasUserPermission(MANAGE_PROJECT_INFRA); + const ManageAndAssignTak = useHasUserPermission( ASSIGN_REPORT_TASK ); + useEffect(() => { const project = getCachedData("projectInfo"); @@ -170,7 +179,7 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { className="accordion-collapse collapse" aria-labelledby={`heading-${workArea.id}`} > -
+
@@ -189,9 +198,11 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { - + {( ManageInfra || ( !projectId && ManageAndAssignTak ) ) && ( + + )} diff --git a/src/components/Project/Infrastructure/WorkItem.jsx b/src/components/Project/Infrastructure/WorkItem.jsx index 9a694729..06303908 100644 --- a/src/components/Project/Infrastructure/WorkItem.jsx +++ b/src/components/Project/Infrastructure/WorkItem.jsx @@ -148,7 +148,7 @@ const WorkItem = ({ {hasWorkItem ? NewWorkItem?.workItem?.activityMaster?.activityName || - workItem.activityMaster?.activityName + workItem.activityMaster?.activityName : "NA"} @@ -157,8 +157,8 @@ const WorkItem = ({ {/* Progress Bar - always visible */} - + + + {/* Mobile (sm only): dropdown with icons */} +
+ + + +
+ + )} );
Progress - Actions - + Actions +
{hasWorkItem ? NewWorkItem?.workItem?.completedWork ?? - workItem?.completedWork ?? - "NA" + workItem?.completedWork ?? + "NA" : "NA"} /{" "} {hasWorkItem @@ -171,26 +171,28 @@ const WorkItem = ({ {hasWorkItem ? NewWorkItem?.workItem?.workCategoryMaster?.name || - workItem.workCategoryMaster?.name || - "NA" + workItem.workCategoryMaster?.name || + "NA" : "NA"} - {hasWorkItem ? ( - `${NewWorkItem?.workItem?.completedWork ?? - workItem?.completedWork ?? - "0"}/${NewWorkItem?.workItem?.plannedWork ?? - workItem?.plannedWork ?? - "0"}` - ) : ( - "NA" - )} + {hasWorkItem + ? `${ + NewWorkItem?.workItem?.completedWork ?? + workItem?.completedWork ?? + "0" + }/${ + NewWorkItem?.workItem?.plannedWork ?? + workItem?.plannedWork ?? + "0" + }` + : "NA"} +
{/* Actions - always visible */} -
- {/* Desktop (md and up): inline icons */} -
- {!projectId && - ManageAndAssignTak && - PlannedWork !== CompletedWork && ( - - )} - - {ManageInfra && ( - <> - - - - )} -
- - {/* Mobile (sm only): dropdown with icons */} -
- - - -
-