From 84725b2dfae10047d661cd23a013ef2b0b5fd35f Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Thu, 9 Apr 2026 00:28:59 +0200 Subject: [PATCH] feat(modules): relocate marketplace browser to super-admin context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The module marketplace browser UI (ModuleIndexView, ModuleDetailView, ModuleCard, the four-step installer store) was filed under features/company/modules/ only by historical accident — it's authorized via the manage modules ability (super-admin-only) and conceptually belongs in the admin context, not the company context. - Move features/company/modules/{store.ts, views/ModuleIndexView.vue, views/ModuleDetailView.vue, components/ModuleCard.vue} to features/admin/modules/. - Update hardcoded /admin/modules/... paths in the moved files to /admin/administration/modules/... so the breadcrumbs and ModuleCard navigation target the new admin-context routes. - Tighten the four-step installer's silent catch {} blocks in the moved store.ts: errors were being swallowed, now they dispatch through the global notification store instead. - New features/admin/modules/routes.ts declares admin.modules.index + admin.modules.view as children of /admin/administration with meta.isSuperAdmin: true. - features/admin/{index,routes}.ts re-export and mount the relocated routes. - config/invoiceshelf.php gains a new AdminModules entry in admin_menu pointing at /admin/administration/modules with super_admin_only: true. - The dev-gated navigation.modules entry in main_menu is replaced (not deleted) with a non-gated entry pointing at the new company-context Active Modules index page that lands in the next commit. The ability is set to manage modules so non-owners can't see it. The new company-context Active Modules index, schema-driven settings page, and dynamic sidebar group are introduced in subsequent commits. --- config/invoiceshelf.php | 36 ++-- resources/scripts/features/admin/index.ts | 16 ++ .../modules/components/ModuleCard.vue | 2 +- .../scripts/features/admin/modules/index.ts | 17 ++ .../scripts/features/admin/modules/routes.ts | 34 +++ .../scripts/features/admin/modules/store.ts | 193 ++++++++++++++++++ .../modules/views/ModuleDetailView.vue | 4 +- .../modules/views/ModuleIndexView.vue | 0 resources/scripts/features/admin/routes.ts | 2 + 9 files changed, 286 insertions(+), 18 deletions(-) rename resources/scripts/features/{company => admin}/modules/components/ModuleCard.vue (97%) create mode 100644 resources/scripts/features/admin/modules/index.ts create mode 100644 resources/scripts/features/admin/modules/routes.ts create mode 100644 resources/scripts/features/admin/modules/store.ts rename resources/scripts/features/{company => admin}/modules/views/ModuleDetailView.vue (99%) rename resources/scripts/features/{company => admin}/modules/views/ModuleIndexView.vue (100%) diff --git a/config/invoiceshelf.php b/config/invoiceshelf.php index 95cea065..fba7c1d3 100644 --- a/config/invoiceshelf.php +++ b/config/invoiceshelf.php @@ -346,21 +346,16 @@ return [ 'ability' => 'view-expense', 'model' => Expense::class, ], - // TODO: remove env check once the module management os implemented. - ...( - env('APP_ENV', 'production') == 'development' ? [ - [ - 'title' => 'navigation.modules', - 'group' => 3, - 'link' => '/admin/modules', - 'icon' => 'PuzzlePieceIcon', - 'name' => 'Modules', - 'owner_only' => true, - 'ability' => '', - 'model' => '', - ], - ] : [] - ), + [ + 'title' => 'navigation.modules', + 'group' => 3, + 'link' => '/admin/modules', + 'icon' => 'PuzzlePieceIcon', + 'name' => 'Modules', + 'owner_only' => false, + 'ability' => 'manage modules', + 'model' => '', + ], [ 'title' => 'navigation.members', 'group' => 3, @@ -430,6 +425,17 @@ return [ 'ability' => '', 'model' => '', ], + [ + 'title' => 'navigation.modules', + 'group' => 1, + 'link' => '/admin/administration/modules', + 'icon' => 'PuzzlePieceIcon', + 'name' => 'AdminModules', + 'owner_only' => false, + 'super_admin_only' => true, + 'ability' => '', + 'model' => '', + ], [ 'title' => 'navigation.settings', 'group' => 1, diff --git a/resources/scripts/features/admin/index.ts b/resources/scripts/features/admin/index.ts index 64e64cc5..0453838c 100644 --- a/resources/scripts/features/admin/index.ts +++ b/resources/scripts/features/admin/index.ts @@ -18,3 +18,19 @@ export { default as AdminSettingsView } from './views/AdminSettingsView.vue' export { default as AdminCompanyDropdown } from './components/AdminCompanyDropdown.vue' export { default as AdminUserDropdown } from './components/AdminUserDropdown.vue' + +// Modules (super-admin marketplace browser) +export { + adminModuleRoutes, + useModuleStore, + ModuleIndexView, + ModuleDetailView, + ModuleCard, +} from './modules' +export type { + ModuleState, + ModuleStore, + ModuleDetailResponse, + ModuleDetailMeta, + InstallationStep, +} from './modules' diff --git a/resources/scripts/features/company/modules/components/ModuleCard.vue b/resources/scripts/features/admin/modules/components/ModuleCard.vue similarity index 97% rename from resources/scripts/features/company/modules/components/ModuleCard.vue rename to resources/scripts/features/admin/modules/components/ModuleCard.vue index 022fccfd..bd1e5445 100644 --- a/resources/scripts/features/company/modules/components/ModuleCard.vue +++ b/resources/scripts/features/admin/modules/components/ModuleCard.vue @@ -1,7 +1,7 @@