{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <div class="row max-width-initial">
        <div class="large-8 columns">
            <form method="GET" action="{{ path('dashboard_appointment_notice_preview') }}">
                <div class="large-6 columns">
                    <div class="input-group">
                        <label class="input-group-label">Branch</label>
                        <select class="input-group-field" name="branch[]" multiple size="4">
                            <option value='All'>All</option>
                            {% for h in healthFacilities %}
                                <option value={{ h.id }} {{ h.id == branch ? 'selected' : '' }}>{{ h.description }}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                <div class="large-3 columns">
                    <div class="input-group">
                        <label class="input-group-label">Month </label>
                        <select class="input-group-field" name="month">
                            <option value="" selected>All</option>
                            {% for month in monthFilter %}
                                <option value="{{ month.value }}" {{ getMonth == month.value ? 'selected' : '' }}>{{ month.display }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="input-group">
                        <label class="input-group-label">Year </label>
                        <select class="input-group-field" name="year">
                            <option value="" selected>All</option>
                            {% for year in yearFilter %}
                                <option value="{{ year.value }}" {{ getYear == year.value ? 'selected' : '' }}>{{ year.display }}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                <div class="large-3 columns">
                    <button type="submit" class="button just-continue" value=""
                            data-message="Are you sure you want to save this information?"
                    >Apply filter</button>
                </div>
            </form>
            <form method="POST" action="{{ path('patient_appointment_notice_export_to_excel') }}">
                <div class="large-3 columns">
                    <button type="submit" class="button just-continue" value=""
                            data-message="Are you sure you want to save this information?"
                    >Export To Excel</button>
                </div>
            </form>
        </div>
        <div class="large-4 columns" style="border: 1px solid; margin-bottom: 20px;">
            <p><strong>Summary</strong></p>
            {% for summary in summaries %}
                <p style="margin-bottom: 0px;">{{ summary.summaryCount }}</p>
            {% endfor %}
        </div>
    </div>
    <div class="large-12 columns">
        <h5 class="report-header">{{ page_title }}</h5>
    </div>
    <div class="large-12 columns">
        <table class="report-data" width="100%">
            <thead class="header">
            <tr>
                <th>Schedule ID</th>
                <th>Branch</th>
                <th>Schedule Date</th>
                <th>Patient Name</th>
                <th>Clinician</th>
                <th>Encounter Type</th>
                <th>Start Time</th>
                <th>End Time</th>
            </tr>
            </thead>
            <tbody>
            {% for record in records %}
                <tr>
                    <td><a href="{{ path('patient_detail', {patient_id : record.ptId|base64Encode, tab:'s'}) }}" target="_blank">{{ record.schedId }}</a></td>
                    <td>{{ record.hfDesc }}</td>
                    <td>{{ record.schedDate }}</td>
                    <td>{{ record.ptName }}</td>
                    <td>{{ record.provName }}</td>
                    <td>{{ record.ctDesc }}</td>
                    <td>{{ record.sTime }}</td>
                    <td>{{ record.eTime }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td colspan="8">Total: {{ records|length|number_format(0, '.', ',') }}</td>
            </tr>
        </table>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
{% endblock %}