<?php
/**
 * @var Slider $slider
 */

use kernel\app_modules\slider\models\Slider;

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

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


$form->field(class: \itguild\forms\inputs\TextArea::class, name: "content", params: [
    'class' => "form-control",
    'placeholder' => 'Контент',
    'rows' => '10',
    'value' => $model->content ?? ''
])
    ->setLabel("Контент")
    ->render();

$form->field(class: \itguild\forms\inputs\TextInput::class, name: "additional_information", params: [
    'class' => "form-control",
    'placeholder' => 'Дополнительная информация',
    'rows' => '10',
    'value' => $model->additional_information ?? ''
])
    ->setLabel("Дополнительная информация")
    ->render();

$form->field(class: \itguild\forms\inputs\TextInput::class, name: "link", params: [
    'class' => "form-control",
    'placeholder' => 'Ссылка',
    'rows' => '10',
    'value' => $model->link ?? ''
])
    ->setLabel("Ссылка")
    ->render();

$form->field(class: \itguild\forms\inputs\Select::class, name: "status", params: [
    'class' => "form-control",
    'value' => $model->status ?? ''
])
    ->setLabel("Статус")
    ->setOptions(Slider::getStatus())
    ->render();

$entityRelations = new \kernel\EntityRelation();
if (!isset($model)) {
    $model = new Slider();
}
$entityRelations->renderEntityAdditionalPropertyFormBySlug("slider", $model);

?>
    <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();
