[UPDT] ATTENDANCE: Updated attendance app by adding widget for date fields in attendance request form

This commit is contained in:
Horilla
2025-07-05 15:24:21 +05:30
parent 60bc3fc490
commit f4a935244e
6 changed files with 7 additions and 36 deletions

View File

@@ -646,6 +646,13 @@ class AttendanceRequestForm(BaseModelForm):
"request_description",
"batch_attendance_id",
]
widgets = {
"attendance_date": DateTimeInput(attrs={"type": "date"}),
"attendance_clock_in": DateTimeInput(attrs={"type": "time"}),
"attendance_clock_in_date": DateTimeInput(attrs={"type": "date"}),
"attendance_clock_out": DateTimeInput(attrs={"type": "time"}),
"attendance_clock_out_date": DateTimeInput(attrs={"type": "date"}),
}
def as_p(self, *args, **kwargs):
"""

View File

@@ -4,10 +4,3 @@
>
{{form.as_p}}
</form>
<script>
$(document).ready(function () {
$("select").on("select2:select", function (e) {
$(this).closest("select")[0].dispatchEvent(new Event("change"));
});
});
</script>

View File

@@ -1,11 +1,4 @@
{% load i18n %}
<form hx-post="{% url 'attendance-update' obj_id %}?{{urlencode}}" hx-swap="#updateAttendanceModalBody" id="attendanceUpdateForm" data-url="{% url 'attendance-update' obj_id %}">
{{form.as_p}}
<script>
$(document).ready(function () {
$("select").on("select2:select", function (e) {
$(this).closest("select")[0].dispatchEvent(new Event("change"));
});
});
</script>
</form>

View File

@@ -1,8 +1 @@
{{form.as_p}}
<script>
$(document).ready(function () {
$("select").on("select2:select", function (e) {
$(this).closest("select")[0].dispatchEvent(new Event("change"));
});
});
</script>

View File

@@ -1,10 +1,3 @@
{% load i18n %}
<label class="oh-label" for="id_{{field.name }}" title="{{field.help_text|safe }}">{{field.label}}</label>
{{field}}
<script>
$(document).ready(function () {
$("select").on("select2:select", function (e) {
$(this).closest("select")[0].dispatchEvent(new Event("change"));
});
});
</script>

View File

@@ -60,12 +60,4 @@
</form>
</div>
</div>
<script>
$(document).ready(function () {
$("select").on("select2:select", function (e) {
$(".leave-message").hide()
$(this).closest("select")[0].dispatchEvent(new Event("change"));
});
});
</script>
</div>