[UPDT] ATTENDANCE: Selected time format display
This commit is contained in:
@@ -583,7 +583,7 @@ $("#attendance-info-import").click(function (e) {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "attendance-excel",
|
||||
url: "/attendance/attendance-excel",
|
||||
dataType: "binary",
|
||||
xhrFields: {
|
||||
responseType: "blob",
|
||||
@@ -1267,3 +1267,26 @@ $('.dateformat_changer').each(function(index, element) {
|
||||
// Display the formatted date wherever needed
|
||||
var currentDate = $('.dateformat_changer').first().text();
|
||||
var formattedDate = dateFormatter.getFormattedDate(currentDate);
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
// * THIS IS FOR SWITCHING THE TIME FORMAT IN THE ALL VIEWS *
|
||||
// ******************************************************************
|
||||
|
||||
// Iterate through all elements with the 'timeformat_changer' class and format their content
|
||||
$('.timeformat_changer').each(function(index, element) {
|
||||
var currentTime = $(element).text();
|
||||
|
||||
// Checking currentTime value is a valid time.
|
||||
if (/[\.:]/.test(currentTime)) {
|
||||
var formattedTime = timeFormatter.getFormattedTime(currentTime);
|
||||
} else {
|
||||
var formattedTime = 'None';
|
||||
}
|
||||
$(element).text(formattedTime);
|
||||
|
||||
});
|
||||
|
||||
// Display the formatted time wherever needed
|
||||
var currentTime = $('.timeformat_changer').first().text();
|
||||
var formattedTime = timeFormatter.getFormattedTime(currentTime);
|
||||
|
||||
@@ -66,13 +66,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day.get_day_display }}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<div class="oh-timeoff-modal__stats-container mt-3 mb-3">
|
||||
<div class="oh-timeoff-modal__stat">
|
||||
<span class="oh-timeoff-modal__stat-title">{% trans "Check_In" %}</span>
|
||||
<span class="oh-timeoff-modal__stat-count">{{attendance_request.attendance_clock_in}}</span>
|
||||
<span class="oh-timeoff-modal__stat-count timeformat_changer">{{attendance_request.attendance_clock_in}}</span>
|
||||
</div>
|
||||
<div class="oh-timeoff-modal__stat" style="margin-left: 20px;">
|
||||
<span class="oh-timeoff-modal__stat-title">{% trans "Check_In Date" %}</span>
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class="oh-timeoff-modal__stats-container mt-3 mb-3">
|
||||
<div class="oh-timeoff-modal__stat">
|
||||
<span class="oh-timeoff-modal__stat-title">{% trans "Check_Out" %}</span>
|
||||
<span class="oh-timeoff-modal__stat-count">{{attendance_request.attendance_clock_out}}</span>
|
||||
<span class="oh-timeoff-modal__stat-count timeformat_changer">{{attendance_request.attendance_clock_out}}</span>
|
||||
</div>
|
||||
<div class="oh-timeoff-modal__stat" style="margin-left: 20px;">
|
||||
<span class="oh-timeoff-modal__stat-title">{% trans "Check_Out Date" %}</span>
|
||||
|
||||
@@ -125,13 +125,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day.get_day_display }}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
@@ -357,13 +357,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day.get_day_display }}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
@@ -601,13 +601,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day.get_day_display }}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% load i18n %}
|
||||
<form
|
||||
hx-post="{% url 'attendance-update' form.instance.id %}"
|
||||
hx-post="{% url 'attendance-update' form.instance.id %}?{{urlencode}}"
|
||||
hx-swap="#updateAttendanceModalBody"
|
||||
method="post"
|
||||
id="updateForm"
|
||||
|
||||
@@ -108,13 +108,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day.get_day_display }}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{activity.attendance_date}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{activity.clock_in_date}}</div>
|
||||
<div class="oh-sticky-table__td">{{activity.clock_in}}</div>
|
||||
<div class="oh-sticky-table__td">{{activity.clock_out}}</div>
|
||||
<div class="oh-sticky-table__td timeformat_changer">{{activity.clock_in}}</div>
|
||||
<div class="oh-sticky-table__td timeformat_changer">{{activity.clock_out}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{activity.clock_out_date}}</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{% if perms.attendance.delete_attendanceactivity %}
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{activity.attendance_date}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{activity.clock_in_date}}</div>
|
||||
<div class="oh-sticky-table__td">{{activity.clock_in}}</div>
|
||||
<div class="oh-sticky-table__td">{{activity.clock_out}}</div>
|
||||
<div class="oh-sticky-table__td timeformat_changer">{{activity.clock_in}}</div>
|
||||
<div class="oh-sticky-table__td timeformat_changer">{{activity.clock_out}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{activity.clock_out_date}}</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class='oh-sticky-table__td dateformat_changer'>{{late_in_early_out.attendance_id.attendance_date}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.attendance_clock_in}}</div>
|
||||
<div class='oh-sticky-table__td timeformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_in}}</div>
|
||||
<div class='oh-sticky-table__td dateformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_in_date}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.attendance_clock_out}}</div>
|
||||
<div class='oh-sticky-table__td timeformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_out}}</div>
|
||||
<div class='oh-sticky-table__td dateformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_out_date}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.minimum_hour}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.attendance_worked_hour}}</div>
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class='oh-sticky-table__td dateformat_changer'>{{late_in_early_out.attendance_id.attendance_date}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.attendance_clock_in}}</div>
|
||||
<div class='oh-sticky-table__td timeformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_in}}</div>
|
||||
<div class='oh-sticky-table__td dateformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_in_date}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.attendance_clock_out}}</div>
|
||||
<div class='oh-sticky-table__td timeformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_out}}</div>
|
||||
<div class='oh-sticky-table__td dateformat_changer'>{{late_in_early_out.attendance_id.attendance_clock_out_date}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.minimum_hour}}</div>
|
||||
<div class='oh-sticky-table__td'>{{late_in_early_out.attendance_id.attendance_worked_hour}}</div>
|
||||
|
||||
@@ -196,13 +196,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day|capfirst}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
{{attendance.attendance_day|capfirst}}
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__td {% if 'attendance_clock_in' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %}"
|
||||
class="oh-sticky-table__td {% if 'attendance_clock_in' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %} timeformat_changer"
|
||||
>
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
@@ -102,7 +102,7 @@
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__td {% if 'attendance_clock_out' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %}"
|
||||
class="oh-sticky-table__td {% if 'attendance_clock_out' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %} timeformat_changer"
|
||||
>
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
@@ -322,13 +322,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day|capfirst}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
|
||||
@@ -92,6 +92,23 @@
|
||||
<td class="p-2 ml-2 dateformat_changer">{% if diff.0 %}{{diff.0}},{% endif %}</td>
|
||||
<td class="p-2 ml-2 dateformat_changer">{{diff.1}},</td>
|
||||
{% endif %}
|
||||
{% elif key == 'Check-Out' or key == 'Check-In'%}
|
||||
{% if diff.0 == 'None' %}
|
||||
<td class="p-2 ml-2 timeformat_changer">{% if diff.0 %}{{diff.0}}{% endif %}</td>
|
||||
<td class="p-2 ml-2 timeformat_changer">{{diff.1}},</td>
|
||||
{% endif %}
|
||||
{% if diff.1 == 'None' %}
|
||||
<td class="p-2 ml-2 timeformat_changer">{% if diff.0 %}{{diff.0}},{% endif %}</td>
|
||||
<td class="p-2 ml-2 timeformat_changer">{{diff.1}}</td>
|
||||
{% endif %}
|
||||
{% if diff.0 == 'None' and diff.1 == 'None'%}
|
||||
<td class="p-2 ml-2 timeformat_changer">{% if diff.0 %}{{diff.0}}{% endif %}</td>
|
||||
<td class="p-2 ml-2 timeformat_changer">{{diff.1}}</td>
|
||||
{% endif %}
|
||||
{% if diff.0 != 'None' and diff.1 != 'None'%}
|
||||
<td class="p-2 ml-2 timeformat_changer">{% if diff.0 %}{{diff.0}},{% endif %}</td>
|
||||
<td class="p-2 ml-2 timeformat_changer">{{diff.1}},</td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<td class="p-2 ml-2">{% if diff.0 %}{{diff.0}}{% endif %}</td>
|
||||
<td class="p-2 ml-2">{{diff.1}}</td>
|
||||
|
||||
@@ -75,13 +75,13 @@
|
||||
<div class="oh-sticky-table__td {% if 'attendance_day' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %}" >
|
||||
{{attendance.attendance_day|capfirst}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td {% if 'attendance_clock_in' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %}" >
|
||||
<div class="oh-sticky-table__td {% if 'attendance_clock_in' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %} timeformat_changer" >
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td {% if 'attendance_clock_in_date' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %} dateformat_changer" >
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td {% if 'attendance_clock_out' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %}" >
|
||||
<div class="oh-sticky-table__td {% if 'attendance_clock_out' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %} timeformat_changer" >
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td {% if 'attendance_clock_out_date' in attendance.requested_fields or attendance.request_type == 'create_request' %} diff-cell{% endif %} dateformat_changer" >
|
||||
@@ -220,13 +220,13 @@
|
||||
<div class="oh-sticky-table__td">
|
||||
{{attendance.attendance_day|capfirst}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_in}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{attendance.attendance_clock_in_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__td timeformat_changer">
|
||||
{{attendance.attendance_clock_out}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
|
||||
@@ -57,7 +57,7 @@ def process_attendance_data(attendance_dicts):
|
||||
except Exception as exception:
|
||||
attendance_data[
|
||||
"Error14"
|
||||
] = "The date format for attendance date is not valid"
|
||||
] = "The attendance date format is invalid. Please use the format YYYY-MM-DD"
|
||||
save = False
|
||||
|
||||
try:
|
||||
@@ -65,7 +65,7 @@ def process_attendance_data(attendance_dicts):
|
||||
except Exception as exception:
|
||||
attendance_data[
|
||||
"Error15"
|
||||
] = "The date format for Check-in date is not valid"
|
||||
] = "The Check-in date format is invalid. Please use the format YYYY-MM-DD"
|
||||
save = False
|
||||
|
||||
try:
|
||||
@@ -75,7 +75,7 @@ def process_attendance_data(attendance_dicts):
|
||||
except Exception as exception:
|
||||
attendance_data[
|
||||
"Error16"
|
||||
] = "The date format for Check-out date is not valid"
|
||||
] = "The Check-out date format is invalid. Please use the format YYYY-MM-DD"
|
||||
save = False
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user