<?php
/**
 * @var \kernel\app_modules\user_custom_fields\models\UserCustomValues $model
 */

use kernel\app_modules\user_custom_fields\models\CustomField;

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

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

$form->field(\itguild\forms\inputs\Select::class, 'user_id', [
    'class' => "form-control",
    'value' => $model->user_id ?? ''
])
    ->setLabel("Пользователь")
    ->setOptions(\kernel\modules\user\service\UserService::getList())
    ->render();

$form->field(\itguild\forms\inputs\Select::class, 'custom_field_id', [
    'class' => "form-control",
    'value' => $model->custom_field_id ?? ''
])
    ->setLabel("Поле")
    ->setOptions(\kernel\app_modules\user_custom_fields\services\CustomFieldService::getList())
    ->render();

$form->field(\itguild\forms\inputs\TextInput::class, 'value', [
    'class' => "form-control",
    'placeholder' => 'Значение',
    'value' => $model->value ?? ''
])
    ->setLabel("Значение")
    ->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();
