Added E-Mail Account Adding/Editing
This commit is contained in:
@@ -305,9 +305,8 @@ const links = computed(() => {
|
|||||||
icon: "i-heroicons-key"
|
icon: "i-heroicons-key"
|
||||||
},*/{
|
},*/{
|
||||||
label: "E-Mail Konten",
|
label: "E-Mail Konten",
|
||||||
to: "/settings/emailAccounts",
|
to: "/settings/emailaccounts",
|
||||||
icon: "i-heroicons-envelope",
|
icon: "i-heroicons-envelope"
|
||||||
disabled: true
|
|
||||||
},{
|
},{
|
||||||
label: "Bankkonten",
|
label: "Bankkonten",
|
||||||
to: "/settings/banking",
|
to: "/settings/banking",
|
||||||
|
|||||||
137
pages/settings/emailaccounts/[mode]/[[id]].vue
Normal file
137
pages/settings/emailaccounts/[mode]/[[id]].vue
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const mode = route.params.mode
|
||||||
|
|
||||||
|
const itemInfo = ref({})
|
||||||
|
|
||||||
|
const setup = async () => {
|
||||||
|
if(mode === "create") {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
itemInfo.value = await useNuxtApp().$api(`/api/email/accounts/${route.params.id}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setup()
|
||||||
|
|
||||||
|
const createAccount = async () => {
|
||||||
|
const res = await useNuxtApp().$api(`/api/email/accounts`, {
|
||||||
|
method: "POST",
|
||||||
|
body: itemInfo.value,
|
||||||
|
})
|
||||||
|
|
||||||
|
if(res.success) {
|
||||||
|
navigateTo("/settings/emailaccounts")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveAccount = async () => {
|
||||||
|
const res = await useNuxtApp().$api(`/api/email/accounts/${route.params.id}`, {
|
||||||
|
method: "POST",
|
||||||
|
body: itemInfo.value,
|
||||||
|
})
|
||||||
|
|
||||||
|
if(res.success) {
|
||||||
|
navigateTo("/settings/emailaccounts")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UDashboardNavbar :title="`E-Mail Konto ${mode === 'create' ? 'erstellen' : 'bearbeiten'}`">
|
||||||
|
<template #right>
|
||||||
|
<UButton
|
||||||
|
v-if="mode === 'create'"
|
||||||
|
@click="createAccount"
|
||||||
|
>
|
||||||
|
Erstellen
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
v-if="mode === 'edit'"
|
||||||
|
@click="saveAccount"
|
||||||
|
>
|
||||||
|
Speichern
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
|
</UDashboardNavbar>
|
||||||
|
<UForm class="w-2/3 mx-auto mt-5">
|
||||||
|
<UFormGroup
|
||||||
|
label="E-Mail Adresse"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.email"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Passwort"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
type="password"
|
||||||
|
v-model="itemInfo.password"
|
||||||
|
placeholder="********"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UDivider> IMAP </UDivider>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="IMAP Host"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.imap_host"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="IMAP Port"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
type="number"
|
||||||
|
v-model="itemInfo.imap_port"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="IMAP SSL"
|
||||||
|
>
|
||||||
|
<UToggle
|
||||||
|
v-model="itemInfo.imap_ssl"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UDivider> SMTP </UDivider>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="SMTP Host"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.smtp_host"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="SMTP Port"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
type="number"
|
||||||
|
v-model="itemInfo.smtp_port"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="SMTP SSL"
|
||||||
|
>
|
||||||
|
<UToggle
|
||||||
|
v-model="itemInfo.smtp_ssl"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
</UForm>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -9,28 +9,13 @@ const createEMailType = ref("imap")
|
|||||||
const showEmailAddressModal = ref(false)
|
const showEmailAddressModal = ref(false)
|
||||||
|
|
||||||
const items = ref([])
|
const items = ref([])
|
||||||
const profiles = ref([])
|
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
items.value = await useSupabaseSelect("emailAccounts","*")
|
items.value = await useNuxtApp().$api("/api/email/accounts")
|
||||||
profiles.value = await useSupabaseSelect("profiles","*")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const createAccount = async () => {
|
const createAccount = async () => {
|
||||||
showEmailAddressModal.value = false
|
showEmailAddressModal.value = false
|
||||||
|
|
||||||
const {data,error} = await supabase.functions.invoke('emailengine_authenticate',{
|
|
||||||
body: {
|
|
||||||
emailAddress: createEMailAddress.value,
|
|
||||||
accountType: createEMailType.value,
|
|
||||||
profile: profileStore.activeProfile.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log(error)
|
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
window.open(data.url, '_blank').focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
@@ -38,16 +23,8 @@ setupPage()
|
|||||||
|
|
||||||
const templateColumns = [
|
const templateColumns = [
|
||||||
{
|
{
|
||||||
key: "emailAddress",
|
key: "email",
|
||||||
label: "Adresse:"
|
label: "E-Mail Adresse:"
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "profiles",
|
|
||||||
label: "Bneutzer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "mailboxes",
|
|
||||||
label: "Ordner"
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const selectedColumns = ref(templateColumns)
|
const selectedColumns = ref(templateColumns)
|
||||||
@@ -98,7 +75,7 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
|
|||||||
<template #right>
|
<template #right>
|
||||||
<UTooltip title="In der Beta nicht verfügbar">
|
<UTooltip title="In der Beta nicht verfügbar">
|
||||||
<UButton
|
<UButton
|
||||||
@click="showEmailAddressModal = true"
|
@click="navigateTo('/settings/emailaccounts/create')"
|
||||||
>
|
>
|
||||||
+ E-Mail Konto
|
+ E-Mail Konto
|
||||||
</UButton>
|
</UButton>
|
||||||
@@ -110,15 +87,10 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
|
|||||||
:rows="items"
|
:rows="items"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
|
@select="(i) => navigateTo(`/settings/emailaccounts/edit/${i.id}`)"
|
||||||
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine E-Mail Konten anzuzeigen' }"
|
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine E-Mail Konten anzuzeigen' }"
|
||||||
>
|
>
|
||||||
<template #profiles-data="{row}">
|
|
||||||
{{row.profiles}}
|
|
||||||
</template>
|
|
||||||
<template #mailboxes-data="{row}">
|
|
||||||
{{row.mailboxes}}
|
|
||||||
</template>
|
|
||||||
</UTable>
|
</UTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
Reference in New Issue
Block a user