Added Email-Signature to Profile

This commit is contained in:
2024-10-08 13:53:36 +02:00
parent e1f94cfb72
commit 06badd590c
2 changed files with 48 additions and 0 deletions

View File

@@ -11,6 +11,8 @@ dayjs.extend(isBetween)
const dataStore = useDataStore()
const route = useRoute()
const router = useRouter()
const supabase = useSupabaseClient()
const toast = useToast()
const itemInfo = ref({})
const oldItemInfo = ref({})
@@ -113,6 +115,31 @@ const getDuration = (time) => {
setupPage()
changeRange()
const emailSignature = ref(dataStore.activeProfile.emailSignature)
const tiptapLoaded = ref(false)
const contentSaved = ref(true)
const contentChanged = async (content) => {
console.log(tiptapLoaded)
emailSignature.value = content.html
if(tiptapLoaded.value === true) {
contentSaved.value = false
} else {
tiptapLoaded.value = true
}
}
const saveSignature = async () => {
const {data,error} = await supabase.from("profiles").update({emailSignature: emailSignature.value}).eq("id", dataStore.activeProfile.id)
if(error) {
toast.add({title: "Fehler beim Speichern der Signatur", color:"rose"})
}
else {
contentSaved.value = true
}
}
</script>
<template>
@@ -224,6 +251,23 @@ changeRange()
/>
</UFormGroup>
</InputGroup>
<UDivider class="my-5">
E-Mail Signatur
</UDivider>
<UButton
variant="outline"
v-if="!contentSaved"
@click="saveSignature"
>
Speichern
</UButton>
<Tiptap
@updateContent="contentChanged"
:preloadedContent="emailSignature"
/>
</div>
<div v-if="item.label === 'Logbuch'">
<HistoryDisplay