-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove IndividualMailboxSettings
- Loading branch information
1 parent
7417521
commit eadeae6
Showing
2 changed files
with
65 additions
and
82 deletions.
There are no files selected for viewing
76 changes: 0 additions & 76 deletions
76
frontend/src/components/Settings/IndividualMailboxSettings.vue
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,81 @@ | ||
<template> | ||
<h1 class="font-semibold mb-8">Mailbox</h1> | ||
<h1 class="font-semibold mb-8">email</h1> | ||
<div class="flex items-center mb-2"> | ||
<span class="font-medium leading-normal text-gray-800 text-base">Email Address</span> | ||
<Link | ||
v-model="mailbox" | ||
v-model="email" | ||
doctype="Mailbox" | ||
:filters="{ user: userResource.data?.name }" | ||
class="ml-auto" | ||
/> | ||
</div> | ||
<IndividiualMailboxSettings v-if="mailbox" :mailbox="mailbox" /> | ||
<div v-if="mailbox.doc"> | ||
<Switch | ||
label="Enabled" | ||
v-model="mailbox.doc.enabled" | ||
@update:modelValue="mailbox.setValue.submit({ enabled: mailbox.doc.enabled })" | ||
/> | ||
<Switch | ||
label="Incoming" | ||
v-model="mailbox.doc.incoming" | ||
@update:modelValue="mailbox.setValue.submit({ incoming: mailbox.doc.incoming })" | ||
/> | ||
<Switch | ||
label="Outgoing" | ||
v-model="mailbox.doc.outgoing" | ||
@update:modelValue="mailbox.setValue.submit({ outgoing: mailbox.doc.outgoing })" | ||
/> | ||
<Switch | ||
label="Default Outgoing" | ||
v-model="mailbox.doc.is_default" | ||
:disabled="!mailbox.doc.outgoing" | ||
@update:modelValue="mailbox.setValue.submit({ is_default: mailbox.doc.is_default })" | ||
/> | ||
<Switch | ||
label="Track Outgoing Mail" | ||
v-model="mailbox.doc.track_outgoing_mail" | ||
:disabled="!mailbox.doc.outgoing" | ||
@update:modelValue=" | ||
mailbox.setValue.submit({ track_outgoing_mail: mailbox.doc.track_outgoing_mail }) | ||
" | ||
/> | ||
<Switch | ||
label="Create Mail Contact" | ||
v-model="mailbox.doc.create_mail_contact" | ||
@update:modelValue=" | ||
mailbox.setValue.submit({ create_mail_contact: mailbox.doc.create_mail_contact }) | ||
" | ||
/> | ||
</div> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue' | ||
import { ref, watch } from 'vue' | ||
import { Switch, createDocumentResource } from 'frappe-ui' | ||
import Link from '@/components/Controls/Link.vue' | ||
import IndividiualMailboxSettings from '@/components/Settings/IndividualMailboxSettings.vue' | ||
import { userStore } from '@/stores/user' | ||
const { userResource, defaultOutgoing } = userStore() | ||
const mailbox = ref(defaultOutgoing.data) | ||
const email = ref(defaultOutgoing.data) | ||
watch(email, () => { | ||
mailbox.name = email.value | ||
mailbox.reload() | ||
}) | ||
const mailbox = createDocumentResource({ | ||
doctype: 'Mailbox', | ||
name: email.value, | ||
transform(data) { | ||
for (const d of [ | ||
'enabled', | ||
'incoming', | ||
'outgoing', | ||
'is_default', | ||
'track_outgoing_mail', | ||
'create_mail_contact', | ||
]) { | ||
data[d] = !!data[d] | ||
} | ||
}, | ||
}) | ||
</script> |