{% extends 'base.html' %}
{% load bootstrap4 %}
{% load static %}
{% load notifications_extras %}


{% block content %}

<div class="jumbotron">
    <h1>List of {{level}} notifications</h1>
    <p>
        {% if all %}
        <a href="{{request.path}}">Just show new notifications</a>
        {% else %}
        <a href="{{request.path}}?all=True">Show all read notifications as well
        </a>
        {% endif %}
    </p>
</div>
<div class="container">
    {% if notification_list %}
    {% for notification in notification_list %}
    {% render_notification notification hide_close=all %}
    {% endfor %}
    {% else %}
    <p>There are no new notifications</p>
    {% endif %}
</div>
{% if is_paginated %}
<nav aria-label="Page navigation example">
    <ul class="pagination justify-content-center">
        {% if page_obj.has_previous %}
        <li class="page-item"><a class="page-link" href="?page=1{% if all %}&all=True{% endif %}">&laquo; First</a></li>
        <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if all %}&all=True{% endif %}">Previous</a></li>
        {% endif %}

        <li class="page-item active">
            <span class="page-link">
                {{ page_obj.number }}<span class="sr-only">of {{ paginator.num_pages }}</span>
            </span>
        </li>

        {% if page_obj.has_next %}
        <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}{% if all %}&all=True{% endif %}">Next</a></li>
        <li class="page-item"><a class="page-link" href="?page={{ paginator.num_pages }}{% if all %}&all=True{% endif %}">Last &raquo;</a></li>
        {% endif %}
    </ul>
</nav>
{% endif %}
{% endblock %}
