Changes in during a merge
This commit is contained in:
parent
527e052786
commit
d7986e4af4
@ -88,6 +88,8 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
|
|
||||||
// Changed to an array to hold multiple selected roles
|
// Changed to an array to hold multiple selected roles
|
||||||
const [selectedRoles, setSelectedRoles] = useState(["all"]);
|
const [selectedRoles, setSelectedRoles] = useState(["all"]);
|
||||||
|
// Changed to an array to hold multiple selected roles
|
||||||
|
// const [selectedRoles, setSelectedRoles] = useState(["all"]);
|
||||||
const [displayedSelection, setDisplayedSelection] = useState("");
|
const [displayedSelection, setDisplayedSelection] = useState("");
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
@ -224,314 +226,337 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">
|
<div className="fs-5 text-dark text-center d-flex align-items-center justify-content-center flex-wrap">
|
||||||
<p className="align-items-center flex-wrap m-0 ">Assign Task</p>
|
<p className="align-items-center flex-wrap m-0 ">Assign Task</p>
|
||||||
<div className="container my-3">
|
<div className="container my-3">
|
||||||
<div className="mb-1">
|
<div className="mb-1">
|
||||||
<p className="mb-0">
|
<p className="mb-0">
|
||||||
<span className="text-dark text-start d-flex align-items-center flex-wrap form-text">
|
<span className="text-dark text-start d-flex align-items-center flex-wrap form-text">
|
||||||
<span className="me-2 m-0 font-bold">Work Location :</span>
|
<span className="me-2 m-0 fw-bold">Work Location :</span> {/* Changed font-bold to fw-bold */}
|
||||||
{[
|
{[
|
||||||
assignData?.building?.buildingName,
|
assignData?.building?.buildingName,
|
||||||
assignData?.floor?.floorName,
|
assignData?.floor?.floorName,
|
||||||
assignData?.workArea?.areaName,
|
assignData?.workArea?.areaName,
|
||||||
assignData?.workItem?.activityMaster?.activityName,
|
assignData?.workItem?.activityMaster?.activityName,
|
||||||
]
|
]
|
||||||
.filter(Boolean) // Filter out any undefined/null values
|
.filter(Boolean) // Filter out any undefined/null values
|
||||||
.map((item, index, array) => (
|
.map((item, index, array) => (
|
||||||
<span key={index} className="d-flex align-items-center">
|
<span key={index} className="d-flex align-items-center">
|
||||||
{item}
|
{item}
|
||||||
{index < array.length - 1 && (
|
{index < array.length - 1 && (
|
||||||
<i className="bx bx-chevron-right mx-2"></i>
|
<i className="bx bx-chevron-right mx-2"></i>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className="form-label text-start">
|
<div className="form-label text-start">
|
||||||
<div className="row mb-1">
|
<div className="row mb-1">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="form-text text-start">
|
<div className="form-text text-start">
|
||||||
<div className="d-flex align-items-center form-text fs-7">
|
<div className="d-flex align-items-center form-text fs-7">
|
||||||
<span className="text-dark">Select Team</span>
|
<span className="text-dark">Select Team</span>
|
||||||
<div className="dropdown position-relative d-inline-block">
|
<div className="dropdown position-relative d-inline-block">
|
||||||
<a
|
<a
|
||||||
className={`dropdown-toggle hide-arrow cursor-pointer ${selectedRoles.includes("all") || selectedRoles.length === 0
|
className={`dropdown-toggle hide-arrow cursor-pointer ${
|
||||||
? "text-secondary"
|
selectedRoles.includes("all") || selectedRoles.length === 0
|
||||||
: "text-primary"
|
? "text-secondary"
|
||||||
}`}
|
: "text-primary"
|
||||||
data-bs-toggle="dropdown"
|
}`}
|
||||||
role="button"
|
data-bs-toggle="dropdown"
|
||||||
aria-expanded="false"
|
role="button"
|
||||||
>
|
aria-expanded="false"
|
||||||
<i className="bx bx-slider-alt ms-2"></i>
|
>
|
||||||
</a>
|
<i className="bx bx-slider-alt ms-2"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
{/* Badge */}
|
{/* Badge */}
|
||||||
{selectedRolesCount > 0 && (
|
{selectedRolesCount > 0 && (
|
||||||
<span
|
<span
|
||||||
className="position-absolute top-0 start-100 translate-middle badge rounded-circle bg-warning text-white"
|
className="position-absolute top-0 start-100 translate-middle badge rounded-circle bg-warning text-white"
|
||||||
style={{
|
style={{
|
||||||
fontSize: "0.65rem",
|
fontSize: "0.65rem",
|
||||||
minWidth: "18px",
|
minWidth: "18px",
|
||||||
height: "18px",
|
height: "18px",
|
||||||
padding: "0",
|
padding: "0",
|
||||||
lineHeight: "18px",
|
lineHeight: "18px",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
}}
|
}}
|
||||||
>
|
|
||||||
{selectedRolesCount}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Dropdown Menu */}
|
|
||||||
<ul
|
|
||||||
className="dropdown-menu p-2 text-capitalize "
|
|
||||||
>
|
|
||||||
<li key="all">
|
|
||||||
<div className="form-check dropdown-item py-0">
|
|
||||||
<input
|
|
||||||
className="form-check-input"
|
|
||||||
type="checkbox"
|
|
||||||
id="checkboxAllRoles"
|
|
||||||
value="all"
|
|
||||||
checked={selectedRoles.includes("all")}
|
|
||||||
onChange={(e) => handleRoleChange(e, e.target.value)}
|
|
||||||
/>
|
|
||||||
<label className="form-check-label ms-2" htmlFor="checkboxAllRoles">
|
|
||||||
All Roles
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{jobRolesForDropdown?.map((role) => (
|
|
||||||
<li key={role.id}>
|
|
||||||
<div className="form-check dropdown-item py-0">
|
|
||||||
<input
|
|
||||||
className="form-check-input"
|
|
||||||
type="checkbox"
|
|
||||||
id={`checkboxRole-${role.id}`}
|
|
||||||
value={role.id}
|
|
||||||
checked={selectedRoles.includes(String(role.id))}
|
|
||||||
onChange={(e) => handleRoleChange(e, e.target.value)}
|
|
||||||
/>
|
|
||||||
<label className="form-check-label ms-2" htmlFor={`checkboxRole-${role.id}`}>
|
|
||||||
{role.name}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<ul
|
|
||||||
className="dropdown-menu p-2 text-capitalize"
|
|
||||||
style={{ maxHeight: "300px", overflowY: "auto" }}
|
|
||||||
>
|
>
|
||||||
<li key="all">
|
{selectedRolesCount}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Dropdown Menu - Corrected: Removed duplicate ul block */}
|
||||||
|
<ul className="dropdown-menu p-2 text-capitalize" style={{ maxHeight: "300px", overflowY: "auto" }}>
|
||||||
|
<li> {/* Changed key="all" to a unique key if possible, or keep it if "all" is a unique identifier */}
|
||||||
|
<div className="form-check dropdown-item py-0">
|
||||||
|
<input
|
||||||
|
className="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
id="checkboxAllRoles" // Unique ID
|
||||||
|
value="all"
|
||||||
|
checked={selectedRoles.includes("all")}
|
||||||
|
onChange={(e) => handleRoleChange(e, e.target.value)}
|
||||||
|
/>
|
||||||
|
<label className="form-check-label ms-2" htmlFor="checkboxAllRoles">
|
||||||
|
All Roles
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{jobRolesForDropdown?.map((role) => (
|
||||||
|
<li key={role.id}>
|
||||||
<div className="form-check dropdown-item py-0">
|
<div className="form-check dropdown-item py-0">
|
||||||
<input
|
<input
|
||||||
className="form-check-input"
|
className="form-check-input"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="checkboxAllRoles"
|
id={`checkboxRole-${role.id}`} // Unique ID
|
||||||
value="all"
|
value={role.id}
|
||||||
checked={selectedRoles.includes("all")}
|
checked={selectedRoles.includes(String(role.id))}
|
||||||
onChange={(e) =>
|
onChange={(e) => handleRoleChange(e, e.target.value)}
|
||||||
handleRoleChange(e, e.target.value)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<label
|
<label className="form-check-label ms-2" htmlFor={`checkboxRole-${role.id}`}>
|
||||||
className="form-check-label ms-2"
|
{role.name}
|
||||||
htmlFor="checkboxAllRoles"
|
|
||||||
>
|
|
||||||
All Roles
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{jobRolesForDropdown?.map((role) => (
|
))}
|
||||||
<li key={role.id}>
|
</ul>
|
||||||
<div className="form-check dropdown-item py-0">
|
|
||||||
<input
|
|
||||||
className="form-check-input"
|
|
||||||
type="checkbox"
|
|
||||||
id={`checkboxRole-${role.id}`}
|
|
||||||
value={role.id}
|
|
||||||
checked={selectedRoles.includes(String(role.id))}
|
|
||||||
onChange={(e) =>
|
|
||||||
handleRoleChange(e, e.target.value)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="form-check-label ms-2"
|
|
||||||
htmlFor={`checkboxRole-${role.id}`}
|
|
||||||
>
|
|
||||||
{role.name}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control form-control-sm ms-auto mb-2 mt-2"
|
|
||||||
placeholder="Search employees or roles..."
|
|
||||||
value={searchTerm}
|
|
||||||
onChange={handleSearchChange}
|
|
||||||
style={{ maxWidth: '200px' }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control form-control-sm ms-auto mb-2 mt-2"
|
||||||
|
placeholder="Search employees or roles..."
|
||||||
|
value={searchTerm}
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
style={{ maxWidth: "200px" }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
</div>
|
||||||
className="col-12 mt-2"
|
</div>
|
||||||
style={{ maxHeight: "280px", overflowY: "auto", overflowX: "hidden" }}
|
<div
|
||||||
>
|
className="col-12 mt-2"
|
||||||
{selectedRoles?.length > 0 && (
|
style={{ maxHeight: "280px", overflowY: "auto", overflowX: "hidden" }}
|
||||||
<div className="row">
|
>
|
||||||
{employeeLoading ? (
|
{selectedRoles?.length > 0 && (
|
||||||
<div className="col-12">
|
<div className="row">
|
||||||
<p className="text-center">Loading employees...</p>
|
{employeeLoading ? (
|
||||||
</div>
|
<div className="col-12">
|
||||||
) : filteredEmployees?.length > 0 ? (
|
<p className="text-center">Loading employees...</p>
|
||||||
filteredEmployees.map((emp) => {
|
|
||||||
const jobRole = jobRoleData?.find(
|
|
||||||
(role) => role?.id === emp?.jobRoleId
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
key={emp.id}
|
|
||||||
className="col-6 col-md-4 col-lg-3 mb-3"
|
|
||||||
>
|
|
||||||
<div className="form-check d-flex align-items-start">
|
|
||||||
<Controller
|
|
||||||
name="selectedEmployees"
|
|
||||||
control={control}
|
|
||||||
render={({ field }) => (
|
|
||||||
<input
|
|
||||||
{...field}
|
|
||||||
className="form-check-input me-1 mt-1"
|
|
||||||
type="checkbox"
|
|
||||||
id={`employee-${emp?.id}`}
|
|
||||||
value={emp.id}
|
|
||||||
checked={field.value?.includes(emp.id)}
|
|
||||||
onChange={(e) => {
|
|
||||||
handleCheckboxChange(e, emp);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<div className="flex-grow-1">
|
|
||||||
<p
|
|
||||||
className="mb-0"
|
|
||||||
style={{ fontSize: "13px" }}
|
|
||||||
>
|
|
||||||
{emp.firstName} {emp.lastName}
|
|
||||||
</p>
|
|
||||||
<small
|
|
||||||
className="text-muted"
|
|
||||||
style={{ fontSize: "11px" }}
|
|
||||||
>
|
|
||||||
{loading ? (
|
|
||||||
<span className="placeholder-glow">
|
|
||||||
<span className="placeholder col-6"></span>
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
jobRole?.name || "Unknown Role"
|
|
||||||
)}
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
) : (
|
|
||||||
<div className="col-12">
|
|
||||||
<p className="text-center">
|
|
||||||
No employees found for the selected role(s).
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
) : filteredEmployees?.length > 0 ? (
|
||||||
</div>
|
filteredEmployees.map((emp) => {
|
||||||
|
const jobRole = jobRoleData?.find(
|
||||||
|
(role) => role?.id === emp?.jobRoleId
|
||||||
|
);
|
||||||
|
|
||||||
<div
|
return (
|
||||||
className="col-12 h-25 overflow-auto"
|
<div
|
||||||
style={{ maxHeight: "200px" }}
|
key={emp.id}
|
||||||
>
|
className="col-6 col-md-4 col-lg-3 mb-3"
|
||||||
{watch("selectedEmployees")?.length > 0 && (
|
>
|
||||||
<div className="mt-1">
|
<div className="form-check d-flex align-items-start">
|
||||||
<div className="text-start px-2">
|
<Controller
|
||||||
{watch("selectedEmployees")?.map((empId) => {
|
name="selectedEmployees"
|
||||||
const emp = employees.find((emp) => emp.id === empId);
|
control={control}
|
||||||
return (
|
render={({ field }) => (
|
||||||
emp && (
|
<input
|
||||||
<span
|
{...field}
|
||||||
key={empId}
|
className="form-check-input me-1 mt-1"
|
||||||
className="badge rounded-pill bg-label-primary d-inline-flex align-items-center me-1 mb-1"
|
type="checkbox"
|
||||||
|
id={`employee-${emp?.id}`} // Unique ID
|
||||||
|
value={emp.id}
|
||||||
|
checked={field.value?.includes(emp.id)}
|
||||||
|
onChange={(e) => {
|
||||||
|
handleCheckboxChange(e, emp);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<div className="flex-grow-1">
|
||||||
|
<p
|
||||||
|
className="mb-0"
|
||||||
|
style={{ fontSize: "13px" }}
|
||||||
>
|
>
|
||||||
{emp.firstName} {emp.lastName}
|
{emp.firstName} {emp.lastName}
|
||||||
<p
|
</p>
|
||||||
type="button"
|
<small
|
||||||
className=" btn-close-white p-0 m-0"
|
className="text-muted"
|
||||||
aria-label="Close"
|
style={{ fontSize: "11px" }}
|
||||||
onClick={() => {
|
>
|
||||||
const updatedSelected = watch(
|
{loading ? (
|
||||||
"selectedEmployees"
|
<span className="placeholder-glow">
|
||||||
).filter((id) => id !== empId);
|
<span className="placeholder col-6"></span>
|
||||||
setValue(
|
</span>
|
||||||
"selectedEmployees",
|
) : (
|
||||||
updatedSelected
|
jobRole?.name || "Unknown Role"
|
||||||
);
|
)}
|
||||||
trigger("selectedEmployees");
|
</small>
|
||||||
}}
|
</div>
|
||||||
>
|
</div>
|
||||||
<i className="icon-base bx bx-x icon-md "></i>
|
</div>
|
||||||
</p>
|
);
|
||||||
</span>
|
})
|
||||||
)
|
) : (
|
||||||
);
|
<div className="col-12">
|
||||||
})}
|
<p className="text-center">
|
||||||
</div>
|
No employees found for the selected role(s).
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{!loading && errors.selectedEmployees && (
|
<div
|
||||||
<div className="danger-text mt-1">
|
className="col-12 h-25 overflow-auto"
|
||||||
<p>{errors.selectedEmployees.message}</p>{" "}
|
style={{ maxHeight: "200px" }}
|
||||||
|
>
|
||||||
|
{watch("selectedEmployees")?.length > 0 && (
|
||||||
|
<div className="mt-1">
|
||||||
|
<div className="text-start px-2">
|
||||||
|
{watch("selectedEmployees")?.map((empId) => {
|
||||||
|
const emp = employees.find((emp) => emp.id === empId);
|
||||||
|
return (
|
||||||
|
emp && (
|
||||||
|
<span
|
||||||
|
key={empId}
|
||||||
|
className="badge rounded-pill bg-label-primary d-inline-flex align-items-center me-1 mb-1"
|
||||||
|
>
|
||||||
|
{emp.firstName} {emp.lastName}
|
||||||
|
{/* Changed p tag to button for semantic correctness and accessibility */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn-close btn-close-white ms-1" // Added ms-1 for spacing, removed p-0 m-0
|
||||||
|
aria-label="Remove employee" // More descriptive aria-label
|
||||||
|
onClick={() => {
|
||||||
|
const updatedSelected = watch(
|
||||||
|
"selectedEmployees"
|
||||||
|
).filter((id) => id !== empId);
|
||||||
|
setValue(
|
||||||
|
"selectedEmployees",
|
||||||
|
updatedSelected
|
||||||
|
);
|
||||||
|
trigger("selectedEmployees");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<i className="icon-base bx bx-x icon-md"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="col-md text-start mx-0 px-0">
|
{!loading && errors.selectedEmployees && (
|
||||||
<div className="form-check form-check-inline mt-3 px-1">
|
<div className="danger-text mt-1">
|
||||||
<label
|
<p>{errors.selectedEmployees.message}</p>{" "}
|
||||||
className="form-text text-dark align-items-center d-flex"
|
</div>
|
||||||
htmlFor="inlineCheckbox1"
|
)}
|
||||||
|
|
||||||
|
<div className="col-md text-start mx-0 px-0">
|
||||||
|
<div className="form-check form-check-inline mt-3 px-1">
|
||||||
|
<label
|
||||||
|
className="form-text text-dark align-items-center d-flex"
|
||||||
|
htmlFor="inlineCheckbox1" // This htmlFor isn't linked to a checkbox in this context
|
||||||
|
>
|
||||||
|
Pending Task of Activity :
|
||||||
|
<label
|
||||||
|
className="form-check-label fs-7 ms-4"
|
||||||
|
htmlFor="inlineCheckbox1" // This htmlFor isn't linked to a checkbox in this context
|
||||||
|
>
|
||||||
|
<strong>
|
||||||
|
{assignData?.workItem?.plannedWork -
|
||||||
|
assignData?.workItem?.completedWork}
|
||||||
|
</strong>{" "}
|
||||||
|
<u>
|
||||||
|
{
|
||||||
|
assignData?.workItem?.activityMaster
|
||||||
|
?.unitOfMeasurement
|
||||||
|
}
|
||||||
|
</u>
|
||||||
|
</label>
|
||||||
|
<div style={{ display: "flex", alignItems: "center" }}>
|
||||||
|
<div
|
||||||
|
ref={infoRef}
|
||||||
|
tabIndex="0"
|
||||||
|
className="d-flex align-items-center avatar-group justify-content-center ms-2"
|
||||||
|
data-bs-toggle="popover"
|
||||||
|
data-bs-trigger="focus"
|
||||||
|
data-bs-placement="right"
|
||||||
|
data-bs-html="true"
|
||||||
|
style={{ cursor: "pointer" }}
|
||||||
>
|
>
|
||||||
Pending Task of Activity :
|
|
||||||
<label
|
<svg
|
||||||
className="form-check-label fs-7 ms-4"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
htmlFor="inlineCheckbox1"
|
width="13"
|
||||||
|
height="13"
|
||||||
|
fill="currentColor"
|
||||||
|
className="bi bi-info-circle"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
>
|
>
|
||||||
<strong>
|
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||||
{assignData?.workItem?.plannedWork -
|
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.547 1.11l1.91-2.011c.241-.256.384-.592.287-.984-.172-.439-.58-.827-1.13-.967a.664.664 0 0 1-.58-.309l-.15-.241-.002-.002zM8 4c-.535 0-.943.372-.943.836 0 .464.408.836.943.836.535 0 .943-.372.943-.836 0-.464-.408-.836-.943-.836z" />
|
||||||
assignData?.workItem?.completedWork}
|
</svg>
|
||||||
</strong>{" "}
|
</div>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Target for Today input and validation */}
|
||||||
|
<div className="col-md text-start mx-0 px-0">
|
||||||
|
<div className="form-check form-check-inline mt-2 px-1 mb-2 text-start">
|
||||||
|
<label
|
||||||
|
className="text-dark text-start d-flex align-items-center flex-wrap form-text"
|
||||||
|
htmlFor="targetForTodayInput" // Added a unique htmlFor for clarity
|
||||||
|
>
|
||||||
|
<span>Target for Today</span>
|
||||||
|
<span style={{ marginLeft: "46px" }}>:</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="form-check form-check-inline col-sm-3 mt-2"
|
||||||
|
style={{ marginLeft: "-28px" }}
|
||||||
|
>
|
||||||
|
<Controller
|
||||||
|
name="plannedTask"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<div className="d-flex align-items-center gap-1 ">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control form-control-sm"
|
||||||
|
{...field}
|
||||||
|
id="defaultFormControlInput" // Consider a more descriptive ID if used elsewhere
|
||||||
|
aria-describedby="defaultFormControlHelp"
|
||||||
|
/>
|
||||||
|
<span style={{ paddingLeft: "6px", whiteSpace: "nowrap" }}>
|
||||||
<u>
|
<u>
|
||||||
|
{" "}
|
||||||
{
|
{
|
||||||
assignData?.workItem?.activityMaster
|
assignData?.workItem?.activityMaster
|
||||||
?.unitOfMeasurement
|
?.unitOfMeasurement
|
||||||
}
|
}
|
||||||
</u>
|
</u>
|
||||||
</label>
|
</span>
|
||||||
<div style={{ display: "flex", alignItems: "center" }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
ref={infoRef}
|
ref={infoRef1}
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
className="d-flex align-items-center avatar-group justify-content-center ms-2"
|
className="d-flex align-items-center avatar-group justify-content-center ms-2"
|
||||||
data-bs-toggle="popover"
|
data-bs-toggle="popover"
|
||||||
@ -554,143 +579,75 @@ const AssignTask = ({ assignData, onClose, setAssigned }) => {
|
|||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Target for Today input and validation */}
|
|
||||||
<div className="col-md text-start mx-0 px-0">
|
|
||||||
<div className="form-check form-check-inline mt-2 px-1 mb-2 text-start">
|
|
||||||
<label
|
|
||||||
className="text-dark text-start d-flex align-items-center flex-wrap form-text"
|
|
||||||
htmlFor="inlineCheckbox1"
|
|
||||||
>
|
|
||||||
<span>Target for Today</span>
|
|
||||||
<span style={{ marginLeft: "46px" }}>:</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="form-check form-check-inline col-sm-3 mt-2"
|
|
||||||
style={{ marginLeft: "-28px" }}
|
|
||||||
>
|
|
||||||
<Controller
|
|
||||||
name="plannedTask"
|
|
||||||
control={control}
|
|
||||||
render={({ field }) => (
|
|
||||||
<div className="d-flex align-items-center gap-1 ">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control form-control-sm"
|
|
||||||
{...field}
|
|
||||||
id="defaultFormControlInput"
|
|
||||||
aria-describedby="defaultFormControlHelp"
|
|
||||||
/>
|
|
||||||
<span style={{ paddingLeft: "6px", whiteSpace: "nowrap" }}>
|
|
||||||
<u> {
|
|
||||||
assignData?.workItem?.activityMaster
|
|
||||||
?.unitOfMeasurement
|
|
||||||
}</u>
|
|
||||||
</span>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
ref={infoRef1}
|
|
||||||
tabIndex="0"
|
|
||||||
className="d-flex align-items-center avatar-group justify-content-center ms-2"
|
|
||||||
data-bs-toggle="popover"
|
|
||||||
data-bs-trigger="focus"
|
|
||||||
data-bs-placement="right"
|
|
||||||
data-bs-html="true"
|
|
||||||
style={{ cursor: "pointer" }}
|
|
||||||
>
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="13"
|
|
||||||
height="13"
|
|
||||||
fill="currentColor"
|
|
||||||
className="bi bi-info-circle"
|
|
||||||
viewBox="0 0 16 16"
|
|
||||||
>
|
|
||||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
|
||||||
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.547 1.11l1.91-2.011c.241-.256.384-.592.287-.984-.172-.439-.58-.827-1.13-.967a.664.664 0 0 1-.58-.309l-.15-.241-.002-.002zM8 4c-.535 0-.943.372-.943.836 0 .464.408.836.943.836.535 0 .943-.372.943-.836 0-.464-.408-.836-.943-.836z" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{errors.plannedTask && (
|
|
||||||
<div className="danger-text mt-1">
|
|
||||||
{errors.plannedTask.message}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isHelpVisible && (
|
|
||||||
<div
|
|
||||||
className="position-absolute bg-white border p-2 rounded shadow"
|
|
||||||
style={{ zIndex: 10, marginLeft: "10px" }}
|
|
||||||
>
|
|
||||||
<p className="mb-0">
|
|
||||||
Enter the target value for today's task.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label
|
|
||||||
className="form-text fs-7 m-1 text-lg text-dark"
|
|
||||||
htmlFor="descriptionTextarea"
|
|
||||||
>
|
|
||||||
Description
|
|
||||||
</label>
|
|
||||||
<Controller
|
|
||||||
name="description"
|
|
||||||
control={control}
|
|
||||||
render={({ field }) => (
|
|
||||||
<textarea
|
|
||||||
{...field}
|
|
||||||
className="form-control"
|
|
||||||
id="descriptionTextarea"
|
|
||||||
rows="2"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
{errors.description && (
|
|
||||||
<div className="danger-text">{errors.description.message}</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-12 d-flex justify-content-center align-items-center gap-sm-6 gap-8 text-center mt-1">
|
{errors.plannedTask && (
|
||||||
<button
|
<div className="danger-text mt-1">
|
||||||
type="submit"
|
{errors.plannedTask.message}
|
||||||
className="btn btn-sm btn-primary "
|
</div>
|
||||||
disabled={isSubmitting || loading}
|
)}
|
||||||
|
|
||||||
|
{isHelpVisible && (
|
||||||
|
<div
|
||||||
|
className="position-absolute bg-white border p-2 rounded shadow"
|
||||||
|
style={{ zIndex: 10, marginLeft: "10px" }}
|
||||||
>
|
>
|
||||||
{isSubmitting ? "Please Wait" : "Submit"}
|
<p className="mb-0">
|
||||||
</button>
|
Enter the target value for today's task.
|
||||||
<button
|
</p>
|
||||||
type="reset"
|
</div>
|
||||||
className="btn btn-sm btn-label-secondary"
|
)}
|
||||||
data-bs-dismiss="modal"
|
</div>
|
||||||
aria-label="Close"
|
|
||||||
onClick={closedModel}
|
<label
|
||||||
disabled={isSubmitting || loading}
|
className="form-text fs-7 m-1 text-dark" // Removed duplicate htmlFor and text-lg
|
||||||
>
|
htmlFor="descriptionTextarea"
|
||||||
Cancel
|
>
|
||||||
</button>
|
Description
|
||||||
</div>
|
</label>
|
||||||
</form>
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<textarea
|
||||||
|
{...field}
|
||||||
|
className="form-control"
|
||||||
|
id="descriptionTextarea" // Unique ID
|
||||||
|
rows="2"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{errors.description && (
|
||||||
|
<div className="danger-text">{errors.description.message}</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div className="col-12 d-flex justify-content-center align-items-center gap-sm-6 gap-8 text-center mt-1">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="btn btn-sm btn-primary "
|
||||||
|
disabled={isSubmitting || loading}
|
||||||
|
>
|
||||||
|
{isSubmitting ? "Please Wait" : "Submit"}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="reset"
|
||||||
|
className="btn btn-sm btn-label-secondary"
|
||||||
|
data-bs-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
onClick={closedModel}
|
||||||
|
disabled={isSubmitting || loading}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
);
|
</div>
|
||||||
|
</div> );
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AssignTask;
|
export default AssignTask;
|
||||||
Loading…
x
Reference in New Issue
Block a user