Organigramm und Dokumente kompakter
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m31s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m9s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m16s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 4m3s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 4m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 4m16s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 4m21s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m26s

- Organigramm: zwei Ebenen offen, Fläche so hoch wie der Inhalt, kleinere
  Abstände; Fokus-Ansicht in voller Breite mit Seitenspalte und Team-Vorschau
- Dokumente: dichtere Zeilen, Unterordner in den Bereichen, Infospalte
  „Über diesen Ordner“ mit den pflegenden Rollen
- Etwas weniger Randabstand im Seitenlayout

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 13:15:44 +00:00
parent ab0384ceb1
commit 33862183bf
80 changed files with 475 additions and 352 deletions

View file

@ -20,15 +20,15 @@ defineEmits(['toggle', 'focus']);
<template>
<div
:id="`person-${person.id}`"
class="group/card relative w-60 rounded-lg border bg-card text-left shadow-xs transition-shadow hover:shadow-sm"
:class="highlighted ? 'border-brand-400 ring-3 ring-brand-300/50' : ''"
class="group/card relative 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' : '']"
>
<div class="flex items-center gap-3" :class="compact ? 'px-3 py-2' : 'px-3.5 pt-3.5 pb-3'">
<PersonAvatar :person="person" :class="compact ? 'size-8 text-[11px]' : 'size-11'" />
<div class="flex items-center gap-3" :class="compact ? 'px-2.5 py-1.5' : 'px-3 pt-2.5 pb-2'">
<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>
<Link :href="`/personen/${person.id}`" class="block truncate text-sm leading-tight font-semibold hover:underline">{{ person.name }}</Link>
<p class="truncate text-xs text-muted-foreground" :title="person.job_title">{{ person.job_title || '–' }}</p>
<p class="truncate text-xs leading-tight text-muted-foreground" :title="person.job_title">{{ person.job_title || '–' }}</p>
</div>
</div>
@ -45,7 +45,7 @@ defineEmits(['toggle', 'focus']);
<button
v-if="!compact && person.reports"
type="button"
class="flex w-full items-center justify-center gap-1.5 rounded-b-lg border-t py-1.5 text-xs font-medium hover:bg-accent"
class="flex w-full items-center justify-center gap-1.5 rounded-b-lg border-t py-1 text-xs font-medium hover:bg-accent"
:class="open ? 'bg-brand-soft/60 text-brand-soft-foreground' : 'text-muted-foreground'"
:aria-expanded="open"
@click="$emit('toggle')"

View file

@ -10,7 +10,7 @@ import OrgChartNode from './OrgChartNode.vue';
const props = defineProps({
roots: { type: Array, required: true },
teams: { type: Object, default: () => ({}) },
path: { type: Array, default: () => [] },
open: { type: Array, default: () => [] },
focus: { type: Number, default: null },
});
@ -89,15 +89,15 @@ watch(() => props.focus, center);
<div
ref="canvas"
class="org-canvas h-[calc(100vh-17rem)] min-h-[28rem] cursor-grab overflow-auto active:cursor-grabbing"
class="org-canvas max-h-[calc(100vh-12rem)] min-h-[18rem] cursor-grab overflow-auto active:cursor-grabbing"
@pointerdown="onPointerDown"
@pointermove="onPointerMove"
@pointerup="onPointerUp"
@pointercancel="onPointerUp"
>
<div class="inline-block min-w-full p-10" :style="{ zoom: scale }">
<div class="inline-block min-w-full px-6 pt-5 pb-6" :style="{ zoom: scale }">
<ul class="org-tree">
<OrgChartNode v-for="person in roots" :key="person.id" :person="person" :teams="teams" :path="path" :focus="focus" @focus="$emit('focus', $event)" />
<OrgChartNode v-for="person in roots" :key="person.id" :person="person" :teams="teams" :open="open" :focus="focus" @focus="$emit('focus', $event)" />
</ul>
</div>
</div>
@ -124,7 +124,7 @@ watch(() => props.focus, center);
.org-tree ul {
position: relative;
padding-top: 22px;
padding-top: 16px;
}
.org-tree li {
@ -132,7 +132,7 @@ watch(() => props.focus, center);
display: flex;
flex-direction: column;
align-items: center;
padding: 22px 10px 0;
padding: 16px 5px 0;
list-style: none;
}
@ -143,7 +143,7 @@ watch(() => props.focus, center);
top: 0;
right: 50%;
width: 50%;
height: 22px;
height: 16px;
border-top: 1.5px solid var(--org-line);
}
@ -188,7 +188,7 @@ watch(() => props.focus, center);
position: absolute;
top: 0;
left: 50%;
height: 22px;
height: 16px;
border-left: 1.5px solid var(--org-line);
}
@ -196,7 +196,7 @@ watch(() => props.focus, center);
.org-members {
position: relative;
display: grid;
gap: 8px;
gap: 6px;
}
.org-members::before {
@ -213,7 +213,7 @@ watch(() => props.focus, center);
}
.org-members-wide {
grid-template-columns: repeat(2, 15rem);
column-gap: 24px;
grid-template-columns: repeat(2, 13.5rem);
column-gap: 16px;
}
</style>

View file

@ -10,35 +10,35 @@ import OrgCard from './OrgCard.vue';
const props = defineProps({
person: { type: Object, required: true },
teams: { type: Object, default: () => ({}) },
path: { type: Array, default: () => [] },
open: { type: Array, default: () => [] },
focus: { type: Number, default: null },
});
defineEmits(['focus']);
const isOnPath = () => props.path.includes(props.person.id) && props.person.id !== props.focus;
const startsOpen = () => props.open.includes(props.person.id) && props.teams[props.person.id] !== undefined;
const team = ref(props.teams[props.person.id] ?? null);
const open = ref(isOnPath() && team.value !== null);
const expanded = ref(startsOpen());
const loading = ref(false);
watch(() => props.teams, (teams) => {
team.value = teams[props.person.id] ?? team.value;
open.value = isOnPath() && team.value !== null;
expanded.value = startsOpen();
});
const managers = computed(() => (team.value ?? []).filter((p) => p.reports));
const members = computed(() => (team.value ?? []).filter((p) => !p.reports));
async function toggle() {
open.value = !open.value;
expanded.value = !expanded.value;
if (open.value && team.value === null) {
if (expanded.value && team.value === null) {
loading.value = true;
try {
team.value = (await http.get(`/personen/organigramm/${props.person.id}/team`)).team;
} catch {
open.value = false;
expanded.value = false;
} finally {
loading.value = false;
}
@ -48,9 +48,9 @@ async function toggle() {
<template>
<li>
<OrgCard :person="person" :highlighted="person.id === focus" :open="open" :loading="loading" @toggle="toggle" @focus="$emit('focus', $event)" />
<ul v-if="open && team?.length">
<OrgChartNode v-for="child in managers" :key="child.id" :person="child" :teams="teams" :path="path" :focus="focus" @focus="$emit('focus', $event)" />
<OrgCard :person="person" :highlighted="person.id === focus" :open="expanded" :loading="loading" @toggle="toggle" @focus="$emit('focus', $event)" />
<ul v-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 }">
<OrgCard v-for="member in members" :key="member.id" :person="member" compact :highlighted="member.id === focus" @focus="$emit('focus', $event)" />

View file

@ -1,12 +1,12 @@
<script setup>
import { computed } from 'vue';
import { Link } from '@inertiajs/vue3';
import { Mail, MapPin, Network, Phone, UserRound, Users } from '@lucide/vue';
import { ChevronUp, Mail, MapPin, Network, Phone, Smartphone, UserRound, Users } from '@lucide/vue';
import { Button } from '@/components/ui/button';
import PersonAvatar from '@/components/PersonAvatar.vue';
/**
* Fokus-Ansicht: eine Person groß, darüber die Kette der Vorgesetzten, daneben
* Fokus-Ansicht: eine Person mit Kontakt, rechts die Kette der Vorgesetzten und
* das eigene Team, darunter die direkt unterstellten Personen.
*/
const props = defineProps({
@ -29,93 +29,111 @@ const chain = computed(() => props.path.slice(0, -1).map((id) => known.value.get
const manager = computed(() => chain.value.at(-1) ?? null);
const peers = computed(() => (manager.value ? (props.teams[manager.value.id] ?? []).filter((p) => p.id !== props.details.id) : []));
const reports = computed(() => props.teams[props.details.id] ?? []);
const meta = computed(() => [props.details.department, props.details.location].filter(Boolean));
const contact = computed(() => [
{ icon: Mail, value: props.details.email, href: `mailto:${props.details.email}` },
{ icon: Phone, value: props.details.phone, href: props.details.phone && `tel:${props.details.phone}` },
{ icon: Smartphone, value: props.details.mobile, href: props.details.mobile && `tel:${props.details.mobile}` },
{ icon: MapPin, value: [props.details.department, props.details.location].filter(Boolean).join(' · ') },
].filter((c) => c.value));
</script>
<template>
<div class="mx-auto grid max-w-5xl gap-6">
<!-- Vorgesetzte -->
<ol v-if="chain.length" class="flex flex-col items-center" aria-label="Vorgesetzte">
<li v-for="person in chain" :key="person.id" class="flex flex-col items-center">
<button
type="button"
class="flex w-72 items-center gap-3 rounded-lg border bg-card px-3 py-2 text-left shadow-xs hover:border-brand-300 hover:shadow-sm"
@click="$emit('focus', person)"
>
<PersonAvatar :person="person" class="size-8 text-[11px]" />
<span class="min-w-0">
<span class="block truncate text-sm font-medium">{{ person.name }}</span>
<span class="block truncate text-xs text-muted-foreground">{{ person.job_title || person.department || '–' }}</span>
</span>
</button>
<span class="h-5 w-px bg-border" aria-hidden="true" />
</li>
</ol>
<!-- Person im Fokus -->
<section class="overflow-hidden rounded-lg border bg-card shadow-sm" :class="{ '-mt-6': chain.length }">
<div class="h-20 bg-brand" style="background-image: linear-gradient(120deg, transparent 40%, rgb(255 255 255 / 0.08))" />
<div class="flex flex-col gap-4 px-6 pb-6 md:flex-row md:items-end md:justify-between">
<div class="flex flex-col gap-4 sm:flex-row sm:items-end">
<PersonAvatar :person="details" class="-mt-12 size-24 text-2xl ring-4 ring-card" />
<div class="min-w-0 sm:pb-1">
<h2 class="text-xl font-semibold tracking-tight">{{ details.name }}</h2>
<p v-if="details.job_title" class="text-[15px] text-muted-foreground">{{ details.job_title }}</p>
<p v-if="meta.length" class="mt-1 flex items-center gap-1.5 text-[13px] text-muted-foreground">
<MapPin class="size-3.5" /> {{ meta.join(' · ') }}
</p>
<div class="grid items-start gap-4" :class="{ 'lg:grid-cols-[minmax(0,1fr)_19rem]': chain.length || peers.length }">
<div class="grid gap-4">
<!-- Person im Fokus -->
<section class="overflow-hidden rounded-lg border bg-card">
<div class="flex flex-col gap-4 p-4 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>
<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]">
<li v-for="item in contact" :key="item.value" class="flex min-w-0 items-center gap-1.5">
<component :is="item.icon" class="size-3.5 shrink-0 text-muted-foreground" />
<a v-if="item.href" :href="item.href" class="truncate text-brand-text hover:underline">{{ item.value }}</a>
<span v-else class="truncate text-muted-foreground">{{ item.value }}</span>
</li>
</ul>
</div>
<div class="flex shrink-0 flex-wrap gap-2 sm:flex-col">
<Button size="sm" as-child><Link :href="`/personen/${details.id}`"><UserRound /> Profil</Link></Button>
<Button variant="outline" size="sm" @click="$emit('show-in-tree', details)"><Network /> Im Baum</Button>
</div>
</div>
<div class="flex flex-wrap gap-2 md:pb-1">
<Button variant="outline" size="sm" as-child><a :href="`mailto:${details.email}`"><Mail /> E-Mail</a></Button>
<Button v-if="details.phone || details.mobile" variant="outline" size="sm" as-child><a :href="`tel:${details.phone || details.mobile}`"><Phone /> Anrufen</a></Button>
<Button variant="outline" size="sm" @click="$emit('show-in-tree', details)"><Network /> Im Baum</Button>
<Button size="sm" as-child><Link :href="`/personen/${details.id}`"><UserRound /> Profil</Link></Button>
</div>
</div>
</section>
<div v-if="manager" class="flex flex-wrap items-center gap-x-3 gap-y-2 border-t bg-muted/30 px-6 py-3 text-[13px]">
<span class="text-muted-foreground">Im Team von <button type="button" class="font-medium text-foreground hover:underline" @click="$emit('focus', manager)">{{ manager.name }}</button><template v-if="peers.length"> mit</template></span>
<div v-if="peers.length" class="flex flex-wrap gap-1.5">
<button
v-for="peer in peers.slice(0, 12)"
:key="peer.id"
type="button"
class="rounded-full ring-2 ring-transparent hover:ring-brand-300"
:title="`${peer.name}${peer.job_title ? ' – ' + peer.job_title : ''}`"
@click="$emit('focus', peer)"
>
<PersonAvatar :person="peer" class="size-7 text-[10px]" />
</button>
<span v-if="peers.length > 12" class="grid h-7 place-items-center rounded-full bg-muted px-2 text-xs text-muted-foreground">+{{ peers.length - 12 }}</span>
</div>
</div>
</section>
<!-- Direkt unterstellt -->
<section v-if="reports.length">
<h3 class="mb-3 flex items-center gap-2 text-base font-semibold">
<Users class="size-4 text-brand-text" /> Direkt unterstellt <span class="font-normal text-muted-foreground">({{ reports.length }})</span>
</h3>
<ul class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
<li v-for="person in reports" :key="person.id">
<button
type="button"
class="flex w-full items-center gap-3 rounded-lg border bg-card p-3 text-left shadow-xs hover:border-brand-300 hover:shadow-sm"
@click="$emit('focus', person)"
>
<PersonAvatar :person="person" class="size-11" />
<span class="min-w-0 flex-1">
<span class="block truncate text-sm font-semibold">{{ person.name }}</span>
<span class="block truncate text-xs text-muted-foreground">{{ person.job_title || '–' }}</span>
<span v-if="person.reports" class="mt-1 inline-flex items-center gap-1 text-xs font-medium text-brand-text">
<Users class="size-3.5" /> {{ person.reports }} im Team
<!-- Direkt unterstellt -->
<section class="rounded-lg border bg-card">
<h3 class="flex items-center gap-2 border-b px-4 py-2.5 text-sm font-semibold">
<Users class="size-4 text-brand-text" /> Direkt unterstellt <span class="font-normal text-muted-foreground">{{ reports.length }}</span>
</h3>
<div v-if="reports.length" class="overflow-hidden rounded-b-lg">
<ul class="-mr-px -mb-px grid sm:grid-cols-2 xl:grid-cols-3">
<li v-for="person in reports" :key="person.id" class="border-r border-b">
<button type="button" class="flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-accent/60" @click="$emit('focus', person)">
<PersonAvatar :person="person" class="size-9" />
<span class="min-w-0 flex-1">
<span class="block truncate text-sm font-medium">{{ person.name }}</span>
<span class="block truncate text-xs text-muted-foreground">{{ person.job_title || '–' }}</span>
</span>
</span>
</button>
</li>
</ul>
</section>
<p v-else class="text-center text-sm text-muted-foreground">{{ details.name }} hat keine direkt unterstellten Personen.</p>
<span v-if="person.reports" class="inline-flex shrink-0 items-center gap-1 rounded-full bg-brand-soft px-2 py-0.5 text-[11px] font-medium text-brand-soft-foreground" :title="`${person.reports} im Team`">
<Users class="size-3" /> {{ person.reports }}
</span>
</button>
<div v-if="teams[person.id]?.length" class="flex items-center gap-1 px-4 pb-2.5 pl-16">
<button
v-for="member in teams[person.id].slice(0, 7)"
:key="member.id"
type="button"
class="-ml-1 rounded-full ring-2 ring-card first:ml-0 hover:ring-brand-300"
:title="`${member.name}${member.job_title ? ' – ' + member.job_title : ''}`"
@click="$emit('focus', member)"
>
<PersonAvatar :person="member" class="size-6 text-[9px]" />
</button>
<span v-if="teams[person.id].length > 7" class="ml-1 text-xs text-muted-foreground">+{{ teams[person.id].length - 7 }}</span>
</div>
</li>
</ul>
</div>
<p v-else class="px-4 py-3 text-[13px] text-muted-foreground">Keine direkt unterstellten Personen.</p>
</section>
</div>
<aside v-if="chain.length || peers.length" class="grid gap-4">
<section v-if="chain.length" class="rounded-lg border bg-card">
<h3 class="flex items-center gap-2 border-b px-4 py-2.5 text-sm font-semibold"><ChevronUp class="size-4 text-brand-text" /> Berichtet an</h3>
<ol class="p-2">
<li v-for="(person, index) in [...chain].reverse()" :key="person.id" class="relative">
<span v-if="index < chain.length - 1" class="absolute top-9 bottom-0 left-[1.45rem] w-px bg-border" aria-hidden="true" />
<button type="button" class="relative flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-accent" @click="$emit('focus', person)">
<PersonAvatar :person="person" class="size-8 text-[11px]" />
<span class="min-w-0">
<span class="block truncate text-sm font-medium">{{ person.name }}</span>
<span class="block truncate text-xs text-muted-foreground">{{ person.job_title || person.department || '–' }}</span>
</span>
</button>
</li>
</ol>
</section>
<section v-if="peers.length" class="rounded-lg border bg-card">
<h3 class="flex items-center gap-2 border-b px-4 py-2.5 text-sm font-semibold">
<Users class="size-4 text-brand-text" /> Im selben Team <span class="font-normal text-muted-foreground">{{ peers.length }}</span>
</h3>
<ul class="max-h-80 overflow-y-auto p-2">
<li v-for="peer in peers" :key="peer.id">
<button type="button" class="flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-accent" @click="$emit('focus', peer)">
<PersonAvatar :person="peer" class="size-7 text-[10px]" />
<span class="min-w-0">
<span class="block truncate text-[13px] font-medium">{{ peer.name }}</span>
<span class="block truncate text-xs text-muted-foreground">{{ peer.job_title || '–' }}</span>
</span>
</button>
</li>
</ul>
</section>
</aside>
</div>
</template>