action button update

This commit is contained in:
Билай Станислав 2024-11-20 12:45:02 +03:00
parent 6c2798c123
commit 6ac5de06e6
30 changed files with 377 additions and 129 deletions

View File

@ -13,7 +13,7 @@
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
<link rel="stylesheet" href="<?=$resources?>/css/style.css">
</head>
<body>

View File

@ -5,9 +5,4 @@ namespace app\modules\tag\controllers;
class TagController extends \kernel\app_modules\tag\controllers\TagController
{
public function actionByEntity()
{
// TODO
}
}

View File

@ -1,6 +1,6 @@
{
"name": "Tags",
"version": "0.12",
"version": "0.2",
"author": "ITGuild",
"slug": "tag",
"description": "Tags module",

View File

@ -13,7 +13,7 @@
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
<link rel="stylesheet" href="<?=$resources?>/css/style.css">
</head>
<body>

View File

@ -8,6 +8,10 @@ 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;
$table = new ListEloquentTable(new EloquentDataProvider(Tag::class, [
'currentPage' => $page_number,

View File

@ -3,9 +3,6 @@
* @var $json string
*/
use kernel\models\Option;
use kernel\widgets\ActionButtonWidget;
$table = new \Itguild\Tables\ListJsonTable($json);
$table->columns([
@ -14,19 +11,15 @@ $table->columns([
}
]);
$table->addAction(function ($row, $url){
$path = $row['path'];
$active_admin_theme = \kernel\modules\option\service\OptionService::getItem('active_admin_theme');
$btn = ActionButtonWidget::create([
'btn_type' => "primary",
'label' => "Активировать",
'url' => "$url/activate/?p=$path",
])->run();
if ($path === $active_admin_theme){
$btn = "Активна";
if ($row['path'] === $active_admin_theme){
return "Активна";
} else {
$url = "$url/activate/?p=" . $row['path'];
return \kernel\widgets\IconBtn\IconBtnActivateWidget::create(['url' => $url])->run();
}
return $btn;
});
$table->create();
$table->render();

View File

@ -23,8 +23,7 @@ $table->rows([
}
]);
$table->beforePrint(function () {
$btn = PrimaryBtn::create("Список", "/admin/settings/admin-themes")->fetch();
return $btn;
return \kernel\widgets\IconBtn\IconBtnListWidget::create(['url' => '/admin/settings/admin-themes'])->run();
});
$table->create();
$table->render();

View File

@ -6,11 +6,11 @@
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\IGTabel\action_column\DeleteActionColumn;
use kernel\IGTabel\action_column\EditActionColumn;
use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\models\Menu;
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(Menu::class, [
'currentPage' => $page_number,
@ -25,11 +25,17 @@ $table->columns([
}),
]);
$table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/settings/menu/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
return IconBtnCreateWidget::create(['url' => '/admin/settings/menu/create'])->run();
});
$table->addAction(function($row) {
return IconBtnViewWidget::create(['url' => '/admin/settings/menu/view/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnEditWidget::create(['url' => '/admin/settings/menu/update/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnDeleteWidget::create(['url' => '/admin/settings/menu/delete/' . $row['id']])->run();
});
$table->addAction(ViewActionColumn::class);
$table->addAction(EditActionColumn::class);
$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();

View File

@ -6,10 +6,10 @@
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\models\Menu;
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
use kernel\widgets\IconBtn\IconBtnListWidget;
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($menu, [
'params' => ["class" => "table table-bordered", "border" => "2"],
@ -17,9 +17,9 @@ $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($menu, [
]));
$table->beforePrint(function () use ($menu) {
$btn = PrimaryBtn::create("Список", "/admin/settings/menu")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/settings/menu/update/" . $menu->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/settings/menu/delete/" . $menu->id)->fetch();
$btn = IconBtnListWidget::create(['url' => '/admin/settings/menu'])->run();
$btn .= IconBtnEditWidget::create(['url' => '/admin/settings/menu/update/' . $menu->id])->run();
$btn .= IconBtnDeleteWidget::create(['url' => '/admin/settings/menu/delete/' . $menu->id])->run();
return $btn;
});
$table->rows([

View File

@ -31,31 +31,21 @@ $info_to_table['data'] = $modules_info;
$table = new ListJsonTable(json_encode($info_to_table, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
$table->addAction(function ($row, $url) use ($moduleService) {
$id = $row['id'];
$url = "$url/view/" . $row['id'];
return ActionButtonWidget::create([
'btn_type' => "primary",
'label' => "<i class='fa-regular fa-eye'></i>",
'url' => "$url/view/$id",
])->run();
return \kernel\widgets\IconBtn\IconBtnViewWidget::create(['url' => $url])->run();
});
$table->addAction(function ($row, $url) use ($moduleService){
$slug = $row['slug'];
$id = $row['id'];
if ($moduleService->isInstall($slug)){
return ActionButtonWidget::create([
'btn_type' => "danger",
'label' => "<i class='fa-regular fa-trash-can'></i>",
'url' => "$url/delete/?slug=$slug",
])->run();
if ($moduleService->isInstall($row['slug'])){
$url = "$url/delete/?slug=" . $row['slug'];
return \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => $url])->run();
}
else {
return ActionButtonWidget::create([
'btn_type' => "success",
'label' => "<i class='fa-solid fa-download'></i>",
'url' => "$url/install/?id=$id",
])->run();
$url = "$url/install/?id=" . $row['id'];
return \kernel\widgets\IconBtn\IconBtnInstallWidget::create(['url' => $url])->run();
}
});
@ -63,19 +53,16 @@ $table->addAction(function ($row, $url) use ($moduleService){
$slug = $row['slug'];
if ($moduleService->isInstall($slug)){
if (!$moduleService->isLastVersion($slug)) {
return ActionButtonWidget::create([
'btn_type' => "info",
'label' => "<i class='fa-regular fa-pen-to-square'></i>",
'url' => "$url/update/?slug=$slug",
])->run();
$url = "$url/update/?slug=" . $slug;
return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run();
}
}
return false;
});
\kernel\widgets\ModuleTabsWidget::create()->run();
$table->create();
\kernel\widgets\ModuleTabsWidget::create()->run();
$table->render();

View File

@ -25,8 +25,7 @@ $table_info = [
$table = new \Itguild\Tables\ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
$table->beforePrint(function () {
$btn = PrimaryBtn::create("Список", "/admin/module_shop_client")->fetch();
return $btn;
return \kernel\widgets\IconBtn\IconBtnListWidget::create(['url' => '/admin/module_shop_client'])->run();
});
$table->create();
$table->render();

View File

@ -11,6 +11,10 @@ use kernel\IGTabel\action_column\EditActionColumn;
use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\modules\option\models\Option;
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(Option::class, [
'current_page' => $page_number,
@ -20,8 +24,7 @@ $table = new ListEloquentTable(new EloquentDataProvider(Option::class, [
]));
$table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/option/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
return IconBtnCreateWidget::create(['url' => '/admin/option/create'])->run();
});
$table->columns([
@ -31,8 +34,15 @@ $table->columns([
}]
]);
$table->addAction(ViewActionColumn::class);
$table->addAction(EditActionColumn::class);
$table->addAction(DeleteActionColumn::class);
$table->addAction(function($row) {
return IconBtnViewWidget::create(['url' => '/admin/option/view/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnEditWidget::create(['url' => '/admin/option/update/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $row['id']])->run();
});
$table->create();
$table->render();

View File

@ -8,15 +8,18 @@ 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 = PrimaryBtn::create("Список", "/admin/option")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/option/update/" . $option->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/option/delete/" . $option->id)->fetch();
$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;
});

View File

@ -13,6 +13,10 @@ use kernel\modules\user\models\User;
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\IGTabel\btn\PrimaryBtn;
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(Post::class, [
'currentPage' => $page_number,
@ -39,12 +43,18 @@ $table->columns([
return User::find($data)->username;
})
]);
$table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/post/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
return IconBtnCreateWidget::create(['url' => '/admin/post/create'])->run();
});
$table->addAction(function($row) {
return IconBtnViewWidget::create(['url' => '/admin/post/view/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnEditWidget::create(['url' => '/admin/post/update/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnDeleteWidget::create(['url' => '/admin/post/delete/' . $row['id']])->run();
});
$table->addAction(ViewActionColumn::class);
$table->addAction(EditActionColumn::class);
$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();

View File

@ -10,17 +10,21 @@ 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($content, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/post",
]));
$table->beforePrint(function () use ($content) {
$btn = PrimaryBtn::create("Список", "/admin/post")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/post/update/" . $content->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/post/delete/" . $content->id)->fetch();
$btn = IconBtnListWidget::create(['url' => '/admin/post'])->run();
$btn .= IconBtnEditWidget::create(['url' => '/admin/post/update/' . $content->id])->run();
$btn .= IconBtnDeleteWidget::create(['url' => '/admin/post/delete/' . $content->id])->run();
return $btn;
});
$table->rows([
'created_at' => function ($data) {
if (!$data){

View File

@ -12,6 +12,10 @@ use kernel\IGTabel\action_column\EditActionColumn;
use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\modules\user\models\User;
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(User::class, [
'currentPage' => $page_number,
@ -42,11 +46,16 @@ $table->columns([
}
]);
$table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/user/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
return IconBtnCreateWidget::create(['url' => '/admin/user/create'])->run();
});
$table->addAction(function($row) {
return IconBtnViewWidget::create(['url' => '/admin/user/view/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnEditWidget::create(['url' => '/admin/user/update/' . $row['id']])->run();
});
$table->addAction(function($row) {
return IconBtnDeleteWidget::create(['url' => '/admin/user/delete/' . $row['id']])->run();
});
$table->addAction(ViewActionColumn::class);
$table->addAction(EditActionColumn::class);
$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();

View File

@ -10,17 +10,21 @@ 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($user, [
'params' => ["class" => "table table-bordered", "border" => "2"],
'baseUrl' => "/admin/user",
]));
$table->beforePrint(function () use ($user) {
$btn = PrimaryBtn::create("Список", "/admin/user")->fetch();
$btn .= SuccessBtn::create("Редактировать", "/admin/user/update/" . $user->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/user/delete/" . $user->id)->fetch();
$btn = IconBtnListWidget::create(['url' => '/admin/user'])->run();
$btn .= IconBtnEditWidget::create(['url' => '/admin/user/update/' . $user->id])->run();
$btn .= IconBtnDeleteWidget::create(['url' => '/admin/user/delete/' . $user->id])->run();
return $btn;
});
$table->rows([
'created_at' => function ($data) {
if (!$data){

View File

@ -7,7 +7,11 @@
* @var \kernel\services\ModuleService $moduleService
*/
use kernel\widgets\ActionButtonWidget;
use kernel\widgets\IconBtn\IconBtnActivateWidget;
use kernel\widgets\IconBtn\IconBtnDeactivateWidget;
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnUpdateWidget;
use kernel\widgets\IconBtn\IconBtnViewWidget;
use kernel\widgets\ModuleTabsWidget;
$meta = [];
@ -32,40 +36,28 @@ $table = new \Itguild\Tables\ListJsonTable(json_encode($info_to_table, JSON_PRET
$table->addAction(function ($row, $url) use ($moduleService) {
$slug = $row['slug'];
if ($moduleService->isActive($slug)) {
return ActionButtonWidget::create([
'btn_type' => "warning",
'label' => "<i class='fa-regular fa-circle-xmark'></i>",
'url' => "$url/deactivate/?slug=$slug",
])->run();
$url = "$url/deactivate/?slug=". $row['slug'];
return IconBtnDeactivateWidget::create(['url' => $url])->run();
} else {
return ActionButtonWidget::create([
'label' => "<i class='fa-regular fa-circle-check'></i>",
'url' => "$url/deactivate/?slug=$slug",
'btn_type' => "success"
])->run();
$url = "$url/activate/?slug=". $row['slug'];
return IconBtnActivateWidget::create(['url' => $url])->run();
}
});
$table->addAction(function ($row, $url) use ($moduleService) {
$slug = $row['slug'];
$table->addAction(function ($row, $url) {
$url = "$url/view/?slug=". $row['slug'];
return ActionButtonWidget::create([
'btn_type' => "primary",
'label' => "<i class='fa-regular fa-eye'></i>",
'url' => "$url/view/?slug=$slug",
])->run();
return IconBtnViewWidget::create(['url' => $url])->run();
});
$table->addAction(function ($row, $url) use ($moduleService){
$slug = $row['slug'];
if (!$moduleService->isKernelModule($slug)){
if (!$moduleService->isLastVersion($slug)) {
return ActionButtonWidget::create([
'btn_type' => "info",
'label' => "<i class='fa-regular fa-pen-to-square'></i>",
'url' => "$url/view/?slug=$slug",
])->run();
if (!$moduleService->isKernelModule($row['slug'])){
if (!$moduleService->isLastVersion($row['slug'])) {
$url = "$url/update/?slug=". $row['slug'];
return IconBtnUpdateWidget::create(['url' => $url])->run();
}
}
@ -75,11 +67,9 @@ $table->addAction(function ($row, $url) use ($moduleService){
$table->addAction(function ($row) use ($moduleService){
$slug = $row['slug'];
if (!$moduleService->isKernelModule($slug)) {
return ActionButtonWidget::create([
'btn_type' => "danger",
'label' => "<i class='fa-regular fa-trash-can'></i>",
'url' => "admin/module_shop_client/delete/?slug=$slug",
])->run();
$url = "admin/module_shop_client/delete/?slug=" . $row['slug'];
return IconBtnDeleteWidget::create(['url' => $url])->run();
}
return false;
});

View File

@ -3,9 +3,8 @@
* @var array $data
*/
use kernel\IGTabel\btn\DangerBtn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\IGTabel\btn\SuccessBtn;
use Itguild\Tables\ViewJsonTable;
use kernel\widgets\IconBtn\IconBtnListWidget;
$table_info = [
"meta" => [
@ -20,11 +19,10 @@ $table_info = [
],
"data" => $data
];
$table = new \Itguild\Tables\ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
$table = new ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
$table->beforePrint(function () {
$btn = PrimaryBtn::create("Список", "/admin")->fetch();
return $btn;
return IconBtnListWidget::create(['url' => '/admin'])->run();
});
$table->create();
$table->render();

View File

@ -3,7 +3,8 @@
* @var string $label
* @var string $btn_type
* @var string $url
* @var string $title
*/
?>
<a class='btn btn-<?= $btn_type ?>' href='<?= $url ?>' style='margin: 3px' ><?= $label ?></a>
<a title="<?= $title ?>" class='btn btn-<?= $btn_type ?>' href='<?= $url ?>' style='margin: 3px' ><?= $label ?></a>

View File

@ -18,7 +18,8 @@ class ActionButtonWidget extends Widget
$label = $this->data['label'];
$btn_type = $this->data['btn_type'];
$url = $this->data['url'];
$title = $this->data['title'] ?? '';
return $this->cgView->fetch('/action_button.php', ['label' => $label, 'btn_type' => $btn_type, 'url' => $url]);
return $this->cgView->fetch('/action_button.php', ['label' => $label, 'btn_type' => $btn_type, 'url' => $url, 'title' => $title]);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnActivateWidget extends Widget
{
public static function create(array $data = []): IconBtnActivateWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-regular fa-circle-check'></i>",
'url' => $url,
'btn_type' => "success",
'title' => "Активировать"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnCreateWidget extends Widget
{
public static function create(array $data = []): IconBtnCreateWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-regular fa-square-plus'></i>",
'url' => $url,
'btn_type' => "success",
'title' => "Создать"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnDeactivateWidget extends Widget
{
public static function create(array $data = []): IconBtnDeactivateWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-regular fa-circle-xmark'></i>",
'url' => $url,
'btn_type' => "warning",
'title' => "Деактивировать"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnDeleteWidget extends Widget
{
public static function create(array $data = []): IconBtnDeleteWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-regular fa-trash-can'></i>",
'url' => $url,
'btn_type' => "danger",
'title' => "Удалить"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnEditWidget extends Widget
{
public static function create(array $data = []): IconBtnEditWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-solid fa-pen'></i>",
'url' => $url,
'btn_type' => "success",
'title' => "Редактировать"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnInstallWidget extends Widget
{
public static function create(array $data = []): IconBtnInstallWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-solid fa-download'></i>",
'url' => $url,
'btn_type' => "success",
'title' => "Установить"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnListWidget extends Widget
{
public static function create(array $data = []): IconBtnListWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-regular fa-rectangle-list'></i>",
'url' => $url,
'btn_type' => "primary",
'title' => "Список"
])->run();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnUpdateWidget extends Widget
{
public static function create(array $data = []): IconBtnUpdateWidget
{
return new static($data);
}
public function run()
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'label' => "<i class='fa-solid fa-cloud-arrow-down'></i>",
'url' => $url,
'btn_type' => "info",
'title' => "Обновить"
])->run();
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace kernel\widgets\IconBtn;
use kernel\Widget;
use kernel\widgets\ActionButtonWidget;
class IconBtnViewWidget extends Widget
{
public static function create(array $data = []): IconBtnViewWidget
{
return new static($data);
}
public function run(): string
{
$url = $this->data['url'];
return ActionButtonWidget::create([
'btn_type' => "primary",
'label' => "<i class='fa-regular fa-eye'></i>",
'url' => $url,
'title' => "Просмотреть"
])->run();
}
}