install, uninstall. pack to ModuleService
This commit is contained in:
		| @@ -0,0 +1,58 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @var Tag $model | ||||
|  */ | ||||
|  | ||||
| use kernel\app_modules\tag\models\Tag; | ||||
|  | ||||
| $form = new \itguild\forms\ActiveForm(); | ||||
| $form->beginForm(isset($model) ? "/admin/tag/edit/" . $model->id : "/admin/tag"); | ||||
|  | ||||
| $form->field(class: \itguild\forms\inputs\TextInput::class, name: "label", params: [ | ||||
|     'class' => "form-control", | ||||
|     'placeholder' => 'Заголовок', | ||||
|     'value' => $model->label ?? '' | ||||
| ]) | ||||
|     ->setLabel("Заголовок") | ||||
|     ->render(); | ||||
|  | ||||
| $form->field(class: \itguild\forms\inputs\TextInput::class, name: "entity", params: [ | ||||
|     'class' => "form-control", | ||||
|     'placeholder' => 'Сущность', | ||||
|     'value' => $model->entity ?? '' | ||||
| ]) | ||||
|     ->setLabel("Сущность") | ||||
|     ->render(); | ||||
|  | ||||
| $form->field(\itguild\forms\inputs\Select::class, 'status', [ | ||||
|     'class' => "form-control", | ||||
|     'value' => $model->status ?? '' | ||||
| ]) | ||||
|     ->setLabel("Статус") | ||||
|     ->setOptions(Tag::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(); | ||||
| @@ -0,0 +1,39 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @var \Illuminate\Database\Eloquent\Collection $menuItem | ||||
|  * @var int $page_number | ||||
|  */ | ||||
|  | ||||
| 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, | ||||
|     'perPage' => 8, | ||||
|     'params' => ["class" => "table table-bordered", "border" => "2"], | ||||
|     'baseUrl' => "/admin/tag", | ||||
| ])); | ||||
|  | ||||
| $table->beforePrint(function () { | ||||
|     return PrimaryBtn::create("Создать", "/admin/tag/create")->fetch(); | ||||
|     //return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch(); | ||||
| }); | ||||
|  | ||||
| $table->columns([ | ||||
|     "status" => [ | ||||
|         "value" => function ($cell) { | ||||
|             return Tag::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(); | ||||
| @@ -0,0 +1,30 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * @var \Illuminate\Database\Eloquent\Collection $tag | ||||
|  */ | ||||
|  | ||||
| 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($tag, [ | ||||
|     'params' => ["class" => "table table-bordered", "border" => "2"], | ||||
|     'baseUrl' => "/admin/tag", | ||||
| ])); | ||||
| $table->beforePrint(function () use ($tag) { | ||||
|     $btn = PrimaryBtn::create("Список", "/admin/tag")->fetch(); | ||||
|     $btn .= SuccessBtn::create("Редактировать", "/admin/tag/update/" . $tag->id)->fetch(); | ||||
|     $btn .= DangerBtn::create("Удалить", "/admin/tag/delete/" . $tag->id)->fetch(); | ||||
|     return $btn; | ||||
| }); | ||||
| $table->rows([ | ||||
|     'status' => (function ($data) { | ||||
|         return \kernel\app_modules\tag\models\Tag::getStatus()[$data]; | ||||
|     }) | ||||
| ]); | ||||
| $table->create(); | ||||
| $table->render(); | ||||
		Reference in New Issue
	
	Block a user