[FIX]missing column attendance view (#2)

Co-authored-by: Nikhil <nikhil@cybrosys.in>
This commit is contained in:
Horilla
2023-05-11 16:26:27 +05:30
committed by GitHub
parent 860925396c
commit f193fb00a0
4 changed files with 40 additions and 2 deletions

View File

@@ -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)

View File

@@ -19,6 +19,7 @@
<div class="oh-sticky-table__th">{% trans "Clock Out" %}</div>
<div class="oh-sticky-table__th">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th">{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th">{% trans "Overtime" %}</div>
@@ -97,6 +98,9 @@
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>
@@ -181,6 +185,7 @@
<div class="oh-sticky-table__th">{% trans "Clock Out" %}</div>
<div class="oh-sticky-table__th">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th">{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th">{% trans "Overtime" %}</div>
@@ -256,6 +261,9 @@
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>
@@ -339,6 +347,7 @@
<div class="oh-sticky-table__th">{% trans "Clock Out" %}</div>
<div class="oh-sticky-table__th">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th">{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th">{% trans "Overtime" %}</div>
@@ -415,6 +424,9 @@
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>

View File

@@ -25,6 +25,7 @@
<div class="oh-sticky-table__th">{% trans "Clock Out" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=attendance_clock_out_date" hx-target="#tab_contents">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th" >{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=at_work_second" hx-target="#tab_contents">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=overtime_second" hx-target="#tab_contents">{% trans "Overtime" %}</div>
@@ -77,6 +78,9 @@
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>
@@ -170,6 +174,7 @@
<div class="oh-sticky-table__th">{% trans "Clock Out" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=attendance_clock_out_date" hx-target="#tab_contents">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th" >{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=at_work_second" hx-target="#tab_contents">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=overtime_second" hx-target="#tab_contents">{% trans "Overtime" %}</div>
@@ -225,6 +230,9 @@
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>
@@ -324,6 +332,7 @@
<div class="oh-sticky-table__th">{% trans "Clock Out" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=attendance_clock_out_date" hx-target="#tab_contents">{% trans "Out Date" %}</div>
<div class="oh-sticky-table__th">{% trans "Shift" %}</div>
<div class="oh-sticky-table__th">{% trans "Work Type" %}</div>
<div class="oh-sticky-table__th">{% trans "Min Hour" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=at_work_second" hx-target="#tab_contents">{% trans "At Work" %}</div>
<div class="oh-sticky-table__th" hx-get="{% url 'attendance-search' %}?{{pd}}&sortby=overtime_second" hx-target="#tab_contents">{% trans "Overtime" %}</div>
@@ -377,6 +386,9 @@
<div class="oh-sticky-table__td">
{{attendance.work_type_id}}
</div>
<div class="oh-sticky-table__td">
{{attendance.minimum_hour}}
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>

View File

@@ -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")
})
});