{% 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>Referral Date</th>
            <th>Received Date</th>
            <th>Referring Physician</th>
            <th>Referring Affiliate</th>
            <th>Checked</th>
            <th>Unchecked</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>{{ record.patientFullName }}</td>
                <td>{{ record.referralDate }}</td>
                <td>{{ record.receiveDate }}</td>
                <td>{{ record.referringProvider }}</td>
                <td>{{ record.referringHealthFacility }}</td>
                <td>
                    {% set split = record.patientChecklist_Checked|split(',') %}
                    {% for s in split %}
                        {% set patientChecked = s|split('|') %}
                        <div>{{ patientChecked[1]|default('') }}</div>
                    {% endfor %}
                </td>
                <td>
                    {% set split1 = record.patientChecklist_Unchecked|split(',') %}
                    {% for s1 in split1 %}
                        {% set patientUnchecked = s1|split('|') %}
                        <div>{{ patientUnchecked[1]|default('') }}</div>
                    {% endfor %}
                </td>
            </tr>
        {% endfor %}
    </table>
    <div>Total Records: {{ totalCount }}</div>
    <div>&nbsp;</div>
    <div class="large-6 columns">
        <h5 class="report-header">Summary - Checked</h5>
        <table class="report-data" width="100%">
            <thead class="header">
            <tr>
                <th>Checklist</th>
                <th>Count</th>
            </tr>
            </thead>
            <tbody>
            {% set totalCount = 0 %}
            {% for checked, desc in summary.checked %}
                <tr>
                    <td>{{ checked }}</td>
                    <td>{{ desc }}</td>
                </tr>
            {% endfor %}
        </table>
    </div>
    <div class="large-6 columns">
        <h5 class="report-header">Summary - Unchecked</h5>
        <table class="report-data" width="100%">
            <thead class="header">
            <tr>
                <th>Checklist</th>
                <th>Count</th>
            </tr>
            </thead>
            <tbody>
            {% set totalCount = 0 %}
            {% for checked, desc in summary.unchecked %}
                <tr>
                    <td>{{ checked }}</td>
                    <td>{{ desc }}</td>
                </tr>
            {% endfor %}
        </table>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        jQ(document).ready(function(){
            report_preview.init();
        });
        //]]>
    </script>
{% endblock %}