{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <div class="row max-width-initial">
        <div class="small-12 columns">
            <div class="content-container has-loading">
                <div class="content-container-content hide">
                    <div class="row max-width-initial">
                        <div class="large-4 columns">
                            <div class="input-group">
                                <label class="input-group-label">Branch</label>
                                <select class="input-group-field" id="branch-filter">
                                    <option value='All'>All</option>
                                    {% for h in healthFacilities %}
                                        <option value={{ h.id }}>{{ h.description }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                            <input type='checkbox' style='margin:10px; display: none;' class='patient-checkbox-hl7-all'><a style="display: none" class='href-new-action patient-checkbox-hl7-all'>Check All</a>
                        </div>
                        <div class="large-4 columns">
                            <div class="input-group">
                                <label class="input-group-label">Status</label>
                                <select class="input-group-field" id="active-filter">
                                    <option value='All'>All</option>
                                    <option value='1' selected>Active</option>
                                    <option value='0'>Inactive</option>
                                </select>
                            </div>
                        </div>
                        {% if userData.type == 'Super Admin' or 'Admin Patient New' in userData.accesses %}
                            <div class="large-4 columns">
                                <label class="middle text-right">
                                    <a class="href-new-action href-export-all-to-hl7" href="javascript:void(0)" id="download-hl7-all" title="Download all patient HL7 file"><i class="fa fa-cloud-download"></i> </a><a class="href-new-action">| </a>
                                    <a class="href-new-action" href="javascript:void(0)" id="download-show-checkbox" data-trigger="hidden" title="Download HL7 file"><i class="fa fa-download"></i> </a><a class="href-new-action">| </a>
                                    <a class="href-new-action" href="{{ path('patient_upload_form') }}" title="Upload HL7 file"><i class="fa fa-upload"></i> </a><a class="href-new-action">| </a>
                                    <a class="href-new-action" href="{{ path('patient_form') }}">New Patient</a>
                                    {% if userData.type == 'Super Admin' or 'Admin Clinicmaster File' in userData.accesses %}
                                        <a class="href-new-action">| </a><a class="href-new-action" href="{{ path('clinicmaster_file') }}">Imported Files</a>
                                    {% endif %}
                                </label>
                            </div>
                        {% endif %}
                    </div>
                    <form method="GET" action="{{ path('patient_mass_export_hl7') }}">
                        <table class="display responsive" id="patient-datalist" width="100%">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>Full Name</th>
                                <th>PHN</th>
                                <th>Branch</th>
                                <th>Address</th>
                                <th>Phone</th>
                                <th>Mobile</th>
                                <th>Gender</th>
                                <th>Birth Date</th>
                                <th>Action</th>
                            </tr>
                            </thead>
                            <tbody></tbody>
                        </table>
                        <div class="small-12 columns">
                            <hr class="max-width-initial">
                            <div class="row">
                                <div class="large-6 columns">
                                    <select name="forms[type]" id="hl7-types" style="display: none;">
                                        {% for messageType in hl7MessageTypes %}
                                            {% if messageType.settings.displayGlobal %}
                                                <option value="{{ messageType.code }}">{{ messageType.code ~ ' - ' ~ messageType.label }}</option>
                                            {% endif %}
                                        {% endfor %}
                                    </select>
                                </div>
                                <button type="submit" class="button just-continue" id="hl7-export" style="background-color: grey; display: none;">Export</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="reveal small" id="modal-small" data-reveal>
        <div id="modal-content-small"></div>
        <button class="close-button" data-close aria-label="Close modal" type="button">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script language="javascript">
        //<![CDATA[
        patient.settings.ajaxUrl = '{{ path('patient_ajax_list') }}';
        patient.settings.patient_export_all_hl7_formUrl = '{{ path('patient_export_all_hl7_form') }}';
        patient.settings.patient_export_all_hl7_formActionUrl = '{{ path('patient_export_all_hl7') }}';
        jQ(document).ready(function(){
            patient.init();
        });
        //]]>
    </script>
{% endblock %}