Finish send mail dialog, fixes #12

This commit is contained in:
2025-11-19 14:30:24 +01:00
parent d6e58a762c
commit ed017e0510
5 changed files with 57 additions and 31 deletions
@@ -9,17 +9,19 @@ import { Label } from "@/components/ui/label"
const props = defineProps<DialogRootProps & {
title: string,
description?: string,
recipient?: string
to?: string,
cc?: string
}>()
const recipient = ref<string | undefined>(props.recipient)
const to = ref<string | undefined>(props.to)
const cc = ref<string | undefined>(props.cc)
const emits = defineEmits<DialogRootEmits & {
send: [recipient: string | undefined]
send: [to: string | undefined, cc: string | undefined]
}>()
const forwarded = useForwardPropsEmits(props, emits)
watch(() => props.open,
(newValue, oldValue) => {
recipient.value = props.recipient
to.value = props.to
}
)
</script>
@@ -32,15 +34,15 @@ watch(() => props.open,
<DialogDescription v-if="props.description" v-html="props.description" />
</DialogHeader>
<div class="grid grid-cols-[min-content_1fr] gap-4 py-4">
<Label for="email" class="text-right text-muted-foreground">
<Label for="to" class="text-right text-muted-foreground">
An
</Label>
<Input id="email" required v-model="recipient" type="email" placeholder="E-Mail" />
<Input id="to" required v-model="to" type="email" placeholder="E-Mail" />
<Label for="email" class="text-right text-muted-foreground">
<Label for="cc" class="text-right text-muted-foreground">
Kopie
</Label>
<Input id="email" required :value="'buchhaltung@tooloop.de'" type="email" placeholder="E-Mail" />
<Input id="cc" v-model="cc" type="email" placeholder="E-Mail" />
</div>
<DialogFooter>
<DialogClose as-child>
@@ -48,7 +50,7 @@ watch(() => props.open,
Abbrechen
</Button>
</DialogClose>
<Button variant="destructive" @click="$emit('send', recipient)">
<Button variant="destructive" @click="$emit('send', to, cc)">
E-Mail senden
</Button>
</DialogFooter>