{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <h5 class="report-header" style=" width:100%">{{ page_title }}</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="10%">Patient</th>
            <th width="10%">Branch</th>
            <th width="10%">User</th>
            <th width="7%">Referral Date</th>
            <th width="7%">Received Date</th>
            <th width="10%">Date</th>
            <th width="10%">Description</th>
            <th width="10%">File Type</th>
            <th width="26%">Notes</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:'f'}) }}" target="_blank">{{ record.patientName }}</a></td>
                <td>{{ record.healthFacilityDesc }}</td>
                <td>{{ record.createdBy }}</td>
                <td>{{ record.referralDate }}</td>
                <td>{{ record.receiveDate }}</td>
                <td>{{ record.createdAt }}</td>
                <td><a href="{{ path('patient_file_download', {patientFile_id : record.patientFileId|default('null')|base64Encode}) }}">{{ record.fileName }}</a></td>
                <td>{{ record.fileTypeDesc }}</td>
                <td>{{ record.note|raw }}</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 %}