59 lines
1.8 KiB
PHP
59 lines
1.8 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;
|
|
|
|
$view->setTitle("Список существующих диалогов");
|
|
|
|
$table = new ListEloquentTable(new EloquentDataProvider(\app\modules\tgbot\models\Tgbot::class, [
|
|
'currentPage' => $page_number,
|
|
'perPage' => 8,
|
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
|
'baseUrl' => "/admin/tg-bot",
|
|
'searchPrefix' => "",
|
|
'searchParams' => (new \kernel\Request())->get(),
|
|
]));
|
|
|
|
$table->beforePrint(function () {
|
|
return PrimaryBtn::create("Создать", "/admin/tg-bot/create")->fetch();
|
|
});
|
|
|
|
$table->columns([
|
|
"status" => [
|
|
"value" => function ($cell) {
|
|
return \app\modules\tgbot\models\Tgbot::getStatus()[$cell] ?? 0;
|
|
}
|
|
],
|
|
"username" => [
|
|
"filter" => [
|
|
"class" => \Itguild\Tables\Filter\InputTextFilter::class
|
|
]
|
|
],
|
|
"bot_id" => [
|
|
"filter" => [
|
|
"class" => \Itguild\Tables\Filter\InputTextFilter::class
|
|
]
|
|
],
|
|
"dialog_id" => [
|
|
"filter" => [
|
|
"class" => \Itguild\Tables\Filter\InputTextFilter::class
|
|
]
|
|
]
|
|
]);
|
|
|
|
|
|
$table->addAction(\kernel\IGTabel\action_column\ViewActionColumn::class);
|
|
$table->addAction(\kernel\IGTabel\action_column\DeleteActionColumn::class);
|
|
$table->addAction(\kernel\IGTabel\action_column\EditActionColumn::class);
|
|
$table->create();
|
|
$table->render(); |