diff --git a/attendance/templates/attendance/work_record/work_record_list.html b/attendance/templates/attendance/work_record/work_record_list.html
index f4b509429..006c13725 100644
--- a/attendance/templates/attendance/work_record/work_record_list.html
+++ b/attendance/templates/attendance/work_record/work_record_list.html
@@ -1,8 +1,41 @@
-{% load i18n %} {% load attendancefilters %}
+{% load i18n %} {% load attendancefilters %} {% include "filter_tags.html" %}
-
+
+
+
+
+
+
+
@@ -38,7 +71,7 @@
{% for employee_data in data %}
- | {{ employee_data.employee }} |
+ {{ employee_data.employee }} |
{% for date in current_month_dates_list %}
{% with work_record=employee_data.work_record|get_item:forloop.counter0 %}
diff --git a/attendance/views/clock_in_out.py b/attendance/views/clock_in_out.py
index c5d708c78..b3c1bc4bb 100644
--- a/attendance/views/clock_in_out.py
+++ b/attendance/views/clock_in_out.py
@@ -295,7 +295,7 @@ def clock_out_attendance_and_activity(employee, date_today, now, out_datetime=No
"""
attendance_activities = AttendanceActivity.objects.filter(
- employee_id=employee
+ employee_id=employee, clock_out__isnull=True
).order_by("attendance_date", "id")
if attendance_activities.exists():
attendance_activity = attendance_activities.last()
diff --git a/attendance/views/views.py b/attendance/views/views.py
index c048005c7..66045fdd1 100644
--- a/attendance/views/views.py
+++ b/attendance/views/views.py
@@ -73,6 +73,7 @@ from base.methods import (
get_pagination,
)
from base.models import EmployeeShiftSchedule
+from employee.filters import EmployeeFilter
from employee.models import Employee, EmployeeWorkInformation
from horilla.decorators import (
hx_request_required,
@@ -2030,6 +2031,7 @@ def work_records(request):
@hx_request_required
def work_records_change_month(request):
previous_data = request.GET.urlencode()
+ employee_filter_form = EmployeeFilter()
if request.GET.get("month"):
date_obj = request.GET.get("month")
month = int(date_obj.split("-")[1])
@@ -2040,6 +2042,9 @@ def work_records_change_month(request):
schedules = list(EmployeeShiftSchedule.objects.all())
employees = list(Employee.objects.filter(is_active=True))
+ if request.method == "POST":
+ employee_filter_form = EmployeeFilter(request.POST)
+ employees = list(employee_filter_form.qs)
data = []
month_matrix = calendar.monthcalendar(year, month)
@@ -2093,6 +2098,7 @@ def work_records_change_month(request):
"data": data,
"pd": previous_data,
"current_date": date.today(),
+ "f": employee_filter_form,
}
return render(
request, "attendance/work_record/work_record_list.html", context=context