diff --git a/src/components/Activities/CheckCheckOutForm.jsx b/src/components/Activities/CheckCheckOutForm.jsx index 419e7b12..b820233d 100644 --- a/src/components/Activities/CheckCheckOutForm.jsx +++ b/src/components/Activities/CheckCheckOutForm.jsx @@ -50,8 +50,11 @@ const CheckCheckOutmodel = ({modeldata,closeModal,handleSubmitForm,}) => { showToast("Attendance Marked Successfully", "success"); }) - .catch((error) => { - showToast(error, "error"); + .catch( ( error ) => + { + + showToast(error, "error" ); + }); // } else diff --git a/src/components/Project/Infrastructure/EditActivityModal.jsx b/src/components/Project/Infrastructure/EditActivityModal.jsx index a0077e26..e8927ae3 100644 --- a/src/components/Project/Infrastructure/EditActivityModal.jsx +++ b/src/components/Project/Infrastructure/EditActivityModal.jsx @@ -303,6 +303,7 @@ const EditActivityModal = ({ type="number" className="form-control form-control-sm me-2" placeholder="Completed Work" + disabled={getValues("completedWork") > 0} /> {errors.completedWork && (

{errors.completedWork.message}

diff --git a/src/components/Project/Infrastructure/Floor.jsx b/src/components/Project/Infrastructure/Floor.jsx index f59fece2..fe015b16 100644 --- a/src/components/Project/Infrastructure/Floor.jsx +++ b/src/components/Project/Infrastructure/Floor.jsx @@ -23,7 +23,7 @@ const Floor = ({ floor, workAreas, forBuilding }) => { Floor:  {" "} - + {floor.floorName} diff --git a/src/components/Project/Infrastructure/WorkArea.jsx b/src/components/Project/Infrastructure/WorkArea.jsx index 8ac3ef60..493312b1 100644 --- a/src/components/Project/Infrastructure/WorkArea.jsx +++ b/src/components/Project/Infrastructure/WorkArea.jsx @@ -69,7 +69,9 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { {/* ************************** */} Progress - Actions + + Actions + diff --git a/src/components/Project/Infrastructure/WorkItem.jsx b/src/components/Project/Infrastructure/WorkItem.jsx index 7a7dfb38..0b050068 100644 --- a/src/components/Project/Infrastructure/WorkItem.jsx +++ b/src/components/Project/Infrastructure/WorkItem.jsx @@ -119,6 +119,9 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { showToast(message, "error"); } }; + + const PlannedWork = NewWorkItem?.workItem?.plannedWork || workItem?.plannedWork; + const CompletedWork = NewWorkItem?.workItem?.completedWork ?? workItem?.completedWork; return ( <> {isModalOpen && ( @@ -233,56 +236,65 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { > - -
- {!projectId && ManageTasks && ( - - )} - {ManageInfra && ( - <> - - - - )} -
- + +
+ {/* Reserve space for Assign button */} +
+ {(!projectId && ManageTasks) && (PlannedWork !== CompletedWork) ? ( + + ) : ( + // Hidden placeholder to preserve layout + + Assign + + )} +
+ + {/* Edit and Delete buttons */} + {ManageInfra && ( + <> + + + + )} +
+ + + + ); diff --git a/src/components/common/TimePicker.jsx b/src/components/common/TimePicker.jsx index cb76a5d1..7676e013 100644 --- a/src/components/common/TimePicker.jsx +++ b/src/components/common/TimePicker.jsx @@ -120,15 +120,21 @@ const TimePicker = ({ label, onChange, interval = 10, value,checkInTime,checkOut }, [value, interval, onChange]); - useEffect(() => { - if (isOpen && time && slotRefs.current[time]) { - const selectedSlot = slotRefs.current[time]; - selectedSlot.scrollIntoView({ + useEffect(() => { + if (isOpen) { + const slots = generateTimeSlots(); + const targetTime = slots.find(slot => slot.time === time && slot.isSelectable) + ? time + : (slots.find(slot => slot.isSelectable)?.time || null); + + if (targetTime && slotRefs.current[targetTime]) { + slotRefs.current[targetTime].scrollIntoView({ behavior: "smooth", block: "center", }); } - }, [isOpen, time]); + } +}, [isOpen, time]); return ( diff --git a/src/slices/apiSlice/attedanceLogsSlice.js b/src/slices/apiSlice/attedanceLogsSlice.js index e09ab294..249d5445 100644 --- a/src/slices/apiSlice/attedanceLogsSlice.js +++ b/src/slices/apiSlice/attedanceLogsSlice.js @@ -38,8 +38,10 @@ export const markAttendance = createAsyncThunk( const response = await AttendanceRepository.markAttendance( newRecordAttendance ); return response.data; - } catch (error) { - return thunkAPI.rejectWithValue(error.message); + } catch ( error ) + { + const message = error?.response?.data?.message || error.message || "Error Occured During Api Call"; + return thunkAPI.rejectWithValue(message); } } ); diff --git a/src/utils/dateUtils.jsx b/src/utils/dateUtils.jsx index f18efd0f..cb393e41 100644 --- a/src/utils/dateUtils.jsx +++ b/src/utils/dateUtils.jsx @@ -41,7 +41,7 @@ export const convertShortTime = (dateString) => { }; export const timeElapsed = (checkInTime, timeElapsedInHours) => { - const checkInDate = new Date(checkInTime); + const checkInDate = new Date( checkInTime.split( "T" )[ 0 ] ); const currentTime = new Date();