From f193fb00a0eafc7c352a7d2f3753c65b4ec0c76e Mon Sep 17 00:00:00 2001 From: Horilla <131998600+horilla-opensource@users.noreply.github.com> Date: Thu, 11 May 2023 16:26:27 +0530 Subject: [PATCH] [FIX]missing column attendance view (#2) Co-authored-by: Nikhil --- attendance/models.py | 10 ++++++++++ .../attendance/attendance/group_by.html | 12 ++++++++++++ .../attendance/attendance/tab_content.html | 16 ++++++++++++++-- static/build/js/htmxSelect2.js | 4 ++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/attendance/models.py b/attendance/models.py index 44334ce91..3d6943bd2 100644 --- a/attendance/models.py +++ b/attendance/models.py @@ -101,6 +101,16 @@ class Attendance(models.Model): self.overtime_second = strtime_seconds(self.attendance_overtime) self.attendance_day = EmployeeShiftDay.objects.get(day = self.attendance_date.strftime('%A').lower()) prev_attendance_approved = False + + condition = AttendanceValidationCondition.objects.first() + if condition is not None: + overtime_cutoff = condition.overtime_cutoff + cutoff_seconds = strtime_seconds(overtime_cutoff) + overtime = self.overtime_second + if overtime > cutoff_seconds: + self.overtime_second = cutoff_seconds + self.attendance_overtime = format_time(cutoff_seconds) + if self.pk is not None: # Get the previous values of the boolean field prev_state = Attendance.objects.get(pk=self.pk) diff --git a/attendance/templates/attendance/attendance/group_by.html b/attendance/templates/attendance/attendance/group_by.html index fd5d2c426..a9a399dd3 100644 --- a/attendance/templates/attendance/attendance/group_by.html +++ b/attendance/templates/attendance/attendance/group_by.html @@ -19,6 +19,7 @@
{% trans "Clock Out" %}
{% trans "Out Date" %}
{% trans "Shift" %}
+
{% trans "Work Type" %}
{% trans "Min Hour" %}
{% trans "At Work" %}
{% trans "Overtime" %}
@@ -97,6 +98,9 @@
{{attendance.work_type_id}}
+
+ {{attendance.minimum_hour}} +
{{attendance.attendance_worked_hour}}
@@ -181,6 +185,7 @@
{% trans "Clock Out" %}
{% trans "Out Date" %}
{% trans "Shift" %}
+
{% trans "Work Type" %}
{% trans "Min Hour" %}
{% trans "At Work" %}
{% trans "Overtime" %}
@@ -256,6 +261,9 @@
{{attendance.work_type_id}}
+
+ {{attendance.minimum_hour}} +
{{attendance.attendance_worked_hour}}
@@ -339,6 +347,7 @@
{% trans "Clock Out" %}
{% trans "Out Date" %}
{% trans "Shift" %}
+
{% trans "Work Type" %}
{% trans "Min Hour" %}
{% trans "At Work" %}
{% trans "Overtime" %}
@@ -415,6 +424,9 @@
{{attendance.work_type_id}}
+
+ {{attendance.minimum_hour}} +
{{attendance.attendance_worked_hour}}
diff --git a/attendance/templates/attendance/attendance/tab_content.html b/attendance/templates/attendance/attendance/tab_content.html index 59a9fbc3a..49139f1f0 100644 --- a/attendance/templates/attendance/attendance/tab_content.html +++ b/attendance/templates/attendance/attendance/tab_content.html @@ -25,7 +25,8 @@
{% trans "Clock Out" %}
{% trans "Out Date" %}
{% trans "Shift" %}
-
{% trans "Min Hour" %}
+
{% trans "Work Type" %}
+
{% trans "Min Hour" %}
{% trans "At Work" %}
{% trans "Overtime" %}
@@ -77,6 +78,9 @@
{{attendance.work_type_id}}
+
+ {{attendance.minimum_hour}} +
{{attendance.attendance_worked_hour}}
@@ -170,7 +174,8 @@
{% trans "Clock Out" %}
{% trans "Out Date" %}
{% trans "Shift" %}
-
{% trans "Min Hour" %}
+
{% trans "Work Type" %}
+
{% trans "Min Hour" %}
{% trans "At Work" %}
{% trans "Overtime" %}
@@ -225,6 +230,9 @@
{{attendance.work_type_id}}
+
+ {{attendance.minimum_hour}} +
{{attendance.attendance_worked_hour}}
@@ -324,6 +332,7 @@
{% trans "Clock Out" %}
{% trans "Out Date" %}
{% trans "Shift" %}
+
{% trans "Work Type" %}
{% trans "Min Hour" %}
{% trans "At Work" %}
{% trans "Overtime" %}
@@ -377,6 +386,9 @@
{{attendance.work_type_id}}
+
+ {{attendance.minimum_hour}} +
{{attendance.attendance_worked_hour}}
diff --git a/static/build/js/htmxSelect2.js b/static/build/js/htmxSelect2.js index 7bf7e03bf..540a5deed 100644 --- a/static/build/js/htmxSelect2.js +++ b/static/build/js/htmxSelect2.js @@ -4133,5 +4133,9 @@ $(document).on("htmx:afterSettle", function (e) { } }); + $(`#${targetId} .oh-sticky-table__tr.oh-table__toggle-parent`).on("click",function(e){ + $(this).parent().find(".oh-table__toggle-child").toggleClass("oh-table__toggle-child--show") + }) + });