diff --git a/app/Http/Controllers/Company/General/BootstrapController.php b/app/Http/Controllers/Company/General/BootstrapController.php index 484ca1d5..b21409c5 100644 --- a/app/Http/Controllers/Company/General/BootstrapController.php +++ b/app/Http/Controllers/Company/General/BootstrapController.php @@ -15,6 +15,7 @@ use App\Models\Setting; use App\Traits\GeneratesMenuTrait; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use InvoiceShelf\Modules\Registry as ModuleRegistry; use Silber\Bouncer\BouncerFacade; class BootstrapController extends Controller @@ -118,6 +119,7 @@ class BootstrapController extends Controller 'main_menu' => $main_menu, 'setting_menu' => $setting_menu, 'modules' => Module::where('enabled', true)->pluck('name'), + 'module_menu' => array_values(ModuleRegistry::allMenu()), 'pending_invitations' => CompanyInvitationResource::collection($pendingInvitations), ]); } diff --git a/resources/scripts/api/services/bootstrap.service.ts b/resources/scripts/api/services/bootstrap.service.ts index 90561331..5a22fabc 100644 --- a/resources/scripts/api/services/bootstrap.service.ts +++ b/resources/scripts/api/services/bootstrap.service.ts @@ -15,6 +15,20 @@ export interface MenuItem { ability?: string } +/** + * Sidebar item registered by an active module via + * \InvoiceShelf\Modules\Registry::registerMenu() in the module's ServiceProvider::boot(). + * + * Distinct shape from MenuItem because module entries are namespaced (i18n + * keys come from the module's lang files) and don't carry group/ability — + * they always render under the dynamic "Modules" sidebar section. + */ +export interface ModuleMenuItem { + title: string + link: string + icon: string +} + export interface BootstrapResponse { current_user: User current_user_settings: Record @@ -28,6 +42,7 @@ export interface BootstrapResponse { config: Record global_settings: Record modules: string[] + module_menu?: ModuleMenuItem[] admin_mode?: boolean pending_invitations?: Array<{ token: string diff --git a/resources/scripts/layouts/partials/SiteSidebar.vue b/resources/scripts/layouts/partials/SiteSidebar.vue index 0b7123cc..8b27d410 100644 --- a/resources/scripts/layouts/partials/SiteSidebar.vue +++ b/resources/scripts/layouts/partials/SiteSidebar.vue @@ -99,6 +99,34 @@ {{ $t(item.title) }} + + + @@ -168,6 +196,49 @@ + +
+
+ {{ $t('modules.sidebar.section_title') }} +
+
+ + + + {{ $t(item.title) }} + + +
+