All checks were successful
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m30s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m34s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m45s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m35s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m42s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m7s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m15s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
- Organigramm: grafischer Baum (Linien, Zoom, Verschieben) und Fokus-Ansicht mit Vorgesetzten, Team und direkt Unterstellten - Dokumente: Übersicht mit Bereichen und „Zuletzt aktualisiert“, sortierbare Dateiliste oder Kacheln (Wahl wird gemerkt) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
121 lines
6.9 KiB
Vue
121 lines
6.9 KiB
Vue
<script setup>
|
||
import { computed } from 'vue';
|
||
import { Link } from '@inertiajs/vue3';
|
||
import { Mail, MapPin, Network, Phone, 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
|
||
* das eigene Team, darunter die direkt unterstellten Personen.
|
||
*/
|
||
const props = defineProps({
|
||
roots: { type: Array, required: true },
|
||
teams: { type: Object, default: () => ({}) },
|
||
path: { type: Array, default: () => [] },
|
||
details: { type: Object, required: true },
|
||
});
|
||
|
||
defineEmits(['focus', 'show-in-tree']);
|
||
|
||
const known = computed(() => {
|
||
const map = new Map();
|
||
[...props.roots, ...Object.values(props.teams).flat()].forEach((p) => map.set(p.id, p));
|
||
|
||
return map;
|
||
});
|
||
|
||
const chain = computed(() => props.path.slice(0, -1).map((id) => known.value.get(id)).filter(Boolean));
|
||
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));
|
||
</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>
|
||
</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>
|
||
|
||
<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
|
||
</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>
|
||
</div>
|
||
</template>
|