{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <h5 class="report-header" style="width: 120%;">{{ page_title }}</h5>
    <table class="report-data" width="120%">
        <thead class="header">
        <tr>
            <th>Patient</th>
            <th>Referring Physician</th>
            <th>Interpreting Physician</th>
            <th>Letter Type</th>
            <th>Letter Status</th>
            <th>Letter Request Date</th>
            <th>Date of letter initiation</th>
            <th>Letter audited</th>
            <th>Date Sent</th>
            <th>Fax Confirmation</th>
            <th>Created By</th>
            <th>Assigned To</th>
            <th>Link to Letter</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>
                <td><a href="{{ path('patient_detail', {patient_id : record.patientId|base64Encode, tab: 'l'}) }}" target="_blank">{{ record.patientName }}</a></td>
                <td>{{ record.referringPhysician }}</td>
                <td>{{ record.hsatInProvider }}</td>
                <td>{{ record.letterType }}</td>
                <td>{{ record.letterStatus }}</td>
                <td>{{ record.requestDate }}</td>
                <td>{{ record.startedAndCompletedDate }}</td>
                <td>{{ record.reviewBy ? record.reviewBy~' ('~record.reviewAt~')' : '' }}</td>
                <td>{{ record.sentBy ? record.sentBy~' ('~record.sentAt~')' : '' }}</td>
                <td><a href="{{ path('patient_file_download', {patientFile_id: record.patientFileId|base64Encode|default('null')}) }}">{{ record.faxConfirmationDesc }}</a></td>
                <td>{{ record.createdBy }}</td>
                <td>{{ record.assignTo }}</td>
                <td><a href="{{ path('patient_letter_preview', {patientLetter_id : record.patient_letter_id|base64Encode, letter_type:record.letterType|default('null')}) }}" target="_blank">{{ record.letterType }}</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 %}