{% set userData = app.session.get('userData') %}
<form method="POST" id="form-patientLinkedReferringHealthFacilityAndProvider">
    <h5>{{ page_title }}</h5>
    <div id="flash-messages-content-modal"></div>
    <div class="row max-width-initial">
        <div class="large-12 columns">
            <div class="row large-text-center">
                <div class="large-4 large-text-right columns">
                    <label class="middle required" for="patientLinkedReferringHealthFacilityAndProvider_healthFacility_desc">Referring Affiliate</label>
                </div>
                <div class="large-8 columns">
                    <input type="text" required id="patientLinkedReferringHealthFacilityAndProvider_healthFacility_desc">
                    <input type="hidden" required name="patientLinkedReferringHealthFacilityAndProvider[referringHealthFacility]" id="patientLinkedReferringHealthFacilityAndProvider_healthFacility">
                </div>
            </div>
            <div class="row large-text-center">
                <div class="large-4 large-text-right columns">
                    <label class="middle required" for="patientLinkedReferringHealthFacilityAndProvider_provider_desc">Referring Physician</label>
                </div>
                <div class="large-8 columns">
                    <input type="text" required id="patientLinkedReferringHealthFacilityAndProvider_provider_desc">
                    <input type="hidden" required name="patientLinkedReferringHealthFacilityAndProvider[referringProvider]" id="patientLinkedReferringHealthFacilityAndProvider_provider">
                </div>
            </div>
            <div class="row large-text-center">
                <div class="large-4 large-text-right columns">
                    <label class="middle required" for="patientLinkedReferringHealthFacilityAndProvider_startDate">Start Date</label>
                </div>
                <div class="large-8 columns">
                    <input type="text" required name="patientLinkedReferringHealthFacilityAndProvider[startDate]" id="patientLinkedReferringHealthFacilityAndProvider_startDate" class="date">
                </div>
            </div>
            <div class="row large-text-center">
                <div class="large-4 large-text-right columns">
                    {#{{ form_label(form.end_date) }}#}
                </div>
                <div class="large-8 columns">
                    {#{{ form_widget(form.end_date) }}#}
                </div>
            </div>
        </div>
    </div>
    <hr>
    <div class="row-max-width-initial">
        <div class="small-12 columns no-padding-right">
            <div class="button-container clearfix text-right">
                <a href="javascript:void(0)" class="button just-continue href-patient-linked-referring-health-facility-and-provider-action float-right" data-axn="{{ action }}"
                   data-message="Are you sure you want to save this information?"
                   style="margin-left: 10px; margin-right: 0;"
                >Save</a>
                {% if action == 'u' and (userData.type == 'Super Admin' or 'Admin Patient Referring Health Facility Delete' in userData.accesses) %}
                    <a href="javascript:void(0)" class="ask-continue button alert href-patient-linked-referring-health-facility-and-provider-action float-right" data-axn="d"
                       data-message="Are you sure you want to delete this record?"
                       style="margin-left: 10px; margin-right: 0;"
                    >Delete</a>
                {% endif %}
                <a href="javascript:void(0)" class="button secondary" data-close style="margin-left: 10px; margin-right: 0;">Close</a>
            </div>
        </div>
    </div>
    {#{{ form_widget(form.action) }}#}
    {#{{ form_widget(form.id) }}#}
    {#{{ form_widget(form.patient) }}#}
    {#{{ form_widget(form._token) }}#}
</form>
<script language="javascript">
    //<![CDATA[
    jQ(document).ready(function(){
        let autoCompleteUrl = '{{ path('referring_health_facility_autocomplete') }}' ;
        global.autocomplete.bind(autoCompleteUrl, '#patientLinkedReferringHealthFacilityAndProvider_healthFacility_desc', '#patientLinkedReferringHealthFacilityAndProvider_healthFacility');
        let autoCompleteUrl2 = '{{ path('referring_provider_autocomplete') }}' ;
        global.autocomplete.bind(autoCompleteUrl2, '#patientLinkedReferringHealthFacilityAndProvider_provider_desc', '#patientLinkedReferringHealthFacilityAndProvider_provider');
    });
    //]]>
</script>