kernel update

This commit is contained in:
2024-11-18 16:04:57 +03:00
parent 10605e17e7
commit 2af9ea876d
27 changed files with 434 additions and 91 deletions

View File

@ -26,32 +26,53 @@ $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){
$table->addAction(function ($row, $url) use ($moduleService) {
$slug = $row['slug'];
if ($moduleService->isActive($slug)){
if ($moduleService->isActive($slug)) {
$label = "Деактивировать";
$btn_type = "warning";
$btn = "<a class='btn btn-$btn_type' href='$url/deactivate/?slug=$slug' style='margin: 3px; width: 150px;' >$label</a>";
}
else {
} else {
$label = "Активировать";
$btn_type = "primary";
$btn_type = "success";
$btn = "<a class='btn btn-$btn_type' href='$url/activate/?slug=$slug' style='margin: 3px; width: 150px;' >$label</a>";
}
return $btn;
});
$table->addAction(function ($row, $url) use ($moduleService){
$table->addAction(function ($row, $url) use ($moduleService) {
$slug = $row['slug'];
return "<a class='btn btn-primary' href='$url/view/?slug=$slug' style='margin: 3px; width: 150px;' >Просмотр</a>";
});
$table->addAction(function ($row, $url) use ($moduleService){
$slug = $row['slug'];
return "<a class='btn btn-primary' href='$url/update/?slug=$slug' style='margin: 3px; width: 150px;' >Обновить</a>";
if (!$moduleService->isKernelModule($slug)){
if (!$moduleService->isLastVersion($slug)) {
$label = "Обновить";
$btn_type = "info";
return "<a class='btn btn-$btn_type' href='$url/update/?slug=$slug' style='margin: 3px; width: 150px;' >$label</a>";
}
}
return false;
});
$table->addAction(function ($row, $url) use ($moduleService){
$slug = $row['slug'];
if (!$moduleService->isKernelModule($slug)){
$label = "Удалить";
$btn_type = "danger";
return "<a class='btn btn-$btn_type' href='admin/module_shop_client/delete/?slug=$slug' style='margin: 3px; width: 150px;' >$label</a>";
}
return false;
});
$table->create();
if ($moduleService->isActive('module_shop_client')) {
\kernel\widgets\ModuleTabsWidget::create()->run();
}
$table->render();