diff --git a/src/app/router/index.js b/src/app/router/index.js index aa08eb0f..82691621 100644 --- a/src/app/router/index.js +++ b/src/app/router/index.js @@ -62,9 +62,25 @@ const routes = [ children: [ { path: 'communications', + redirect: { + name: `${CrmSections.CONTACTS}-communications-phones`, + }, name: `${CrmSections.CONTACTS}-communications`, component: ContactCommunications, + children: [ + { + path: 'phones', + name: `${CrmSections.CONTACTS}-communications-phones`, + component: ContactCommunications, + }, + { + path: '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..7bbf2638 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..9b1098c9 100644 --- a/src/modules/contacts/components/opened-contact-tabs.vue +++ b/src/modules/contacts/components/opened-contact-tabs.vue @@ -51,19 +51,13 @@ const tabs = computed(() => [ }, ]); -const currentTab = computed(() => tabs.value.find(({ pathName }) => pathName === route.name)); +const currentTab = computed(() => { + return tabs.value.find(({ pathName }) => route?.matched?.find(({name}) => name === pathName)); +}); function changeTab(tab) { return router.push({ name: tab.pathName }); } - -function initializeTab() { - if (!currentTab.value) changeTab(tabs.value[0]); -} - -onMounted(() => { - initializeTab(); -});