Titelbild im Profil, durchsuchbare Baum-Auswahl im IT-Ticket (0.20.1)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m6s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m23s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m40s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m47s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m6s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m23s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m40s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m8s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2f03597b89
commit
05b4b79cb3
146 changed files with 1051 additions and 495 deletions
26
resources/js/components/CoverBanner.vue
Normal file
26
resources/js/components/CoverBanner.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
|
||||
/**
|
||||
* Titelbild (Profil, Begrüßung): eigenes Bild der Person oder das Standardbild aus
|
||||
* dem Erscheinungsbild – immer unter einer leicht durchsichtigen Fläche in der Markenfarbe.
|
||||
*/
|
||||
const props = defineProps({
|
||||
image: { type: String, default: null },
|
||||
});
|
||||
|
||||
const cover = computed(() => usePage().props.branding?.profile_cover ?? {});
|
||||
const src = computed(() => props.image || cover.value.image_url || null);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative isolate overflow-hidden bg-brand">
|
||||
<template v-if="src">
|
||||
<img :src="src" alt="" class="absolute inset-0 -z-10 size-full object-cover" loading="lazy" />
|
||||
<div class="absolute inset-0 -z-10 bg-brand" :style="{ opacity: cover.overlay ?? 0.7 }" />
|
||||
</template>
|
||||
<div v-else class="absolute inset-0 -z-10" style="background-image: linear-gradient(120deg, transparent 40%, rgb(255 255 255 / 0.08))" />
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -3,6 +3,7 @@ import { computed } from 'vue';
|
|||
import { Link } from '@inertiajs/vue3';
|
||||
import { LogOut, Settings, UserRound, UserRoundPen } from '@lucide/vue';
|
||||
import AppIcon from '@/components/AppIcon.vue';
|
||||
import CoverBanner from '@/components/CoverBanner.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -18,7 +19,7 @@ const columns = computed(() => ({ 3: 'grid-cols-3', 4: 'grid-cols-4', 5: 'grid-c
|
|||
|
||||
<template>
|
||||
<section class="overflow-hidden rounded-lg border bg-card">
|
||||
<div class="flex items-center justify-between gap-4 bg-brand px-6 py-6 text-brand-foreground">
|
||||
<CoverBanner :image="user.cover_url" class="flex items-center justify-between gap-4 px-6 py-6 text-brand-foreground">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm opacity-85">{{ greeting }},</div>
|
||||
<div class="mt-0.5 text-[22px] leading-tight font-semibold tracking-tight break-words">{{ user.name }}</div>
|
||||
|
|
@ -27,7 +28,7 @@ const columns = computed(() => ({ 3: 'grid-cols-3', 4: 'grid-cols-4', 5: 'grid-c
|
|||
</div>
|
||||
</div>
|
||||
<PersonAvatar :person="user" class="size-16 shrink-0 text-lg ring-4 ring-white/25 xl:size-20 xl:text-xl" />
|
||||
</div>
|
||||
</CoverBanner>
|
||||
<nav class="grid divide-x" :class="columns" aria-label="Mein Bereich">
|
||||
<Link :href="`/personen/${user.id}`" class="flex flex-col items-center gap-2 px-2 py-4 text-center text-xs font-medium text-foreground/80 hover:bg-accent hover:text-foreground">
|
||||
<UserRound class="size-5 text-brand-text" :stroke-width="1.75" />
|
||||
|
|
|
|||
220
resources/js/components/TreeSelect.vue
Normal file
220
resources/js/components/TreeSelect.vue
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
<script setup>
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { Check, ChevronsUpDown, Search, X } from '@lucide/vue';
|
||||
import { PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui';
|
||||
|
||||
/**
|
||||
* Durchsuchbare Auswahl für Bäume (z. B. Kategorien, Standorte).
|
||||
* options in Baum-Reihenfolge: [{ value, name, depth, path }] – depth 0 = oberste Ebene.
|
||||
* Beim Suchen bleiben die übergeordneten Einträge der Treffer als Orientierung sichtbar.
|
||||
*/
|
||||
const props = defineProps({
|
||||
options: { type: Array, required: true },
|
||||
placeholder: { type: String, default: '– bitte wählen –' },
|
||||
searchPlaceholder: { type: String, default: 'Suchen …' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
clearable: { type: Boolean, default: false },
|
||||
id: { type: String, default: null },
|
||||
});
|
||||
|
||||
const model = defineModel({ type: [String, Number, null], default: null });
|
||||
|
||||
const open = ref(false);
|
||||
const query = ref('');
|
||||
const active = ref(0);
|
||||
const list = ref(null);
|
||||
const input = ref(null);
|
||||
const trigger = ref(null);
|
||||
|
||||
// Klick auf das Feld selbst schließt über @click – nicht zusätzlich als „Klick außerhalb“
|
||||
function ignoreTrigger(event) {
|
||||
const target = event.detail?.originalEvent?.target ?? event.target;
|
||||
|
||||
if (trigger.value?.contains(target)) event.preventDefault();
|
||||
}
|
||||
|
||||
const normalize = (text) => String(text ?? '').toLocaleLowerCase('de-DE').normalize('NFD').replace(/[̀-ͯ]/g, '');
|
||||
|
||||
// Eltern je Eintrag (Baum-Reihenfolge: nächster Vorgänger eine Ebene höher)
|
||||
const items = computed(() => {
|
||||
const stack = [];
|
||||
|
||||
return props.options.map((option, index) => {
|
||||
const depth = option.depth ?? 0;
|
||||
stack.length = depth;
|
||||
const parent = depth > 0 ? stack[depth - 1] ?? null : null;
|
||||
stack[depth] = index;
|
||||
const next = props.options[index + 1];
|
||||
|
||||
return { ...option, name: option.name ?? String(option.label ?? '').replace(/^[\s └]+/, ''), depth, index, parent, hasChildren: (next?.depth ?? 0) > depth };
|
||||
});
|
||||
});
|
||||
|
||||
const selected = computed(() => items.value.find((item) => String(item.value) === String(model.value)) ?? null);
|
||||
|
||||
const visible = computed(() => {
|
||||
const term = normalize(query.value.trim());
|
||||
|
||||
if (!term) return items.value.map((item) => ({ ...item, match: true }));
|
||||
|
||||
const keep = new Set();
|
||||
const matches = new Set();
|
||||
|
||||
for (const item of items.value) {
|
||||
if (!normalize(item.name).includes(term) && !normalize(item.path).includes(term)) continue;
|
||||
|
||||
matches.add(item.index);
|
||||
for (let parent = item.parent; parent !== null && !keep.has(parent); parent = items.value[parent].parent) keep.add(parent);
|
||||
keep.add(item.index);
|
||||
}
|
||||
|
||||
return items.value.filter((item) => keep.has(item.index)).map((item) => ({ ...item, match: matches.has(item.index) }));
|
||||
});
|
||||
|
||||
// Treffer hervorheben
|
||||
function parts(name) {
|
||||
const term = normalize(query.value.trim());
|
||||
const at = term ? normalize(name).indexOf(term) : -1;
|
||||
|
||||
if (at < 0) return [{ text: name }];
|
||||
|
||||
return [{ text: name.slice(0, at) }, { text: name.slice(at, at + term.length), mark: true }, { text: name.slice(at + term.length) }];
|
||||
}
|
||||
|
||||
watch(open, (value) => {
|
||||
if (!value) return;
|
||||
|
||||
query.value = '';
|
||||
nextTick(() => {
|
||||
const current = visible.value.findIndex((item) => String(item.value) === String(model.value));
|
||||
active.value = Math.max(0, current);
|
||||
scrollToActive('center');
|
||||
input.value?.focus();
|
||||
});
|
||||
});
|
||||
|
||||
watch(query, () => {
|
||||
const first = visible.value.findIndex((item) => item.match);
|
||||
active.value = Math.max(0, first);
|
||||
nextTick(() => scrollToActive());
|
||||
});
|
||||
|
||||
function scrollToActive(block = 'nearest') {
|
||||
list.value?.querySelector(`[data-index="${active.value}"]`)?.scrollIntoView({ block });
|
||||
}
|
||||
|
||||
function move(step) {
|
||||
const count = visible.value.length;
|
||||
|
||||
if (!count) return;
|
||||
|
||||
active.value = (active.value + step + count) % count;
|
||||
nextTick(() => scrollToActive());
|
||||
}
|
||||
|
||||
function choose(item) {
|
||||
if (!item) return;
|
||||
|
||||
model.value = item.value;
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
function clear() {
|
||||
model.value = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PopoverRoot v-model:open="open">
|
||||
<PopoverAnchor as-child>
|
||||
<div class="relative">
|
||||
<!-- Eigener Knopf statt PopoverTrigger: der würde die id überschreiben (Label-Bezug) -->
|
||||
<button
|
||||
:id="id"
|
||||
ref="trigger"
|
||||
type="button"
|
||||
:disabled="disabled"
|
||||
role="combobox"
|
||||
aria-haspopup="listbox"
|
||||
:aria-expanded="open"
|
||||
@click="open = !open"
|
||||
@keydown.down.prevent="open = true"
|
||||
class="flex h-9 w-full items-center gap-2 rounded-md border border-input bg-card pr-8 pl-3 text-left text-sm shadow-xs focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none disabled:opacity-60 aria-invalid:border-destructive"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<span v-if="selected" class="min-w-0 flex-1 truncate">
|
||||
<span v-if="selected.path && selected.path !== selected.name" class="text-muted-foreground">{{ selected.path.slice(0, selected.path.length - selected.name.length) }}</span>{{ selected.name }}
|
||||
</span>
|
||||
<span v-else class="min-w-0 flex-1 truncate text-muted-foreground">{{ placeholder }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="clearable && selected && !disabled"
|
||||
type="button"
|
||||
class="absolute top-1/2 right-7 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground"
|
||||
aria-label="Auswahl entfernen"
|
||||
@click="clear"
|
||||
>
|
||||
<X class="size-3.5" />
|
||||
</button>
|
||||
<ChevronsUpDown class="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground" />
|
||||
</div>
|
||||
</PopoverAnchor>
|
||||
|
||||
<PopoverPortal>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
:side-offset="4"
|
||||
class="z-50 w-(--reka-popover-trigger-width) min-w-64 max-w-[calc(100vw-2rem)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md outline-hidden"
|
||||
@open-auto-focus.prevent
|
||||
@interact-outside="ignoreTrigger"
|
||||
>
|
||||
<div class="flex items-center gap-2 border-b px-3">
|
||||
<Search class="size-4 shrink-0 text-muted-foreground" />
|
||||
<input
|
||||
ref="input"
|
||||
v-model="query"
|
||||
type="search"
|
||||
:placeholder="searchPlaceholder"
|
||||
class="h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground [&::-webkit-search-cancel-button]:hidden"
|
||||
aria-label="Einträge durchsuchen"
|
||||
autocomplete="off"
|
||||
@keydown.down.prevent="move(1)"
|
||||
@keydown.up.prevent="move(-1)"
|
||||
@keydown.enter.prevent="choose(visible[active])"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ul ref="list" role="listbox" class="max-h-72 overflow-y-auto overscroll-contain p-1">
|
||||
<li
|
||||
v-for="(item, position) in visible"
|
||||
:key="item.value"
|
||||
role="option"
|
||||
:aria-selected="String(item.value) === String(model)"
|
||||
:data-index="position"
|
||||
class="relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 text-sm select-none"
|
||||
:class="[position === active ? 'bg-accent text-accent-foreground' : '', item.match ? '' : 'text-muted-foreground']"
|
||||
:style="{ paddingLeft: `${0.5 + item.depth * 1.25}rem` }"
|
||||
@mousemove="active = position"
|
||||
@click="choose(item)"
|
||||
>
|
||||
<!-- Baumlinien -->
|
||||
<span
|
||||
v-for="level in item.depth"
|
||||
:key="level"
|
||||
aria-hidden="true"
|
||||
class="absolute inset-y-0 border-l border-border"
|
||||
:style="{ left: `${0.5 + (level - 1) * 1.25 + 0.3}rem` }"
|
||||
/>
|
||||
<span v-if="item.depth" aria-hidden="true" class="absolute top-1/2 w-2 border-t border-border" :style="{ left: `${0.5 + (item.depth - 1) * 1.25 + 0.3}rem` }" />
|
||||
|
||||
<span class="min-w-0 flex-1 break-words" :class="item.hasChildren ? 'font-medium' : ''">
|
||||
<template v-for="(part, i) in parts(item.name)" :key="i"><mark v-if="part.mark" class="rounded-[2px] bg-brand/15 text-inherit">{{ part.text }}</mark><template v-else>{{ part.text }}</template></template>
|
||||
</span>
|
||||
<Check v-if="String(item.value) === String(model)" class="size-4 shrink-0 text-brand-text" />
|
||||
</li>
|
||||
<li v-if="!visible.length" class="px-3 py-6 text-center text-sm text-muted-foreground">Keine Treffer für „{{ query }}“</li>
|
||||
</ul>
|
||||
</PopoverContent>
|
||||
</PopoverPortal>
|
||||
</PopoverRoot>
|
||||
</template>
|
||||
|
|
@ -2,13 +2,14 @@
|
|||
import { pluginComponent } from '@/lib/pluginComponents';
|
||||
import { defineAsyncComponent, ref } from 'vue';
|
||||
import { router, useForm } from '@inertiajs/vue3';
|
||||
import { Camera, LoaderCircle, Trash2 } from '@lucide/vue';
|
||||
import { Camera, Image as ImageIcon, LoaderCircle, Trash2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import CoverBanner from '@/components/CoverBanner.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
|
|
@ -103,6 +104,33 @@ function removeAvatar() {
|
|||
});
|
||||
}
|
||||
|
||||
// Titelbild
|
||||
const coverInput = ref(null);
|
||||
const coverForm = useForm({ cover: null });
|
||||
|
||||
function uploadCover(event) {
|
||||
const file = event.target.files?.[0];
|
||||
|
||||
if (!file) return;
|
||||
|
||||
coverForm.cover = file;
|
||||
coverForm.post('/profil/titelbild', {
|
||||
preserveScroll: true,
|
||||
forceFormData: true,
|
||||
onSuccess: () => toast.success('Titelbild aktualisiert'),
|
||||
onFinish: () => {
|
||||
event.target.value = '';
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function removeCover() {
|
||||
router.delete('/profil/titelbild', {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => toast.success('Titelbild entfernt – es gilt wieder das Standardbild'),
|
||||
});
|
||||
}
|
||||
|
||||
// Passwort
|
||||
const passwordForm = useForm({
|
||||
current_password: '',
|
||||
|
|
@ -146,6 +174,23 @@ function savePassword() {
|
|||
<p class="mt-3 text-[13px] text-muted-foreground">JPG, PNG oder WebP, höchstens 8 MB. Das Bild wird quadratisch zugeschnitten.</p>
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Titelbild" class="mt-6">
|
||||
<CoverBanner :image="profile.cover_url" class="h-24 rounded-md" />
|
||||
<input ref="coverInput" type="file" accept="image/jpeg,image/png,image/webp" class="hidden" @change="uploadCover" />
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<Button variant="outline" :disabled="coverForm.processing" @click="coverInput?.click()">
|
||||
<LoaderCircle v-if="coverForm.processing" class="animate-spin" />
|
||||
<ImageIcon v-else />
|
||||
{{ profile.cover_url ? 'Bild ändern' : 'Bild hochladen' }}
|
||||
</Button>
|
||||
<Button v-if="profile.cover_url" variant="ghost" class="text-destructive hover:text-destructive" @click="removeCover">
|
||||
<Trash2 /> Entfernen
|
||||
</Button>
|
||||
</div>
|
||||
<p v-if="coverForm.errors.cover" class="mt-3 text-[13px] text-destructive">{{ coverForm.errors.cover }}</p>
|
||||
<p class="mt-3 text-[13px] text-muted-foreground">Erscheint oben in Ihrem Profil und in der Begrüßung auf der Startseite – mit einer Fläche in der Hausfarbe darüber. Querformat, höchstens 8 MB.</p>
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<div class="grid content-start gap-6 lg:col-span-8">
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { Link } from '@inertiajs/vue3';
|
|||
import { Building2, Mail, MapPin, Phone, Smartphone, UserRoundPen } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import CoverBanner from '@/components/CoverBanner.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ function fieldHref(field) {
|
|||
<template>
|
||||
<AppLayout :title="person.name">
|
||||
<section class="overflow-hidden rounded-lg border bg-card">
|
||||
<div class="h-28 bg-brand sm:h-32" style="background-image: linear-gradient(120deg, transparent 40%, rgb(255 255 255 / 0.08))" />
|
||||
<CoverBanner :image="person.cover_url" class="h-28 sm:h-40" />
|
||||
<div class="flex flex-col gap-4 px-6 pb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-end">
|
||||
<PersonAvatar :person="person" class="-mt-14 size-28 text-2xl ring-4 ring-card" />
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export { default as PersonAvatar } from '@/components/PersonAvatar.vue';
|
|||
export { default as AppIcon } from '@/components/AppIcon.vue';
|
||||
export { default as FileIcon } from '@/components/FileIcon.vue';
|
||||
export { default as RichTextEditor } from '@/components/RichTextEditor.vue';
|
||||
export { default as TreeSelect } from '@/components/TreeSelect.vue';
|
||||
|
||||
// UI-Kit (shadcn-vue)
|
||||
export { Button } from '@/components/ui/button';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue