{% extends "theme::layouts/default" %}

{% block styles %}
    {{ asset_style('visiosoft.theme.base::css/login.css') }}
{% endblock %}

{% block content %}
    {% set phoneLogin = not setting_value('visiosoft.module.advs::register_email_field') or app.request.get('type') == 'phone' %}
    <div class="row justify-content-center">
        <div class="col-12 text-left m-0 row justify-content-center">
            <div class="col-12 col-lg-5 m-3 login-section">
                {% set form = form('signIn')
                    .redirect(app.request.get('redirect'))
                    .get() %}
                {{ form_open({
                    'class': 'aaa',
                    'url': form.options.url
                })|raw }}
                <div class="col-12 pt-4 pt-lg-0">
                    <h3 class="text-center login_subject">
                        {{ trans('visiosoft.theme.base::button.login') }}
                    </h3>
                    <div class="form-group email-field email-field_type">
                        <label class="control-label">
                            {{ phoneLogin ? trans('visiosoft.theme.base::field.phone_number') : trans('visiosoft.theme.base::field.email') }}
                            <span class="required">*</span>
                        </label>

                        <div class="input-wrapper">
                            {{ form.fields.email.setAttributes({
                                'class': phoneLogin ? 'form-control phone' : 'form-control'
                            }).input|raw }}
                        </div>
                    </div>
                </div>
                <div class="col-12">
                    <div class="form-group password-field password-field_type">
                        <div class="col-12 p-0 row m-0">
                            <div class="col-6 p-0">
                                <label class="control-label">
                                    {{ trans('visiosoft.theme.base::field.password') }}
                                    <span class="required">*</span>
                                </label>
                            </div>
                            <div class="col-6 p-0 text-right">
                                <a href="{{ url_route('anomaly.module.users::password.forgot') }}">
                                    <small class="forgot_password">
                                        {{ trans('visiosoft.theme.base::field.forgot_password') }}
                                    </small>
                                </a>
                            </div>
                        </div>

                        <div class="input-wrapper">
                            {{ form.fields.password.input|raw }}
                        </div>
                    </div>
                </div>
                <div class="col-12 row m-0 pb-4 pb-lg-0">
                    <button class="btn btn-sm font-weight-bolder w-100 py-3">
                        <i class="fas fa-key"></i>
                        {{ trans('visiosoft.theme.base::button.login') }}
                    </button>
                </div>
                <div class="col-12 py-0">
                    <label class="c-input c-checkbox remember_me">
                        <input value="0" type="hidden" name="remember_me">
                        <input type="checkbox" name="remember_me" class="align-middle">
                        <span class="c-indicator"></span>
                        {{ trans('visiosoft.theme.base::field.remember_me') }}
                    </label>
                </div>

                {% if addBlock('login/oauth') or setting_value('visiosoft.module.advs::register_email_field') %}
                    <div class="text-center text-muted">- {{ trans('visiosoft.theme.base::field.or') }} -</div>
                    <div class="social-login py-2 px-3">
                        {% if setting_value('visiosoft.module.advs::register_email_field') %}
                            <a class="btn btn-info text-white w-100 d-flex align-items-center justify-content-center position-relative mb-3"
                               href="{{ url_route('anomaly.module.users::login') }}{{ phoneLogin ? '' : '?type=phone' }}">
                                <span class="position-relative py-1">
                                    {{ phoneLogin ? trans('visiosoft.theme.base::field.login_with_email_address') : trans('visiosoft.theme.base::field.login_with_phone_number') }}
                                </span>
                            </a>
                        {% endif %}
                        {{ addBlock('login/oauth')|raw }}
                    </div>
                {% endif %}
            </div>

            <div class="col-12 col-lg-5 m-3 py-4 row register-section align-items-center">
                <div class="col-12 text-center">
                    <h3 class="py-0">{{ trans('visiosoft.theme.base::field.not_a_member_yet') }}?</h3>
                    <p class="py-0">{{ trans('visiosoft.theme.base::field.not_a_member_yet_message') }}.</p>
                    <a href="{{ url('register') }}"
                       class="btn btn-sm">
                        <i class="fas fa-user-plus"></i>
                        {{ trans('visiosoft.theme.base::button.register') }}
                    </a>
                </div>
            </div>
        </div>
    </div>
    {{ asset_add('scripts.js','visiosoft.theme.base::js/login.js') }}
{% endblock %}