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

@@ -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 () => {

View File

@@ -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