{% extends '@RxConnexion/Admin/global.html.twig' %}
{% block body %}
    <h5 class="report-header" style=" width:100%">{{ page_title }}</h5>
    {% for record in records %}
        <div>
            <h4 style="background-color: #4ccfdd"><strong style="color: #0a0a0a;">{{ record.description }}</strong></h4>
        </div>
        <table>
            <thead>
            <tr>
                <th style="background-color: #b2b2b2"><span style="color: #000000"></span></th>
                {% for referringProvider in record.referringProviders %}
                    <th style="background-color: #b2b2b2"><span style="color: #000000">{{ referringProvider.name }}</span></th>
                {% endfor %}
                {#<th style="background-color: #b2b2b2"><span style="color: #000000">Total</span></th>#}
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Patients:</td>
                {% for rp in record.referringProviders %}
                    {% set hasTD = false %}
                    {% for patientTotal in record.total if rp.id == patientTotal.id %}
                        {% set hasTD = true %}
                        <td><a href="{{ path('report_patient_preview', {
                                company_id:'null',
                                branch_id:'null',
                                insurance:'null',
                                status:'null',
                                province_id:'null',
                                postal_code_id:'null',
                                referring_health_facility:'null',
                                referring_provider:patientTotal.id,
                                city:city
                            })
                            }}" target="_blank">{{ patientTotal.count }}</a></td>
                    {% endfor %}
                    {% if not hasTD %}
                        <td>0</td>
                    {% endif %}
                {% endfor %}
            </tr>
            </tbody>
        </table>
    {% endfor %}
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        jQ(document).ready(function(){
            report_preview.init();
        });
        //]]>
    </script>
{% endblock %}