Ü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>
62 lines
3 KiB
Vue
62 lines
3 KiB
Vue
<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>
|