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

- 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:
Friederich Loheide 2026-09-26 09:51:19 +00:00
parent 435960725d
commit ee8dde93c0
262 changed files with 2385 additions and 692 deletions

View file

@ -1,7 +1,7 @@
<script setup>
import { computed } from 'vue';
import { useForm, usePage } from '@inertiajs/vue3';
import { CircleCheck, EyeOff, LoaderCircle, Paperclip, Send, X } from '@lucide/vue';
import { CircleCheck, EyeOff, LoaderCircle, Lock, Paperclip, Send, X } from '@lucide/vue';
import { toast } from 'vue-sonner';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@ -176,6 +176,12 @@ const fieldId = (field) => `f${props.form.id}-${field.key}`;
</label>
</div>
<div v-else-if="field.locked" class="flex h-9 items-center gap-2 rounded-md border border-input bg-muted/60 px-3 text-sm" :aria-describedby="`${fieldId(field)}-locked`">
<Lock class="size-3.5 shrink-0 text-muted-foreground" />
<span v-if="data.answers[field.key]" :id="fieldId(field)" class="truncate">{{ data.answers[field.key] }}</span>
<span v-else class="text-muted-foreground italic">{{ preview ? 'wird aus dem Profil übernommen' : 'nicht im Profil hinterlegt' }}</span>
</div>
<Input
v-else
:id="fieldId(field)"
@ -189,7 +195,11 @@ const fieldId = (field) => `f${props.form.id}-${field.key}`;
/>
</template>
<p v-if="error(field)" class="text-[13px] text-destructive">{{ error(field) }}</p>
<p v-if="error(field)" class="text-[13px] text-destructive">
{{ error(field) }}
<a v-if="field.locked" href="/profil/bearbeiten" class="font-medium underline">Profil öffnen</a>
</p>
<p v-else-if="field.locked" :id="`${fieldId(field)}-locked`" class="text-[13px] text-muted-foreground">Aus Ihrem Profil – nicht änderbar.</p>
<p v-else-if="field.help" class="text-[13px] text-muted-foreground">
{{ field.help }}<template v-if="field.type === 'file' && field.max_size"> (höchstens {{ field.max_size }} MB)</template>
</p>

View file

@ -1,6 +1,6 @@
<script setup>
import { computed, inject } from 'vue';
import { Asterisk, Calendar, ChevronDown, Copy, GitBranch, GripVertical, Paperclip, Plus, Trash2, X } from '@lucide/vue';
import { Asterisk, Calendar, ChevronDown, Copy, GitBranch, GripVertical, Lock, Paperclip, Plus, Trash2, X } from '@lucide/vue';
import { fieldTypes, layoutTypes, operators, optionTypes } from '../../lib/fields';
/**
@ -95,6 +95,9 @@ const fake = 'flex h-9 w-full items-center rounded-md border border-input bg-car
<button type="button" class="grid size-6 place-items-center rounded text-destructive hover:bg-destructive/10" title="Entfernen" @click="builder.remove(field._id)"><Trash2 class="size-3.5" /></button>
</div>
<p v-if="d.prefill && !d.locked && !isLayout" class="mb-1.5 mr-1 inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">
Vorbelegt: {{ builder.prefillOptions.find((o) => o.value === d.prefill)?.label ?? d.prefill }}
</p>
<p v-if="conditionText" class="mb-1.5 inline-flex items-center gap-1 rounded bg-amber-100 px-1.5 py-0.5 text-[11px] text-amber-800 dark:bg-amber-900/50 dark:text-amber-200">
<GitBranch class="size-3" /> Nur wenn {{ conditionText }}
</p>
@ -156,6 +159,10 @@ const fake = 'flex h-9 w-full items-center rounded-md border border-input bg-car
<div v-else-if="field.type === 'date'" :class="[fake, 'justify-between']">TT.MM.JJJJ <Calendar class="size-4" /></div>
<div v-else-if="d.locked && d.prefill" class="flex h-9 items-center gap-2 rounded-md border border-input bg-muted/60 px-3 text-sm text-muted-foreground">
<Lock class="size-3.5" /> Aus dem Profil: {{ builder.prefillOptions.find((o) => o.value === d.prefill)?.label ?? d.prefill }} – nicht änderbar
</div>
<div v-else class="rounded-md border border-input bg-card shadow-xs">
<input v-model="d.placeholder" class="h-9 w-full bg-transparent px-3 text-sm outline-none placeholder:text-muted-foreground/50" :placeholder="field.type === 'text' ? 'Platzhalter (optional)' : ''" :disabled="field.type !== 'text'" aria-label="Platzhalter" />
</div>

View file

@ -121,9 +121,20 @@ const maxSize = computed(number('max_size'));
<label v-if="['text', 'email', 'phone'].includes(field.type)" class="grid gap-1.5">
<span class="text-[13px] font-medium">Vorbelegen mit</span>
<NativeSelect :model-value="d.prefill ?? null" :options="builder.prefillOptions" placeholder="– nicht vorbelegen –" @update:model-value="(v) => (v ? (d.prefill = v) : delete d.prefill)" />
<span class="text-xs text-muted-foreground">Aus dem Profil der ausfüllenden Person; änderbar.</span>
<NativeSelect :model-value="d.prefill ?? null" :options="builder.prefillOptions" placeholder="– nicht vorbelegen –" @update:model-value="(v) => (v ? (d.prefill = v) : (delete d.prefill, delete d.locked))" />
</label>
<div v-if="['text', 'email', 'phone'].includes(field.type) && d.prefill" class="grid gap-1.5 rounded-md border p-3">
<label class="flex items-center justify-between gap-3 text-[13px] font-medium">
Nicht änderbar
<Switch :model-value="!!d.locked" @update:model-value="(v) => (v ? (d.locked = true) : delete d.locked)" />
</label>
<span class="text-xs text-muted-foreground">
{{ d.locked
? 'Das Feld zeigt den Wert aus dem Profil und kann nicht geändert werden. Beim Absenden wird immer der Profilwert gespeichert.'
: 'Das Feld ist mit dem Profilwert vorausgefüllt, kann aber geändert werden.' }}
</span>
<span v-if="d.locked && builder.anonymous" class="text-xs text-amber-700 dark:text-amber-300">Achtung: Das Formular ist anonym – diese Profilangabe wird trotzdem mit der Einsendung gespeichert.</span>
</div>
<div v-if="['text', 'textarea', 'number', 'checkboxes'].includes(field.type)" class="grid grid-cols-2 gap-3">
<label v-if="['number', 'checkboxes'].includes(field.type)" class="grid gap-1.5">

View file

@ -97,6 +97,7 @@ export function toFrontend(fields) {
multiple: !!data.multiple,
accept: accept[data.accept ?? 'any'] || undefined,
max_size: data.max_size,
locked: !!(data.locked && data.prefill && ['text', 'email', 'phone'].includes(type)),
condition: data.condition_field ? { field: data.condition_field, operator: data.condition_operator ?? 'equals', value: String(data.condition_value ?? '') } : null,
}));
}

View file

@ -87,6 +87,7 @@ provide('forms:builder', {
},
types: props.types,
prefillOptions: props.prefillOptions,
anonymous: props.form.anonymous,
selectedId,
errorIndex,
select,