Loheide-eu-mitarbeiterplatt.../resources/js/components/org/OrgFocus.vue
Friederich Loheide dda250aaad
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
Menü-Editor, farbige Initialen, Seitenköpfe, Favoriten, Vorschaubilder
- 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>
2026-09-26 13:56:57 +00:00

141 lines
8.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup>
import { computed } from 'vue';
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
* 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 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="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="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 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]">
<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>
</section>
<!-- 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 hover:bg-accent/60">
<button type="button" class="flex w-full items-center gap-3 px-4 py-3 text-left" @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 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-5">
<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>