<form class="js-form" method="{{form.method | default('POST')}}" action="{{site.uri.public}}/{{form.action}}">
    {% include "forms/csrf.html.twig" %}
    <div class="js-form-alerts">
    </div>
    <div class="row">
        {% block user_form %}
            {% if 'user_name' not in form.fields.hidden %}
            <div class="col-sm-6">
                <div class="form-group">
                    <label>{{translate('USERNAME')}}</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fas fa-edit fa-fw"></i></span>
                        <input type="text" class="form-control" name="user_name" autocomplete="off" value="{{user.user_name}}" placeholder="{{translate('USERNAME')}}" {% if 'user_name' in form.fields.disabled %}disabled{% endif %}>
                    </div>
                </div>
            </div>
            {% endif %}
            {% if 'group' not in form.fields.hidden %}
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="input-group">{{translate('GROUP')}}</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fas fa-users fa-fw"></i></span>
                        {% if 'group' in form.fields.disabled %}
                            <input type="text" class="form-control" name="theme" value="{{user.group.name}}" disabled>
                        {% else %}
                            <select id="input-group" class="form-control js-select2" name="group_id">
                                <option value="0">{{translate('GROUP.NONE')}}</option>
                                <option disabled="disabled">-----</option>
                                {% for group in groups %}
                                <option value="{{group.id}}" {% if (group.id == user.group_id) %}selected{% endif %}>{{group.name}}</option>
                                {% endfor %}
                            </select>
                        {% endif %}
                    </div>
                </div>
            </div>
            {% endif %}
            {% if 'name' not in form.fields.hidden %}
            <div class="col-sm-6">
                <div class="form-group">
                    <label>{{translate('FIRST_NAME')}}</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fas fa-edit fa-fw"></i></span>
                        <input type="text" class="form-control" name="first_name" autocomplete="off" value="{{user.first_name}}" placeholder="{{translate('FIRST_NAME')}}" {% if 'name' in form.fields.disabled %}disabled{% endif %}>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label>{{translate('LAST_NAME')}}</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fas fa-edit fa-fw"></i></span>
                        <input type="text" class="form-control" name="last_name" autocomplete="off" value="{{user.last_name}}" placeholder="{{translate('LAST_NAME')}}" {% if 'name' in form.fields.disabled %}disabled{% endif %}>
                    </div>
                </div>
            </div>
            {% endif %}
            {% if 'email' not in form.fields.hidden %}
            <div class="col-sm-6">
                <div class="form-group">
                    <label>{{translate('EMAIL')}}</label>
                    <div class="input-group js-copy-container">
                        <span class="input-group-addon"><i class="fas fa-envelope fa-fw"></i></span>
                        <input type="text" class="form-control js-copy-target" name="email" autocomplete="off" value="{{user.email}}" placeholder="{{translate('EMAIL')}}" {% if 'email' in form.fields.disabled %}disabled{% endif %}>
                        {% if 'email' in form.fields.disabled %}
                            <span class="input-group-btn">
                                <button class="btn btn-default uf-copy-trigger js-copy-trigger" type="button"><i class="fas fa-clipboard"></i></button>
                            </span>
                        {% endif %}
                    </div>
                </div>
            </div>
            {% endif %}
            {% if 'theme' not in form.fields.hidden %}
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="input-theme">{{translate('THEME')}}</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fas fa-puzzle-piece fa-fw"></i></span>
                        {% if 'theme' in form.fields.disabled %}
                            <input type="text" class="form-control" name="theme" value="{{themes[user.theme]}}" disabled>
                        {% else %}
                            <select id="input-theme" class="form-control js-select2" name="theme">
                                {% for option, label in theme %}
                                <option value="{{option}}" {% if (option == user.theme) %}selected{% endif %}>{{label}}</option>
                                {% endfor %}
                            </select>
                        {% endif %}
                    </div>
                </div>
            </div>
            {% endif %}
            {% if 'locale' not in form.fields.hidden %}
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="input-locale">{{translate('LOCALE')}}</label>
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fas fa-language fa-fw"></i></span>
                        {% if 'locale' in form.fields.disabled %}
                            <input type="text" class="form-control" name="theme" value="{{locales[user.locale]}}" disabled>
                        {% else %}
                            <select id="input-locale" class="form-control js-select2" name="locale">
                                {% for option, label in locales %}
                                <option value="{{option}}" {% if (option == user.locale) %}selected{% endif %}>{{label}}</option>
                                {% endfor %}
                            </select>
                        {% endif %}
                    </div>
                </div>
            </div>
            {% endif %}
            {% if 'password' not in form.fields.hidden %}
                {% include "forms/partials/user-set-password.html.twig" %}
            {% endif %}
        {% endblock %}
    </div><br>
    <div class="row">
        <div class="col-xs-8 col-sm-4">
            <button type="submit" class="btn btn-block btn-lg btn-success">{{form.submit_text}}</button>
        </div>
        <div class="col-xs-4 col-sm-3 pull-right">
            <button type="button" class="btn btn-block btn-lg btn-link" data-dismiss="modal">{{translate('CANCEL')}}</button>
        </div>
    </div>
</form>
<!-- Include validation rules -->
<script>
{% include "pages/partials/page.js.twig" %}
</script>
