From 4e031c7c8bb12f32a3a70b5b4e83d195f013dcda Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Fri, 6 Sep 2024 11:47:11 +0300 Subject: [PATCH] some fix --- kernel/modules/menu/views/index.php | 14 -------------- kernel/modules/menu/views/view.php | 18 ++---------------- kernel/services/MenuService.php | 2 +- views/admin/menu/index.php | 16 +--------------- views/widgets/admin/menu.php | 2 +- 5 files changed, 5 insertions(+), 47 deletions(-) diff --git a/kernel/modules/menu/views/index.php b/kernel/modules/menu/views/index.php index e55b8fe..c65a20f 100644 --- a/kernel/modules/menu/views/index.php +++ b/kernel/modules/menu/views/index.php @@ -23,20 +23,6 @@ $table->columns([ if ($data == 0) return null; return Menu::find($data)->label; }), - 'created_at' => function ($data) { - if (!$data){ - return null; - } - - return (new DateTimeImmutable($data))->format("d-m-Y"); - }, - 'updated_at' => function ($data) { - if (!$data){ - return null; - } - - return (new DateTimeImmutable($data))->format("d-m-Y"); - } ]); $table->beforePrint(function () { return PrimaryBtn::create("Создать", "/admin/settings/menu/create")->fetch(); diff --git a/kernel/modules/menu/views/view.php b/kernel/modules/menu/views/view.php index 98c7ee4..da9f5cc 100644 --- a/kernel/modules/menu/views/view.php +++ b/kernel/modules/menu/views/view.php @@ -14,7 +14,7 @@ use kernel\models\Menu; $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($menu, [ 'params' => ["class" => "table table-bordered", "border" => "2"], - 'baseUrl' => "/admin/menu", + 'baseUrl' => "/admin/settings/menu", ])); $table->beforePrint(function () use ($menu) { @@ -27,21 +27,7 @@ $table->rows([ 'parent_id' => (function ($data) { if ($data == 0) return null; return Menu::find($data)->label; - }), - 'created_at' => function ($data) { - if (!$data){ - return null; - } - - return (new DateTimeImmutable($data))->format("d-m-Y"); - }, - 'updated_at' => function ($data) { - if (!$data){ - return null; - } - - return (new DateTimeImmutable($data))->format("d-m-Y"); - } + }) ]); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/services/MenuService.php b/kernel/services/MenuService.php index 583606c..3b26c4e 100644 --- a/kernel/services/MenuService.php +++ b/kernel/services/MenuService.php @@ -35,7 +35,7 @@ class MenuService return false; } - public static function getActiveStatus($url) + public static function isActive($url): bool { if ($url === Request::getUrlPath()){ return true; diff --git a/views/admin/menu/index.php b/views/admin/menu/index.php index 7b5780a..d5f55c3 100644 --- a/views/admin/menu/index.php +++ b/views/admin/menu/index.php @@ -22,21 +22,7 @@ $table->columns([ 'parent_id' => (function ($data) { if ($data == 0) return null; return Menu::find($data)->label; - }), - 'created_at' => function ($data) { - if (!$data){ - return null; - } - - return (new DateTimeImmutable($data))->format("d-m-Y"); - }, - 'updated_at' => function ($data) { - if (!$data){ - return null; - } - - return (new DateTimeImmutable($data))->format("d-m-Y"); - } + }) ]); $table->beforePrint(function () { return PrimaryBtn::create("Создать", "/admin/menu/create")->fetch(); diff --git a/views/widgets/admin/menu.php b/views/widgets/admin/menu.php index 82be0db..54ddc6d 100644 --- a/views/widgets/admin/menu.php +++ b/views/widgets/admin/menu.php @@ -11,7 +11,7 @@