{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <h3 class="report-header"><strong>{{ page_title }}</strong> From: {{ date_from }} To: {{ date_to }}</h3>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th>ID</th>
            <th>Schedule Date</th>
            <th>Time</th>
            <th>Schedule Status</th>
            <th>Patient</th>
            <th>Company</th>
            <th>Branch</th>
            <th>Clinician</th>
            <th>Encounter Type</th>
            <th>Status</th>
            <th>Created By</th>
            {#<th>Note</th>#}
        </tr>
        </thead>
        <tbody>
        {% set totalCount = 0 %}
        {% for record in records %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set totalCount = totalCount + 1 %}
            <tr class="{{ trC }}">
                <td><a href="{{ path('patient_detail',{ patient_id:record.patientId|base64Encode, tab:'s'}) }}" target="_blank">{{ record.scheduleId }}</a></td>
                <td>{{ record.scheduleDate }}</td>
                <td>{{ record.startTime~' - '~record.endTime }}</td>
                <td>{{ record.scheduleStatus }}</td>
                <td>{{ record.patient }}</td>
                <td>{{ record.companyDesc }}</td>
                <td>{{ record.branch }}</td>
                <td>{{ record.clinician }}</td>
                <td>{{ record.chartType }}</td>
                <td>{{ record.chartStatus }}</td>
                <td>{{ record.user }}</td>
                {#<td>{{ record.note }}</td>#}
            </tr>
        {% endfor %}
    </table>
    <div>Total Records: {{ totalCount }}</div>
    <h3 class="report-header">Appointment Summary</h3>
    <div style="border: 1px solid; padding: 20px; margin: 10px;">
        <ul>
            {% for key,encounterType in apptSummary.clinicians %}
                    {{ key }}
                    <ul>
                        {% for key2,scheduleStatus in encounterType %}
                            <li>
                                {{ key2 }}
                                <ul>
                                    {% for key3,scheduleStatus in scheduleStatus %}
                                        <li>
                                            {{ key3 }} : <strong>{{ scheduleStatus }}</strong>
                                        </li>
                                    {% endfor %}
                                </ul>
                            </li>
                        {% endfor %}
                    </ul>
            {% endfor %}
        </ul>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        jQ(document).ready(function(){
            report_preview.init();
        });
        //]]>
    </script>
{% endblock %}