fix menu crud
This commit is contained in:
parent
2ae5c4ac73
commit
c54bf22942
8
composer.lock
generated
8
composer.lock
generated
@ -827,11 +827,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "itguild/forms",
|
"name": "itguild/forms",
|
||||||
"version": "0.1.2",
|
"version": "0.1.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.itguild.info/ItGuild/forms_bundle.git",
|
"url": "https://git.itguild.info/ItGuild/forms_bundle.git",
|
||||||
"reference": "0501718421203f721cfa750d3d703ed613cd72b7"
|
"reference": "62e1e8f3382391fd00adb5b4421015c2faa6e19b"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"itguild/php-cg-select-v2": "^0.1.0",
|
"itguild/php-cg-select-v2": "^0.1.0",
|
||||||
@ -855,7 +855,7 @@
|
|||||||
"email": "apuc06@mail.ru"
|
"email": "apuc06@mail.ru"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-07-26T13:21:26+00:00"
|
"time": "2024-09-03T09:45:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "itguild/php-cg-select-v2",
|
"name": "itguild/php-cg-select-v2",
|
||||||
@ -2495,5 +2495,5 @@
|
|||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@ class Menu extends Model
|
|||||||
public static function labels(): array
|
public static function labels(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'label' => 'Заголовок',
|
||||||
'parent_id' => 'Родительский пункт меню',
|
'parent_id' => 'Родительский пункт меню',
|
||||||
'icon_file' => 'Путь к иконке',
|
'icon_file' => 'Путь к иконке',
|
||||||
'icon_font' => 'Иконка',
|
'icon_font' => 'Иконка',
|
||||||
'label' => 'Заголовок',
|
|
||||||
'url' => 'URL',
|
'url' => 'URL',
|
||||||
'status' => 'Статус',
|
'status' => 'Статус',
|
||||||
];
|
];
|
||||||
|
@ -28,10 +28,10 @@ class Menu extends Model
|
|||||||
public static function labels(): array
|
public static function labels(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'label' => 'Заголовок',
|
||||||
'parent_id' => 'Родительский пункт меню',
|
'parent_id' => 'Родительский пункт меню',
|
||||||
'icon_file' => 'Путь к иконке',
|
'icon_file' => 'Путь к иконке',
|
||||||
'icon_font' => 'Иконка',
|
'icon_font' => 'Иконка',
|
||||||
'label' => 'Заголовок',
|
|
||||||
'url' => 'URL',
|
'url' => 'URL',
|
||||||
'status' => 'Статус',
|
'status' => 'Статус',
|
||||||
];
|
];
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
use kernel\models\Menu;
|
use kernel\models\Menu;
|
||||||
|
|
||||||
$form = new \itguild\forms\ActiveForm();
|
$form = new \itguild\forms\ActiveForm();
|
||||||
$form->beginForm(isset($model) ? "/admin/settings/menu/edit/" . $model->id : "/admin/menu");
|
$form->beginForm(isset($model) ? "/admin/settings/menu/edit/" . $model->id : "/admin/settings/menu");
|
||||||
|
|
||||||
$form->field(class: \itguild\forms\inputs\Select::class, name: "parent_id", params: [
|
$form->field(class: \itguild\forms\inputs\Select::class, name: "parent_id", params: [
|
||||||
'class' => "form-control",
|
'class' => "form-control",
|
||||||
@ -16,7 +16,7 @@ $form->field(class: \itguild\forms\inputs\Select::class, name: "parent_id", para
|
|||||||
->setOptions(\app\services\MenuService::createLabelArr())
|
->setOptions(\app\services\MenuService::createLabelArr())
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "icon_file", params: [
|
$form->field(class: \itguild\forms\inputs\File::class, name: "icon_file", params: [
|
||||||
'class' => "form-control",
|
'class' => "form-control",
|
||||||
'value' => $model->icon_file ?? ''
|
'value' => $model->icon_file ?? ''
|
||||||
])
|
])
|
||||||
|
@ -39,7 +39,7 @@ $table->columns([
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
$table->beforePrint(function () {
|
$table->beforePrint(function () {
|
||||||
return PrimaryBtn::create("Создать", "/admin/menu/create")->fetch();
|
return PrimaryBtn::create("Создать", "/admin/settings/menu/create")->fetch();
|
||||||
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
|
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
|
||||||
});
|
});
|
||||||
$table->addAction(MenuViewActionColumn::class);
|
$table->addAction(MenuViewActionColumn::class);
|
||||||
|
@ -16,11 +16,7 @@ $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($menu, [
|
|||||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||||
'baseUrl' => "/admin/menu",
|
'baseUrl' => "/admin/menu",
|
||||||
]));
|
]));
|
||||||
$r = new ViewJsonTableEloquentModel($menu, [
|
|
||||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
|
||||||
'baseUrl' => "/admin/menu",
|
|
||||||
]);
|
|
||||||
\app\helpers\Debug::dd($r->getJson());
|
|
||||||
$table->beforePrint(function () use ($menu) {
|
$table->beforePrint(function () use ($menu) {
|
||||||
$btn = PrimaryBtn::create("Список", "/admin/settings/menu")->fetch();
|
$btn = PrimaryBtn::create("Список", "/admin/settings/menu")->fetch();
|
||||||
$btn .= SuccessBtn::create("Редактировать", "/admin/settings/menu/update/" . $menu->id)->fetch();
|
$btn .= SuccessBtn::create("Редактировать", "/admin/settings/menu/update/" . $menu->id)->fetch();
|
||||||
|
@ -16,7 +16,7 @@ $form->field(class: \itguild\forms\inputs\Select::class, name: "parent_id", para
|
|||||||
->setOptions(\app\services\MenuService::createLabelArr())
|
->setOptions(\app\services\MenuService::createLabelArr())
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "icon_file", params: [
|
$form->field(class: \itguild\forms\inputs\File::class, name: "icon_file", params: [
|
||||||
'class' => "form-control",
|
'class' => "form-control",
|
||||||
'value' => $model->icon_file ?? ''
|
'value' => $model->icon_file ?? ''
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user