From 080d2307ca9d399604ac59cf27d942af167f9363 Mon Sep 17 00:00:00 2001 From: pramod mahajan Date: Tue, 16 Sep 2025 10:49:44 +0530 Subject: [PATCH] removed unused code --- src/components/Employee/EmpAttendance.jsx | 72 ++++++++++------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/src/components/Employee/EmpAttendance.jsx b/src/components/Employee/EmpAttendance.jsx index 0aa03cf3..c441b826 100644 --- a/src/components/Employee/EmpAttendance.jsx +++ b/src/components/Employee/EmpAttendance.jsx @@ -16,29 +16,27 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { localToUtc } from "../../utils/appUtils"; - - const EmpAttendance = ({ employee }) => { const [attendances, setAttendnaces] = useState([]); const [selectedDate, setSelectedDate] = useState(""); - const [dateRange, setDateRange] = useState({ startDate: "", endDate: "" }); const [isModalOpen, setIsModalOpen] = useState(false); const [attendanceId, setAttendanecId] = useState(); - const methods = useForm({ - resolver: zodResolver(z.object({ - startDate: z.string(), - endDate: z.string() - })), + resolver: zodResolver( + z.object({ + startDate: z.string(), + endDate: z.string(), + }) + ), defaultValues: { startDate: "", - endDate: "" + endDate: "", }, }); const { control, register, handleSubmit, reset, watch } = methods; - const startDate = watch('startDate') - const endDate = watch('endDate') + const startDate = watch("startDate"); + const endDate = watch("endDate"); const { data = [], isLoading: loading, @@ -46,15 +44,13 @@ const EmpAttendance = ({ employee }) => { isError, error, refetch, - } = useAttendanceByEmployee(employee, localToUtc(startDate), localToUtc(endDate)); + } = useAttendanceByEmployee( + employee, + localToUtc(startDate), + localToUtc(endDate) + ); const dispatch = useDispatch(); - // const { data, loading, error } = useSelector( - // (store) => store.employeeAttendance - // ); - - const [isRefreshing, setIsRefreshing] = useState(true); - const today = new Date(); today.setHours(0, 0, 0, 0); @@ -92,13 +88,6 @@ const EmpAttendance = ({ employee }) => { .sort(sortByName); const group5 = data.filter((d) => d.activity === 5).sort(sortByName); - // const sortedFinalList = [ - // ...group1, - // ...group2, - // ...group3, - // ...group4, - // ...group5, - // ]; const uniqueMap = new Map(); @@ -111,7 +100,7 @@ const EmpAttendance = ({ employee }) => { if ( !existing || new Date(rec.checkInTime || rec.checkOutTime) > - new Date(existing.checkInTime || existing.checkOutTime) + new Date(existing.checkInTime || existing.checkOutTime) ) { uniqueMap.set(key, rec); } @@ -135,11 +124,7 @@ const EmpAttendance = ({ employee }) => { }; const closeModal = () => setIsModalOpen(false); - - - const onSubmit = (formData) => { - - } + const onSubmit = (formData) => {}; return ( <> {isModalOpen && ( @@ -152,27 +137,28 @@ const EmpAttendance = ({ employee }) => { className="dataTables_length text-start py-2 d-flex justify-content-between " id="DataTables_Table_0_length" > -
+
<> -
+
-
refetch()} @@ -265,8 +251,9 @@ const EmpAttendance = ({ employee }) => { {[...Array(totalPages)].map((_, index) => (
  • ))}