server test version

This commit is contained in:
2025-01-03 02:11:09 +03:00
parent 093b04c2c9
commit 74efe9e01e
101 changed files with 2871 additions and 117 deletions

View File

@ -0,0 +1,83 @@
<?php
/**
* @var Tgbot $model
*/
use app\modules\tgbot\models\Tgbot;
$form = new \itguild\forms\ActiveForm();
$form->beginForm(isset($model) ? "/admin/tg-bot/edit/" . $model->id : "/admin/tg-bot");
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "bot_id", params: [
'class' => "form-control",
'placeholder' => 'Bot ID',
'value' => $model->bot_id ?? ''
])
->setLabel("Bot ID")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "dialog_id", params: [
'class' => "form-control",
'placeholder' => 'Dialog ID',
'value' => $model->dialog_id ?? ''
])
->setLabel("Dialog ID")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "username", params: [
'class' => "form-control",
'placeholder' => 'Username',
'value' => $model->username ?? ''
])
->setLabel("Username")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "first_name", params: [
'class' => "form-control",
'placeholder' => 'First name',
'value' => $model->first_name ?? ''
])
->setLabel("First name")
->render();
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "last_name", params: [
'class' => "form-control",
'placeholder' => 'Last name',
'value' => $model->last_name ?? ''
])
->setLabel("Last name")
->render();
$form->field(\itguild\forms\inputs\Select::class, 'status', [
'class' => "form-control",
'value' => $model->status ?? ''
])
->setLabel("Статус")
->setOptions(Tgbot::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();

View File

@ -0,0 +1,59 @@
<?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];
}
],
"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();

View File

@ -0,0 +1,30 @@
<?php
/**
* @var \Illuminate\Database\Eloquent\Collection $tg
*/
use kernel\modules\user\models\User;
use Itguild\EloquentTable\ViewEloquentTable;
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
use kernel\IGTabel\btn\DangerBtn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\IGTabel\btn\SuccessBtn;
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($tg, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/tg-bot",
]));
$table->beforePrint(function () use ($tg) {
$btn = PrimaryBtn::create("Список", "/admin/tg-bot")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/tg-bot/update/" . $tg->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/tg-bot/delete/" . $tg->id)->fetch();
return $btn;
});
$table->rows([
'status' => (function ($data) {
return \app\modules\tgbot\models\Tgbot::getStatus()[$data];
})
]);
$table->create();
$table->render();