Files
Caramel-CRM/resources/js/components/ui/send-mail-dialog/SendMailDialog.vue
T

66 lines
2.3 KiB
Vue
Raw Normal View History

2025-11-11 11:29:17 +01:00
<script setup lang="ts">
import { ref, watch } from "vue"
import { type DialogRootEmits, type DialogRootProps, useForwardPropsEmits } from 'reka-ui'
2025-11-21 13:21:59 +01:00
import { Button } from "@/components/ui/crm-button"
2025-11-18 10:27:49 +01:00
import { Dialog, DialogContent, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"
2025-11-21 13:21:59 +01:00
import { Input } from "@/components/ui/crm-input"
2025-11-11 11:29:17 +01:00
import { Label } from "@/components/ui/label"
const props = defineProps<DialogRootProps & {
title: string,
description?: string,
2025-11-19 14:30:24 +01:00
to?: string,
cc?: string
2025-11-11 11:29:17 +01:00
}>()
2025-11-19 14:30:24 +01:00
const to = ref<string | undefined>(props.to)
const cc = ref<string | undefined>(props.cc)
2025-11-11 11:29:17 +01:00
const emits = defineEmits<DialogRootEmits & {
2025-11-19 14:30:24 +01:00
send: [to: string | undefined, cc: string | undefined]
2025-11-11 11:29:17 +01:00
}>()
const forwarded = useForwardPropsEmits(props, emits)
watch(() => props.open,
(newValue, oldValue) => {
2025-11-19 14:30:24 +01:00
to.value = props.to
2025-11-11 11:29:17 +01:00
}
)
</script>
<template>
<Dialog v-bind="forwarded" :open="open" data-slot="send-mail-dialog">
2025-11-11 11:29:17 +01:00
<DialogContent class="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>{{ props.title }}</DialogTitle>
<DialogDescription v-if="props.description" v-html="props.description" />
</DialogHeader>
<div class="grid grid-cols-[min-content_1fr] gap-4 py-4">
2025-11-19 14:30:24 +01:00
<Label for="to" class="text-right text-muted-foreground">
2025-11-11 11:29:17 +01:00
An
</Label>
2025-11-19 14:30:24 +01:00
<Input id="to" required v-model="to" type="email" placeholder="E-Mail" />
2025-11-11 11:29:17 +01:00
2025-11-19 14:30:24 +01:00
<Label for="cc" class="text-right text-muted-foreground">
2025-11-11 11:29:17 +01:00
Kopie
</Label>
2025-11-19 14:30:24 +01:00
<Input id="cc" v-model="cc" type="email" placeholder="E-Mail" />
2025-11-11 11:29:17 +01:00
</div>
<DialogFooter>
<DialogClose as-child>
<Button>
Abbrechen
</Button>
</DialogClose>
2025-11-19 14:30:24 +01:00
<Button variant="destructive" @click="$emit('send', to, cc)">
2025-11-11 11:29:17 +01:00
E-Mail senden
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
<style scoped>
2025-11-11 11:29:17 +01:00
/* Remove close X */
[data-slot=send-mail-dialog] [data-slot=dialog-content] button.ring-offset-background {
2025-11-11 11:29:17 +01:00
display: none;
}
</style>