feat(app): auth, orgs/events UI, router guards, and dev tooling
- Add Sanctum auth flow (store, composables, login, axios interceptors) - Add dashboard, organisation list/detail, events CRUD dialogs - Wire router guards, navigation, organisation switcher in layout - Replace Vuexy @db types in NavSearchBar; add @iconify/types; themeConfig title typing - Vuetify settings.scss + resolve configFile via fileURLToPath; drop dead path aliases - Root index redirects to dashboard; fix events table route name - API: DevSeeder + DatabaseSeeder updates; docs TEST_SCENARIO; corporate identity assets Made-with: Cursor
This commit is contained in:
64
apps/app/src/components/layout/OrganisationSwitcher.vue
Normal file
64
apps/app/src/components/layout/OrganisationSwitcher.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const hasMultipleOrgs = computed(() => authStore.organisations.length > 1)
|
||||
const currentOrgName = computed(() => authStore.currentOrganisation?.name ?? 'Geen organisatie')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="organisation-switcher mx-4 mb-2">
|
||||
<!-- Single org: just show the name -->
|
||||
<div
|
||||
v-if="!hasMultipleOrgs"
|
||||
class="d-flex align-center gap-x-2 pa-2"
|
||||
>
|
||||
<VIcon
|
||||
icon="tabler-building"
|
||||
size="20"
|
||||
color="primary"
|
||||
/>
|
||||
<span class="text-body-2 font-weight-medium text-truncate">
|
||||
{{ currentOrgName }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Multiple orgs: dropdown -->
|
||||
<VBtn
|
||||
v-else
|
||||
variant="tonal"
|
||||
color="primary"
|
||||
block
|
||||
class="text-none justify-start"
|
||||
prepend-icon="tabler-building"
|
||||
>
|
||||
<span class="text-truncate">{{ currentOrgName }}</span>
|
||||
|
||||
<VMenu
|
||||
activator="parent"
|
||||
width="250"
|
||||
location="bottom start"
|
||||
>
|
||||
<VList density="compact">
|
||||
<VListItem
|
||||
v-for="org in authStore.organisations"
|
||||
:key="org.id"
|
||||
:active="org.id === authStore.currentOrganisation?.id"
|
||||
@click="authStore.setActiveOrganisation(org.id)"
|
||||
>
|
||||
<VListItemTitle>{{ org.name }}</VListItemTitle>
|
||||
<template #append>
|
||||
<VChip
|
||||
size="x-small"
|
||||
variant="text"
|
||||
>
|
||||
{{ org.role }}
|
||||
</VChip>
|
||||
</template>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</VBtn>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user