fix: allow tabs in contact & organization quick entry modal
This commit is contained in:
parent
2081123e3e
commit
187b887c8d
@ -22,13 +22,12 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="filteredSections.length">
|
<FieldLayout
|
||||||
<FieldLayout
|
v-if="tabs.data?.length"
|
||||||
:tabs="filteredSections"
|
:tabs="tabs.data"
|
||||||
:data="_contact"
|
:data="_contact"
|
||||||
doctype="Contact"
|
doctype="Contact"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 pb-7 pt-4 sm:px-6">
|
<div class="px-4 pb-7 pt-4 sm:px-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
@ -53,7 +52,7 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
|
|||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { capture } from '@/telemetry'
|
import { capture } from '@/telemetry'
|
||||||
import { call, createResource } from 'frappe-ui'
|
import { call, createResource } from 'frappe-ui'
|
||||||
import { ref, nextTick, watch, computed } from 'vue'
|
import { ref, nextTick, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -127,7 +126,25 @@ const tabs = createResource({
|
|||||||
tab.sections.forEach((section) => {
|
tab.sections.forEach((section) => {
|
||||||
section.columns.forEach((column) => {
|
section.columns.forEach((column) => {
|
||||||
column.fields.forEach((field) => {
|
column.fields.forEach((field) => {
|
||||||
if (field.type === 'Table') {
|
if (field.name == 'email_id') {
|
||||||
|
field.read_only = false
|
||||||
|
} else if (field.name == 'mobile_no') {
|
||||||
|
field.read_only = false
|
||||||
|
} else if (field.name == 'address') {
|
||||||
|
field.create = (value, close) => {
|
||||||
|
_contact.value.address = value
|
||||||
|
_address.value = {}
|
||||||
|
showAddressModal.value = true
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
field.edit = async (addr) => {
|
||||||
|
_address.value = await call('frappe.client.get', {
|
||||||
|
doctype: 'Address',
|
||||||
|
name: addr,
|
||||||
|
})
|
||||||
|
showAddressModal.value = true
|
||||||
|
}
|
||||||
|
} else if (field.type === 'Table') {
|
||||||
_contact.value[field.name] = []
|
_contact.value[field.name] = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -137,33 +154,6 @@ const tabs = createResource({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const filteredSections = computed(() => {
|
|
||||||
let allSections = tabs.data?.[0]?.sections || []
|
|
||||||
if (!allSections.length) return []
|
|
||||||
|
|
||||||
allSections.forEach((s) => {
|
|
||||||
s.fields.forEach((field) => {
|
|
||||||
if (field.name == 'address') {
|
|
||||||
field.create = (value, close) => {
|
|
||||||
_contact.value.address = value
|
|
||||||
_address.value = {}
|
|
||||||
showAddressModal.value = true
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
field.edit = async (addr) => {
|
|
||||||
_address.value = await call('frappe.client.get', {
|
|
||||||
doctype: 'Address',
|
|
||||||
name: addr,
|
|
||||||
})
|
|
||||||
showAddressModal.value = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
return [{ sections: allSections }]
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => show.value,
|
() => show.value,
|
||||||
(value) => {
|
(value) => {
|
||||||
|
|||||||
@ -22,13 +22,12 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="filteredSections.length">
|
<FieldLayout
|
||||||
<FieldLayout
|
v-if="tabs.data?.length"
|
||||||
:tabs="filteredSections"
|
:tabs="tabs.data"
|
||||||
:data="_organization"
|
:data="_organization"
|
||||||
doctype="CRM Organization"
|
doctype="CRM Organization"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 pb-7 pt-4 sm:px-6">
|
<div class="px-4 pb-7 pt-4 sm:px-6">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
@ -53,7 +52,7 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
|
|||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { capture } from '@/telemetry'
|
import { capture } from '@/telemetry'
|
||||||
import { call, FeatherIcon, createResource } from 'frappe-ui'
|
import { call, FeatherIcon, createResource } from 'frappe-ui'
|
||||||
import { ref, nextTick, watch, computed } from 'vue'
|
import { ref, nextTick, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -126,7 +125,21 @@ const tabs = createResource({
|
|||||||
tab.sections.forEach((section) => {
|
tab.sections.forEach((section) => {
|
||||||
section.columns.forEach((column) => {
|
section.columns.forEach((column) => {
|
||||||
column.fields.forEach((field) => {
|
column.fields.forEach((field) => {
|
||||||
if (field.type === 'Table') {
|
if (field.name == 'address') {
|
||||||
|
field.create = (value, close) => {
|
||||||
|
_organization.value.address = value
|
||||||
|
_address.value = {}
|
||||||
|
showAddressModal.value = true
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
field.edit = (addr) => {
|
||||||
|
_address.value = await call('frappe.client.get', {
|
||||||
|
doctype: 'Address',
|
||||||
|
name: addr,
|
||||||
|
})
|
||||||
|
showAddressModal.value = true
|
||||||
|
}
|
||||||
|
} else if (field.type === 'Table') {
|
||||||
_organization.value[field.name] = []
|
_organization.value[field.name] = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -136,33 +149,6 @@ const tabs = createResource({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const filteredSections = computed(() => {
|
|
||||||
let allSections = tabs.data?.[0]?.sections || []
|
|
||||||
if (!allSections.length) return []
|
|
||||||
|
|
||||||
allSections.forEach((s) => {
|
|
||||||
s.fields.forEach((field) => {
|
|
||||||
if (field.name == 'address') {
|
|
||||||
field.create = (value, close) => {
|
|
||||||
_organization.value.address = value
|
|
||||||
_address.value = {}
|
|
||||||
showAddressModal.value = true
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
field.edit = async (addr) => {
|
|
||||||
_address.value = await call('frappe.client.get', {
|
|
||||||
doctype: 'Address',
|
|
||||||
name: addr,
|
|
||||||
})
|
|
||||||
showAddressModal.value = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
return [{ sections: allSections }]
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => show.value,
|
() => show.value,
|
||||||
(value) => {
|
(value) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user