fix: allow tabs in contact & organization quick entry modal
This commit is contained in:
parent
2081123e3e
commit
187b887c8d
@ -22,14 +22,13 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="filteredSections.length">
|
|
||||||
<FieldLayout
|
<FieldLayout
|
||||||
:tabs="filteredSections"
|
v-if="tabs.data?.length"
|
||||||
|
: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">
|
||||||
<Button
|
<Button
|
||||||
@ -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,23 +126,11 @@ 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') {
|
||||||
_contact.value[field.name] = []
|
field.read_only = false
|
||||||
}
|
} else if (field.name == 'mobile_no') {
|
||||||
})
|
field.read_only = false
|
||||||
})
|
} else if (field.name == 'address') {
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
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) => {
|
field.create = (value, close) => {
|
||||||
_contact.value.address = value
|
_contact.value.address = value
|
||||||
_address.value = {}
|
_address.value = {}
|
||||||
@ -157,11 +144,14 @@ const filteredSections = computed(() => {
|
|||||||
})
|
})
|
||||||
showAddressModal.value = true
|
showAddressModal.value = true
|
||||||
}
|
}
|
||||||
|
} else if (field.type === 'Table') {
|
||||||
|
_contact.value[field.name] = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
return [{ sections: allSections }]
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@ -22,14 +22,13 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="filteredSections.length">
|
|
||||||
<FieldLayout
|
<FieldLayout
|
||||||
:tabs="filteredSections"
|
v-if="tabs.data?.length"
|
||||||
|
: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">
|
||||||
<Button
|
<Button
|
||||||
@ -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,22 +125,6 @@ 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') {
|
|
||||||
_organization.value[field.name] = []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const filteredSections = computed(() => {
|
|
||||||
let allSections = tabs.data?.[0]?.sections || []
|
|
||||||
if (!allSections.length) return []
|
|
||||||
|
|
||||||
allSections.forEach((s) => {
|
|
||||||
s.fields.forEach((field) => {
|
|
||||||
if (field.name == 'address') {
|
if (field.name == 'address') {
|
||||||
field.create = (value, close) => {
|
field.create = (value, close) => {
|
||||||
_organization.value.address = value
|
_organization.value.address = value
|
||||||
@ -149,18 +132,21 @@ const filteredSections = computed(() => {
|
|||||||
showAddressModal.value = true
|
showAddressModal.value = true
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
field.edit = async (addr) => {
|
field.edit = (addr) => {
|
||||||
_address.value = await call('frappe.client.get', {
|
_address.value = await call('frappe.client.get', {
|
||||||
doctype: 'Address',
|
doctype: 'Address',
|
||||||
name: addr,
|
name: addr,
|
||||||
})
|
})
|
||||||
showAddressModal.value = true
|
showAddressModal.value = true
|
||||||
}
|
}
|
||||||
|
} else if (field.type === 'Table') {
|
||||||
|
_organization.value[field.name] = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
return [{ sections: allSections }]
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user