1
0
forked from test/crm

fix: added more fields in contact edit dialog

This commit is contained in:
Shariq Ansari 2023-11-20 18:36:42 +05:30
parent 6e294ee34c
commit d2be5936c0
2 changed files with 45 additions and 6 deletions

View File

@ -27,9 +27,11 @@
<div <div
v-for="field in detailFields" v-for="field in detailFields"
:key="field.name" :key="field.name"
class="flex h-7 items-center gap-2 text-gray-800 text-base" class="flex h-7 items-center gap-2 text-base text-gray-800"
> >
<div class="w-7 grid place-content-center"><component class="" :is="field.icon" /></div> <div class="grid w-7 place-content-center">
<component :is="field.icon" />
</div>
<div v-if="field.type == 'dropdown'"> <div v-if="field.type == 'dropdown'">
<Dropdown <Dropdown
:options="field.options" :options="field.options"
@ -227,7 +229,7 @@ async function callInsertDoc() {
} }
function handleContactUpdate(doc) { function handleContactUpdate(doc) {
contacts.value.reload() contacts.reload()
if (doc.name && props.options.redirect) { if (doc.name && props.options.redirect) {
router.push({ router.push({
name: 'Contact', name: 'Contact',
@ -283,7 +285,7 @@ const detailFields = computed(() => {
icon: PhoneIcon, icon: PhoneIcon,
name: 'mobile_no', name: 'mobile_no',
value: _contact.value.mobile_no, value: _contact.value.mobile_no,
...sections.value[2].fields[1], ...sections.value[3].fields[0],
}, },
{ {
icon: OrganizationsIcon, icon: OrganizationsIcon,
@ -369,6 +371,10 @@ const sections = computed(() => {
_show.value = true _show.value = true
}, },
}, },
],
},
{
fields: [
{ {
label: 'Mobile no.', label: 'Mobile no.',
type: 'dropdown', type: 'dropdown',
@ -401,6 +407,16 @@ const sections = computed(() => {
_show.value = true _show.value = true
}, },
}, },
{
label: 'Gender',
type: 'link',
name: 'gender',
placeholder: 'Select gender',
doctype: 'Gender',
change: (value) => {
_contact.value.gender = value
},
},
], ],
}, },
{ {
@ -423,6 +439,29 @@ const sections = computed(() => {
}, },
], ],
}, },
{
fields: [
{
label: 'Designation',
type: 'data',
name: 'designation',
},
],
},
{
fields: [
{
label: 'Address',
type: 'link',
name: 'address',
placeholder: 'Select address',
doctype: 'Address',
change: (value) => {
_contact.value.address = value
},
},
],
},
] ]
}) })

View File

@ -30,7 +30,7 @@
:key="field.name" :key="field.name"
> >
<div class="grid w-7 place-content-center"> <div class="grid w-7 place-content-center">
<component class="" :is="field.icon" /> <component :is="field.icon" />
</div> </div>
<div>{{ field.value }}</div> <div>{{ field.value }}</div>
</div> </div>
@ -211,7 +211,7 @@ async function callInsertDoc() {
} }
function handleOrganizationUpdate(doc) { function handleOrganizationUpdate(doc) {
organizations.value?.reload() organizations.reload()
if (doc.name && props.options.redirect) { if (doc.name && props.options.redirect) {
router.push({ router.push({
name: 'Organization', name: 'Organization',