Loheide-eu-mitarbeiterplatt.../resources/js/components/org/OrgChartNode.vue
Friederich Loheide ab0384ceb1
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 und Dokumente neu gestaltet
- 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>
2026-09-26 13:06:23 +00:00

61 lines
2.2 KiB
Vue

<script setup>
import { computed, ref, watch } from 'vue';
import { http } from '@/lib/http';
import OrgCard from './OrgCard.vue';
/**
* Ein Knoten im Baum. Teams laden beim Aufklappen nach; Mitarbeitende ohne
* eigenes Team stehen platzsparend untereinander statt nebeneinander.
*/
const props = defineProps({
person: { type: Object, required: true },
teams: { type: Object, default: () => ({}) },
path: { type: Array, default: () => [] },
focus: { type: Number, default: null },
});
defineEmits(['focus']);
const isOnPath = () => props.path.includes(props.person.id) && props.person.id !== props.focus;
const team = ref(props.teams[props.person.id] ?? null);
const open = ref(isOnPath() && team.value !== null);
const loading = ref(false);
watch(() => props.teams, (teams) => {
team.value = teams[props.person.id] ?? team.value;
open.value = isOnPath() && team.value !== null;
});
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;
if (open.value && team.value === null) {
loading.value = true;
try {
team.value = (await http.get(`/personen/organigramm/${props.person.id}/team`)).team;
} catch {
open.value = false;
} finally {
loading.value = false;
}
}
}
</script>
<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)" />
<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)" />
</div>
</li>
</ul>
</li>
</template>