From 4983b7ba9300dcc8a29883a2790c0b029ed3aefe Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 2 Jul 2024 13:20:14 +0530 Subject: [PATCH] feat: show quick entry layout edit button in respective modal and remove from settings --- .../src/components/Modals/ContactModal.vue | 31 +++-- frontend/src/components/Modals/DealModal.vue | 97 ++++++++----- frontend/src/components/Modals/LeadModal.vue | 63 ++++++--- .../components/Modals/OrganizationModal.vue | 12 +- .../components/Settings/QuickEntryLayout.vue | 113 ---------------- .../components/Settings/QuickEntryModal.vue | 127 ++++++++++++++++++ .../src/components/Settings/SettingsModal.vue | 6 - frontend/src/pages/Contact.vue | 8 ++ frontend/src/pages/Contacts.vue | 13 +- frontend/src/pages/Deals.vue | 8 ++ frontend/src/pages/Leads.vue | 4 + frontend/src/pages/Organization.vue | 8 ++ frontend/src/pages/Organizations.vue | 12 +- 13 files changed, 312 insertions(+), 190 deletions(-) delete mode 100644 frontend/src/components/Settings/QuickEntryLayout.vue create mode 100644 frontend/src/components/Settings/QuickEntryModal.vue diff --git a/frontend/src/components/Modals/ContactModal.vue b/frontend/src/components/Modals/ContactModal.vue index c8e855ca..08c8c5b5 100644 --- a/frontend/src/components/Modals/ContactModal.vue +++ b/frontend/src/components/Modals/ContactModal.vue @@ -10,10 +10,9 @@
@@ -92,7 +91,7 @@ import CertificateIcon from '@/components/Icons/CertificateIcon.vue' import EditIcon from '@/components/Icons/EditIcon.vue' import Dropdown from '@/components/frappe-ui/Dropdown.vue' import { call, createResource } from 'frappe-ui' -import { ref, nextTick, watch, computed, h } from 'vue' +import { ref, nextTick, watch, computed } from 'vue' import { createToast } from '@/utils' import { useRouter } from 'vue-router' @@ -237,7 +236,7 @@ const detailFields = computed(() => { const sections = createResource({ url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_fields_layout', cache: ['quickEntryFields', 'Contact'], - params: { doctype: 'Contact', type: 'Quick Entry'}, + params: { doctype: 'Contact', type: 'Quick Entry' }, auto: true, }) @@ -273,7 +272,7 @@ const filteredSections = computed(() => { onDelete: async (option, isNew) => { props.contact.data.email_ids = props.contact.data.email_ids.filter( - (email) => email.name !== option.name + (email) => email.name !== option.name, ) !isNew && (await deleteOption('Contact Email', option.name)) if (_contact.value.email_id === option.value) { @@ -281,7 +280,7 @@ const filteredSections = computed(() => { _contact.value.email_id = '' } else { _contact.value.email_id = props.contact.data.email_ids.find( - (email) => email.is_primary + (email) => email.is_primary, )?.email_id } } @@ -296,7 +295,10 @@ const filteredSections = computed(() => { isNew: true, }) } - } else if (field.name == 'mobile_no' || field.name == 'actual_mobile_no') { + } else if ( + field.name == 'mobile_no' || + field.name == 'actual_mobile_no' + ) { field.type = props.contact?.data?.name ? 'Dropdown' : 'Data' field.name = 'actual_mobile_no' field.options = @@ -323,7 +325,7 @@ const filteredSections = computed(() => { onDelete: async (option, isNew) => { props.contact.data.phone_nos = props.contact.data.phone_nos.filter( - (phone) => phone.name !== option.name + (phone) => phone.name !== option.name, ) !isNew && (await deleteOption('Contact Phone', option.name)) if (_contact.value.actual_mobile_no === option.value) { @@ -332,7 +334,7 @@ const filteredSections = computed(() => { } else { _contact.value.actual_mobile_no = props.contact.data.phone_nos.find( - (phone) => phone.is_primary_mobile_no + (phone) => phone.is_primary_mobile_no, )?.phone } } @@ -432,8 +434,17 @@ watch( editMode.value = true } }) - } + }, ) + +const showQuickEntryModal = defineModel('quickEntry') + +function openQuickEntryModal() { + showQuickEntryModal.value = true + nextTick(() => { + show.value = false + }) +}