[UPDT] DASHBOARD: Fixed pagination showing in dashboard tables
This commit is contained in:
@@ -12,11 +12,20 @@ from attendance.models import Attendance, AttendanceValidationCondition
|
||||
from attendance.views.views import strtime_seconds
|
||||
from base.methods import filtersubordinates
|
||||
from base.models import ShiftRequest, WorkTypeRequest
|
||||
from employee.not_in_out_dashboard import paginator_qry
|
||||
from horilla.decorators import login_required
|
||||
from leave.models import LeaveAllocationRequest, LeaveRequest
|
||||
from pms.models import Feedback
|
||||
from django.db.models import Q
|
||||
from django.core.paginator import Paginator
|
||||
|
||||
|
||||
def paginator_qry(qryset, page_number):
|
||||
"""
|
||||
This method is used to paginate query set
|
||||
"""
|
||||
paginator = Paginator(qryset, 10)
|
||||
qryset = paginator.get_page(page_number)
|
||||
return qryset
|
||||
|
||||
|
||||
@login_required
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
{% if validate_attendances.has_previous %}
|
||||
<span
|
||||
class="oh-card-dashboard__title"
|
||||
id="department-previous"
|
||||
style="cursor: pointer"
|
||||
hx-target="#AttendanceValidateTarget"
|
||||
hx-get="{% url 'dashboard-attendance-validate' %}?{{pd}}&page={{ validate_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 %}
|
||||
|
||||
<span class="oh-card-dashboard__title"
|
||||
>{% trans 'Attendance To Validate' %}
|
||||
</span>
|
||||
|
||||
{% if validate_attendances.has_next %}
|
||||
<span
|
||||
class="oh-card-dashboard__title float-end"
|
||||
id="department-previous"
|
||||
style="cursor: pointer"
|
||||
hx-target="#AttendanceValidateTarget"
|
||||
hx-get="{% url 'dashboard-attendance-validate' %}?{{pd}}&page={{ validate_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 %}
|
||||
<div class=" float-end mb-2">
|
||||
{% if validate_attendances.has_previous %}
|
||||
<span
|
||||
class="oh-card-dashboard__title"
|
||||
id="department-previous"
|
||||
style="cursor: pointer"
|
||||
hx-target="#AttendanceValidateTarget"
|
||||
hx-get="{% url 'dashboard-attendance-validate' %}?{{pd}}&page={{ validate_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 validate_attendances.has_next %}
|
||||
<span
|
||||
class="oh-card-dashboard__title float-end ms-2"
|
||||
id="department-previous"
|
||||
style="cursor: pointer"
|
||||
hx-target="#AttendanceValidateTarget"
|
||||
hx-get="{% url 'dashboard-attendance-validate' %}?{{pd}}&page={{ validate_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 validate_attendances.has_next or validate_attendances.has_previous %}
|
||||
<span class="oh-pagination__page float-end fw-bold">
|
||||
{% trans "Page" %} {{ validate_attendances.number }} {%trans "of" %}
|
||||
{{validate_attendances.paginator.num_pages }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-card-dashboard__body" style="height: 80%">
|
||||
{% if validate_attendances %}
|
||||
@@ -99,10 +107,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<span class="oh-pagination__page float-end mt-2 fw-bold">
|
||||
{% trans "Page" %} {{ validate_attendances.number }} {%trans "of" %}
|
||||
{{validate_attendances.paginator.num_pages }}.
|
||||
</span>
|
||||
{% else %}
|
||||
<div
|
||||
style="
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="oh-sticky-table__th">{% trans "Employee" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Leave Type" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Requested Days" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
|
||||
@@ -5,16 +5,15 @@
|
||||
<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 "Start Date" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "End Date" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "period" %}</div>
|
||||
<div class="oh-sticky-table__th"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for leave_request in leave_requests %}
|
||||
<div class="oh-sticky-table__tr" draggable="true" data-toggle="oh-modal-toggle" data-target="#bigModal"
|
||||
hx-get="{% url 'one-request-view' leave_request.id %}?instances_ids={{requests_ids}}&dashboard=true" hx-target="#bigModalTarget">
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
<img src="{{leave_request.employee_id.get_avatar}}" class="oh-profile__image"
|
||||
@@ -23,8 +22,7 @@
|
||||
<span class="oh-profile__name oh-text--dark">{{leave_request.employee_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{leave_request.start_date}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">{{leave_request.end_date}}</div>
|
||||
<div class="oh-sticky-table__td"><span class="dateformat_changer">{{leave_request.start_date}}</span> {% trans "to" %} <span class="dateformat_changer">{{leave_request.end_date}}</span></div>
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
<div class="oh-btn-group" >
|
||||
<a type="submit" href="{% url 'request-approve' leave_request.id %}" title="{% trans 'Approve' %}"
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider">
|
||||
{% if overtime_attendances.has_previous %}
|
||||
<span
|
||||
class="oh-card-dashboard__title"
|
||||
id="department-previous"
|
||||
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 %}
|
||||
|
||||
|
||||
<span class="oh-card-dashboard__title"
|
||||
>{% trans 'Overtime To Approve' %}
|
||||
</span>
|
||||
|
||||
{% if overtime_attendances.has_next %}
|
||||
<span
|
||||
class="oh-card-dashboard__title float-end"
|
||||
id="department-previous"
|
||||
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 %}
|
||||
<div class=" float-end mb-2">
|
||||
{% if overtime_attendances.has_previous %}
|
||||
<span
|
||||
class="oh-card-dashboard__title"
|
||||
id="department-previous"
|
||||
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 "
|
||||
id="department-previous"
|
||||
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>
|
||||
</div>
|
||||
|
||||
<div class="oh-card-dashboard__body" id="OTApproveBody" style="height: 80%">
|
||||
@@ -100,10 +108,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<span class="oh-pagination__page float-end mt-2 fw-bold">
|
||||
{% trans "Page" %} {{ overtime_attendances.number }} {%trans "of" %}
|
||||
{{overtime_attendances.paginator.num_pages }}.
|
||||
</span>
|
||||
{% else %}
|
||||
<div
|
||||
style="
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
{% load i18n %}
|
||||
<div class="oh-card-dashboard oh-card-dashboard--no-scale oh-card-dashboard--transparent" style="min-height: 423px;">
|
||||
<div class="oh-card-dashboard__header oh-card-dashboard__header--divider mb-0">
|
||||
{% if employees.has_previous %}
|
||||
|
||||
<span class="oh-card-dashboard__title">{% trans 'Offline Employees' %} </span>
|
||||
<div class=" float-end mb-2">
|
||||
{% if employees.has_previous %}
|
||||
<span class="oh-card-dashboard__title" id="employee-previous" style="cursor: pointer;" hx-target="#notInYetId"
|
||||
hx-get="{% url 'not-in-yet' %}?{{pd}}&page={{ employees.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 %}
|
||||
<span class="oh-card-dashboard__title">{% trans 'Offline Employees' %} </span>
|
||||
{% if employees.has_next %}
|
||||
|
||||
<span class="oh-card-dashboard__title float-end" id="employee-previous" style="cursor: pointer;" hx-target="#notInYetId"
|
||||
hx-get="{% url 'not-in-yet' %}?{{pd}}&page={{ employees.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>
|
||||
{% if employees.has_next %}
|
||||
<span class="oh-card-dashboard__title ms-2 float-end" id="employee-previous" style="cursor: pointer;" hx-target="#notInYetId"
|
||||
hx-get="{% url 'not-in-yet' %}?{{pd}}&page={{ employees.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 employees.has_previous or employees.has_next %}
|
||||
<span class="oh-pagination__page mt-1 fw-bold">
|
||||
{% trans "Page" %} {{ employees.number }}
|
||||
{%trans "of" %} {{employees.paginator.num_pages }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if employees %}
|
||||
<div class="oh-card-dashboard__body">
|
||||
@@ -47,10 +55,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="oh-pagination__page float-end mt-2 fw-bold">
|
||||
{% trans "Page" %} {{ employees.number }}
|
||||
{%trans "of" %} {{employees.paginator.num_pages }}.
|
||||
</span>
|
||||
{% else %}
|
||||
<div style="height: 380px; display:flex;align-items: center;justify-content: center;" class="">
|
||||
<div style="" class="">
|
||||
|
||||
Reference in New Issue
Block a user