diff --git a/web/src/components/features/organizations/parts/OrgDetailModal.vue b/web/src/components/features/organizations/parts/OrgDetailModal.vue index 08069b2..28bb1e2 100644 --- a/web/src/components/features/organizations/parts/OrgDetailModal.vue +++ b/web/src/components/features/organizations/parts/OrgDetailModal.vue @@ -34,6 +34,7 @@ ({ default: false }) const props = defineProps<{ organization: Organization | null + initialTab?: OrgDetailTab }>() const { t } = useI18n() @@ -127,17 +130,26 @@ const editName = ref('') const editSlug = ref('') const saving = ref(false) +const activeTab = ref('general') + const tabs = computed(() => { const items = [ - { label: t('organizations.general'), slot: 'general' }, + { label: t('organizations.general'), slot: 'general', value: 'general' }, ] if (isAdmin.value) { - items.push({ label: t('organizations.members'), slot: 'members' }) - items.push({ label: 'SSO', slot: 'sso' }) + items.push({ label: t('organizations.members'), slot: 'members', value: 'members' }) + items.push({ label: 'SSO', slot: 'sso', value: 'sso' }) } return items }) +watch(open, (isOpen) => { + if (isOpen) { + const requested = props.initialTab ?? 'general' + activeTab.value = tabs.value.some(tab => tab.value === requested) ? requested : 'general' + } +}) + watch(() => props.organization, (org) => { if (org) { editName.value = org.name diff --git a/web/src/components/features/organizations/types.ts b/web/src/components/features/organizations/types.ts new file mode 100644 index 0000000..5aff3cd --- /dev/null +++ b/web/src/components/features/organizations/types.ts @@ -0,0 +1 @@ +export type OrgDetailTab = 'general' | 'members' | 'sso' diff --git a/web/src/components/sidebars/dashboard-second/SidebarOrgSelect.vue b/web/src/components/sidebars/dashboard-second/SidebarOrgSelect.vue index 5a5db1c..904061d 100644 --- a/web/src/components/sidebars/dashboard-second/SidebarOrgSelect.vue +++ b/web/src/components/sidebars/dashboard-second/SidebarOrgSelect.vue @@ -54,12 +54,13 @@ class="flex items-center justify-center gap-2 mb-3" > @@ -86,6 +88,7 @@ @@ -95,8 +98,10 @@ import { ref } from 'vue' import { useI18n } from 'vue-i18n' import { storeToRefs } from 'pinia' import type { Organization } from 'taskview-api' +import type { OrgDetailTab } from '@/components/features/organizations/types' import { useOrganizationStore } from '@/stores/organization.store' import { useOrgSwitcher } from '@/composables/useOrgSwitcher' +import { useOrgPermissions } from '@/composables/useOrgPermissions' import OrgCreateModal from '@/components/features/organizations/parts/OrgCreateModal.vue' import OrgDetailModal from '@/components/features/organizations/parts/OrgDetailModal.vue' @@ -105,9 +110,17 @@ const orgStore = useOrganizationStore() const { organizations, currentOrg } = storeToRefs(orgStore) const { switchOrg } = useOrgSwitcher() +const { isAdmin } = useOrgPermissions(() => currentOrg.value) + const open = ref(false) const isCreateOpen = ref(false) const isDetailOpen = ref(false) +const detailTab = ref('general') + +function openDetail(tab: OrgDetailTab) { + detailTab.value = tab + isDetailOpen.value = true +} function selectOrg(org: Organization) { open.value = false