Merge branch 'main' of https://git.marcoaiot.com/admin/marco.pms.web into Purchase_Invoice_Management
This commit is contained in:
commit
6a0feacb1b
@ -10,11 +10,13 @@ import {
|
||||
import useMaster, { useServices } from "../../../hooks/masterHook/useMaster";
|
||||
import showToast from "../../../services/toastService";
|
||||
import { useOrganizationEmployees } from "../../../hooks/useOrganization";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeMaster } from "../../../slices/localVariablesSlice";
|
||||
|
||||
const TeamEmployeeList = ({ organizationId, searchTerm, closeModal }) => {
|
||||
const selectedProject = useSelectedProject();
|
||||
const debounceSearchTerm = useDebounce(searchTerm, 500);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const {
|
||||
data: employeesData = [],
|
||||
isLoading,
|
||||
@ -45,6 +47,7 @@ const TeamEmployeeList = ({ organizationId, searchTerm, closeModal }) => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(changeMaster("Job Role"));
|
||||
if (employeesData?.data?.length > 0) {
|
||||
const available = employeesData.data.filter((emp) => {
|
||||
const projEmp = projectEmployees.find((pe) => pe.employeeId === emp.id);
|
||||
@ -119,7 +122,7 @@ const TeamEmployeeList = ({ organizationId, searchTerm, closeModal }) => {
|
||||
status: true,
|
||||
}));
|
||||
|
||||
handleAssignEmployee({ payload,actionType:"assign"} );
|
||||
handleAssignEmployee({ payload, actionType: "assign" });
|
||||
|
||||
setEmployees((prev) =>
|
||||
prev.map((emp) => ({
|
||||
@ -132,26 +135,26 @@ const TeamEmployeeList = ({ organizationId, searchTerm, closeModal }) => {
|
||||
);
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
return ( <div className="page-min-h d-flex justify-content-center align-items-center "><p className="text-muted">Loading employees...</p></div>) ;
|
||||
}
|
||||
if (isLoading) {
|
||||
return (<div className="page-min-h d-flex justify-content-center align-items-center "><p className="text-muted">Loading employees...</p></div>);
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
return (
|
||||
<div className="page-min-h d-flex justify-content-center align-items-center ">
|
||||
{error?.status === 400 ? (
|
||||
<p className="m-0">Enter employee you want to find.</p>
|
||||
) : (
|
||||
<p className="m-0 dange-text">Something went wrong. Please try again later.</p>
|
||||
)}
|
||||
</div>
|
||||
if (isError) {
|
||||
return (
|
||||
<div className="page-min-h d-flex justify-content-center align-items-center ">
|
||||
{error?.status === 400 ? (
|
||||
<p className="m-0">Enter employee you want to find.</p>
|
||||
) : (
|
||||
<p className="m-0 dange-text">Something went wrong. Please try again later.</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (employees.length === 0) {
|
||||
return(<div className="page-min-h d-flex justify-content-center align-items-center "><p className="text-muted">No available employees to assign.</p></div>) ;
|
||||
}
|
||||
if (employees.length === 0) {
|
||||
return (<div className="page-min-h d-flex justify-content-center align-items-center "><p className="text-muted">No available employees to assign.</p></div>);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
@ -183,9 +186,8 @@ if (employees.length === 0) {
|
||||
onChange={(e) =>
|
||||
handleSelectChange(index, "serviceId", e.target.value)
|
||||
}
|
||||
className={`form-select form-select-sm w-auto border-none rounded-0 py-1 px-auto ${
|
||||
emp.errors.serviceId ? "is-invalid" : ""
|
||||
}`}
|
||||
className={`form-select form-select-sm w-auto border-none rounded-0 py-1 px-auto ${emp.errors.serviceId ? "is-invalid" : ""
|
||||
}`}
|
||||
>
|
||||
<option value="">Select Service</option>
|
||||
{services?.map((s) => (
|
||||
@ -205,9 +207,8 @@ if (employees.length === 0) {
|
||||
onChange={(e) =>
|
||||
handleSelectChange(index, "jobRole", e.target.value)
|
||||
}
|
||||
className={`form-select form-select-sm w-auto border-none rounded-0 py-1 px-auto ${
|
||||
emp.errors.jobRole ? "is-invalid" : ""
|
||||
}`}
|
||||
className={`form-select form-select-sm w-auto border-none rounded-0 py-1 px-auto ${emp.errors.jobRole ? "is-invalid" : ""
|
||||
}`}
|
||||
>
|
||||
<option value="">Select Job Role</option>
|
||||
{jobRoles?.map((r) => (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user