diff --git a/frontend/src/components/Modals/ContactModal.vue b/frontend/src/components/Modals/ContactModal.vue index 9a7570a9..47315e7a 100644 --- a/frontend/src/components/Modals/ContactModal.vue +++ b/frontend/src/components/Modals/ContactModal.vue @@ -22,13 +22,12 @@ -
- -
+
@@ -53,7 +52,7 @@ import EditIcon from '@/components/Icons/EditIcon.vue' import { usersStore } from '@/stores/users' import { capture } from '@/telemetry' import { call, createResource } from 'frappe-ui' -import { ref, nextTick, watch, computed } from 'vue' +import { ref, nextTick, watch } from 'vue' import { useRouter } from 'vue-router' const props = defineProps({ @@ -127,7 +126,25 @@ const tabs = createResource({ tab.sections.forEach((section) => { section.columns.forEach((column) => { 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] = [] } }) @@ -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( () => show.value, (value) => { diff --git a/frontend/src/components/Modals/OrganizationModal.vue b/frontend/src/components/Modals/OrganizationModal.vue index 1b5dfde0..227ab89e 100644 --- a/frontend/src/components/Modals/OrganizationModal.vue +++ b/frontend/src/components/Modals/OrganizationModal.vue @@ -22,13 +22,12 @@
-
- -
+
@@ -53,7 +52,7 @@ import EditIcon from '@/components/Icons/EditIcon.vue' import { usersStore } from '@/stores/users' import { capture } from '@/telemetry' 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' const props = defineProps({ @@ -126,7 +125,21 @@ const tabs = createResource({ tab.sections.forEach((section) => { section.columns.forEach((column) => { 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] = [] } }) @@ -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( () => show.value, (value) => {