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 && {!loading &&
(regularizes?.length > 0 ? ( (currentItems?.length > 0 ? (
regularizes?.map((att, index) => ( currentItems?.map((att, index) => (
<tr key={index}> <tr key={index}>
<td colSpan={2}> <td colSpan={2}>
<div className="d-flex justify-content-start align-items-center"> <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 () => { const handleSubmit = async () => {
let WorkItemId = workItem.workItemId || workItem.id; let WorkItemId = workItem.workItemId || workItem.id;
debugger
DeleteTask({ DeleteTask({
workItemId: WorkItemId, workItemId: WorkItemId,
workAreaId: forWorkArea?.id, workAreaId: forWorkArea?.id,

View File

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

View File

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

View File

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

View File

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

View File

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