inhaus-plugin-verleih/resources/js/components/RequestDialog.vue
Friederich Loheide 14aaa16b30 Verleih 1.0.0: Verleihsystem für Inhaus
Übersicht mit Status und Standort, Anfragen im Portal (Benachrichtigung +
E-Mail ans Team), Zusagen/Absagen mit automatischem Eintrag, Zurücknehmen,
Recht „Verleih verwalten“, einstellbare Bezeichnungen und Übernahme aus dem
WordPress-Plugin „FL-Verleihsystem“ (WXR mit Bildern).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 15:17:47 +00:00

62 lines
3 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup>
import { useForm } from '@inertiajs/vue3';
import { LoaderCircle, Send } from '@lucide/vue';
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, FormField, Input, Textarea } from '@inhaus/ui';
const props = defineProps({
item: { type: Object, required: true },
labels: { type: Object, required: true },
defaultLocation: { type: String, default: null },
});
const open = defineModel('open', { type: Boolean, default: false });
const today = new Date().toISOString().slice(0, 10);
const form = useForm({ location: props.defaultLocation ?? '', from: '', until: '', message: '' });
function submit() {
form.post(`/verleih/${props.item.id}/anfragen`, {
preserveScroll: true,
onSuccess: () => {
open.value = false;
form.reset('from', 'until', 'message');
},
});
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="ih:sm:max-w-lg">
<DialogHeader>
<DialogTitle>„{{ item.title }}“ anfragen</DialogTitle>
<DialogDescription>
Das Team bekommt Ihre Anfrage im Portal und per E-Mail und meldet sich bei Ihnen.
<template v-if="item.lent"> Gerade ist es verliehen – Sie können es trotzdem für später anfragen.</template>
</DialogDescription>
</DialogHeader>
<form id="verleih-anfrage" class="ih:grid ih:gap-4" @submit.prevent="submit">
<FormField id="vl-location" label="Wo soll es hin?" :error="form.errors.location">
<Input id="vl-location" v-model="form.location" maxlength="200" placeholder="z. B. Verwaltung, Besprechungsraum 2. OG" required />
</FormField>
<div class="ih:grid ih:gap-4 ih:sm:grid-cols-2">
<FormField id="vl-from" label="Ab (optional)" :error="form.errors.from">
<Input id="vl-from" v-model="form.from" type="date" :min="today" />
</FormField>
<FormField id="vl-until" label="Bis (optional)" :error="form.errors.until">
<Input id="vl-until" v-model="form.until" type="date" :min="form.from || today" />
</FormField>
</div>
<FormField id="vl-message" label="Nachricht (optional)" :error="form.errors.message">
<Textarea id="vl-message" v-model="form.message" rows="3" maxlength="2000" placeholder="z. B. Anlass, Ansprechperson vor Ort …" />
</FormField>
</form>
<DialogFooter>
<Button variant="outline" @click="open = false">Abbrechen</Button>
<Button type="submit" form="verleih-anfrage" :disabled="form.processing || !form.location.trim()">
<LoaderCircle v-if="form.processing" class="ih:animate-spin" /><Send v-else /> Anfrage senden
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>