Compare commits
No commits in common. "ffd7f15488910b9ed6463aabe6173980b51b1c87" and "108ca1cc96b9fc33b9cd9b7627663b08621bee61" have entirely different histories.
ffd7f15488
...
108ca1cc96
@ -243,7 +243,6 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
|
|||||||
return () => eventBus.off("employee", employeeHandler);
|
return () => eventBus.off("employee", employeeHandler);
|
||||||
}, [employeeHandler]);
|
}, [employeeHandler]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
@ -282,10 +281,8 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
|
|||||||
<th className="border-top-1" colSpan={2}>
|
<th className="border-top-1" colSpan={2}>
|
||||||
Name
|
Name
|
||||||
</th>
|
</th>
|
||||||
<th className="border-top-1">Project Name</th>
|
|
||||||
<th className="border-top-1">Date</th>
|
<th className="border-top-1">Date</th>
|
||||||
{/* <th>Organization</th> */}
|
{/* <th>Organization</th> */}
|
||||||
|
|
||||||
<th>
|
<th>
|
||||||
<i className="bx bxs-down-arrow-alt text-success"></i> Check-In
|
<i className="bx bxs-down-arrow-alt text-success"></i> Check-In
|
||||||
</th>
|
</th>
|
||||||
@ -344,7 +341,6 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>{attendance.projectName || "--"}</td>
|
|
||||||
<td>
|
<td>
|
||||||
{moment(
|
{moment(
|
||||||
attendance.checkInTime || attendance.checkOutTime
|
attendance.checkInTime || attendance.checkOutTime
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import { cacheData, clearCacheKey, useSelectedProject } from "../../slices/apiDa
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import Pagination from "../common/Pagination";
|
import Pagination from "../common/Pagination";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { employee } from "../../data/masters";
|
|
||||||
|
|
||||||
const Regularization = ({ handleRequest, searchTerm, projectId, organizationId, IncludeInActive }) => {
|
const Regularization = ({ handleRequest, searchTerm, projectId, organizationId, IncludeInActive }) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -120,8 +119,6 @@ const Regularization = ({ handleRequest, searchTerm, projectId, organizationId,
|
|||||||
return () => eventBus.off("employee", employeeHandler);
|
return () => eventBus.off("employee", employeeHandler);
|
||||||
}, [employeeHandler]);
|
}, [employeeHandler]);
|
||||||
|
|
||||||
console.log("Kartik",currentItems)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="table-responsive text-nowrap pb-4" style={{ minHeight: "200px" }}>
|
<div className="table-responsive text-nowrap pb-4" style={{ minHeight: "200px" }}>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
@ -133,7 +130,6 @@ const Regularization = ({ handleRequest, searchTerm, projectId, organizationId,
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colSpan={2}>Name</th>
|
<th colSpan={2}>Name</th>
|
||||||
<th>Project Name</th>
|
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
{/* <th>Organization</th> */}
|
{/* <th>Organization</th> */}
|
||||||
<th>
|
<th>
|
||||||
@ -173,7 +169,6 @@ const Regularization = ({ handleRequest, searchTerm, projectId, organizationId,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>{att.projectName || "--"}</td>
|
|
||||||
<td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td>
|
<td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td>
|
||||||
|
|
||||||
{/* <td>{att.organizationName || "--"}</td> */}
|
{/* <td>{att.organizationName || "--"}</td> */}
|
||||||
|
|||||||
@ -123,7 +123,7 @@ const EmpAttendance = ({ employee }) => {
|
|||||||
};
|
};
|
||||||
const closeModal = () => setIsModalOpen(false);
|
const closeModal = () => setIsModalOpen(false);
|
||||||
|
|
||||||
const onSubmit = (formData) => { };
|
const onSubmit = (formData) => {};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isModalOpen && (
|
{isModalOpen && (
|
||||||
@ -153,13 +153,19 @@ const EmpAttendance = ({ employee }) => {
|
|||||||
</FormProvider>
|
</FormProvider>
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="col-md-2 m-0 text-end">
|
||||||
|
<i
|
||||||
|
className={`bx bx-refresh cursor-pointer fs-4 ${
|
||||||
|
isFetching ? "spin" : ""
|
||||||
|
}`}
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="Refresh"
|
||||||
|
onClick={() => refetch()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="table-responsive text-nowrap">
|
<div className="table-responsive text-nowrap">
|
||||||
{!loading && data.length === 0 && (
|
{!loading && data.length === 0 && <span>No employee logs</span>}
|
||||||
<span style={{ fontSize: "0.9rem" }}>
|
|
||||||
No attendance record found in selected date range
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{isError && <div className="text-center">{error.message}</div>}
|
{isError && <div className="text-center">{error.message}</div>}
|
||||||
{loading && !data && <div className="text-center">Loading...</div>}
|
{loading && !data && <div className="text-center">Loading...</div>}
|
||||||
{data && data.length > 0 && (
|
{data && data.length > 0 && (
|
||||||
@ -244,7 +250,8 @@ const EmpAttendance = ({ employee }) => {
|
|||||||
{[...Array(totalPages)].map((_, index) => (
|
{[...Array(totalPages)].map((_, index) => (
|
||||||
<li
|
<li
|
||||||
key={index}
|
key={index}
|
||||||
className={`page-item ${currentPage === index + 1 ? "active" : ""
|
className={`page-item ${
|
||||||
|
currentPage === index + 1 ? "active" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@ -256,7 +263,8 @@ const EmpAttendance = ({ employee }) => {
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
<li
|
<li
|
||||||
className={`page-item ${currentPage === totalPages ? "disabled" : ""
|
className={`page-item ${
|
||||||
|
currentPage === totalPages ? "disabled" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -42,6 +42,7 @@ export const useAttendance = (projectId, organizationId, includeInactive = false
|
|||||||
|
|
||||||
export const useAttendancesLogs = (projectId, fromDate, toDate,organizationId) => {
|
export const useAttendancesLogs = (projectId, fromDate, toDate,organizationId) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const enabled = !!projectId && !!fromDate && !!toDate;
|
||||||
|
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
queryKey: ['attendanceLogs', projectId, fromDate, toDate,organizationId],
|
queryKey: ['attendanceLogs', projectId, fromDate, toDate,organizationId],
|
||||||
@ -54,6 +55,7 @@ export const useAttendancesLogs = (projectId, fromDate, toDate,organizationId) =
|
|||||||
);
|
);
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
|
enabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -121,7 +123,7 @@ export const useRegularizationRequests = (projectId, organizationId, IncludeInAc
|
|||||||
refetch: recall,
|
refetch: recall,
|
||||||
isFetching,
|
isFetching,
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ["regularizedList", projectId, organizationId, IncludeInActive],
|
queryKey: ["regularizedList", projectId, organizationId, IncludeInActive], // include filters in cache key
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const response = await AttendanceRepository.getRegularizeList(
|
const response = await AttendanceRepository.getRegularizeList(
|
||||||
projectId,
|
projectId,
|
||||||
@ -130,6 +132,7 @@ export const useRegularizationRequests = (projectId, organizationId, IncludeInAc
|
|||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
enabled: !!projectId, // only run if projectId exists
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
showToast(error.message || "Error while fetching regularizes", "error");
|
showToast(error.message || "Error while fetching regularizes", "error");
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { api } from "../utils/axiosClient";
|
|||||||
const AttendanceRepository = {
|
const AttendanceRepository = {
|
||||||
markAttendance: (data) => api.post("/api/attendance/record", data),
|
markAttendance: (data) => api.post("/api/attendance/record", data),
|
||||||
|
|
||||||
getAttendance: (projectId, organizationId, includeInactive, date) => {
|
getAttendance: (projectId, organizationId, includeInactive,date) => {
|
||||||
let url = `/api/attendance/project/team`;
|
let url = `/api/attendance/project/team`;
|
||||||
|
|
||||||
const params = [];
|
const params = [];
|
||||||
@ -13,47 +13,41 @@ const AttendanceRepository = {
|
|||||||
if (date) params.push(`date=${date}`);
|
if (date) params.push(`date=${date}`);
|
||||||
|
|
||||||
if (params.length > 0) {
|
if (params.length > 0) {
|
||||||
url += `?${params.join("&")}`;
|
url += `&${params.join("&")}`; }
|
||||||
}
|
|
||||||
|
|
||||||
return api.get(url);
|
return api.get(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
getAttendanceFilteredByDate: (projectId, fromDate, toDate, organizationId) => {
|
getAttendanceFilteredByDate: (projectId, fromDate, toDate,organizationId) => {
|
||||||
let url = `api/attendance/project/log`;
|
let url = `api/Attendance/project/log?projectId=${projectId}`;
|
||||||
|
if (fromDate) {
|
||||||
const params = [];
|
url += `&dateFrom=${fromDate}`;
|
||||||
if (projectId) params.push(`projectId=${projectId}`);
|
|
||||||
if (fromDate) params.push(`dateFrom=${fromDate}`);
|
|
||||||
if (toDate) params.push(`dateTo=${toDate}`);
|
|
||||||
if (organizationId) params.push(`organizationId=${organizationId}`);
|
|
||||||
|
|
||||||
if (params.length > 0) {
|
|
||||||
url += `?${params.join("&")}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toDate) {
|
||||||
|
url += `&dateTo=${toDate}`;
|
||||||
|
}
|
||||||
|
if (organizationId) {
|
||||||
|
url += `&organizationId=${organizationId}`;
|
||||||
|
}
|
||||||
return api.get(url);
|
return api.get(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getAttendanceLogs: (id) => api.get(`api/attendance/log/attendance/${id}`),
|
getAttendanceLogs: (id) => api.get(`api/attendance/log/attendance/${id}`),
|
||||||
|
|
||||||
getRegularizeList: (projectId, organizationId, IncludeInActive) => {
|
getRegularizeList: (projectId, organizationId, IncludeInActive) => {
|
||||||
let url = `/api/attendance/regularize`;
|
let url = `/api/attendance/regularize?projectId=${projectId}`;
|
||||||
|
|
||||||
const params = [];
|
const params = [];
|
||||||
if (projectId) params.push(`projectId=${projectId}`);
|
|
||||||
if (organizationId) params.push(`organizationId=${organizationId}`);
|
if (organizationId) params.push(`organizationId=${organizationId}`);
|
||||||
if (IncludeInActive) params.push(`IncludeInActive=${IncludeInActive}`);
|
if (IncludeInActive) params.push(`IncludeInActive=${IncludeInActive}`);
|
||||||
|
|
||||||
if (params.length > 0) {
|
if (params.length > 0) {
|
||||||
url += `?${params.join("&")}`;
|
url += `&${params.join("&")}`; }
|
||||||
}
|
|
||||||
|
|
||||||
return api.get(url);
|
return api.get(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getAttendanceByEmployee: (employeeId, fromDate, toDate) => {
|
getAttendanceByEmployee: (employeeId, fromDate, toDate) => {
|
||||||
let url = `api/Attendance/log/employee/${employeeId}?`;
|
let url = `api/Attendance/log/employee/${employeeId}?`;
|
||||||
if (fromDate) {
|
if (fromDate) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user