{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <form method="POST" action="{{ path('patient_schedule_form', {patient_id : patient_id, action: action, id: id}) }}">
        <div class="row max-width-initial">
            <div class="large-6 columns">
                <h5>Schedule information</h5>
                <p class="form-hint-text">Enter schedule information below</p>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.health_facility_desc) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.health_facility_desc) }}
                        {{ form_widget(form.health_facility) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.provider_fullName) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.provider_fullName) }}
                        {{ form_widget(form.provider) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.note_type) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.note_type) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.note) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.note) }}
                    </div>
                </div>
            </div>
            <div class="large-6 columns" style="margin-top: 70px;">
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.scheduleStatus) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.scheduleStatus) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.chartType_desc) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.chartType_desc) }}
                        {{ form_widget(form.chartType) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.schedule_date) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.schedule_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="xxlarge-6 xlarge-6 large-6 medium-6 small-12 columns">
                        <label class="required">Start Time</label>
                        <div class="row collapse">
                            <div class="xxlarge-3 xlarge-3 large-3 medium-3 small-3 columns">
                                {{ form_widget(form.start_time_hour) }}
                            </div>
                            <div class="xxlarge-1 xlarge-1 large-1 medium-1 small-1 columns text-center">:</div>
                            <div class="xxlarge-3 xlarge-3 large-3 medium-3 small-3 columns">
                                {{ form_widget(form.start_time_minute) }}
                            </div>
                            <div class="xxlarge-1 xlarge-1 large-1 medium-1 small-1 columns text-center">&nbsp;</div>
                            <div class="xxlarge-3 xlarge-3 large-3 medium-3 small-3 columns end">
                                {{ form_widget(form.start_time_period) }}
                            </div>
                        </div>
                    </div>
                    <div class="xxlarge-6 xlarge-6 large-6 medium-6 small-12 columns">
                        <label class="required">End Time</label>
                        <div class="row collapse">
                            <div class="xxlarge-3 xlarge-3 large-3 medium-3 small-3 columns">
                                {{ form_widget(form.end_time_hour) }}
                            </div>
                            <div class="xxlarge-1 xlarge-1 large-1 medium-1 small-1 columns text-center">:</div>
                            <div class="xxlarge-3 xlarge-3 large-3 medium-3 small-3 columns">
                                {{ form_widget(form.end_time_minute) }}
                            </div>
                            <div class="xxlarge-1 xlarge-1 large-1 medium-1 small-1 columns text-center">&nbsp;</div>
                            <div class="xxlarge-3 xlarge-3 large-3 medium-3 small-3 columns end">
                                {{ form_widget(form.end_time_period) }}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="large-12 columns">
                <h5>Fax details</h5>
                <p class="form-hint-text">Enter fax details below</p>
                <div class="row">
                    <div class="large-2 large-text-right columns">
                        {{ form_label(form.faxCoverSelection) }}
                    </div>
                    <div class="large-10 columns">
                        {{ form_widget(form.faxCoverSelection) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-2 large-text-right columns">
                        {{ form_label(form.faxBodySelection) }}
                    </div>
                    <div class="large-10 columns">
                        {{ form_widget(form.faxBodySelection) }}
                    </div>
                </div>
            </div>
            <div class="small-12 columns">
                <hr class="max-width-initial">
                <div class="button-container">
                    <button type="submit" class="button just-continue" name="action" value="{{ action }}"
                            data-message="Are you sure you want to save this information?"
                    >Save</button>
                    {% if action == 'u' and (userData.type == 'Super Admin' or 'Admin Patient Schedule Delete' in userData.accesses) %}
                        <button type="submit" class="ask-continue button alert" name="action" value="d"
                                data-message="Are you sure you want to delete this record?"
                        >Delete</button>
                    {% endif %}
                    <a href="{{ path('patient_detail', {patient_id:patient_id, tab:'s'}) }}" class="button secondary">Back</a>
                </div>
            </div>
        </div>
        {{ form_widget(form.action) }}
        {{ form_widget(form.id) }}
        {{ form_widget(form.patient) }}
        {{ form_widget(form._token) }}
    </form>
    {% if action != 'n' %}
    <form method="POST" action="{{ path('appointment_notice_form', {patient_id: patient_id, schedule_id: id}) }}">
        <div class="row max-width-initial">
            <hr class="max-width-initial">
            <div class="large-12 columns">
                <h5>Create new appointment notice</h5>
                <div class="row">
                    <div class="large-6 columns">
                        {{ form_label(form2.affiliate_type) }}
                        {{ form_widget(form2.affiliate_type) }}
                    </div>
                    <div class="large-6 columns">
                        <div id="affiliate-Referring-Provider" class="hide">
                            {{ form_label(form2.patient_referring_provider_desc) }}
                            {{ form_widget(form2.patient_referring_provider_desc) }}
                            {{ form_widget(form2.patient_referring_provider) }}
                        </div>
                        <div id="affiliate-Referring-HealthFacility" class="hide">
                            {{ form_label(form2.patient_referring_health_facility_desc) }}
                            {{ form_widget(form2.patient_referring_health_facility_desc) }}
                            {{ form_widget(form2.patient_referring_health_facility) }}
                        </div>
                        <div id="affiliate-Insurance" class="hide">
                            {{ form_label(form2.patient_insurance_desc) }}
                            {{ form_widget(form2.patient_insurance_desc) }}
                            {{ form_widget(form2.patient_insurance) }}
                        </div>
                    </div>
                </div>
            </div>
            <div class="large-12 columns">
                <h5 class="subheader">Appointment Notices</h5>
                <table class="display responsive" id="appointmentNoticeFax-datalist" width="100%">
                    <thead>
                    <tr>
                        <th>Date/Time</th>
                        <th>Schedule ID</th>
                        <th>Type</th>
                        <th>Name</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
            <div class="small-12 columns">
                <hr class="max-width-initial">
                <div class="button-container">
                    <button type="submit" class="button just-continue hide" id="create-new-appointment-notice-save" name="action" value="{{ action }}"
                            data-message="Are you sure you want to save this information?"
                    >Save</button>
                </div>
            </div>
        </div>
        {{ form_widget(form2.action) }}
        {{ form_widget(form2.id) }}
        {{ form_widget(form2.patient) }}
        {{ form_widget(form2.schedule) }}
        {{ form_widget(form2._token) }}
    </form>
    {% endif %}
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        patient_schedule_form.settings.medical_facility_autocomplete_url = '{{ path('health_facility_autocomplete') }}';
        patient_schedule_form.settings.provider_autocomplete_url = '{{ path('for_patient_schedule_provider_autocomplete') }}';
        patient_schedule_form.settings.patient_referring_provider_autocompleteUrl = '{{ path('patient_referring_provider_autocomplete') }}';
        patient_schedule_form.settings.patient_referring_health_facility_autocompleteUrl = '{{ path('patient_referring_health_facility_autocomplete') }}';
        patient_schedule_form.settings.patient_insurance_autocompleteUrl = '{{ path('patient_insurance_autocomplete') }}';
        patient_schedule_form.settings.chartType_autocompleteUrl = '{{ path('chart_type_autocomplete') }}';
        patient_schedule_form.settings.patientId = '{{ patient_id }}';
        patient_schedule_form.settings.scheduleId = '{{ id }}';
        patient_schedule_form.settings.appointmentNoticeFax_ajaxUrl= '{{ path('patient_appointment_notice_fax_ajax_list') }}';
        jQ(document).ready(function(){
            patient_schedule_form.init();
        });
        //]]>
    </script>
{% endblock %}