63 lines
2.1 KiB
PHP
63 lines
2.1 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* @var int $page_number
|
||
|
* @var \kernel\CgView $view
|
||
|
*/
|
||
|
|
||
|
use Itguild\EloquentTable\EloquentDataProvider;
|
||
|
use Itguild\EloquentTable\ListEloquentTable;
|
||
|
use kernel\app_modules\tag\models\Tag;
|
||
|
use kernel\IGTabel\btn\PrimaryBtn;
|
||
|
use kernel\models\Menu;
|
||
|
use kernel\modules\menu\table\columns\MenuDeleteActionColumn;
|
||
|
use kernel\modules\menu\table\columns\MenuEditActionColumn;
|
||
|
use kernel\modules\menu\table\columns\MenuViewActionColumn;
|
||
|
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||
|
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||
|
use kernel\widgets\IconBtn\IconBtnViewWidget;
|
||
|
|
||
|
$view->setTitle("Список существующих диалогов");
|
||
|
|
||
|
$table = new ListEloquentTable(new EloquentDataProvider(\kernel\app_modules\tgbot\models\TgbotNotification::query()->orderBy("id", "DESC"), [
|
||
|
'currentPage' => $page_number,
|
||
|
'perPage' => 8,
|
||
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||
|
'baseUrl' => "/admin/tg-bot-notification",
|
||
|
'searchPrefix' => "",
|
||
|
'searchParams' => (new \kernel\Request())->get(),
|
||
|
]));
|
||
|
|
||
|
$table->beforePrint(function () {
|
||
|
return PrimaryBtn::create("Создать", "/admin/tg-bot-notification/create")->fetch();
|
||
|
});
|
||
|
|
||
|
$table->columns([
|
||
|
"status" => [
|
||
|
"value" => function ($cell) {
|
||
|
return \kernel\app_modules\tgbot\models\TgbotNotification::getStatus()[$cell] ?? 0;
|
||
|
}
|
||
|
],
|
||
|
"bot_id" => [
|
||
|
"filter" => [
|
||
|
"class" => \Itguild\Tables\Filter\InputTextFilter::class
|
||
|
]
|
||
|
],
|
||
|
"dialog_id" => [
|
||
|
"filter" => [
|
||
|
"class" => \Itguild\Tables\Filter\InputTextFilter::class
|
||
|
]
|
||
|
]
|
||
|
]);
|
||
|
|
||
|
|
||
|
$table->addAction(function($row) {
|
||
|
return IconBtnViewWidget::create(['url' => '/admin/tg-bot-notification/' . $row['id']])->run();
|
||
|
});
|
||
|
$table->addAction(function($row) {
|
||
|
return IconBtnEditWidget::create(['url' => '/admin/tg-bot-notification/update/' . $row['id']])->run();
|
||
|
});
|
||
|
$table->addAction(function($row) {
|
||
|
return IconBtnDeleteWidget::create(['url' => '/admin/tg-bot-notification/delete/' . $row['id']])->run();
|
||
|
});
|
||
|
$table->create();
|
||
|
$table->render();
|