{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <div class="small-12 columns">
        <div id="flash-messages-content-page"></div>
        <nav aria-label="You are here:" role="navigation">
            <ul class="breadcrumbs">
                <li>
                    <a href="{{ path('referring_provider') }}">Referring Physician List</a>
                </li>
                <li>
                    <a href="{{ path('referring_provider_detail', {referringProvider_id : referring_provider_id, } ) }}">{{ referringProvider.fullName }}</a>
                </li>
                <li>
                    <span class="show-for-sr">Current: </span> Referring Physician Encounter
                </li>
            </ul>
        </nav>
        {% include '@RxConnexion/ReferringProvider/overview.html.twig' with {referringProvider: referringProvider} %}
        <br />
    </div>
    <form method="POST" action="{{ path('referring_provider_chart_form', {referring_provider_id: referring_provider_id, action: action, id: id}) }}" enctype="multipart/form-data">
        <div class="row max-width-initial">
            <div class="large-12 columns">
                <div class="content-container has-loading">
                    <div class="content-container-content">
                        <ul class="tabs custom-tabs" data-tabs role="tablist" id="patient-chart-tabs">
                            <li class="tabs-title {{ tab is null or tab is empty or tab == 'ma' ? 'is-active' : '' }}"><a href="#panel-main" role="tab" tabindex="0" aria-selected="true" >Main</a></li>
                            {#{% if userData.type == 'Super Admin' or 'Admin Patient Chart Device' in userData.accesses %}
                                <li class="tabs-title {{ tab == 'd' ? 'is-active' : '' }}"><a href="#panel-device" role="tab" tabindex="5" aria-selected="false" >Devices</a></li>
                            {% endif %}
                            {% if userData.type == 'Super Admin' or 'Admin Patient Chart Billing' in userData.accesses %}
                                <li class="tabs-title {{ tab == 'b' ? 'is-active' : '' }}"><a href="#panel-billing" role="tab" tabindex="6" aria-selected="false" >Billing</a></li>
                            {% endif %}
                            {% if userData.type == 'Super Admin' or 'Admin Patient Chart Payment' in userData.accesses %}
                                <li class="tabs-title {{ tab == 'p' ? 'is-active' : '' }}"><a href="#panel-payment" role="tab" tabindex="7" aria-selected="false" >Payment</a></li>
                            {% endif %}#}
                            <li class="tabs-title {{ tab == 'n' ? 'is-active' : '' }}"><a href="#panel-notes" role="tab" tabindex="8" aria-selected="false" >Notes</a></li>
                        </ul>
                        <div class="tabs-content custom-tabs-content" data-tabs-content="patient-chart-tabs">
                            <section role="tabpanel" aria-hidden="false" class="tabs-panel {{ tab is null or tab is empty or tab == 'ma' ? 'is-active' : '' }}" id="panel-main">
                                <div class="row large-text-center">
                                    <div class="large-6 columns">
                                        <div class="row">
                                            <div class="large-4 large-text-right columns">
                                                {{ form_label(form.health_facility_desc) }}
                                            </div>
                                            <div class="large-8 columns">
                                                {{ form_widget(form.health_facility_desc) }}
                                                {{ form_widget(form.health_facility) }}
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="large-4 large-text-right columns">
                                                {{ form_label(form.marketingStaff_desc) }}
                                            </div>
                                            <div class="large-8 columns">
                                                {{ form_widget(form.marketingStaff_desc) }}
                                                {{ form_widget(form.marketingStaff) }}
                                            </div>
                                        </div>
                                        {#<div class="row">#}
                                            {#<div class="large-4 large-text-right columns">#}
                                                {#{{ form_label(form.note_type) }}#}
                                            {#</div>#}
                                            {#<div class="large-8 columns">#}
                                                {#{{ form_widget(form.note_type) }}#}
                                            {#</div>#}
                                        {#</div>#}
                                        <div class="row">
                                            <div class="large-4 large-text-right columns">
                                                {{ form_label(form.note) }}
                                            </div>
                                            <div class="large-8 columns">
                                                {{ form_widget(form.note) }}
                                            </div>
                                        </div>
                                    </div>
                                    <div class="large-6 columns">
                                        <div class="row">
                                            <div class="large-4 large-text-right columns">
                                                {{ form_label(form.chart_type) }}
                                            </div>
                                            <div class="large-8 columns">
                                                {{ form_widget(form.chart_type) }}
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="large-4 large-text-right columns">
                                                {{ form_label(form.chart_status) }}
                                            </div>
                                            <div class="large-8 columns">
                                                {{ form_widget(form.chart_status) }}
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="large-4 large-text-right columns">
                                                {{ form_label(form.chart_date) }}
                                            </div>
                                            <div class="large-8 columns">
                                                {{ form_widget(form.chart_date) }}
                                            </div>
                                        </div>
                                        {#<div class="row">#}
                                            {#<div class="large-3 large-text-right columns">#}
                                                {#{{ form_label(form.is_endorsed) }}#}
                                            {#</div>#}
                                            {#<div class="large-1 columns">#}
                                                {#{{ form_widget(form.is_endorsed) }}#}

                                            {#</div>#}
                                            {#<div class="large-8 columns">#}
                                                {#{{ form_widget(form.account_user_endorsed_by) }}#}
                                                {#{{ form_widget(form.endorsed_by, { 'attr': {'style': 'display:none;'}}) }}#}
                                            {#</div>#}
                                        {#</div>#}
                                        {#<div class="row">#}
                                            {#<div class="large-4 large-text-right columns">#}
                                                {#{{ form_label(form.ticket_status) }}#}
                                            {#</div>#}
                                            {#<div class="large-8 columns">#}
                                                {#{{ form_widget(form.ticket_status_id) }}#}
                                                {#{{ form_widget(form.ticket_status, { 'attr': {'style': 'display:none;'}}) }}#}
                                            {#</div>#}
                                        {#</div>#}
                                        {#<div class="row">#}
                                            {#<div class="large-4 large-text-right columns">#}
                                                {#{{ form_label(form.ticket_severity) }}#}
                                            {#</div>#}
                                            {#<div class="large-8 columns">#}
                                                {#{{ form_widget(form.ticket_severity_id) }}#}
                                                {#{{ form_widget(form.ticket_severity, { 'attr': {'style': 'display:none;'}}) }}#}
                                            {#</div>#}
                                        {#</div>#}
                                    </div>
                                </div>
                            </section>
                            <section role="tabpanel" aria-hidden="true" class="tabs-panel {{ tab == 'n' ? 'is-active' : '' }}" id="panel-notes">
                                <div class="text-right">
                                    {% if userData.type == 'Super Admin' or 'Admin Referring Provider Chart Note New' in userData.accesses %}
                                        <a href="javascript:void(0)" class="href-referring-provider-chart-note-form href-new-action" data-action="n" data-id="0">New Notes</a>
                                    {% endif %}
                                </div>
                                <table class="display responsive" id="referring-provider-chart-note-datalist" width="100%">
                                    <thead>
                                    <tr>
                                        <th>Created At</th>
                                        <th>Created By</th>
                                        <th>Notes</th>
                                        <th>Action</th>
                                    </tr>
                                    </thead>
                                    <tbody></tbody>
                                </table>
                            </section>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <hr>
        <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 Referring Provider Chart 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('referring_provider_detail', { referringProvider_id : referring_provider_id, tab:'ch'}) }}" class="button secondary">Back</a>
            </div>
        </div>
        {{ form_widget(form.action) }}
        {{ form_widget(form.id) }}
        {{ form_widget(form.referringProvider) }}
        {{ form_widget(form._token) }}
    </form>
    <div class="reveal large" id="modal" data-reveal>
        <div id="modal-content"></div>
        <button class="close-button" data-close aria-label="Close modal" type="button">
            <span aria-hidden="true">&times;</span>
        </button>
    </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[
        referring_provider_chart_form.settings.account_user_autocomplete_url = '{{ path('account_user_active_autocomplete') }}';
        referring_provider_chart_form.settings.ticket_status_autocomplete_url = '{{ path('ticket_status_autocomplete') }}';
        referring_provider_chart_form.settings.ticket_severity_autocomplete_url = '{{ path('ticket_severity_autocomplete') }}';
        referring_provider_chart_form.settings.healthFacility_autocomplete_url = '{{ path('health_facility_autocomplete') }}' ;
        referring_provider_chart_form.settings.marketing_staff_autocomplete_url = '{{ path('marketing_staff_autocomplete') }}' ;

        referring_provider_chart_form.settings.chart_note_ajaxUrl = '{{ path('referring_provider_chart_note_ajax_list') }}';
        referring_provider_chart_form.settings.referringProvider_chart_note_formUrl = '{{ path('referring_provider_chart_note_form', {referringProviderChart_id : id}) }}' ;
        referring_provider_chart_form.settings.referringProvider_chart_note_formActionUrl = '{{ path('referring_provider_chart_note_save') }}' ;

        referring_provider_chart_form.settings.referringProviderChart_id = '{{ id }}' ;
        referring_provider_chart_form.settings.patient_chart_type = '{{ referringProviderChart.chartType.description }}' ;
        referring_provider_chart_form.settings.referringProvider_id = '{{ referring_provider_id }}' ;
        jQ(document).ready(referring_provider_chart_form.init);
        //]]>
    </script>
{% endblock %}
