server test version
This commit is contained in:
8
app/modules/card/CardModule.php
Normal file
8
app/modules/card/CardModule.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\card;
|
||||
|
||||
class CardModule extends \kernel\app_modules\card\CardModule
|
||||
{
|
||||
|
||||
}
|
21
app/modules/card/controllers/CardController.php
Normal file
21
app/modules/card/controllers/CardController.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\card\controllers;
|
||||
|
||||
use DragonCode\CardNumber\CardNumber;
|
||||
use DragonCode\CardNumber\Factories\BankFactory;
|
||||
use DragonCode\CardNumber\Formatters\BankFormatter;
|
||||
|
||||
class CardController extends \kernel\app_modules\card\controllers\CardController
|
||||
{
|
||||
|
||||
public function actionTestCard(): string
|
||||
{
|
||||
$formatter = BankFormatter::create();
|
||||
|
||||
$customer = BankFactory::create()->paymentType(2)->bank(323, 42, 75)->client(15);
|
||||
|
||||
return CardNumber::generate($customer, $formatter);
|
||||
}
|
||||
|
||||
}
|
11
app/modules/card/manifest.json
Normal file
11
app/modules/card/manifest.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Card",
|
||||
"version": "0.1",
|
||||
"author": "ITGuild",
|
||||
"slug": "card",
|
||||
"description": "Card module",
|
||||
"module_class": "app\\modules\\card\\CardModule",
|
||||
"module_class_file": "{APP}/modules/card/CardModule.php",
|
||||
"routs": "routs/card.php",
|
||||
"migration_path": "migrations"
|
||||
}
|
15
app/modules/card/routs/card.php
Normal file
15
app/modules/card/routs/card.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use kernel\App;
|
||||
use kernel\CgRouteCollector;
|
||||
use Phroute\Phroute\RouteCollector;
|
||||
|
||||
include KERNEL_APP_MODULES_DIR . "/card/routs/card.php";
|
||||
|
||||
App::$collector->group(["prefix" => "admin"], function (CgRouteCollector $router) {
|
||||
App::$collector->group(["before" => "auth"], function (RouteCollector $router) {
|
||||
App::$collector->group(["prefix" => "card"], function (CGRouteCollector $router) {
|
||||
// App::$collector->get('/test', [\app\modules\card\controllers\CardController::class, 'actionTestCard']);
|
||||
});
|
||||
});
|
||||
});
|
12
app/modules/tgbot/TgbotModule.php
Normal file
12
app/modules/tgbot/TgbotModule.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot;
|
||||
|
||||
use kernel\Module;
|
||||
use kernel\modules\menu\service\MenuService;
|
||||
use kernel\services\MigrationService;
|
||||
|
||||
class TgbotModule extends \kernel\app_modules\tgbot\TgbotModule
|
||||
{
|
||||
|
||||
}
|
8
app/modules/tgbot/controllers/TgBotRestController.php
Normal file
8
app/modules/tgbot/controllers/TgBotRestController.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot\controllers;
|
||||
|
||||
class TgBotRestController extends \kernel\app_modules\tgbot\controllers\TgBotRestController
|
||||
{
|
||||
|
||||
}
|
8
app/modules/tgbot/controllers/TgbotController.php
Normal file
8
app/modules/tgbot/controllers/TgbotController.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot\controllers;
|
||||
|
||||
class TgbotController extends \kernel\app_modules\tgbot\controllers\TgbotController
|
||||
{
|
||||
|
||||
}
|
13
app/modules/tgbot/manifest.json
Normal file
13
app/modules/tgbot/manifest.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Telegram Bot",
|
||||
"version": "0.3",
|
||||
"author": "ITGuild",
|
||||
"slug": "tgbot",
|
||||
"type": "entity",
|
||||
"description": "Telegram Bot Tools",
|
||||
"app_module_path": "{APP}/modules/{slug}",
|
||||
"module_class": "app\\modules\\tgbot\\TgbotModule",
|
||||
"module_class_file": "{APP}/modules/tgbot/TgbotModule.php",
|
||||
"routs": "routs/tgbot.php",
|
||||
"dependence": "menu"
|
||||
}
|
19
app/modules/tgbot/models/Tgbot.php
Normal file
19
app/modules/tgbot/models/Tgbot.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id
|
||||
* @property integer $bot_id
|
||||
* @property integer $dialog_id
|
||||
* @property string $username
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property integer $status
|
||||
*/
|
||||
class Tgbot extends \kernel\app_modules\tgbot\models\Tgbot
|
||||
{
|
||||
|
||||
}
|
18
app/modules/tgbot/models/forms/CreateTgBotForm.php
Normal file
18
app/modules/tgbot/models/forms/CreateTgBotForm.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot\models\forms;
|
||||
|
||||
use kernel\FormModel;
|
||||
|
||||
/**
|
||||
* @property integer $bot_id
|
||||
* @property integer $dialog_id
|
||||
* @property string $username
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property integer $status
|
||||
*/
|
||||
class CreateTgBotForm extends \kernel\app_modules\tgbot\models\forms\CreateTgBotForm
|
||||
{
|
||||
|
||||
}
|
3
app/modules/tgbot/routs/tgbot.php
Normal file
3
app/modules/tgbot/routs/tgbot.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
include KERNEL_APP_MODULES_DIR . "/tgbot/routs/tgbot.php";
|
15
app/modules/tgbot/services/TgBotService.php
Normal file
15
app/modules/tgbot/services/TgBotService.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot\services;
|
||||
|
||||
use app\modules\tgbot\models\Tgbot;
|
||||
use kernel\app_modules\tag\models\Tag;
|
||||
use kernel\FormModel;
|
||||
use kernel\helpers\Debug;
|
||||
use kernel\helpers\Slug;
|
||||
use kernel\services\ModuleService;
|
||||
|
||||
class TgBotService extends \kernel\app_modules\tgbot\services\TgBotService
|
||||
{
|
||||
|
||||
}
|
83
app/modules/tgbot/views/tgbot/form.php
Normal file
83
app/modules/tgbot/views/tgbot/form.php
Normal 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();
|
41
app/modules/tgbot/views/tgbot/index.php
Normal file
41
app/modules/tgbot/views/tgbot/index.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?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",
|
||||
]));
|
||||
|
||||
$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];
|
||||
}]
|
||||
]);
|
||||
|
||||
|
||||
$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();
|
30
app/modules/tgbot/views/tgbot/view.php
Normal file
30
app/modules/tgbot/views/tgbot/view.php
Normal 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();
|
Reference in New Issue
Block a user