"Название",
"author" => "Автор",
"version" => "Версия",
"description" => "Описание"
];
$meta['params'] = ["class" => "table table-bordered"];
$meta['perPage'] = $per_page;
$meta['baseUrl'] = "/admin/module";
$meta['currentPage'] = $page_number;
$meta['total'] = $module_count;
$info_to_table['meta'] = $meta;
$info_to_table['data'] = $modules_info;
$table = new \Itguild\Tables\ListJsonTable(json_encode($info_to_table, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
$table->addAction(function ($row, $url) use ($moduleService) {
$slug = $row['slug'];
if ($moduleService->isActive($slug)) {
return ActionButtonWidget::create([
'btn_type' => "warning",
'label' => "",
'url' => "$url/deactivate/?slug=$slug",
])->run();
} else {
return ActionButtonWidget::create([
'label' => "",
'url' => "$url/activate/?slug=$slug",
'btn_type' => "success",
'title' => "Активировать",
])->run();
}
});
$table->addAction(function ($row, $url) use ($moduleService) {
$url = "$url/view/?slug=". $row['slug'];
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' => "",
'url' => "$url/view/?slug=$slug",
])->run();
}
}
return false;
});
$table->addAction(function ($row) use ($moduleService){
$slug = $row['slug'];
if (!$moduleService->isKernelModule($slug)) {
return ActionButtonWidget::create([
'btn_type' => "danger",
'label' => "",
'url' => "admin/module_shop_client/delete/?slug=$slug",
])->run();
}
return false;
});
if ($moduleService->isActive('module_shop_client')) {
ModuleTabsWidget::create()->run();
}
$table->create();
$table->render();