mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 17:24:10 +00:00
Refactor Administration entrypoint
We moved the administration item to the company switcher in the header
This commit is contained in:
@@ -49,16 +49,28 @@ class BootstrapController extends Controller
|
||||
'save_pdf_to_disk',
|
||||
]);
|
||||
|
||||
// Super admin mode — return admin-only menu with all companies listed
|
||||
if ($current_user->isSuperAdmin() && $request->has('admin_mode')) {
|
||||
return response()->json([
|
||||
'current_user' => new UserResource($current_user),
|
||||
'current_user_settings' => $current_user_settings,
|
||||
'current_user_abilities' => [],
|
||||
'companies' => CompanyResource::collection($companies),
|
||||
'current_company' => null,
|
||||
'current_company_settings' => [],
|
||||
'current_company_currency' => Currency::first(),
|
||||
'config' => config('invoiceshelf'),
|
||||
'global_settings' => $global_settings,
|
||||
'main_menu' => $this->generateMenu('admin_menu', $current_user),
|
||||
'setting_menu' => [],
|
||||
'modules' => [],
|
||||
'admin_mode' => true,
|
||||
'pending_invitations' => CompanyInvitationResource::collection($pendingInvitations),
|
||||
]);
|
||||
}
|
||||
|
||||
// User has no companies — return minimal bootstrap
|
||||
if ($companies->isEmpty()) {
|
||||
$main_menu = $current_user->isSuperAdmin()
|
||||
? $this->generateMenu('main_menu', $current_user)
|
||||
: [];
|
||||
|
||||
$setting_menu = $current_user->isSuperAdmin()
|
||||
? $this->generateMenu('setting_menu', $current_user)
|
||||
: [];
|
||||
|
||||
return response()->json([
|
||||
'current_user' => new UserResource($current_user),
|
||||
'current_user_settings' => $current_user_settings,
|
||||
@@ -69,8 +81,8 @@ class BootstrapController extends Controller
|
||||
'current_company_currency' => Currency::first(),
|
||||
'config' => config('invoiceshelf'),
|
||||
'global_settings' => $global_settings,
|
||||
'main_menu' => $main_menu,
|
||||
'setting_menu' => $setting_menu,
|
||||
'main_menu' => [],
|
||||
'setting_menu' => [],
|
||||
'modules' => [],
|
||||
'pending_invitations' => CompanyInvitationResource::collection($pendingInvitations),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user