{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <h5 class="report-header">{{ page_title }}</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th>ID</th>
            <th>Referral Date</th>
            <th>Patient</th>
            <th>Company</th>
            <th>Branch</th>
            <th>Email</th>
            <th>Contact No.</th>
            <th>Address</th>
            <th>DOB</th>
            <th>Appointments</th>
            <th>Last Appt.</th>
            <th>Gender</th>
            <th>Referred By</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 style=" overflow:hidden;">{{ record.patientId }}</td>
                <td style=" overflow:hidden;">{{ record.referralDate }}</td>
                <td><a href="{{ path('patient_detail', {patient_id : record.patientId|base64Encode}) }}" target="_blank">{{ record.patientName }}</a></td>
                <td>{{ record.companyDesc }}</td>
                <td>{{ record.healthFacilityDesc }}</td>
                <td>{{ record.email }}</td>
                <td>{{ record.contactNo }}</td>
                <td>{{ record.address }}</td>
                <td>{{ record.birthDate }}</td>
                <td style="text-align: right;">{{ record.appointmentCnt }}</td>
                <td>{{ record.lastAppt }}</td>
                <td>{{ record.gender }}</td>
                <td><a href="{{ path('patient_detail', {patient_id : record.referredById|base64Encode}) }}" target="_blank">{{ record.referredBy }}</a></td>
            </tr>
        {% endfor %}
    </table>
    <div>Total Records: {{ totalCount }}</div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        jQ(document).ready(function(){
            report_preview.init();
        });
        //]]>
    </script>
{% endblock %}