{% extends 'layouts/admin.twig' %}

{% block content %}

    <ul class="breadcrumbs el">
        <li><a href="/admin/">Admin</a> /</li>
        <li class="end">{{ title }}</li>
    </ul>

    <h1>
        {{ title }}
    </h1>

    <h3>
        Review Alerts
    </h3>
    {% if reviews.count() > 0 %}
        {% include 'admin/reviews/includes/filter.twig' %}
    {% endif %}

    {% if reviews.count() > 0 %}
        {% include 'admin/reviews/includes/list.twig' %}
    {% else %}
        <p>There are currently no review alerts</p>
    {% endif %}

    <h3>
        Flags
    </h3>

    {% if flags.count() > 0 %}
        <table class="manage-items">
            <tr>
                <th>ID</th>
                <th>Type</th>
                <th>Status</th>
                <th>Due Date</th>
                <th>Patient</th>
                <th>Flag</th>
            </tr>
            <tbody class="tabular">
            {% for flag in flags %}
                <tr>
                    <td>
                        {{ flag.id }}
                    </td>
                    <td class="capitalize">
                        {{ flag.type }}
                    </td>
                    <td>
                        {{ flag.status }}
                    </td>
                    <td {{ flag.dateRed ? 'class="red"' : '' }}>
                        {{ flag.due_date }}
                    </td>
                    <td>
                        <a href="{{ route('admin-patients-profile', {
                            id: flag.member_id
                        }) }}"
                            target="_blank"
                        >
                            {{ flag.member.addressBilling.firstname }} {{ flag.member.addressBilling.lastname }}
                        </a>
                    </td>
                    <td>
                        {{ flag.content }}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>There are currently no flag alerts</p>
    {% endif %}

{% endblock %}