{% extends "./template.html" %}
{% block content %}
    <h1 class="mt-5">NearBeach Alerts!</h1>
    {% if project_results %}
        <div class="card mt-4">
            <div class="card-header">
                <h4>Projects overdue</h4>
            </div>
            <div class="card-body">
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <td>Project ID</td>
                            <td>Project Name</td>
                            <td>End Date!</td>
                        </tr>
                    </thead>
                    {% for row in project_results %}
                        <tr class="table-danger">
                            <td><a href="{% url 'project_information' row.project_id %}">PRO{{ row.project_id }}</a></td>
                            <td>{{ row.project_name }}</td>
                            <td>{{ row.project_end_date }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    {% endif %}
    {% if task_results %}
        <div class="card mt-4">
            <div class="card-header">
                <h4>Tasks overdue</h4>
            </div>
            <div class="card-body">
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <td>Task ID</td>
                            <td>Task Name</td>
                            <td>End Date!</td>
                        </tr>
                    </thead>
                    {% for row in task_results %}
                        <tr class="table-danger">
                            <td><a href="{% url 'task_information' row.task_id %}">TASK{{ row.task_id }}</a></td>
                            <td>{{ row.task_short_description }}</td>
                            <td>{{ row.task_end_date }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    {% endif %}

    {% if opportunity_results %}
        <div class="card mt-4">
            <div class="card-header">
                <h4>Opportunity overdue</h4>
            </div>
            <div class="card-body">
                <table class="table table-hover table-striped">
                    <thead>
                        <tr>
                            <td>Opportunity ID</td>
                            <td>Opportunity Name</td>
                            <td>End Date!</td>
                        </tr>
                    </thead>
                    {% for row in opportunity_results %}
                        <tr class="table-danger">
                            <td><a href="{% url 'opportunity_information' row.opportunity_id %}">OPP{{ row.opportunity_id }}</a></td>
                            <td>{{ row.opportunity_name }}</td>
                            <td>{{ row.opportunity_expected_close_date }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    {% endif %}

    {% if quote_results %}
        <div class="card mt-4">
            <div class="card-header">
                <h4>Quotes overdue</h4>
            </div>
            <div class="card-body">
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <td>Quote ID</td>
                            <td>Quote Title</td>
                            <td>End Date!</td>
                        </tr>
                    </thead>
                    {% for row in quote_results %}
                        <tr class="table-danger">
                            <td><a href="{% url 'quote_information' row.quote_id %}">QUOTE{{ row.quote_id }}</a></td>
                            <td>{{ row.quote_title }}</td>
                            <td>{{ row.quote_valid_till }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    {% endif %}
<a href="{% url 'dashboard' %}">Continue onto Dashboard</a>
{% endblock %}