Merge branch 'Issues_July_3W' of https://git.marcoaiot.com/admin/marco.pms.web into Kartik_Task750

This commit is contained in:
Kartik sharma 2025-07-16 18:47:01 +05:30
commit e1f8b23374
7 changed files with 26 additions and 20 deletions

View File

@ -92,8 +92,8 @@ const Regularization = ({ handleRequest }) => {
)} */}
{!loading &&
(regularizes?.length > 0 ? (
regularizes?.map((att, index) => (
(currentItems?.length > 0 ? (
currentItems?.map((att, index) => (
<tr key={index}>
<td colSpan={2}>
<div className="d-flex justify-content-start align-items-center">

View File

@ -91,7 +91,6 @@ const isTaskPlanning = /^\/activities\/task$/.test(location.pathname);
const handleSubmit = async () => {
let WorkItemId = workItem.workItemId || workItem.id;
debugger
DeleteTask({
workItemId: WorkItemId,
workAreaId: forWorkArea?.id,

View File

@ -14,6 +14,8 @@ import {
getProjectStatusName,
} from "../../utils/projectStatus";
import GlobalModel from "../common/GlobalModel";
import { useDispatch } from "react-redux";
import { setProjectId } from "../../slices/localVariablesSlice";
const ProjectCard = ({ projectData, recall }) => {
const [ projectInfo, setProjectInfo ] = useState( projectData );
@ -21,6 +23,7 @@ const ProjectCard = ({ projectData, recall }) => {
projectInfo?.id,false
);
const [showModal, setShowModal] = useState(false);
const dispatch = useDispatch()
const navigate = useNavigate();
const ManageProject = useHasUserPermission(MANAGE_PROJECT);
const {
@ -57,6 +60,7 @@ const ProjectCard = ({ projectData, recall }) => {
const handleClose = () => setShowModal(false);
const handleViewProject = () => {
dispatch(setProjectId(projectInfo.id))
navigate(`/projects/details`);
};

View File

@ -112,18 +112,20 @@ export const useEmployeesByProject = (projectId) => {
};
// EmployeeList.jsx
export const useEmployeesAllOrByProjectId = (projectId, showInactive) => {
const isAllEmployees = !projectId && projectId !== undefined;
export const useEmployeesAllOrByProjectId = (showAllEmployees ,projectId,
showInactive) => {
const queryKey = isAllEmployees
? ['allEmployees', showInactive]
: ['projectEmployees', projectId];
const queryKey = showAllEmployees
? ['allEmployees', showInactive]
: ['projectEmployees', projectId, showInactive];
const queryFn = async () => {
if (isAllEmployees) {
if (showAllEmployees) {
const res = await EmployeeRepository.getAllEmployeeList(showInactive);
return res.data;
} else {
if (!projectId) return [];
const res = await EmployeeRepository.getEmployeeListByproject(projectId);
return res.data;
}
@ -137,7 +139,7 @@ export const useEmployeesAllOrByProjectId = (projectId, showInactive) => {
} = useQuery({
queryKey,
queryFn,
enabled: isAllEmployees || !!projectId,
enabled:typeof showInactive === "boolean" && (showAllEmployees || !!projectId),
});
return {

View File

@ -51,7 +51,7 @@ const EmployeeList = () => {
const { employees, loading, setLoading, error, recallEmployeeData } =
useEmployeesAllOrByProjectId(
showAllEmployees ? null : selectedProjectId,
showAllEmployees ,selectedProjectId,
showInactive
);
@ -153,13 +153,7 @@ const EmployeeList = () => {
}
};
const handleToggle = (e) => {
setShowInactive(e.target.checked);
recallEmployeeData(
e.target.checked,
showAllEmployees ? null : selectedProjectId
); // Use selectedProjectId here
};
const handleAllEmployeesToggle = (e) => {
const isChecked = e.target.checked;
@ -340,7 +334,7 @@ const EmployeeList = () => {
role="switch"
id="inactiveEmployeesCheckbox"
checked={showInactive}
onChange={handleToggle}
onChange={(e)=> setShowInactive(e.target.checked)}
/>
<label
className="form-check-label ms-0"

View File

@ -24,6 +24,7 @@ import eventBus from "../../services/eventBus";
import ProjectProgressChart from "../../components/Dashboard/ProjectProgressChart";
import { useProjectName } from "../../hooks/useProjects";
import AttendanceOverview from "../../components/Dashboard/AttendanceChart";
import { setProjectId } from "../../slices/localVariablesSlice";
const ProjectDetails = () => {

View File

@ -20,9 +20,12 @@ import showToast from "../../services/toastService";
import { getCachedData, cacheData } from "../../slices/apiDataManager";
import GlobalModel from "../../components/common/GlobalModel";
import {formatNumber} from "../../utils/dateUtils";
import { setProjectId } from "../../slices/localVariablesSlice";
import { useDispatch } from "react-redux";
const ProjectListView = ({ projectData, recall }) => {
const [projectInfo, setProjectInfo] = useState(projectData);
const dispatch = useDispatch()
const { projects_Details, loading, error, refetch } = useProjectDetails(
projectInfo?.id,false
);
@ -89,7 +92,10 @@ const ProjectListView = ({ projectData, recall }) => {
<td className="text-start" colSpan={5}>
<span
className="text-primary cursor-pointer"
onClick={() => navigate(`/projects/details`)}
onClick={() => {
dispatch(setProjectId(projectInfo.id))
navigate(`/projects/details`)
}}
>
{projectInfo.shortName
? `${projectInfo.name} (${projectInfo.shortName})`