Menü-Editor, farbige Initialen, Seitenköpfe, Favoriten, Vorschaubilder
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m55s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m44s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m25s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m39s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m51s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m16s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m25s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m55s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m44s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m25s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m39s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m51s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m16s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m25s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
- Admin → Portal → Menü: Bereiche, Seiten (mit Unterseiten), Links und Gruppen mit Unterpunkten, sortierbar, je Rolle einschränkbar; Kopfzeile misst den Platz und legt Überzähliges unter „Mehr“ - Initialen in fester Farbe je Person, Abteilungsfarben im Organigramm - PageHeader für alle Übersichtsseiten - Dokumente: Favoriten (auch als Startseiten-Kachel), „Häufig genutzt“, Vorschaubilder (Bilder, erste PDF-Seite per pdf.js im Browser) - Platzhalter beim Nachladen Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
114811e6c5
commit
dda250aaad
140 changed files with 1993 additions and 427 deletions
33
resources/js/components/PageHeader.vue
Normal file
33
resources/js/components/PageHeader.vue
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ChevronRight } from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* Einheitlicher Seitenkopf: Pfad, Titel, Unterzeile und Aktionen rechts.
|
||||
*/
|
||||
defineProps({
|
||||
title: { type: String, required: true },
|
||||
description: { type: String, default: '' },
|
||||
breadcrumbs: { type: Array, default: () => [] }, // [{ label, href }]
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="mb-6 flex flex-wrap items-end justify-between gap-x-6 gap-y-4">
|
||||
<div class="min-w-0">
|
||||
<nav v-if="breadcrumbs.length" class="mb-1 flex flex-wrap items-center gap-1 text-[13px] text-muted-foreground" aria-label="Brotkrumen">
|
||||
<template v-for="(crumb, index) in breadcrumbs" :key="crumb.href">
|
||||
<ChevronRight v-if="index" class="size-3.5" />
|
||||
<Link :href="crumb.href" class="hover:text-foreground hover:underline">{{ crumb.label }}</Link>
|
||||
</template>
|
||||
</nav>
|
||||
<h1 class="text-2xl leading-tight font-semibold tracking-tight">{{ title }}</h1>
|
||||
<p v-if="description || $slots.description" class="mt-1 max-w-3xl text-sm text-muted-foreground">
|
||||
<slot name="description">{{ description }}</slot>
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="$slots.actions" class="flex w-full flex-wrap items-center gap-2 sm:w-auto">
|
||||
<slot name="actions" />
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
|
@ -1,17 +1,22 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { colorFor } from '@/lib/colors';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
person: { type: Object, required: true },
|
||||
class: { type: [String, Array, Object], default: '' },
|
||||
});
|
||||
|
||||
// Ohne Foto: Initialen in einer festen Farbe je Person.
|
||||
const color = computed(() => colorFor(props.person.id ?? props.person.name));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Avatar :class="cn('size-10', $props.class)">
|
||||
<AvatarImage v-if="person.avatar_url" :src="person.avatar_url" :alt="person.name" />
|
||||
<AvatarFallback class="bg-brand-soft font-semibold text-brand-soft-foreground">
|
||||
<AvatarFallback class="font-semibold" :class="color.soft">
|
||||
{{ person.initials }}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
|
|
|
|||
15
resources/js/components/nav/NavLink.vue
Normal file
15
resources/js/components/nav/NavLink.vue
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
|
||||
/**
|
||||
* Menülink: Portal-Adressen über Inertia, externe bzw. „neuer Tab“ als normaler Link.
|
||||
*/
|
||||
defineProps({
|
||||
item: { type: Object, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a v-if="item.new_tab || !item.href.startsWith('/')" :href="item.href" :target="item.new_tab ? '_blank' : undefined" :rel="item.new_tab ? 'noopener' : undefined"><slot /></a>
|
||||
<Link v-else :href="item.href"><slot /></Link>
|
||||
</template>
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ChevronDown, ChevronUp, LoaderCircle, ScanSearch } from '@lucide/vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import { colorFor } from '@/lib/colors';
|
||||
|
||||
/**
|
||||
* Person im Organigramm. „compact“ für Mitarbeitende ohne eigenes Team.
|
||||
*/
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
person: { type: Object, required: true },
|
||||
compact: { type: Boolean, default: false },
|
||||
highlighted: { type: Boolean, default: false },
|
||||
|
|
@ -15,18 +17,22 @@ defineProps({
|
|||
});
|
||||
|
||||
defineEmits(['toggle', 'focus']);
|
||||
|
||||
// Farbe der Abteilung – als Streifen links und für die Beschriftung.
|
||||
const color = computed(() => colorFor(props.person.department));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:id="`person-${person.id}`"
|
||||
class="group/card relative rounded-lg border bg-card text-left shadow-xs transition-shadow hover:shadow-sm"
|
||||
class="group/card relative overflow-hidden rounded-lg border bg-card text-left shadow-xs transition-shadow hover:shadow-sm"
|
||||
:class="[compact ? 'w-54' : 'w-56', highlighted ? 'border-brand-400 ring-3 ring-brand-300/50' : '']"
|
||||
>
|
||||
<span class="absolute inset-y-0 left-0 w-1 rounded-l-lg" :class="color.bar" aria-hidden="true" />
|
||||
<div class="flex items-center gap-3" :class="compact ? 'px-3 py-2' : 'px-3.5 pt-3 pb-2.5'">
|
||||
<PersonAvatar :person="person" :class="compact ? 'size-7 text-[10px]' : 'size-10'" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<p v-if="person.department && !compact" class="truncate text-[10.5px] font-semibold tracking-wide text-brand-text uppercase">{{ person.department }}</p>
|
||||
<p v-if="person.department && !compact" class="truncate text-[10.5px] font-semibold tracking-wide uppercase" :class="color.text">{{ person.department }}</p>
|
||||
<Link :href="`/personen/${person.id}`" class="block truncate text-sm leading-tight font-semibold hover:underline">{{ person.name }}</Link>
|
||||
<p class="truncate text-xs leading-tight text-muted-foreground" :title="person.job_title">{{ person.job_title || '–' }}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { http } from '@/lib/http';
|
||||
import OrgCard from './OrgCard.vue';
|
||||
|
||||
|
|
@ -49,7 +50,17 @@ async function toggle() {
|
|||
<template>
|
||||
<li>
|
||||
<OrgCard :person="person" :highlighted="person.id === focus" :open="expanded" :loading="loading" @toggle="toggle" @focus="$emit('focus', $event)" />
|
||||
<ul v-if="expanded && team?.length">
|
||||
<ul v-if="expanded && loading" aria-busy="true">
|
||||
<li>
|
||||
<div class="org-members">
|
||||
<div v-for="n in 3" :key="n" class="flex w-54 items-center gap-3 rounded-lg border bg-card px-3 py-2">
|
||||
<Skeleton class="size-7 rounded-full" />
|
||||
<div class="grid flex-1 gap-1.5"><Skeleton class="h-3 w-3/4" /><Skeleton class="h-2.5 w-1/2" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul v-else-if="expanded && team?.length">
|
||||
<OrgChartNode v-for="child in managers" :key="child.id" :person="child" :teams="teams" :open="open" :focus="focus" @focus="$emit('focus', $event)" />
|
||||
<li v-if="members.length">
|
||||
<div class="org-members" :class="{ 'org-members-wide': members.length > 8 }">
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { Link } from '@inertiajs/vue3';
|
|||
import { ChevronUp, Mail, MapPin, Network, Phone, Smartphone, UserRound, Users } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import { colorFor } from '@/lib/colors';
|
||||
|
||||
/**
|
||||
* Fokus-Ansicht: eine Person mit Kontakt, rechts die Kette der Vorgesetzten und
|
||||
|
|
@ -41,11 +42,12 @@ const contact = computed(() => [
|
|||
<div class="grid items-start gap-5" :class="{ 'lg:grid-cols-[minmax(0,1fr)_19rem]': chain.length || peers.length }">
|
||||
<div class="grid gap-5">
|
||||
<!-- Person im Fokus -->
|
||||
<section class="overflow-hidden rounded-lg border bg-card">
|
||||
<section class="relative overflow-hidden rounded-lg border bg-card">
|
||||
<span class="absolute inset-y-0 left-0 w-1" :class="colorFor(details.department).bar" aria-hidden="true" />
|
||||
<div class="flex flex-col gap-5 p-5 sm:flex-row sm:items-center">
|
||||
<PersonAvatar :person="details" class="size-20 text-xl ring-4 ring-brand-soft" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<p v-if="details.department" class="text-[11px] font-semibold tracking-wide text-brand-text uppercase">{{ details.department }}</p>
|
||||
<p v-if="details.department" class="text-[11px] font-semibold tracking-wide uppercase" :class="colorFor(details.department).text">{{ details.department }}</p>
|
||||
<h2 class="text-xl leading-tight font-semibold tracking-tight">{{ details.name }}</h2>
|
||||
<p v-if="details.job_title" class="text-sm text-muted-foreground">{{ details.job_title }}</p>
|
||||
<ul class="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-[13px]">
|
||||
|
|
|
|||
11
resources/js/components/ui/skeleton/Skeleton.vue
Normal file
11
resources/js/components/ui/skeleton/Skeleton.vue
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: [String, Array, Object], default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="cn('animate-pulse rounded-md bg-muted', props.class)" aria-hidden="true" />
|
||||
</template>
|
||||
1
resources/js/components/ui/skeleton/index.js
Normal file
1
resources/js/components/ui/skeleton/index.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as Skeleton } from './Skeleton.vue';
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { Head, Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { ChevronDown, LogOut, Menu, Monitor, Moon, Search, Settings, Sun, UserRound, UserRoundPen } from '@lucide/vue';
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
|
||||
|
|
@ -17,6 +17,7 @@ import { Toaster } from '@/components/ui/sonner';
|
|||
import BrandLogo from '@/components/BrandLogo.vue';
|
||||
import NotificationBell from '@/components/NotificationBell.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import NavLink from '@/components/nav/NavLink.vue';
|
||||
import { useThemePreference } from '@/composables/useThemePreference';
|
||||
|
||||
defineProps({
|
||||
|
|
@ -28,6 +29,52 @@ const user = computed(() => page.props.auth.user);
|
|||
const branding = computed(() => page.props.branding);
|
||||
const headerStyle = computed(() => branding.value.header_style ?? 'light');
|
||||
const navigation = computed(() => page.props.navigation);
|
||||
|
||||
// Was nicht in die Kopfzeile passt, kommt unter „Mehr“. Gemessen wird an einer
|
||||
// unsichtbaren Kopie der Menüpunkte – so passt es bei jeder Breite und Beschriftung.
|
||||
const navBox = ref(null);
|
||||
const navMeasure = ref(null);
|
||||
const navFit = ref(navigation.value.length);
|
||||
const MORE_WIDTH = 84;
|
||||
|
||||
function measureNav() {
|
||||
const box = navBox.value;
|
||||
const items = navMeasure.value ? [...navMeasure.value.children] : [];
|
||||
if (!box || !items.length) return;
|
||||
|
||||
const widths = items.map((el) => el.getBoundingClientRect().width + 4);
|
||||
const available = box.clientWidth;
|
||||
|
||||
if (widths.reduce((sum, w) => sum + w, 0) <= available) {
|
||||
navFit.value = widths.length;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let used = MORE_WIDTH;
|
||||
let fit = 0;
|
||||
|
||||
for (const width of widths) {
|
||||
if (used + width > available) break;
|
||||
used += width;
|
||||
fit++;
|
||||
}
|
||||
|
||||
navFit.value = Math.max(1, fit);
|
||||
}
|
||||
|
||||
let navObserver;
|
||||
onMounted(() => {
|
||||
navObserver = new ResizeObserver(measureNav);
|
||||
if (navBox.value) navObserver.observe(navBox.value);
|
||||
nextTick(measureNav);
|
||||
document.fonts?.ready.then(measureNav);
|
||||
});
|
||||
onBeforeUnmount(() => navObserver?.disconnect());
|
||||
watch(navigation, () => nextTick(measureNav));
|
||||
|
||||
const navVisible = computed(() => navigation.value.slice(0, navFit.value));
|
||||
const navMore = computed(() => navigation.value.slice(navFit.value));
|
||||
const { preference, setPreference } = useThemePreference();
|
||||
|
||||
const mobileNavOpen = ref(false);
|
||||
|
|
@ -67,17 +114,31 @@ const themeOptions = [
|
|||
<SheetHeader class="border-b px-5 py-4">
|
||||
<SheetTitle class="text-left"><BrandLogo /></SheetTitle>
|
||||
</SheetHeader>
|
||||
<nav class="grid gap-1 p-3" aria-label="Hauptnavigation">
|
||||
<Link
|
||||
v-for="item in navigation"
|
||||
:key="item.href"
|
||||
:href="item.href"
|
||||
class="rounded-md px-3 py-2.5 text-[15px] font-medium"
|
||||
:class="item.active ? 'bg-brand-soft text-brand-soft-foreground' : 'text-foreground/80 hover:bg-accent'"
|
||||
@click="mobileNavOpen = false"
|
||||
>
|
||||
{{ item.label }}
|
||||
</Link>
|
||||
<nav class="grid gap-1 overflow-y-auto p-3" aria-label="Hauptnavigation">
|
||||
<template v-for="item in navigation" :key="item.key">
|
||||
<NavLink
|
||||
v-if="item.href"
|
||||
:item="item"
|
||||
class="rounded-md px-3 py-2.5 text-[15px] font-medium"
|
||||
:class="item.active && !item.children.some((c) => c.active) ? 'bg-brand-soft text-brand-soft-foreground' : 'text-foreground/80 hover:bg-accent'"
|
||||
@click="mobileNavOpen = false"
|
||||
>
|
||||
{{ item.label }}
|
||||
</NavLink>
|
||||
<p v-else class="px-3 pt-3 pb-1 text-xs font-semibold tracking-wide text-muted-foreground uppercase">{{ item.label }}</p>
|
||||
<div v-if="item.children.length" class="mb-1 ml-3 grid gap-0.5 border-l pl-2">
|
||||
<NavLink
|
||||
v-for="child in item.children"
|
||||
:key="child.key"
|
||||
:item="child"
|
||||
class="rounded-md px-3 py-2 text-sm"
|
||||
:class="child.active ? 'bg-brand-soft font-medium text-brand-soft-foreground' : 'text-foreground/75 hover:bg-accent'"
|
||||
@click="mobileNavOpen = false"
|
||||
>
|
||||
{{ child.label }}
|
||||
</NavLink>
|
||||
</div>
|
||||
</template>
|
||||
</nav>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
|
|
@ -86,23 +147,76 @@ const themeOptions = [
|
|||
<BrandLogo :inverted="headerStyle !== 'light'" compact />
|
||||
</Link>
|
||||
|
||||
<nav class="hidden h-full lg:block" aria-label="Hauptnavigation">
|
||||
<nav ref="navBox" class="relative hidden h-full min-w-0 flex-1 lg:block" aria-label="Hauptnavigation">
|
||||
<!-- Unsichtbare Kopie zum Messen der Breiten -->
|
||||
<ul ref="navMeasure" class="pointer-events-none invisible absolute flex gap-1" aria-hidden="true">
|
||||
<li v-for="item in navigation" :key="item.key" class="flex items-center gap-1 px-3 text-sm font-medium whitespace-nowrap">
|
||||
{{ item.label }}<ChevronDown v-if="item.children.length" class="size-4" />
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="flex h-full items-stretch gap-1">
|
||||
<li v-for="item in navigation" :key="item.href" class="flex">
|
||||
<Link
|
||||
:href="item.href"
|
||||
<li v-for="item in navVisible" :key="item.key" class="flex">
|
||||
<DropdownMenu v-if="item.children.length">
|
||||
<DropdownMenuTrigger
|
||||
class="relative flex items-center gap-1 px-3 text-sm font-medium whitespace-nowrap transition-colors outline-none"
|
||||
:class="item.active ? 'text-foreground' : 'text-foreground/70 hover:text-foreground'"
|
||||
>
|
||||
{{ item.label }} <ChevronDown class="size-4 opacity-70" />
|
||||
<span v-if="item.active" class="nav-underline absolute inset-x-3 bottom-0 h-[3px] rounded-t-full bg-brand" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" class="min-w-56">
|
||||
<template v-if="item.href">
|
||||
<DropdownMenuItem as-child>
|
||||
<NavLink :item="item" :class="item.active && !item.children.some((c) => c.active) ? 'font-semibold text-brand-text' : 'font-medium'">{{ item.label }} – Übersicht</NavLink>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
</template>
|
||||
<DropdownMenuItem v-for="child in item.children" :key="child.key" as-child>
|
||||
<NavLink :item="child" :class="child.active ? 'font-semibold text-brand-text' : ''">{{ child.label }}</NavLink>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
<NavLink
|
||||
v-else
|
||||
:item="item"
|
||||
class="relative flex items-center px-3 text-sm font-medium whitespace-nowrap transition-colors"
|
||||
:class="item.active ? 'text-foreground' : 'text-foreground/70 hover:text-foreground'"
|
||||
:aria-current="item.active ? 'page' : undefined"
|
||||
>
|
||||
{{ item.label }}
|
||||
<span v-if="item.active" class="nav-underline absolute inset-x-3 bottom-0 h-[3px] rounded-t-full bg-brand" />
|
||||
</Link>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li v-if="navMore.length" class="flex">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger
|
||||
class="relative flex items-center gap-1 px-3 text-sm font-medium whitespace-nowrap transition-colors outline-none"
|
||||
:class="navMore.some((i) => i.active) ? 'text-foreground' : 'text-foreground/70 hover:text-foreground'"
|
||||
>
|
||||
Mehr <ChevronDown class="size-4" />
|
||||
<span v-if="navMore.some((i) => i.active)" class="nav-underline absolute inset-x-3 bottom-0 h-[3px] rounded-t-full bg-brand" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" class="min-w-48">
|
||||
<template v-for="(item, index) in navMore" :key="item.key">
|
||||
<template v-if="item.children.length">
|
||||
<DropdownMenuSeparator v-if="index" />
|
||||
<DropdownMenuLabel class="text-xs text-muted-foreground">{{ item.label }}</DropdownMenuLabel>
|
||||
<DropdownMenuItem v-if="item.href" as-child><NavLink :item="item">Übersicht</NavLink></DropdownMenuItem>
|
||||
<DropdownMenuItem v-for="child in item.children" :key="child.key" as-child>
|
||||
<NavLink :item="child" :class="child.active ? 'font-semibold text-brand-text' : ''">{{ child.label }}</NavLink>
|
||||
</DropdownMenuItem>
|
||||
</template>
|
||||
<DropdownMenuItem v-else as-child>
|
||||
<NavLink :item="item" :class="item.active ? 'font-semibold text-brand-text' : ''">{{ item.label }}</NavLink>
|
||||
</DropdownMenuItem>
|
||||
</template>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="ml-auto flex items-center gap-1">
|
||||
<div class="ml-auto flex shrink-0 items-center gap-1">
|
||||
<form class="mr-2 hidden w-64 md:block xl:w-80" role="search" @submit.prevent="submitSearch">
|
||||
<label class="relative block">
|
||||
<span class="sr-only">Personen suchen</span>
|
||||
|
|
|
|||
31
resources/js/lib/colors.js
Normal file
31
resources/js/lib/colors.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Ruhige Farbpalette für Initialen und Abteilungen – fest je Schlüssel, damit
|
||||
* dieselbe Person bzw. Abteilung überall dieselbe Farbe hat. Klassen stehen
|
||||
* ausgeschrieben, damit Tailwind sie findet.
|
||||
*/
|
||||
const palette = [
|
||||
{ soft: 'bg-sky-100 text-sky-800 dark:bg-sky-950 dark:text-sky-200', bar: 'bg-sky-500', text: 'text-sky-700 dark:text-sky-300' },
|
||||
{ soft: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200', bar: 'bg-emerald-500', text: 'text-emerald-700 dark:text-emerald-300' },
|
||||
{ soft: 'bg-amber-100 text-amber-800 dark:bg-amber-950 dark:text-amber-200', bar: 'bg-amber-500', text: 'text-amber-700 dark:text-amber-300' },
|
||||
{ soft: 'bg-rose-100 text-rose-800 dark:bg-rose-950 dark:text-rose-200', bar: 'bg-rose-500', text: 'text-rose-700 dark:text-rose-300' },
|
||||
{ soft: 'bg-violet-100 text-violet-800 dark:bg-violet-950 dark:text-violet-200', bar: 'bg-violet-500', text: 'text-violet-700 dark:text-violet-300' },
|
||||
{ soft: 'bg-teal-100 text-teal-800 dark:bg-teal-950 dark:text-teal-200', bar: 'bg-teal-500', text: 'text-teal-700 dark:text-teal-300' },
|
||||
{ soft: 'bg-orange-100 text-orange-800 dark:bg-orange-950 dark:text-orange-200', bar: 'bg-orange-500', text: 'text-orange-700 dark:text-orange-300' },
|
||||
{ soft: 'bg-indigo-100 text-indigo-800 dark:bg-indigo-950 dark:text-indigo-200', bar: 'bg-indigo-500', text: 'text-indigo-700 dark:text-indigo-300' },
|
||||
];
|
||||
|
||||
const neutral = { soft: 'bg-muted text-muted-foreground', bar: 'bg-border', text: 'text-muted-foreground' };
|
||||
|
||||
function hash(value) {
|
||||
let h = 0;
|
||||
for (const char of String(value)) h = (h * 31 + char.codePointAt(0)) >>> 0;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
/** Farbe für einen Schlüssel (Personen-ID, Abteilungsname …); leer = neutral. */
|
||||
export function colorFor(key) {
|
||||
if (key === null || key === undefined || key === '') return neutral;
|
||||
|
||||
return palette[hash(typeof key === 'string' ? key.trim().toLowerCase() : key) % palette.length];
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
/**
|
||||
|
|
@ -20,10 +21,7 @@ for (const [path, loader] of Object.entries(loaders)) {
|
|||
|
||||
<template>
|
||||
<AppLayout title="Redaktion">
|
||||
<div class="mb-6">
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Redaktion</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Ihre Seiten und Beiträge – Entwürfe, Freigaben und Geplantes.</p>
|
||||
</div>
|
||||
<PageHeader title="Redaktion" description="Ihre Seiten und Beiträge – Entwürfe, Freigaben und Geplantes." />
|
||||
<div class="grid items-start gap-6 xl:grid-cols-2">
|
||||
<component :is="components[section.component]" v-for="section in sections" :key="section.key" v-bind="section.props" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { useDebounceFn } from '@vueuse/core';
|
|||
import { ChevronLeft, ChevronRight, Mail, Phone, Search, SearchX } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -31,16 +32,13 @@ watch(department, apply);
|
|||
|
||||
<template>
|
||||
<AppLayout title="Personen">
|
||||
<div class="mb-6 flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Personen</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
{{ people.meta.total.toLocaleString('de-DE') }}
|
||||
{{ people.meta.total === 1 ? 'Person' : 'Personen' }}{{ filters.q || filters.abteilung ? ' gefunden' : ' im Verzeichnis' }}
|
||||
· <Link href="/personen/organigramm" class="font-medium text-brand-text hover:underline">Organigramm</Link>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<PageHeader title="Personen">
|
||||
<template #description>
|
||||
{{ people.meta.total.toLocaleString('de-DE') }}
|
||||
{{ people.meta.total === 1 ? 'Person' : 'Personen' }}{{ filters.q || filters.abteilung ? ' gefunden' : ' im Verzeichnis' }}
|
||||
· <Link href="/personen/organigramm" class="font-medium text-brand-text hover:underline">Organigramm</Link>
|
||||
</template>
|
||||
<template #actions>
|
||||
<div class="flex w-full flex-col gap-3 sm:w-auto sm:flex-row">
|
||||
<label class="relative block sm:w-80">
|
||||
<span class="sr-only">Suchen</span>
|
||||
|
|
@ -61,7 +59,8 @@ watch(department, apply);
|
|||
<option v-for="item in departments" :key="item" :value="item">{{ item }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<ul v-if="people.data.length" class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4">
|
||||
<li v-for="person in people.data" :key="person.id" class="flex flex-col rounded-lg border bg-card">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { Link, router } from '@inertiajs/vue3';
|
||||
import { Network, ScanSearch, Search, X } from '@lucide/vue';
|
||||
import { Input } from '@/components/ui/input';
|
||||
|
|
@ -8,6 +8,8 @@ import PersonAvatar from '@/components/PersonAvatar.vue';
|
|||
import OrgChart from '@/components/org/OrgChart.vue';
|
||||
import OrgFocus from '@/components/org/OrgFocus.vue';
|
||||
import { useStoredChoice } from '@/composables/useStoredChoice';
|
||||
import { colorFor } from '@/lib/colors';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { http } from '@/lib/http';
|
||||
|
||||
|
|
@ -67,21 +69,19 @@ function pick(person) {
|
|||
}
|
||||
|
||||
const number = (n) => n.toLocaleString('de-DE');
|
||||
|
||||
// Legende: Abteilungen der sichtbaren Personen
|
||||
const departments = computed(() => {
|
||||
const names = new Set([...props.roots, ...Object.values(props.teams).flat()].map((p) => p.department).filter(Boolean));
|
||||
|
||||
return [...names].sort((a, b) => a.localeCompare(b, 'de')).slice(0, 16);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Organigramm">
|
||||
<div class="mb-5 flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<nav class="mb-1 text-[13px] text-muted-foreground" aria-label="Brotkrumen">
|
||||
<Link href="/personen" class="hover:text-foreground hover:underline">Personen</Link>
|
||||
</nav>
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Organigramm</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">
|
||||
{{ number(stats.people) }} Personen · {{ number(stats.leaders) }} mit Personalverantwortung
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<PageHeader title="Organigramm" :breadcrumbs="[{ label: 'Personen', href: '/personen' }]" :description="`${number(stats.people)} Personen · ${number(stats.leaders)} mit Personalverantwortung`">
|
||||
<template #actions>
|
||||
<div class="flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center">
|
||||
<div class="inline-flex self-start rounded-md border bg-card p-0.5" role="group" aria-label="Ansicht">
|
||||
<button
|
||||
|
|
@ -110,7 +110,8 @@ const number = (n) => n.toLocaleString('de-DE');
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div v-if="!roots.length" class="rounded-lg border bg-card">
|
||||
<EmptyState :icon="Network" title="Noch kein Organigramm" text="Es sind noch keine Vorgesetzten hinterlegt. Sie kommen aus dem Anmeldedienst (z. B. Entra ID) oder werden im Admin-Bereich bei den Benutzern eingetragen." />
|
||||
|
|
@ -125,6 +126,9 @@ const number = (n) => n.toLocaleString('de-DE');
|
|||
<span class="text-muted-foreground">Der Weg zur gesuchten Person ist aufgeklappt.</span>
|
||||
<Link href="/personen/organigramm?ansicht=baum" class="inline-flex items-center gap-1 font-medium text-brand-text hover:underline"><X class="size-3.5" /> Zurücksetzen</Link>
|
||||
</div>
|
||||
<ul v-if="departments.length > 1" class="mb-3 flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted-foreground" aria-label="Abteilungen">
|
||||
<li v-for="name in departments" :key="name" class="flex items-center gap-1.5"><span class="size-2.5 rounded-sm" :class="colorFor(name).bar" />{{ name }}</li>
|
||||
</ul>
|
||||
<OrgChart :roots="roots" :teams="teams" :open="open" :focus="focus" @focus="(p) => show('fokus', p.id)" />
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue