{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <h3 class="report-header"><strong>{{ page_title }}</strong> From: {{ date_from }} To: {{ date_to }}</h3>

    {% if type == 'rhf' %}
        <table class="report-data" width="100%">
            <thead class="header">
            <tr>
                <th>Created At</th>
                <th>Encounter</th>
                <th>Status</th>
                <th>Referring Affiliate</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 }}">
                <tr>
                    <td>{{ record.createdAt }}</td>
                    <td>{{ record.chartType_desc }}</td>
                    <td>{{ record.chartStatus_desc }}</td>
                    <td>{{ record.referringHealthFacility_desc }}</td>
                    <td>{{ record.note }}</td>
                </tr>
            {% endfor %}
        </table>
    {% endif %}

    {% if type == 'rp' %}
        <table class="report-data" width="100%">
            <thead class="header">
            <tr>
                <th>Created At</th>
                <th>Encounter</th>
                <th>Status</th>
                <th>Referring Physician</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 }}">
                <tr>
                    <td>{{ record.createdAt }}</td>
                    <td>{{ record.chartType_desc }}</td>
                    <td>{{ record.chartStatus_desc }}</td>
                    <td>{{ record.referringProvider_desc }}</td>
                    <td>{{ record.note }}</td>
                </tr>
            {% endfor %}
        </table>
    {% endif %}

    <div>Total Records: {{ totalCount }}</div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        jQ(document).ready(function(){
            report_preview.init();
        });
        //]]>
    </script>
{% endblock %}