<?php

declare(strict_types=1);

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use app\models\AccountForm;

?>

<div class="container d-flex flex-column h-100">
    <div class="row my-auto">
        <div class="mx-auto">
            <?php
            $form = ActiveForm::begin([
                'id' => 'form_account',
                'action' => false,
                'fieldConfig' => [
                    'template' => '{label}{input}{error}',
                    'options' => ['class' => '']
                ],
                'options' => [
                    'class' => '',
                    'onsubmit' => 'return false;'
                ]
            ]);

            $model = $model ?? new AccountForm;
            ?>

            <?= $form->field($model, 'mail', ['enableLabel' => false, 'options' => ['class' => 'mb-2']])->textInput(['autofocus' => true, 'placeholder' => $model->getAttributeLabel('mail')]) ?>
            <?= $form->field($model, 'pswd', ['enableLabel' => false])->passwordInput(['placeholder' => $model->getAttributeLabel('pswd')]) ?>

            <div class="d-flex mb-2 mt-3">
                <?= Html::submitButton('Войти', ['name' => 'submitAuthentication', 'onclick' => 'authentication(this.parentElement.parentElement);', 'class' => 'flex-grow-1 mr-2 btn btn-primary button_clean']) ?>
                <?= $form->field($model, 'auto', ['checkboxTemplate' => '<div class="checkbox button_clean">{beginLabel}' .
                    Html::submitButton('{labelTitle}', ['name' => 'submit', 'data-toggle' => 'button', 'class' => 'w-100 btn btn-primary button_clean', 'aria-pressed' => 'false']) .
                    '{endLabel}</div>'])->checkbox()->label($model->getAttributeLabel('auto'), ['class' => 'w-100 m-0']) ?>
            </div>
            <?= Html::submitButton('Регистрация', ['name' => 'submitRegistration', 'onclick' => 'registration(this.parentElement);', 'class' => 'col-12 ml-auto btn btn-success btn-sm button_clean']) ?>

            <?php ActiveForm::end(); ?>
        </div>
    </div>
</div>