removed condiational vaiable and added tooltip for edit and delet icon.

This commit is contained in:
Pramod Mahajan 2025-04-20 13:49:05 +05:30
parent 1b03ea646d
commit 5663a0f071

View File

@ -32,6 +32,11 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => {
}; };
const hasWorkItem = NewWorkItem && NewWorkItem; const hasWorkItem = NewWorkItem && NewWorkItem;
useEffect(() => {
const tooltipTriggerList = Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.forEach((el) => new bootstrap.Tooltip(el));
}, []);
return ( return (
<> <>
@ -56,10 +61,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => {
</td> </td>
{/* for mobile view */} {/* for mobile view */}
<td className="text-center d-sm-none d-sm-table-cell"> <td className="text-center d-sm-none d-sm-table-cell">
{hasWorkItem {NewWorkItem?.workItem?.completedWork}/{" "}
? NewWorkItem?.workItem?.completedWork || workItem?.completedWork
: "NA"}
/{" "}
{hasWorkItem {hasWorkItem
? NewWorkItem?.workItem?.plannedWork || workItem?.plannedWork ? NewWorkItem?.workItem?.plannedWork || workItem?.plannedWork
: "NA"} : "NA"}
@ -71,9 +73,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => {
: "NA"} : "NA"}
</td> </td>
<td className="text-center d-none d-md-table-cell"> <td className="text-center d-none d-md-table-cell">
{hasWorkItem {NewWorkItem?.workItem?.completedWork}
? NewWorkItem?.workItem?.completedWork || workItem?.completedWork
: "NA"}
</td> </td>
{/* ************************************************ */} {/* ************************************************ */}
<td className="text-center" style={{ width: "15%" }}> <td className="text-center" style={{ width: "15%" }}>
@ -89,12 +89,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => {
), ),
height: "5px", height: "5px",
}} }}
aria-valuenow={ aria-valuenow={NewWorkItem?.workItem?.completedWor}
hasWorkItem
? NewWorkItem?.workItem?.completedWork ||
workItem?.completedWork
: 0
}
aria-valuemin="0" aria-valuemin="0"
aria-valuemax={ aria-valuemax={
hasWorkItem hasWorkItem
@ -126,14 +121,23 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => {
type="button" type="button"
className="btn p-0 dropdown-toggle hide-arrow" className="btn p-0 dropdown-toggle hide-arrow"
> >
<i className="bx bxs-edit me-2 text-primary"></i> <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>
<button <button
aria-label="Delete" aria-label="Delete"
type="button" type="button"
className="btn p-0 dropdown-toggle hide-arrow" className="btn p-0 dropdown-toggle hide-arrow"
> >
<i className="bx bx-trash me-1 text-danger"></i> <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> </button>
</div> </div>
</td> </td>
@ -149,7 +153,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => {
<div className="dropdown-menu dropdown-menu-end m-0"> <div className="dropdown-menu dropdown-menu-end m-0">
{" "} {" "}
<a className="dropdown-item"> <a className="dropdown-item ">
{" "} {" "}
<i className="bx bxs-edit me-2 text-primary"></i>Edit <i className="bx bxs-edit me-2 text-primary"></i>Edit
</a> </a>