mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-16 17:54:06 +00:00
feat(modules): translated display names and inline settings modal
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.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<BaseIcon :name="iconName" class="h-5 w-5" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-base font-semibold text-heading">{{ data.name }}</h3>
|
||||
<h3 class="text-base font-semibold text-heading">{{ data.display_name }}</h3>
|
||||
<p class="text-xs text-muted">{{ $t('modules.version') }} {{ data.version }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
v-if="data.has_settings"
|
||||
size="sm"
|
||||
variant="primary-outline"
|
||||
@click="goToSettings"
|
||||
@click="emit('open-settings', data)"
|
||||
>
|
||||
<template #left="slotProps">
|
||||
<BaseIcon name="CogIcon" :class="slotProps.class" />
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { CompanyModuleSummary } from '../store'
|
||||
|
||||
interface Props {
|
||||
@@ -49,13 +48,11 @@ interface Props {
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const router = useRouter()
|
||||
const emit = defineEmits<{
|
||||
(e: 'open-settings', module: CompanyModuleSummary): void
|
||||
}>()
|
||||
|
||||
const iconName = computed<string>(() => {
|
||||
return props.data.menu?.icon ?? 'PuzzlePieceIcon'
|
||||
})
|
||||
|
||||
function goToSettings(): void {
|
||||
router.push({ name: 'modules.settings', params: { slug: props.data.slug } })
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user