Added Email-Signature to Profile
This commit is contained in:
@@ -13,6 +13,10 @@ const items = computed(() => [
|
|||||||
label: '',
|
label: '',
|
||||||
disabled: true
|
disabled: true
|
||||||
}], [{
|
}], [{
|
||||||
|
label: 'Mein Profil',
|
||||||
|
icon: 'i-heroicons-user',
|
||||||
|
to: `/profiles/show/${dataStore.activeProfile.id}`
|
||||||
|
},{
|
||||||
label: 'Abmelden',
|
label: 'Abmelden',
|
||||||
icon: 'i-heroicons-arrow-left-on-rectangle',
|
icon: 'i-heroicons-arrow-left-on-rectangle',
|
||||||
click: async () => {
|
click: async () => {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ dayjs.extend(isBetween)
|
|||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const supabase = useSupabaseClient()
|
||||||
|
const toast = useToast()
|
||||||
|
|
||||||
const itemInfo = ref({})
|
const itemInfo = ref({})
|
||||||
const oldItemInfo = ref({})
|
const oldItemInfo = ref({})
|
||||||
@@ -113,6 +115,31 @@ const getDuration = (time) => {
|
|||||||
setupPage()
|
setupPage()
|
||||||
changeRange()
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -224,6 +251,23 @@ changeRange()
|
|||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
</InputGroup>
|
</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>
|
||||||
<div v-if="item.label === 'Logbuch'">
|
<div v-if="item.label === 'Logbuch'">
|
||||||
<HistoryDisplay
|
<HistoryDisplay
|
||||||
|
|||||||
Reference in New Issue
Block a user