pramod_Task#207 Assign button hide and completedWork not editable if , > 0 #92
@ -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
|
||||
|
@ -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 && (
|
||||
<p className="danger-text">{errors.completedWork.message}</p>
|
||||
|
@ -23,7 +23,7 @@ const Floor = ({ floor, workAreas, forBuilding }) => {
|
||||
<span className="fw-semibold text-primary">
|
||||
Floor:
|
||||
</span>{" "}
|
||||
<span class="fw-normal text-darkgreen">
|
||||
<span className="fw-normal text-darkgreen">
|
||||
{floor.floorName}
|
||||
</span>
|
||||
</div>
|
||||
|
@ -69,7 +69,9 @@ const WorkArea = ({ workArea, floor, forBuilding }) => {
|
||||
</th>
|
||||
{/* ************************** */}
|
||||
<th className="infra-activity-table-header">Progress</th>
|
||||
<th className="infra-activity-table-header">Actions</th>
|
||||
<th className="infra-activity-table-header text-end ">
|
||||
<span className="px-3"> Actions</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="table-border-bottom-0">
|
||||
|
@ -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 }) => {
|
||||
></div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="d-md-table-cell">
|
||||
<div className="dropdown">
|
||||
{!projectId && ManageTasks && (
|
||||
<button
|
||||
aria-label="Modify"
|
||||
type="button"
|
||||
className="btn p-0"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#project-modal"
|
||||
onClick={openModal}
|
||||
>
|
||||
<span className="badge badge-md bg-label-primary me-1">
|
||||
Assign
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
{ManageInfra && (
|
||||
<>
|
||||
<button
|
||||
aria-label="Modify"
|
||||
type="button"
|
||||
className="btn p-0 dropdown-toggle hide-arrow"
|
||||
onClick={showModal1}
|
||||
>
|
||||
<i
|
||||
className="bx bxs-edit me-2 text-primary"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="Edit Activity"
|
||||
data-bs-original-title="Edit Activity"
|
||||
></i>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Delete"
|
||||
type="button"
|
||||
className="btn p-0 dropdown-toggle hide-arrow"
|
||||
onClick={showModalDelete}
|
||||
>
|
||||
<i
|
||||
className="bx bx-trash me-1 text-danger"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="Delete Activity"
|
||||
data-bs-original-title="Delete Activity"
|
||||
></i>
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="text-end align-middle">
|
||||
<div className="dropdown w-auto d-inline-flex align-items-center gap-1">
|
||||
{/* Reserve space for Assign button */}
|
||||
<div style={{ width: 'auto', minWidth: '60px' }}>
|
||||
{(!projectId && ManageTasks) && (PlannedWork !== CompletedWork) ? (
|
||||
<button
|
||||
aria-label="Modify"
|
||||
type="button"
|
||||
className="btn p-0"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#project-modal"
|
||||
onClick={openModal}
|
||||
>
|
||||
<span className="badge badge-md bg-label-primary me-1">Assign</span>
|
||||
</button>
|
||||
) : (
|
||||
// Hidden placeholder to preserve layout
|
||||
<span className="invisible">
|
||||
<span className="badge badge-md bg-label-primary me-1">Assign</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Edit and Delete buttons */}
|
||||
{ManageInfra && (
|
||||
<>
|
||||
<button
|
||||
aria-label="Modify"
|
||||
type="button"
|
||||
className="btn p-0"
|
||||
onClick={showModal1}
|
||||
>
|
||||
<i
|
||||
className="bx bxs-edit me-2 text-primary"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="Edit Activity"
|
||||
></i>
|
||||
</button>
|
||||
<button
|
||||
aria-label="Delete"
|
||||
type="button"
|
||||
className="btn p-0"
|
||||
onClick={showModalDelete}
|
||||
>
|
||||
<i
|
||||
className="bx bx-trash me-1 text-danger"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-placement="top"
|
||||
title="Delete Activity"
|
||||
></i>
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
</>
|
||||
);
|
||||
|
@ -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 (
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user