From ba99d14f688de7eaa20be142e4b3184645b76305 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 30 Jul 2025 17:50:16 +0530 Subject: [PATCH] refactor: clean up unused variables and streamline tab management in Deal, Lead, and MobileLead components --- frontend/src/pages/Deal.vue | 1 + frontend/src/pages/Lead.vue | 24 ++++-------------------- frontend/src/pages/MobileLead.vue | 12 +----------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index 23be6907..7c8e9605 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -584,6 +584,7 @@ const tabs = computed(() => { ] return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true)) }) + const { tabIndex } = useActiveTabManager(tabs, 'lastDealTab') const sections = createResource({ diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index f098b3fe..7fd52dad 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -314,10 +314,13 @@ const props = defineProps({ }, }) +const reload = ref(false) +const activities = ref(null) const errorTitle = ref('') const errorMessage = ref('') const showDeleteLinkedDocModal = ref(false) const showConvertToDealModal = ref(false) +const showFilesUploader = ref(false) const { triggerOnChange, assignees, document, scripts, error } = useDocument( 'CRM Lead', @@ -362,9 +365,6 @@ watch( { once: true }, ) -const reload = ref(false) -const showFilesUploader = ref(false) - const breadcrumbs = computed(() => { let items = [{ label: __('Leads'), route: { name: 'Leads' } }] @@ -396,10 +396,7 @@ const title = computed(() => { }) usePageMeta(() => { - return { - title: title.value, - icon: brand.favicon, - } + return { title: title.value, icon: brand.favicon } }) const tabs = computed(() => { @@ -456,17 +453,6 @@ const tabs = computed(() => { const { tabIndex, changeTabTo } = useActiveTabManager(tabs, 'lastLeadTab') -watch(tabs, (value) => { - if (value && route.params.tabName) { - let index = value.findIndex( - (tab) => tab.name.toLowerCase() === route.params.tabName.toLowerCase(), - ) - if (index !== -1) { - tabIndex.value = index - } - } -}) - const sections = createResource({ url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections', cache: ['sidePanelSections', 'CRM Lead'], @@ -506,8 +492,6 @@ function deleteLead() { showDeleteLinkedDocModal.value = true } -const activities = ref(null) - function openEmailBox() { let currentTab = tabs.value[tabIndex.value] if (!['Emails', 'Comments', 'Activities'].includes(currentTab.name)) { diff --git a/frontend/src/pages/MobileLead.vue b/frontend/src/pages/MobileLead.vue index 2cf9911a..26669ad0 100644 --- a/frontend/src/pages/MobileLead.vue +++ b/frontend/src/pages/MobileLead.vue @@ -384,18 +384,8 @@ const tabs = computed(() => { ] return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true)) }) -const { tabIndex } = useActiveTabManager(tabs, 'lastLeadTab') -watch(tabs, (value) => { - if (value && route.params.tabName) { - let index = value.findIndex( - (tab) => tab.name.toLowerCase() === route.params.tabName.toLowerCase(), - ) - if (index !== -1) { - tabIndex.value = index - } - } -}) +const { tabIndex } = useActiveTabManager(tabs, 'lastLeadTab') const sections = createResource({ url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',