added title name for assign employee modal
This commit is contained in:
parent
14b851b87e
commit
d10d47e642
@ -14,9 +14,13 @@ const MapUsers = ({
|
||||
assignedLoading,
|
||||
setAssignedLoading,
|
||||
}) => {
|
||||
const { employeesList, loading: employeeLoading, error } = useAllEmployees(false);
|
||||
const {
|
||||
employeesList,
|
||||
loading: employeeLoading,
|
||||
error,
|
||||
} = useAllEmployees(false);
|
||||
const [selectedEmployees, setSelectedEmployees] = useState([]);
|
||||
const [ searchText, setSearchText ] = useState( "" );
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
const handleAllocationData = Array.isArray(allocation) ? allocation : [];
|
||||
|
||||
@ -96,9 +100,8 @@ const MapUsers = ({
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = () =>
|
||||
{
|
||||
setAssignedLoading(true)
|
||||
const handleSubmit = () => {
|
||||
setAssignedLoading(true);
|
||||
const selected = selectedEmployees
|
||||
.filter((emp) => emp.isSelected)
|
||||
.map((emp) => ({ empID: emp.id, jobRoleId: emp.jobRoleId }));
|
||||
@ -108,32 +111,33 @@ const MapUsers = ({
|
||||
} else {
|
||||
showToast("Please select Employee", "error");
|
||||
}
|
||||
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div className="modal-dialog modal-dialog-scrollable mx-sm-auto mx-1 modal-lg modal-simple modal-edit-user">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header ">
|
||||
<div className="md-2 mb-n5">
|
||||
{(filteredData.length > 0 ||
|
||||
allocationEmployeesData.length > 0)&& (
|
||||
<div className="input-group">
|
||||
<input
|
||||
type="search"
|
||||
className="form-control form-control-sm"
|
||||
placeholder="Search employees..."
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="modal-header text-center">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
<div className="d-flex justify-content-start align-items-center px-4 mt-6">
|
||||
<h5 className="mb-0 mt-1">
|
||||
<i className=" text-warning me-3"></i> Select Employee
|
||||
</h5>
|
||||
</div>
|
||||
<p className="m-0 fw-semibold fs-5">Assign Employee</p>
|
||||
|
||||
<div className="px-4 mt-4 col-md-4 text-start">
|
||||
{(filteredData.length > 0 ||
|
||||
allocationEmployeesData.length > 0) && (
|
||||
<div className="input-group input-group-sm mb-2">
|
||||
<input
|
||||
type="search"
|
||||
className="form-control"
|
||||
placeholder="Search employees..."
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className="mb-0 small text-muted fw-semibold">Select Employee</p>
|
||||
</div>
|
||||
|
||||
<div className="modal-body p-sm-4 p-0">
|
||||
<table
|
||||
className="datatables-users table border-top dataTable no-footer dtr-column "
|
||||
@ -141,10 +145,9 @@ const MapUsers = ({
|
||||
aria-describedby="DataTables_Table_0_info"
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
|
||||
<tbody>
|
||||
{employeeLoading && allocationEmployeesData.length === 0 && (
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Loading..</td>
|
||||
</tr>
|
||||
)}
|
||||
@ -152,17 +155,18 @@ const MapUsers = ({
|
||||
{!employeeLoading &&
|
||||
allocationEmployeesData.length === 0 &&
|
||||
filteredData.length === 0 && (
|
||||
|
||||
<tr>
|
||||
<td>All employee assigned to Project.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>All employee assigned to Project.</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
{!employeeLoading && allocationEmployeesData.length > 0 && filteredData.length === 0 && (
|
||||
{!employeeLoading &&
|
||||
allocationEmployeesData.length > 0 &&
|
||||
filteredData.length === 0 && (
|
||||
<tr>
|
||||
<td>No matching employees found.</td>
|
||||
</tr>
|
||||
)}
|
||||
<td>No matching employees found.</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
{(filteredData.length > 0 ||
|
||||
allocationEmployeesData.length > 0) &&
|
||||
@ -181,14 +185,11 @@ const MapUsers = ({
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
{(filteredData.length > 0 ||
|
||||
allocationEmployeesData.length > 0) && (
|
||||
<button
|
||||
className="btn btn-sm btn-success"
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
{assignedLoading ? "Please Wait...":"Assign to Project"}
|
||||
</button>
|
||||
)}
|
||||
allocationEmployeesData.length > 0) && (
|
||||
<button className="btn btn-sm btn-success" onClick={handleSubmit}>
|
||||
{assignedLoading ? "Please Wait..." : "Assign to Project"}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
|
Loading…
x
Reference in New Issue
Block a user