Feste Profilfelder in Formularen, Geburtstage, anpassbare Startseite
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m21s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m34s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 3m8s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m43s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m1s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m21s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m34s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 3m8s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m43s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m1s
- Formulare: Felder fest aus dem Profil (nicht änderbar, Server setzt den Profilwert ein), Hinweis bei fehlender Profilangabe - Geburtstage (optionales Plugin, standardmäßig aus): Tag und Monat freiwillig im Profil, Kachel, Liste /geburtstage, Pagebuilder-Block, Glückwunsch am eigenen Geburtstag; Sichtbarkeit alle/Abteilung/Standort - Startseite: Kacheln je Bereich sortieren und ausblenden; eigene Kacheln (Bild mit Link, Text, Hinweis) mit Zeitraum und Zielgruppe - Kern: optionale mitgelieferte Plugins, Startseitenbereich „top“, Profilabschnitte für Plugins, Kachel-Bezeichnungen Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
435960725d
commit
ee8dde93c0
262 changed files with 2385 additions and 692 deletions
|
|
@ -0,0 +1,15 @@
|
|||
<script setup>
|
||||
import BirthdayItem from '../components/BirthdayItem.vue';
|
||||
|
||||
defineProps({ block: { type: Object, required: true } });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section>
|
||||
<h3 v-if="block.data.title" class="mb-3 text-lg font-semibold">{{ block.data.title }}</h3>
|
||||
<div class="divide-y rounded-lg border bg-card px-4">
|
||||
<BirthdayItem v-for="item in block.props?.birthdays ?? []" :key="`${item.person.id}-${item.date}`" :item="item" />
|
||||
<p v-if="!(block.props?.birthdays ?? []).length" class="py-3 text-sm text-muted-foreground">Keine anstehenden Geburtstage.</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Cake } from '@lucide/vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
|
||||
defineProps({
|
||||
item: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const day = (iso) => new Intl.DateTimeFormat('de-DE', { day: 'numeric', month: 'long' }).format(new Date(`${iso}T12:00:00`));
|
||||
const weekday = (iso) => new Intl.DateTimeFormat('de-DE', { weekday: 'short' }).format(new Date(`${iso}T12:00:00`));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Link :href="`/personen/${item.person.id}`" class="group flex items-center gap-3 py-2.5">
|
||||
<span class="relative shrink-0">
|
||||
<PersonAvatar :person="item.person" class="size-10" />
|
||||
<span v-if="item.today" class="absolute -right-1 -bottom-1 grid size-5 place-items-center rounded-full bg-brand text-brand-foreground ring-2 ring-card"><Cake class="size-3" /></span>
|
||||
</span>
|
||||
<span class="min-w-0 flex-1">
|
||||
<span class="block truncate text-sm font-medium group-hover:underline">{{ item.person.name }}</span>
|
||||
<span class="block truncate text-xs text-muted-foreground">{{ item.person.job_title || item.person.department }}</span>
|
||||
</span>
|
||||
<span class="shrink-0 text-right text-xs" :class="item.today ? 'font-semibold text-brand-text' : 'text-muted-foreground'">
|
||||
{{ item.today ? 'Heute' : `${weekday(item.date)}, ${day(item.date)}` }}
|
||||
</span>
|
||||
</Link>
|
||||
</template>
|
||||
52
plugins-core/birthdays/resources/js/pages/Index.vue
Normal file
52
plugins-core/birthdays/resources/js/pages/Index.vue
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Cake } from '@lucide/vue';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import BirthdayItem from '../components/BirthdayItem.vue';
|
||||
|
||||
const props = defineProps({
|
||||
birthdays: { type: Array, required: true },
|
||||
scope: { type: String, required: true },
|
||||
registered: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
// Nach Tagen gruppiert: „Heute“, dann die folgenden Tage
|
||||
const groups = computed(() => {
|
||||
const result = [];
|
||||
|
||||
for (const item of props.birthdays) {
|
||||
const last = result.at(-1);
|
||||
last && last.date === item.date ? last.items.push(item) : result.push({ date: item.date, today: item.today, items: [item] });
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
const label = (group) => group.today ? 'Heute' : new Intl.DateTimeFormat('de-DE', { weekday: 'long', day: 'numeric', month: 'long' }).format(new Date(`${group.date}T12:00:00`));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Geburtstage">
|
||||
<div class="mx-auto max-w-3xl">
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Geburtstage</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">Die nächsten 30 Tage · {{ scope }}</p>
|
||||
|
||||
<p v-if="!registered" class="mt-5 rounded-lg border bg-card px-4 py-3 text-sm">
|
||||
Sie möchten auch in der Liste stehen? Tragen Sie Tag und Monat unter
|
||||
<Link href="/profil/bearbeiten" class="font-medium text-brand-text hover:underline">Profil bearbeiten</Link> ein.
|
||||
</p>
|
||||
|
||||
<div v-if="groups.length" class="mt-6 grid gap-5">
|
||||
<section v-for="group in groups" :key="group.date" class="rounded-lg border bg-card">
|
||||
<h2 class="border-b px-5 py-3 text-sm font-semibold" :class="group.today ? 'text-brand-text' : ''">{{ label(group) }}</h2>
|
||||
<div class="divide-y px-5">
|
||||
<BirthdayItem v-for="item in group.items" :key="item.person.id" :item="item" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div v-else class="mt-6 rounded-lg border bg-card"><EmptyState :icon="Cake" title="Keine Geburtstage in den nächsten 30 Tagen" /></div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { router, useForm } from '@inertiajs/vue3';
|
||||
import { Cake, LoaderCircle } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import NativeSelect from '@/components/NativeSelect.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
|
||||
const props = defineProps({
|
||||
birthday: { type: Object, default: null },
|
||||
months: { type: Array, required: true },
|
||||
scope: { type: String, default: 'all' },
|
||||
});
|
||||
|
||||
const form = useForm({ day: props.birthday?.day ?? null, month: props.birthday?.month ?? null });
|
||||
const days = computed(() => Array.from({ length: 31 }, (_, i) => ({ value: i + 1, label: String(i + 1) })));
|
||||
|
||||
const audience = { all: 'allen Mitarbeitenden', department: 'Ihrer Abteilung', location: 'Ihrem Standort' };
|
||||
|
||||
function save() {
|
||||
form.put('/profil/geburtstag', {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
form.defaults();
|
||||
toast.success('Geburtstag gespeichert');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function remove() {
|
||||
router.delete('/profil/geburtstag', {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
form.day = null;
|
||||
form.month = null;
|
||||
form.defaults();
|
||||
toast.success('Aus der Geburtstagsliste entfernt');
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Panel title="Geburtstag">
|
||||
<form class="grid gap-4" @submit.prevent="save">
|
||||
<p class="flex gap-2 text-sm text-muted-foreground">
|
||||
<Cake class="mt-0.5 size-4 shrink-0 text-brand-text" />
|
||||
<span>Freiwillig: Wenn Sie Tag und Monat eintragen, erscheint Ihr Geburtstag in der Geburtstagsliste und ist {{ audience[scope] }} sichtbar. Das Geburtsjahr wird nicht erfasst. Austragen ist jederzeit möglich.</span>
|
||||
</p>
|
||||
<div class="grid grid-cols-2 gap-4 sm:max-w-sm">
|
||||
<FormField id="birthday-day" label="Tag" :error="form.errors.day">
|
||||
<NativeSelect id="birthday-day" v-model="form.day" :options="days" placeholder="–" />
|
||||
</FormField>
|
||||
<FormField id="birthday-month" label="Monat" :error="form.errors.month">
|
||||
<NativeSelect id="birthday-month" v-model="form.month" :options="months" placeholder="–" />
|
||||
</FormField>
|
||||
</div>
|
||||
<div class="flex justify-end gap-2 border-t pt-4">
|
||||
<Button v-if="birthday" type="button" variant="ghost" class="text-destructive hover:text-destructive" @click="remove">Austragen</Button>
|
||||
<Button type="submit" :disabled="form.processing || !form.day || !form.month || !form.isDirty">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
{{ birthday ? 'Speichern' : 'Eintragen' }}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Panel>
|
||||
</template>
|
||||
55
plugins-core/birthdays/resources/js/widgets/Greeting.vue
Normal file
55
plugins-core/birthdays/resources/js/widgets/Greeting.vue
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { Cake, X } from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* Glückwunsch am eigenen Geburtstag – lässt sich für heute ausblenden.
|
||||
*/
|
||||
const props = defineProps({
|
||||
name: { type: String, required: true },
|
||||
});
|
||||
|
||||
const key = `inhaus.birthday-greeting.${new Date().toISOString().slice(0, 10)}`;
|
||||
const hidden = ref(false);
|
||||
|
||||
try {
|
||||
hidden.value = localStorage.getItem(key) === '1';
|
||||
} catch {
|
||||
// Speicher nicht verfügbar – dann eben immer zeigen.
|
||||
}
|
||||
|
||||
function dismiss() {
|
||||
hidden.value = true;
|
||||
|
||||
try {
|
||||
localStorage.setItem(key, '1');
|
||||
} catch {
|
||||
// ignorieren
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="!hidden" class="relative overflow-hidden rounded-lg bg-brand text-brand-foreground" role="status">
|
||||
<!-- dezente Konfetti-Punkte -->
|
||||
<svg class="pointer-events-none absolute inset-0 size-full opacity-25" aria-hidden="true">
|
||||
<circle cx="8%" cy="30%" r="4" fill="currentColor" />
|
||||
<circle cx="15%" cy="75%" r="3" fill="currentColor" />
|
||||
<rect x="24%" y="18%" width="7" height="7" transform="rotate(20)" fill="currentColor" />
|
||||
<circle cx="62%" cy="20%" r="3" fill="currentColor" />
|
||||
<circle cx="78%" cy="70%" r="5" fill="currentColor" />
|
||||
<rect x="88%" y="30%" width="8" height="8" fill="currentColor" />
|
||||
<circle cx="94%" cy="80%" r="3" fill="currentColor" />
|
||||
</svg>
|
||||
<div class="relative flex items-center gap-4 px-5 py-5 sm:px-8">
|
||||
<span class="grid size-12 shrink-0 place-items-center rounded-full bg-white/15"><Cake class="size-6" /></span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="text-xl font-semibold tracking-tight">Alles Gute zum Geburtstag, {{ props.name }}!</p>
|
||||
<p class="mt-0.5 text-sm opacity-90">Wir wünschen Ihnen einen schönen Tag.</p>
|
||||
</div>
|
||||
<button type="button" class="grid size-9 shrink-0 place-items-center rounded-md hover:bg-white/15" aria-label="Glückwunsch ausblenden" @click="dismiss">
|
||||
<X class="size-5" />
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
17
plugins-core/birthdays/resources/js/widgets/Upcoming.vue
Normal file
17
plugins-core/birthdays/resources/js/widgets/Upcoming.vue
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<script setup>
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import BirthdayItem from '../components/BirthdayItem.vue';
|
||||
|
||||
defineProps({
|
||||
birthdays: { type: Array, required: true },
|
||||
days: { type: Number, default: 7 },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Panel title="Geburtstage" action-label="Alle" action-href="/geburtstage">
|
||||
<div class="-my-2 divide-y">
|
||||
<BirthdayItem v-for="item in birthdays" :key="`${item.person.id}-${item.date}`" :item="item" />
|
||||
</div>
|
||||
</Panel>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue