removed unused code
This commit is contained in:
parent
d2288ea967
commit
080d2307ca
@ -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({
|
||||
resolver: zodResolver(
|
||||
z.object({
|
||||
startDate: z.string(),
|
||||
endDate: 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();
|
||||
|
||||
@ -135,11 +124,7 @@ const EmpAttendance = ({ employee }) => {
|
||||
};
|
||||
const closeModal = () => setIsModalOpen(false);
|
||||
|
||||
|
||||
|
||||
const onSubmit = (formData) => {
|
||||
|
||||
}
|
||||
const onSubmit = (formData) => {};
|
||||
return (
|
||||
<>
|
||||
{isModalOpen && (
|
||||
@ -152,26 +137,27 @@ const EmpAttendance = ({ employee }) => {
|
||||
className="dataTables_length text-start py-2 d-flex justify-content-between "
|
||||
id="DataTables_Table_0_length"
|
||||
>
|
||||
<div className="col-md-4 my-0 ">
|
||||
<div className="col-3 my-0 ">
|
||||
<>
|
||||
<FormProvider {...methods}>
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="p-2 text-start">
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
className="p-2 text-start"
|
||||
>
|
||||
<DateRangePicker1
|
||||
|
||||
placeholder="DD-MM-YYYY To DD-MM-YYYY"
|
||||
startField="startDate"
|
||||
endField="endDate"
|
||||
|
||||
defaultRange={true}
|
||||
/>
|
||||
</form>
|
||||
</FormProvider>
|
||||
</>
|
||||
|
||||
</div>
|
||||
<div className="col-md-2 m-0 text-end">
|
||||
<i
|
||||
className={`bx bx-refresh cursor-pointer fs-4 ${isFetching ? "spin" : ""
|
||||
className={`bx bx-refresh cursor-pointer fs-4 ${
|
||||
isFetching ? "spin" : ""
|
||||
}`}
|
||||
data-toggle="tooltip"
|
||||
title="Refresh"
|
||||
@ -265,7 +251,8 @@ const EmpAttendance = ({ employee }) => {
|
||||
{[...Array(totalPages)].map((_, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className={`page-item ${currentPage === index + 1 ? "active" : ""
|
||||
className={`page-item ${
|
||||
currentPage === index + 1 ? "active" : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
@ -277,7 +264,8 @@ const EmpAttendance = ({ employee }) => {
|
||||
</li>
|
||||
))}
|
||||
<li
|
||||
className={`page-item ${currentPage === totalPages ? "disabled" : ""
|
||||
className={`page-item ${
|
||||
currentPage === totalPages ? "disabled" : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
|
Loading…
x
Reference in New Issue
Block a user