{% macro paging(pagination) %}
	{% if pagination.last_page > 1 %}
		<div class="card-footer border-top">
			<nav aria-label="Pagination">
				<ul class="pagination justify-content-center mb-0">
					{% if pagination.current_page == 1 %}
						<li class="page-item disabled">
							<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
								<i class="fa-solid fa-angles-left"></i>
							</a>
						</li>
						<li class="page-item disabled">
							<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
								<i class="fa-solid fa-chevron-left"></i>
							</a>
						</li>
					{% elseif pagination.current_page > 1 %}
						<li class="page-item">
							<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno=1" tabindex="-1">
								<i class="fa-solid fa-angles-left"></i>
							</a>
						</li>
						<li class="page-item">
							<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno={{ pagination.current_page - 1 }}" tabindex="-1">
								<i class="fa-solid fa-chevron-left"></i>
							</a>
						</li>
					{% endif %}
					{% if pagination.current_page < pagination.last_page %}
						<li class="page-item">
							<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno={{ pagination.current_page + 1 }}" tabindex="-1">
								<i class="fa-solid fa-chevron-right"></i>
							</a>
						</li>
						<li class="page-item">
							<a class="page-link" href="?page={{ page }}&action={{ action }}{{ pagination.link_additions }}&pageno={{ pagination.last_page }}" tabindex="-1">
								<i class="fa-solid fa-angles-right"></i>
							</a>
						</li>
					{% else %}
						<li class="page-item disabled">
							<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
								<i class="fa-solid fa-chevron-right"></i>
							</a>
						</li>
						<li class="page-item disabled">
							<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
								<i class="fa-solid fa-angles-right"></i>
							</a>
						</li>
					{% endif %}
				</ul>
			</nav>
		</div>
	{% endif %}
{% endmacro %}

{% macro titlesorting(pagination, key, th) %}
	{% if pagination is defined and key in pagination.sortfields %}
		<th class="p-3 {{ th.class }}">
			{{ th.text }}
			<a href="?page={{ page }}&action={{ action }}&pageno={{ pagination.current_page }}&sortfield={{ key }}&sortorder=desc">&darr;</a>
			<a href="?page={{ page }}&action={{ action }}&pageno={{ pagination.current_page }}&sortfield={{ key }}&sortorder=asc">&uarr;</a>
		</th>
	{% else %}
		<th class="p-3 {{ th.class }}">{{ th.text }}</th>
	{% endif %}
{% endmacro %}
