[UPDT] EMPLOYEE: Pagination for document request view
This commit is contained in:
@@ -79,8 +79,7 @@
|
||||
</div>
|
||||
{% if documents %}
|
||||
<div class="oh-card">
|
||||
{% dynamic_regroup documents by document_request_id as document_grouper %}
|
||||
{% for document_list in document_grouper %}
|
||||
{% for document_list in documents reversed %}
|
||||
<div class="oh-accordion-meta">
|
||||
<div class="oh-accordion-meta__item">
|
||||
<div
|
||||
@@ -108,12 +107,13 @@
|
||||
<a class="oh-dropdown__link"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#documentRequestCreateModal"
|
||||
hx-get="{% url 'document-request-update' document_list.grouper.id %}"
|
||||
hx-get="{% url 'document-request-update' document_list.list.0.document_request_id.id %}"
|
||||
hx-target="#documentRequestCreateForm">{% trans "Edit" %}</a>
|
||||
</li>
|
||||
<li class="oh-dropdown__item">
|
||||
|
||||
<form action="{% url 'document-request-delete' document_list.grouper.id %}"
|
||||
<form
|
||||
action="{% url 'document-request-delete' document_list.list.0.document_request_id.id %}"
|
||||
class="w-50"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to delete this Document Request?" %}');"
|
||||
method='post'>
|
||||
@@ -230,9 +230,24 @@
|
||||
>
|
||||
<ion-icon class="me-1" name="checkmark-outline"></ion-icon>
|
||||
</a>
|
||||
{% if document.status == 'rejected' %}
|
||||
<a class="oh-btn oh-btn--danger w-100 oh-btn--disabled" onclick="event.stopPropagation()">
|
||||
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
|
||||
</a>
|
||||
{% else %}
|
||||
<a
|
||||
type="submit"
|
||||
hx-get="{% url 'document-reject' document.id %}"
|
||||
hx-target="#rejectFileForm"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#rejectFileModal"
|
||||
title="{% trans 'Reject' %}"
|
||||
class="oh-btn oh-btn--danger w-100"
|
||||
onclick="event.stopPropagation()"
|
||||
>
|
||||
<ion-icon class="me-1" name="close-circle-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<form action="{% url 'document-delete' document.id %}"
|
||||
@@ -261,10 +276,145 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-pagination">
|
||||
<span class="oh-pagination__page">
|
||||
{% trans "Page" %} {{ document_list.list.number }}
|
||||
{%trans "of" %} {{document_list.list.paginator.num_pages }}.
|
||||
</span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1"
|
||||
>{% trans "Page" %}</span
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
name="{{document_list.dynamic_name}}"
|
||||
class="oh-pagination__input"
|
||||
value="{{document_list.list.number}}"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}"
|
||||
hx-target="#historyTable"
|
||||
min="1"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %}
|
||||
{{document_list.list.paginator.num_pages}}</span
|
||||
>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if document_list.list.has_previous %}
|
||||
<li
|
||||
class="oh-pagination__item oh-pagination__item--wide"
|
||||
>
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&{{document_list.dynamic_name}}=1"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li
|
||||
class="oh-pagination__item oh-pagination__item--wide"
|
||||
>
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&{{document_list.dynamic_name}}={{ document_list.list.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %} {% if document_list.list.has_next %}
|
||||
<li
|
||||
class="oh-pagination__item oh-pagination__item--wide"
|
||||
>
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&{{document_list.dynamic_name}}={{ document_list.list.next_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li
|
||||
class="oh-pagination__item oh-pagination__item--wide"
|
||||
>
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&{{document_list.dynamic_name}}={{ document_list.list.paginator.num_pages }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="oh-pagination">
|
||||
<span class="oh-pagination__page">
|
||||
{% trans "Page" %} {{ documents.number }} {% trans "of" %}
|
||||
{{ documents.paginator.num_pages }}.
|
||||
</span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1"
|
||||
>{% trans "Page" %}</span
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{documents.number}}"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}"
|
||||
hx-target="#historyTable"
|
||||
min="1"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %}
|
||||
{{documents.paginator.num_pages}}</span
|
||||
>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if documents.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&page={{ documents.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %} {% if documents.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&page={{ documents.next_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#historyTable"
|
||||
hx-get="{% url 'asset-history-search' %}?{{pd}}&page={{ documents.paginator.num_pages }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="oh-404">
|
||||
|
||||
Reference in New Issue
Block a user