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

use itguild\forms\ActiveForm;
use kernel\modules\notification\models\Notification;

$form = new ActiveForm();
$form->beginForm(isset($model) ? "/admin/notification/edit/" . $model->id : "/admin/notification");

$form->field(class: \itguild\forms\inputs\Select::class, name: "user_id", params: [
    'class' => "form-control",
    'value' => $model->user_id ?? ''
])
    ->setLabel(Notification::labels()['user_id'])
    ->setOptions(\kernel\modules\user\service\UserService::createUsernameArr())
    ->render();

$form->field(\itguild\forms\inputs\TextInput::class, 'subject', [
        'class' => "form-control",
        'placeholder' => Notification::labels()['subject'],
        'value' => $model->subject ?? ''
])
    ->setLabel(Notification::labels()['subject'])
    ->render();

$form->field(\itguild\forms\inputs\TextInput::class, 'type', [
        'class' => "form-control",
        'placeholder' => Notification::labels()['type'],
        'value' => $model->type ?? ''
])
    ->setLabel(Notification::labels()['type'])
    ->render();

$form->field(\itguild\forms\inputs\TextArea::class, 'message', [
    'class' => "form-control",
    'placeholder' => Notification::labels()['message'],
    'value' => $model->message ?? ''
])
    ->setLabel(Notification::labels()['message'])
    ->render();

$form->field(\itguild\forms\inputs\Checkbox::class, 'is_read', [
    'class' => "form-check-input",
    'placeholder' => Notification::labels()['is_read'],
    'value' => $model->is_read ?? ''
])
    ->setLabel(Notification::labels()['is_read'])
    ->render();

$form->field(\itguild\forms\inputs\Select::class, 'status', [
    'class' => "form-control",
    'value' => $model->status ?? ''
])
    ->setLabel("Статус")
    ->setOptions(Notification::getStatus())
    ->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();