From 1650566504a10d578c58008e00218783276808e2 Mon Sep 17 00:00:00 2001 From: Lera24 Date: Mon, 18 Mar 2024 16:15:39 +0200 Subject: [PATCH] fix: routes in communication tabs[WTEL-4296] --- src/app/router/index.js | 13 ++++++++++ .../opened-contact-communications.vue | 25 ++++++++++++++++--- .../components/opened-contact-tabs.vue | 7 +++++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/app/router/index.js b/src/app/router/index.js index aa08eb0f..571c8363 100644 --- a/src/app/router/index.js +++ b/src/app/router/index.js @@ -62,9 +62,22 @@ const routes = [ children: [ { path: 'communications', + redirect: { + name: `${CrmSections.CONTACTS}-communications-phones` + }, name: `${CrmSections.CONTACTS}-communications`, component: ContactCommunications, }, + { + path: 'communications/phones', + name: `${CrmSections.CONTACTS}-communications-phones`, + component: ContactCommunications, + }, + { + path: 'communications/emails', + name: `${CrmSections.CONTACTS}-communications-emails`, + component: ContactCommunications, + }, { path: 'variables', name: `${CrmSections.CONTACTS}-variables`, diff --git a/src/modules/contacts/components/opened-contact-communications.vue b/src/modules/contacts/components/opened-contact-communications.vue index 14089800..73ac50a2 100644 --- a/src/modules/contacts/components/opened-contact-communications.vue +++ b/src/modules/contacts/components/opened-contact-communications.vue @@ -7,7 +7,7 @@ :disabled="currentTab.value === tab.value" :color="currentTab.value !== tab.value && 'secondary'" wide - @click="currentTab = tab" + @click="changeTab(tab)" > diff --git a/src/modules/contacts/components/opened-contact-tabs.vue b/src/modules/contacts/components/opened-contact-tabs.vue index 27cd5009..3aca3cc6 100644 --- a/src/modules/contacts/components/opened-contact-tabs.vue +++ b/src/modules/contacts/components/opened-contact-tabs.vue @@ -51,7 +51,12 @@ const tabs = computed(() => [ }, ]); -const currentTab = computed(() => tabs.value.find(({ pathName }) => pathName === route.name)); +const currentTab = computed(() => { + if(route.name.includes('communications')) { + return tabs.value.find(tab => tab.value === 'communications') + } + return tabs.value.find(({ pathName }) => pathName === route.name) +}); function changeTab(tab) { return router.push({ name: tab.pathName });