{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <form method="POST" action="{{ path('account_user_form', {action: action, id: id}) }}">
        <div class="row max-width-initial">
            <div class="large-6 columns">
                <h5>Basic information</h5>
                <p class="form-hint-text">Enter basic information below</p>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.account_user_type) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.account_user_type) }}
                    </div>
                </div>
                <div class="row sales-agent hide">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.sales_agent_fullname) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.sales_agent_fullname) }}
                        {{ form_widget(form.sales_agent) }}
                    </div>
                </div>
                <div class="row account-staff hide">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.account_staff_fullname) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.account_staff_fullname) }}
                        {{ form_widget(form.account_staff) }}
                    </div>
                </div>
                <div class="row billing hide">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.account_user_billing_fullname) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.account_user_billing_fullname) }}
                        {{ form_widget(form.account_user_billing) }}
                    </div>
                </div>
                <div class="row provider hide">
                    <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 marketing-staff hide">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.marketingStaff_fullname) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.marketingStaff_fullname) }}
                        {{ form_widget(form.marketingStaff) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.first_name) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.first_name) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.middle_name) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.middle_name) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.last_name) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.last_name) }}
                    </div>
                </div>
            </div>
            <div class="large-6 columns">
                <h5>Credentials</h5>
                <p class="form-hint-text">Enter credentials below</p>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.username) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.username) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.password.first) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.password.first) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-4 large-text-right columns">
                        {{ form_label(form.password.second) }}
                    </div>
                    <div class="large-8 columns">
                        {{ form_widget(form.password.second) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.is_active) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.is_active) }}
                    </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 Account User 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('account_user') }}" class="button secondary">Back</a>
                </div>
            </div>
        </div>
        {{ form_widget(form.action) }}
        {{ form_widget(form.id) }}
        {{ form_widget(form._token) }}
    </form>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        accountUser_form.settings.salesAgent_autocompleteUrl = '{{ path('sales_agent_autocomplete') }}';
        accountUser_form.settings.accountStaff_autocompleteUrl = '{{ path('account_staff_autocomplete') }}';
        accountUser_form.settings.accountUserBilling_autocompleteUrl = '{{ path('account_user_billing_autocomplete') }}';
        accountUser_form.settings.provider_autocompleteUrl = '{{ path('provider_autocomplete') }}';
        accountUser_form.settings.marketingStaff_autocompleteUrl = '{{ path('marketing_staff_autocomplete') }}';
        jQ(document).ready(function(){
            accountUser_form.init();
        });
        //]]>
    </script>
{% endblock %}