Skip to content

Commit

Permalink
Added groups listing tab
Browse files Browse the repository at this point in the history
  • Loading branch information
hobsRKM committed May 2, 2024
1 parent f94e9eb commit 565350c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public function storeGroup(StoreGroupRequest $request)
$groupServer->save();
$groupAddedToServerCount[$server_id] = $server_id;
}
foreach ($validatedData['permissions'] as $permissionId) {
foreach ($validatedDfata['permissions'] as $permissionId) {
$permission = Permission::find($permissionId);
if(empty($group->groupFlags()->where('flag', $permission->permission)->first())) {
$groupFlags = new SaGroupsFlags();
Expand Down Expand Up @@ -451,9 +451,8 @@ public function getGroupsList(Request $request)
$searchValue = $request->input('search.value');
$orderColumn = $request->input('order.0.column');
$orderDirection = $request->input('order.0.dir');

$query = SaGroups::query();

DB::statement("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));");
// Join the sa_groups_flag table to fetch flags
$query->leftJoin('sa_groups_flags', 'sa_groups.id', '=', 'sa_groups_flags.group_id');

Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/nav.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</a>
@endif
@if(PermissionsHelper::isSuperAdmin())
<a href="{{env('VITE_SITE_DIR')}}/group/list" class="list-group-item list-group-item-action py-2" data-mdb-ripple-init>
<a href="{{env('VITE_SITE_DIR')}}/list/groups" class="list-group-item list-group-item-action py-2" data-mdb-ripple-init>
<i class="fas fa-users fa-fw me-3"></i><span>All Groups</span> </a>
@endif
@if(PermissionsHelper::isSuperAdmin())
Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getPlayerInfoUrl(serverId) {
const adminListUrl = '{!! env('VITE_SITE_DIR') !!}/list/admins';
const bansListUrl = '{!! env('VITE_SITE_DIR') !!}/list/bans';
const playerActionUrl = '{!! env('VITE_SITE_DIR') !!}/players/action';
const groupsListUrl = '{!! env('VITE_SITE_DIR') !!}/group/list';
const groupsListUrl = '{!! env('VITE_SITE_DIR') !!}/list/groups';
</script>


Expand Down
7 changes: 3 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
Route::get('mutes', [MutesController::class, 'mutes'])->name('list.mutes');;
Route::post('mutes', [MutesController::class, 'getMutesList']);
Route::get('admins', [AdminController::class, 'admins'])->name('admins.list')->middleware('superadmin');
Route::post('admins', [AdminController::class, 'getAdminsList'])->middleware('superadmin');;
Route::post('admins', [AdminController::class, 'getAdminsList'])->middleware('superadmin');
Route::get('/groups', [AdminController::class, 'groups'])->name('groups.list')->middleware('superadmin');
Route::post('/groups', [AdminController::class, 'getGroupsList'])->name('group.list')->middleware('superadmin');
});

Route::prefix('admin')->group(function () {
Expand All @@ -54,9 +56,6 @@
Route::prefix('group')->group(function () {
Route::get('/create', [AdminController::class, 'createGroup'])->name('group.create')->middleware('superadmin');
Route::post('/store', [AdminController::class, 'storeGroup'])->name('group.store')->middleware('superadmin');
Route::get('/list', [AdminController::class, 'groups'])->name('groups.list')->middleware('superadmin');
Route::post('/list', [AdminController::class, 'getGroupsList'])->name('group.list')->middleware('superadmin');

});
Route::prefix('players')->group(function () {
Route::post('ban', [BansController::class, 'store'])->name('ban.store')->middleware('permission.ban');
Expand Down

0 comments on commit 565350c

Please sign in to comment.