mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-16 01:34:08 +00:00
CompanyModulesController attaches a translated display_name to each module before returning the list. ModuleSettingsController gains a translateSchema() helper that resolves section titles and field labels against the host app's i18n store before sending the schema to the frontend, so module authors can keep their 'my_module::settings.field' keys and users still see localized strings. Per-module settings now open in an inline ModuleSettingsModal rather than routing to a standalone page. The modal reuses BaseSchemaForm for rendering, so the whole interaction takes place in-context next to the module card the user clicked — no navigation, no loss of place. CompanyModuleCard displays the translated display_name instead of the raw slug and emits open-settings with the module payload; the parent view hands that to the modal store.
36 lines
843 B
TypeScript
36 lines
843 B
TypeScript
import { defineStore } from 'pinia'
|
|
import { companyModulesService } from '@/scripts/api/services/companyModules.service'
|
|
|
|
export interface CompanyModuleSummary {
|
|
slug: string
|
|
name: string
|
|
display_name: string
|
|
version: string
|
|
has_settings: boolean
|
|
menu: { title: string, link: string, icon: string } | null
|
|
}
|
|
|
|
export interface CompanyModulesState {
|
|
modules: CompanyModuleSummary[]
|
|
isFetching: boolean
|
|
}
|
|
|
|
export const useCompanyModulesStore = defineStore('company-modules', {
|
|
state: (): CompanyModulesState => ({
|
|
modules: [],
|
|
isFetching: false,
|
|
}),
|
|
|
|
actions: {
|
|
async fetchModules(): Promise<void> {
|
|
this.isFetching = true
|
|
try {
|
|
const response = await companyModulesService.list()
|
|
this.modules = response.data
|
|
} finally {
|
|
this.isFetching = false
|
|
}
|
|
},
|
|
},
|
|
})
|