Added Email-Signature to Profile
This commit is contained in:
@@ -13,6 +13,10 @@ const items = computed(() => [
|
||||
label: '',
|
||||
disabled: true
|
||||
}], [{
|
||||
label: 'Mein Profil',
|
||||
icon: 'i-heroicons-user',
|
||||
to: `/profiles/show/${dataStore.activeProfile.id}`
|
||||
},{
|
||||
label: 'Abmelden',
|
||||
icon: 'i-heroicons-arrow-left-on-rectangle',
|
||||
click: async () => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user