[UPDT] ATTENDANCE: Updated attendance app by adding htmx function in attendance dashboard cards

This commit is contained in:
Horilla
2024-12-04 14:46:55 +05:30
parent 078471a282
commit d2476619c9
12 changed files with 340 additions and 511 deletions

View File

@@ -1,79 +0,0 @@
{% load i18n static %}
{% if validate_attendances %}
<div class="oh-sticky-table h-100">
<div class="oh-sticky-table__table oh-table--sortable">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th">
{% trans "Employee" %}
</div>
<div class="oh-sticky-table__th">
{% trans "Worked Hours" %}
</div>
<div class="oh-sticky-table__th" align="center">{% trans "Actions" %}</div>
</div>
</div>
{% for attendance in validate_attendances %}
<div class="oh-sticky-table__tbody">
<div class="oh-sticky-table__tr" draggable="false" data-toggle="oh-modal-toggle"
data-target="#objectDetailsModalW25" hx-target="#objectDetailsModalW25Target"
hx-get="{% url 'user-request-one-view' attendance.id %}?validate=true&instances_ids={{validate_attendances_ids}}&dashboard=true">
<div class="oh-sticky-table__sd">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img src="{{attendance.employee_id.get_avatar}}" class="oh-profile__image" alt="" />
</div>
<span class="oh-profile__name oh-text--dark">{{attendance.employee_id}}</span>
</div>
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_worked_hour}}
</div>
<div class="oh-sticky-table__td">
<a href="{% url 'validate-this-attendance' attendance.id %}"
class="oh-btn oh-btn--info"
onclick="event.stopPropagation();
return confirm('{% trans "Do you want to validate this attendance ?" %}')"
>
{% trans "Validate" %}
</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="oh-empty h-100">
<p class="oh-empty__message">
<img style="display: block;width: 70px;margin: 20px auto ;" src="{% static "/images/ui/no_records.svg" %}" class="" alt=""/>
{% trans "No records available at the moment." %}
</p>
</div>
{% endif %}
{% if validate_attendances.has_next or validate_attendances.has_previous %}
<div class=" float-end mt-3 mb-3">
{% if validate_attendances.has_previous %}
<span class="oh-card-dashboard__title" style="cursor: pointer"
hx-target="#attendanceValidateCardBody"
hx-get="{% url 'dashboard-attendance-validate' %}?{{pd}}&page={{ validate_attendances.previous_page_number }}"
hx-trigger="click delay:0.3s">
<ion-icon name="caret-back-outline" role="img" class="md hydrated" aria-label="caret back outline"></ion-icon>
</span>
{% endif %}
{% if validate_attendances.has_next %}
<span class="oh-card-dashboard__title float-end ms-2" style="cursor: pointer"
hx-target="#attendanceValidateCardBody"
hx-get="{% url 'dashboard-attendance-validate' %}?{{pd}}&page={{ validate_attendances.next_page_number }}"
hx-trigger="click delay:0.3s">
<ion-icon name="caret-forward-outline" role="img" class="md hydrated" aria-label="caret back outline"></ion-icon>
</span>
{% endif %}
<span class="oh-pagination__page float-end fw-bold">
{% trans "Page" %} {{ validate_attendances.number }} {%trans "of" %}
{{validate_attendances.paginator.num_pages }}
</span>
</div>
{% endif %}

View File

@@ -1,74 +0,0 @@
{% load i18n static %}
{% if overtime_attendances %}
<div class="oh-sticky-table h-100">
<div class="oh-sticky-table__table oh-table--sortable">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th">
{% trans "Employee" %}
</div>
<div class="oh-sticky-table__th">
{% trans "Overtime" %}
</div>
<div class="oh-sticky-table__th" align="center">{% trans "Actions" %}</div>
</div>
</div>
{% for attendance in overtime_attendances %}
<div class="oh-sticky-table__tbody">
<div class="oh-sticky-table__tr" draggable="false" data-toggle="oh-modal-toggle"
data-target="#objectDetailsModalW25" hx-target="#objectDetailsModalW25Target"
hx-get="{% url 'user-request-one-view' attendance.id %}?ot=true&instances_ids={{ot_attendances_ids}}&dashboard=true">
<div class="oh-sticky-table__sd">
<div class="oh-profile oh-profile--md">
<div class="oh-profile__avatar mr-1">
<img src="{{attendance.employee_id.get_avatar}}" class="oh-profile__image" alt="" />
</div>
<span class="oh-profile__name oh-text--dark">{{attendance.employee_id}}</span>
</div>
</div>
<div class="oh-sticky-table__td">
{{attendance.attendance_overtime}}
</div>
<div class="oh-sticky-table__td">
<a href="{% url 'approve-overtime' attendance.id %}" onclick="event.stopPropagation();" class="oh-btn oh-btn--info">
{% trans "Approve" %}
</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="oh-empty h-100">
<p class="oh-empty__message">
<img style="display: block;width: 70px;margin: 20px auto ;" src="{% static "/images/ui/no_records.svg" %}" class="" alt=""/>
{% trans "No records available at the moment." %}
</p>
</div>
{% endif %}
{% if overtime_attendances.has_next or overtime_attendances.has_previous %}
<div class=" float-end mt-3 mb-3">
{% if overtime_attendances.has_previous %}
<span class="oh-card-dashboard__title" style="cursor: pointer" hx-target="#OTApproveTarget"
hx-get="{% url 'dashboard-overtime-approve' %}?{{pd}}&page={{ overtime_attendances.previous_page_number }}"
hx-trigger="click delay:0.3s" title="Previous Page">
<ion-icon name="caret-back-outline" role="img" class="md hydrated" aria-label="caret back outline"></ion-icon>
</span>
{% endif %}
{% if overtime_attendances.has_next %}
<span class="oh-card-dashboard__title float-end ms-2 " style="cursor: pointer"
hx-target="#OTApproveTarget"
hx-get="{% url 'dashboard-overtime-approve' %}?{{pd}}&page={{ overtime_attendances.next_page_number }}"
hx-trigger="click delay:0.3s" title="Next Page">
<ion-icon name="caret-forward-outline" role="img" class="md hydrated" aria-label="caret back outline"></ion-icon>
</span>
{% endif %}
{% if overtime_attendances.has_next or overtime_attendances.has_previous %}
<span class="oh-pagination__page float-end fw-bold">
{% trans "Page" %} {{ overtime_attendances.number }} {%trans "of" %}
{{overtime_attendances.paginator.num_pages }}
</span>
{% endif %}
</div>
{% endif %}