fix: set emails/phones table on contact create
This commit is contained in:
parent
f5e3b81be8
commit
f71525fa5a
@ -9,14 +9,15 @@
|
|||||||
label: editMode ? 'Update' : 'Create',
|
label: editMode ? 'Update' : 'Create',
|
||||||
variant: 'solid',
|
variant: 'solid',
|
||||||
disabled: !dirty,
|
disabled: !dirty,
|
||||||
onClick: ({ close }) => editMode ? updateContact(close) : callInsertDoc(close),
|
onClick: ({ close }) =>
|
||||||
|
editMode ? updateContact(close) : callInsertDoc(close),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #body-content>
|
<template #body-content>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<Link
|
<Link
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="md"
|
size="md"
|
||||||
label="Salutation"
|
label="Salutation"
|
||||||
@ -42,7 +43,7 @@
|
|||||||
v-model="_contact.last_name"
|
v-model="_contact.last_name"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Link
|
<Link
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="md"
|
size="md"
|
||||||
label="Organization"
|
label="Organization"
|
||||||
@ -121,6 +122,16 @@ async function callSetValue(values) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function callInsertDoc(close) {
|
async function callInsertDoc(close) {
|
||||||
|
if (_contact.value.email_id) {
|
||||||
|
_contact.value.email_ids = [{ email_id: _contact.value.email_id }]
|
||||||
|
delete _contact.value.email_id
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_contact.value.mobile_no) {
|
||||||
|
_contact.value.phone_nos = [{ phone: _contact.value.mobile_no }]
|
||||||
|
delete _contact.value.mobile_no
|
||||||
|
}
|
||||||
|
|
||||||
const doc = await call('frappe.client.insert', {
|
const doc = await call('frappe.client.insert', {
|
||||||
doc: {
|
doc: {
|
||||||
doctype: 'Contact',
|
doctype: 'Contact',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user