v0.1.10
This commit is contained in:
84
kernel/modules/notification/views/form.php
Normal file
84
kernel/modules/notification/views/form.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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();
|
44
kernel/modules/notification/views/index.php
Normal file
44
kernel/modules/notification/views/index.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \Illuminate\Database\Eloquent\Collection $options
|
||||
* @var int $page_number
|
||||
*/
|
||||
|
||||
use Itguild\EloquentTable\EloquentDataProvider;
|
||||
use Itguild\EloquentTable\ListEloquentTable;
|
||||
use kernel\modules\notification\models\Notification;
|
||||
use kernel\widgets\IconBtn\IconBtnCreateWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnViewWidget;
|
||||
|
||||
$table = new ListEloquentTable(new EloquentDataProvider(Notification::class, [
|
||||
'current_page' => $page_number,
|
||||
'per_page' => 5,
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/notification",
|
||||
]));
|
||||
|
||||
$table->beforePrint(function () {
|
||||
return IconBtnCreateWidget::create(['url' => '/admin/notification/create'])->run();
|
||||
});
|
||||
|
||||
$table->columns([
|
||||
"status" => [
|
||||
"value" => function ($cell) {
|
||||
return Notification::getStatus()[$cell];
|
||||
}]
|
||||
]);
|
||||
|
||||
$table->addAction(function($row) {
|
||||
return IconBtnViewWidget::create(['url' => '/admin/notification/view/' . $row['id']])->run();
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return IconBtnEditWidget::create(['url' => '/admin/Notification/update/' . $row['id']])->run();
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return IconBtnDeleteWidget::create(['url' => '/admin/Notification/delete/' . $row['id']])->run();
|
||||
});
|
||||
|
||||
$table->create();
|
||||
$table->render();
|
32
kernel/modules/notification/views/view.php
Normal file
32
kernel/modules/notification/views/view.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \Illuminate\Database\Eloquent\Collection $option
|
||||
*/
|
||||
|
||||
use Itguild\EloquentTable\ViewEloquentTable;
|
||||
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
|
||||
use kernel\IGTabel\btn\DangerBtn;
|
||||
use kernel\IGTabel\btn\PrimaryBtn;
|
||||
use kernel\IGTabel\btn\SuccessBtn;
|
||||
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnListWidget;
|
||||
|
||||
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($option, [
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/user",
|
||||
]));
|
||||
$table->beforePrint(function () use ($option) {
|
||||
$btn = IconBtnListWidget::create(['url' => '/admin/option'])->run();
|
||||
$btn .= IconBtnEditWidget::create(['url' => '/admin/option/update/' . $option->id])->run();
|
||||
$btn .= IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $option->id])->run();
|
||||
return $btn;
|
||||
});
|
||||
|
||||
$table->rows([
|
||||
'status' => (function ($data) {
|
||||
return \kernel\modules\option\models\Notification::getStatus()[$data];
|
||||
})
|
||||
]);
|
||||
$table->create();
|
||||
$table->render();
|
Reference in New Issue
Block a user