Phase 6 (Teil 1): Dokumente und Organigramm
- Dokumente-Plugin: Ordnerbaum mit vererbten Rechten und Sichtbarkeit, Hochladen per Ziehen und Ablegen, Versionen, Suche, Pagebuilder-Block - Organigramm aus den Vorgesetzten, Vorgesetzte im Admin pflegbar - Personensuche im Kopf übernimmt nur noch Suchbegriffe des Verzeichnisses Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
21c706e5f5
commit
d6d5d4b0fe
110 changed files with 2209 additions and 208 deletions
76
resources/js/components/org/OrgNode.vue
Normal file
76
resources/js/components/org/OrgNode.vue
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ChevronDown, ChevronRight, LoaderCircle, Users } from '@lucide/vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import { http } from '@/lib/http';
|
||||
|
||||
/**
|
||||
* Eine Person im Organigramm; ihr Team lädt beim Aufklappen nach.
|
||||
*/
|
||||
const props = defineProps({
|
||||
person: { type: Object, required: true },
|
||||
teams: { type: Object, default: () => ({}) },
|
||||
path: { type: Array, default: () => [] },
|
||||
focus: { type: Number, default: null },
|
||||
});
|
||||
|
||||
const team = ref(props.teams[props.person.id] ?? null);
|
||||
const open = ref(props.path.includes(props.person.id) && props.person.id !== props.focus);
|
||||
const loading = ref(false);
|
||||
|
||||
watch(() => props.teams, (teams) => {
|
||||
team.value = teams[props.person.id] ?? team.value;
|
||||
open.value = props.path.includes(props.person.id) && props.person.id !== props.focus;
|
||||
});
|
||||
|
||||
async function toggle() {
|
||||
if (!props.person.reports) return;
|
||||
|
||||
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;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li class="relative">
|
||||
<div
|
||||
class="flex items-center gap-3 rounded-lg border bg-card px-3 py-2.5"
|
||||
:class="person.id === focus ? 'border-brand-400 ring-2 ring-brand-300/50' : ''"
|
||||
:id="`person-${person.id}`"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-accent disabled:opacity-0"
|
||||
:disabled="!person.reports"
|
||||
:aria-expanded="open"
|
||||
:aria-label="open ? `Team von ${person.name} zuklappen` : `Team von ${person.name} aufklappen`"
|
||||
@click="toggle"
|
||||
>
|
||||
<LoaderCircle v-if="loading" class="size-4 animate-spin" />
|
||||
<ChevronDown v-else-if="open" class="size-4" />
|
||||
<ChevronRight v-else class="size-4" />
|
||||
</button>
|
||||
<PersonAvatar :person="person" class="size-10" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<Link :href="`/personen/${person.id}`" class="block truncate text-sm font-semibold hover:underline">{{ person.name }}</Link>
|
||||
<p class="truncate text-[13px] text-muted-foreground">{{ [person.job_title, person.department].filter(Boolean).join(' · ') }}</p>
|
||||
</div>
|
||||
<span v-if="person.reports" class="inline-flex shrink-0 items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground" :title="`${person.reports} direkt unterstellt`">
|
||||
<Users class="size-3.5" /> {{ person.reports }}
|
||||
</span>
|
||||
</div>
|
||||
<ul v-if="open && team?.length" class="mt-2 ml-6 grid gap-2 border-l pl-4 sm:ml-8 sm:pl-6">
|
||||
<OrgNode v-for="member in team" :key="member.id" :person="member" :teams="teams" :path="path" :focus="focus" />
|
||||
</ul>
|
||||
</li>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue