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
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