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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue