QM-Texterkennung: Imagick nur mit Ghostscript als verfügbar melden
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 3m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 3m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 3m0s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 2m56s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 4m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 4m1s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 3m41s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 3m39s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m10s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 3m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 3m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 3m0s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 2m56s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 4m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 4m1s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 3m41s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 3m39s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m10s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5a360d3cc7
commit
b50d089946
117 changed files with 1747 additions and 2 deletions
139
plugins-core/gemeinsam/resources/js/components/EntryDialog.vue
Normal file
139
plugins-core/gemeinsam/resources/js/components/EntryDialog.vue
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { LoaderCircle, X } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import { http } from '@/lib/http';
|
||||
|
||||
const props = defineProps({
|
||||
open: { type: Boolean, default: false },
|
||||
section: { type: Object, default: null }, // { key, title }
|
||||
entry: { type: Object, default: null },
|
||||
month: { type: String, required: true },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:open']);
|
||||
|
||||
// Feldbeschriftungen je Abschnitt
|
||||
const config = {
|
||||
welcome: { date: 'Eintritt am', fields: ['department', 'location', 'text'] },
|
||||
transfer: { date: 'Wechsel ab', fields: ['from', 'to', 'text'] },
|
||||
jubilee: { date: 'Jubiläum am', fields: ['label', 'department', 'text'], label: 'Jubiläum', labelPlaceholder: 'z. B. 25 Jahre' },
|
||||
farewell: { date: 'Letzter Arbeitstag', fields: ['department', 'label', 'text'], label: 'Anlass (optional)', labelPlaceholder: 'z. B. Ruhestand' },
|
||||
memoriam: { date: 'Verstorben am', fields: ['born_on', 'department', 'text'] },
|
||||
};
|
||||
|
||||
const current = computed(() => config[props.section?.key] ?? config.welcome);
|
||||
const has = (field) => current.value.fields.includes(field);
|
||||
|
||||
const form = useForm({ section: '', user_id: null, name: '', date: '', born_on: '', department: '', location: '', from: '', to: '', label: '', text: '' });
|
||||
const person = ref(null);
|
||||
const freeName = ref(false);
|
||||
const query = ref('');
|
||||
const results = ref([]);
|
||||
|
||||
watch(() => props.open, (open) => {
|
||||
if (!open) return;
|
||||
const e = props.entry;
|
||||
form.clearErrors();
|
||||
form.defaults({
|
||||
section: props.section.key,
|
||||
user_id: e?.user_id ?? null,
|
||||
name: e?.free_name ?? '',
|
||||
date: e?.date ?? `${props.month}-01`,
|
||||
born_on: e?.born_on ?? '',
|
||||
department: e?.raw?.department ?? '',
|
||||
location: e?.raw?.location ?? '',
|
||||
from: e?.from ?? '',
|
||||
to: e?.to ?? '',
|
||||
label: e?.label ?? '',
|
||||
text: e?.text ?? '',
|
||||
});
|
||||
form.reset();
|
||||
person.value = e?.person ?? null;
|
||||
freeName.value = !!e && !e.user_id;
|
||||
query.value = '';
|
||||
results.value = [];
|
||||
});
|
||||
|
||||
let timer;
|
||||
watch(query, (value) => {
|
||||
clearTimeout(timer);
|
||||
if (value.trim().length < 2) return (results.value = []);
|
||||
timer = setTimeout(async () => (results.value = (await http.get(`/personen/suche?q=${encodeURIComponent(value.trim())}`)).people), 250);
|
||||
});
|
||||
|
||||
function choose(p) {
|
||||
person.value = p;
|
||||
form.user_id = p.id;
|
||||
query.value = '';
|
||||
results.value = [];
|
||||
}
|
||||
|
||||
function clearPerson() {
|
||||
person.value = null;
|
||||
form.user_id = null;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if (freeName.value) form.user_id = null;
|
||||
const options = { preserveScroll: true, onSuccess: () => emit('update:open', false) };
|
||||
props.entry ? form.put(`/gemeinsam/eintraege/${props.entry.id}`, options) : form.post('/gemeinsam/eintraege', options);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog :open="open" @update:open="(v) => emit('update:open', v)">
|
||||
<DialogContent class="sm:max-w-lg">
|
||||
<DialogHeader><DialogTitle>{{ section?.title }}</DialogTitle></DialogHeader>
|
||||
<form class="grid gap-4" @submit.prevent="submit">
|
||||
<FormField id="g-person" label="Person" :error="form.errors.name || form.errors.user_id">
|
||||
<div v-if="!freeName">
|
||||
<div v-if="person" class="flex items-center gap-2 rounded-md border px-2 py-1.5">
|
||||
<PersonAvatar :person="person" class="size-7 text-[10px]" />
|
||||
<span class="min-w-0 flex-1 truncate text-sm">{{ person.name }}</span>
|
||||
<button type="button" class="grid size-6 place-items-center rounded hover:bg-accent" aria-label="Auswahl entfernen" @click="clearPerson"><X class="size-3.5" /></button>
|
||||
</div>
|
||||
<div v-else class="relative">
|
||||
<Input id="g-person" v-model="query" placeholder="Name im Portal suchen …" autocomplete="off" />
|
||||
<ul v-if="results.length" class="absolute inset-x-0 top-full z-30 mt-1 max-h-60 overflow-y-auto rounded-md border bg-popover p-1 shadow-md">
|
||||
<li v-for="p in results" :key="p.id">
|
||||
<button type="button" class="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm hover:bg-accent" @click="choose(p)">
|
||||
<PersonAvatar :person="p" class="size-7 text-[10px]" /> <span class="truncate">{{ p.name }}</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<Input v-else id="g-person" v-model="form.name" maxlength="150" placeholder="Vor- und Nachname" />
|
||||
<button type="button" class="mt-1 justify-self-start text-xs text-brand-text hover:underline" @click="freeName = !freeName">
|
||||
{{ freeName ? 'Stattdessen Person aus dem Portal wählen' : 'Nicht im Portal? Namen frei eintragen' }}
|
||||
</button>
|
||||
</FormField>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<FormField id="g-date" :label="current.date" :error="form.errors.date"><Input id="g-date" v-model="form.date" type="date" /></FormField>
|
||||
<FormField v-if="has('born_on')" id="g-born" label="Geboren am (optional)" :error="form.errors.born_on"><Input id="g-born" v-model="form.born_on" type="date" /></FormField>
|
||||
<FormField v-if="has('label')" id="g-label" :label="current.label" :error="form.errors.label"><Input id="g-label" v-model="form.label" maxlength="150" :placeholder="current.labelPlaceholder" /></FormField>
|
||||
<FormField v-if="has('from')" id="g-from" label="Bisher" :error="form.errors.from"><Input id="g-from" v-model="form.from" maxlength="150" placeholder="z. B. Werkstatt Nord" /></FormField>
|
||||
<FormField v-if="has('to')" id="g-to" label="Künftig" :error="form.errors.to"><Input id="g-to" v-model="form.to" maxlength="150" placeholder="z. B. Verwaltung" /></FormField>
|
||||
<FormField v-if="has('department')" id="g-dep" label="Bereich" :error="form.errors.department"><Input id="g-dep" v-model="form.department" maxlength="150" :placeholder="person?.department || ''" /></FormField>
|
||||
<FormField v-if="has('location')" id="g-loc" label="Standort" :error="form.errors.location"><Input id="g-loc" v-model="form.location" maxlength="150" :placeholder="person?.location || ''" /></FormField>
|
||||
</div>
|
||||
<p v-if="person && (has('department') || has('location'))" class="-mt-2 text-xs text-muted-foreground">Leer gelassen, gilt die Angabe aus dem Profil.</p>
|
||||
|
||||
<FormField v-if="has('text')" id="g-text" label="Text (optional)" :error="form.errors.text"><Textarea id="g-text" v-model="form.text" rows="2" maxlength="1000" /></FormField>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" @click="emit('update:open', false)">Abbrechen</Button>
|
||||
<Button type="submit" :disabled="form.processing"><LoaderCircle v-if="form.processing" class="animate-spin" /> Speichern</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
|
||||
defineProps({
|
||||
entry: { type: Object, required: true },
|
||||
muted: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const initials = (name) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((p) => p[0]).join('').toUpperCase();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex min-w-0 items-center gap-3">
|
||||
<PersonAvatar :person="entry.person ?? { id: entry.name, name: entry.name, initials: initials(entry.name) }" class="size-9 shrink-0" :class="{ 'grayscale': muted }" />
|
||||
<div class="min-w-0">
|
||||
<Link v-if="entry.person?.url" :href="entry.person.url" class="block truncate text-sm font-medium hover:underline">{{ entry.name }}</Link>
|
||||
<span v-else class="block truncate text-sm font-medium">{{ entry.name }}</span>
|
||||
<span v-if="entry.person?.job_title" class="block truncate text-xs text-muted-foreground">{{ entry.person.job_title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
132
plugins-core/gemeinsam/resources/js/pages/Index.vue
Normal file
132
plugins-core/gemeinsam/resources/js/pages/Index.vue
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { ArrowRightLeft, Award, Cake, ChevronLeft, ChevronRight, EllipsisVertical, Flower2, Hand, PencilLine, Plus, Sparkles, Trash2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import EntryDialog from '../components/EntryDialog.vue';
|
||||
import PersonCell from '../components/PersonCell.vue';
|
||||
|
||||
const props = defineProps({
|
||||
month: { type: String, required: true },
|
||||
monthLabel: { type: String, required: true },
|
||||
previous: { type: String, required: true },
|
||||
next: { type: String, required: true },
|
||||
isCurrent: { type: Boolean, default: true },
|
||||
sections: { type: Array, required: true },
|
||||
canManage: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
const icons = { welcome: Sparkles, transfer: ArrowRightLeft, birthdays: Cake, jubilee: Award, farewell: Hand, memoriam: Flower2 };
|
||||
|
||||
// Spalten je Abschnitt (die Person steht immer vorne)
|
||||
const columns = {
|
||||
welcome: [['department', 'Bereich'], ['location', 'Standort'], ['date', 'Eintritt']],
|
||||
transfer: [['from', 'Bisher'], ['to', 'Künftig'], ['date', 'Ab']],
|
||||
birthdays: [['department', 'Bereich'], ['location', 'Standort'], ['date', 'Geburtstag']],
|
||||
jubilee: [['label', 'Jubiläum'], ['department', 'Bereich'], ['date', 'Datum']],
|
||||
farewell: [['department', 'Bereich'], ['label', 'Anlass'], ['date', 'Letzter Arbeitstag']],
|
||||
memoriam: [['lifespan', 'Lebensdaten'], ['department', 'Bereich']],
|
||||
};
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||
const dayFormat = new Intl.DateTimeFormat('de-DE', { day: 'numeric', month: 'long' });
|
||||
const format = (iso, section) => (iso ? (section === 'birthdays' ? dayFormat : dateFormat).format(new Date(`${iso}T12:00:00`)) : '–');
|
||||
|
||||
function value(entry, key, section) {
|
||||
if (key === 'date') return format(entry.date, section);
|
||||
if (key === 'lifespan') return [entry.born_on && `* ${format(entry.born_on)}`, `† ${format(entry.date)}`].filter(Boolean).join(' ');
|
||||
|
||||
return entry[key] || '–';
|
||||
}
|
||||
|
||||
const visible = computed(() => props.sections.filter((s) => s.entries.length || (props.canManage && !s.automatic)));
|
||||
const empty = computed(() => props.sections.every((s) => !s.entries.length));
|
||||
|
||||
const dialog = ref({ open: false, section: null, entry: null });
|
||||
const add = (section) => (dialog.value = { open: true, section, entry: null });
|
||||
const edit = (section, entry) => (dialog.value = { open: true, section, entry });
|
||||
|
||||
function remove(entry) {
|
||||
if (window.confirm(`Eintrag „${entry.name}“ entfernen?`)) router.delete(`/gemeinsam/eintraege/${entry.id}`, { preserveScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Gemeinsam feiern, erinnern und willkommen heißen">
|
||||
<PageHeader title="Gemeinsam feiern, erinnern und willkommen heißen" :description="monthLabel">
|
||||
<template #actions>
|
||||
<div class="flex items-center gap-1 rounded-md border bg-card p-0.5">
|
||||
<Button variant="ghost" size="icon" class="size-8" as-child><Link :href="`/gemeinsam?monat=${previous}`" aria-label="Vorheriger Monat" preserve-scroll><ChevronLeft /></Link></Button>
|
||||
<span class="min-w-32 text-center text-sm font-medium">{{ monthLabel }}</span>
|
||||
<Button variant="ghost" size="icon" class="size-8" as-child><Link :href="`/gemeinsam?monat=${next}`" aria-label="Nächster Monat" preserve-scroll><ChevronRight /></Link></Button>
|
||||
</div>
|
||||
<Button v-if="!isCurrent" variant="outline" as-child><Link href="/gemeinsam">Aktueller Monat</Link></Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div v-if="visible.length && !(empty && !canManage)" class="grid max-w-5xl gap-6">
|
||||
<section
|
||||
v-for="section in visible"
|
||||
:key="section.key"
|
||||
class="overflow-hidden rounded-lg border bg-card"
|
||||
:class="section.key === 'memoriam' ? 'border-t-4 border-t-foreground/70' : 'border-t-4 border-t-brand'"
|
||||
>
|
||||
<header class="flex items-center justify-between gap-3 border-b px-5 py-3">
|
||||
<h2 class="flex items-center gap-2.5 text-base font-semibold" :class="{ 'text-foreground/85': section.key === 'memoriam' }">
|
||||
<component :is="icons[section.key]" class="size-5" :class="section.key === 'memoriam' ? 'text-muted-foreground' : 'text-brand-text'" />
|
||||
{{ section.title }}
|
||||
</h2>
|
||||
<Button v-if="canManage && !section.automatic" size="sm" variant="outline" @click="add(section)"><Plus /> Hinzufügen</Button>
|
||||
<span v-else-if="section.automatic && canManage" class="text-xs text-muted-foreground">aus dem Geburtstagskalender</span>
|
||||
</header>
|
||||
|
||||
<div v-if="section.entries.length" class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-muted/40 text-left text-xs text-muted-foreground">
|
||||
<tr>
|
||||
<th class="px-5 py-2 font-medium">Name</th>
|
||||
<th v-for="[key, label] in columns[section.key]" :key="key" class="px-3 py-2 font-medium whitespace-nowrap">{{ label }}</th>
|
||||
<th v-if="canManage && !section.automatic" class="w-12"><span class="sr-only">Aktionen</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y">
|
||||
<template v-for="entry in section.entries" :key="entry.id">
|
||||
<tr>
|
||||
<td class="px-5 py-2.5"><PersonCell :entry="entry" :muted="section.key === 'memoriam'" /></td>
|
||||
<td v-for="[key] in columns[section.key]" :key="key" class="px-3 py-2.5 whitespace-nowrap" :class="{ 'tabular-nums': key === 'date' || key === 'lifespan' }">{{ value(entry, key, section.key) }}</td>
|
||||
<td v-if="canManage && !section.automatic" class="pr-3 text-right">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger as-child><Button variant="ghost" size="icon" class="size-8 text-muted-foreground" :aria-label="`Aktionen für ${entry.name}`"><EllipsisVertical /></Button></DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem @select="edit(section, entry)"><PencilLine /> Bearbeiten</DropdownMenuItem>
|
||||
<DropdownMenuItem class="text-destructive" @select="remove(entry)"><Trash2 /> Entfernen</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="entry.text">
|
||||
<td :colspan="columns[section.key].length + 2" class="-mt-1 px-5 pb-3 text-[13px] text-muted-foreground" :class="{ italic: section.key === 'memoriam' }">{{ entry.text }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p v-else class="px-5 py-4 text-[13px] text-muted-foreground">Noch keine Einträge in diesem Monat.</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div v-else class="max-w-5xl rounded-lg border bg-card">
|
||||
<EmptyState :icon="Sparkles" title="Keine Einträge in diesem Monat" text="Hier stehen neue Kolleginnen und Kollegen, Wechsel, Geburtstage, Jubiläen, Verabschiedungen und Gedenken." />
|
||||
</div>
|
||||
|
||||
<EntryDialog v-if="canManage" v-model:open="dialog.open" :section="dialog.section" :entry="dialog.entry" :month="month" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue