Skip to content

Commit

Permalink
[FIX] #561
Browse files Browse the repository at this point in the history
  • Loading branch information
horilla-opensource committed Mar 8, 2025
1 parent dcf2395 commit d0539db
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 15 deletions.
45 changes: 45 additions & 0 deletions attendance/templates/attendance/attendance/attendance_empty.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,50 @@ <h5 class="oh-404__subtitle">
</div>
</main>
</div>
<span id="dynamicCreateBatchAttendanceSpan" hx-get="{% url 'create-batch-attendance' %}"
data-target="#dynamicCreateModal" data-toggle="oh-modal-toggle" hx-target="#dynamicCreateModalTarget"
hx-include="#attendanceRequestForm,#attendanceUpdateForm,#attendanceCreateForm"></span>
<button hidden hx-post="{% url 'update-title' %}" hx-target="#objectDetailsModalTarget" id="updateTitleSpan"></button>

<script>
function dateChange(selectElement) {
var selectedDate = selectElement.val();
let parentForm = selectElement.parents().closest("form");
var shiftId = parentForm.find("[name=shift_id]").val();

$.ajax({
type: "post",
url: "{% url 'update-date-details' %}",
data: {
csrfmiddlewaretoken: getCookie("csrftoken"),
attendance_date: selectedDate,
shift_id: shiftId,
},
success: function (response) {
parentForm.find("[name=minimum_hour]").val(response.minimum_hour);
},
});
}
// Dynamic batch attendance create
function dynamicBatchAttendance(element) {
batch = element.val()
if (batch === 'dynamic_create') {
var parentForm = element.parents().closest("form");
previous_url = parentForm.data('url');
$('#dynamicCreateBatchAttendanceSpan').attr("hx-vals", `{"previous_url":"${previous_url}"}`)
$('#dynamicCreateBatchAttendanceSpan').click();
element.val('').change();
}
}

// Batch title change
function batchTitleChange(element) {
console.log(element)
title = $(element).val()
batchId = $(element).data('id')
$('#updateTitleSpan').attr("hx-vals", `{"batch_id":"${batchId}","title":"${title}"}`)
$('#updateTitleSpan').click()
}
</script>

{% endblock content %}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="oh-modal__dialog-header">
<button
type="button"
class="oh-modal_close--custom"
class="oh-modal__close--custom"
onclick="$(this).parents().closest('.oh-modal--show').toggleClass('oh-modal--show');$('#dynamicCreateBatchAttendanceSpan').removeAttr('hx-vals');"
>
<ion-icon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{% load static %}{% load i18n %} {% include 'filter_tags.html' %}
<div class="oh-wrapper-main">
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img
style="width: 190px; height: 200px"
src="{% static 'images/ui/present.png' %}"
class="oh-404__image mb-4"
alt="Page not found. 404."
/>
<h5 class="oh-404__subtitle">
{% blocktrans with month_name=month_name %}The attendances for this employee in {{ month_name }} has not been validated.{% endblocktrans %}
</div>
</div>
</main>
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img style="width: 190px; height: 200px" src="{% static 'images/ui/present.png' %}"
class="oh-404__image mb-4" alt="Page not found. 404." />
<h5 class="oh-404__subtitle">
{% blocktrans with month_name=month_name %}The attendances for this employee in {{ month_name }} has not been validated.{% endblocktrans %}
</div>
</div>
</main>
</div>

0 comments on commit d0539db

Please sign in to comment.