<?php
/**
 * @var UserStage $model
 */

use kernel\app_modules\user_stage\models\UserStage;

$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/user_stage/edit/" . $model->id : "/admin/user_stage", 'multipart/form-data');

// Пример формы:


$form->field(\itguild\forms\inputs\TextInput::class, 'title', [
    'class' => "form-control",
    'placeholder' => 'Заголовок',
    'value' => $model->title ?? ''
])
    ->setLabel("Заголовок")
    ->render();

$form->field(\itguild\forms\inputs\TextArea::class, 'description', [
    'class' => "form-control",
    'placeholder' => 'Описание',
    'value' => $model->description ?? ''
])
    ->setLabel("Описание")
    ->render();

$form->field(\itguild\forms\inputs\TextInput::class, 'position', [
    'class' => "form-control",
    'placeholder' => 'Позиция',
    'type' => 'number',
    'value' => $model->position ?? ''
])
    ->setLabel("Позиция")
    ->render();

$form->field(\itguild\forms\inputs\TextInput::class, 'start_date', [
    'class' => "form-control",
    'placeholder' => 'Начало',
    'type' => 'date',
    'value' => $model->dateStartFormatedToForm ?? ''
])
    ->setLabel("Начало")
    ->render();

$form->field(\itguild\forms\inputs\TextInput::class, 'end_date', [
    'class' => "form-control",
    'placeholder' => 'Конец',
    'type' => 'date',
    'value' => $model->dateEndFormatedToForm ?? ''
])
    ->setLabel("Конец")
    ->render();

$form->field(\itguild\forms\inputs\TextArea::class, 'user_fields', [
    'class' => "form-control",
    'placeholder' => 'Поля пользователя',
    'value' => $model->user_fields ?? ''
])
    ->setLabel("Поля пользователя")
    ->render();

$form->field(\itguild\forms\inputs\Select::class, 'status', [
    'class' => "form-control",
    'value' => $model->status ?? ''
])
    ->setLabel("Статус")
    ->setOptions(UserStage::getStatus())
    ->render();
/*
$form->field(class: \itguild\forms\inputs\Select::class, name: "user_id", params: [
    'class' => "form-control",
    'value' => $model->user_id ?? ''
])
    ->setLabel("Пользователи")
    ->setOptions(\kernel\modules\user\service\UserService::createUsernameArr())
    ->render();
*/

?>
    <div class="row">
        <div class="col-sm-2">
            <?php
            $form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
                'class' => "btn btn-primary ",
                'value' => 'Отправить',
                'typeInput' => 'submit'
            ])
                ->render();
            ?>
        </div>
        <div class="col-sm-2">
            <?php
            $form->field(\itguild\forms\inputs\Button::class, name: "btn-reset", params: [
                'class' => "btn btn-warning",
                'value' => 'Сбросить',
                'typeInput' => 'reset'
            ])
                ->render();
            ?>
        </div>
    </div>
<?php
$form->endForm();
