2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
2019-08-25 05:34:33 +00:00
|
|
|
<router-link
|
|
|
|
:to="menuItem.toState"
|
|
|
|
tag="li"
|
|
|
|
active-class="active"
|
|
|
|
:class="computedClass"
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
:class="getMenuItemClass"
|
|
|
|
data-tooltip
|
|
|
|
aria-haspopup="true"
|
|
|
|
:title="menuItem.toolTip"
|
|
|
|
>
|
|
|
|
<i :class="menuItem.icon" />
|
|
|
|
{{ menuItem.label }}
|
|
|
|
<span
|
|
|
|
v-if="showItem(menuItem)"
|
|
|
|
class="ion-ios-plus-outline"
|
|
|
|
@click.prevent="newLinkClick"
|
|
|
|
/>
|
2019-08-14 09:48:44 +00:00
|
|
|
</a>
|
2019-08-25 05:34:33 +00:00
|
|
|
<ul v-if="menuItem.hasSubMenu" class="nested vertical menu">
|
2019-08-14 09:48:44 +00:00
|
|
|
<router-link
|
|
|
|
v-for="child in menuItem.children"
|
2019-08-25 05:34:33 +00:00
|
|
|
:key="child.label"
|
|
|
|
active-class="active flex-container"
|
2019-08-14 09:48:44 +00:00
|
|
|
:class="computedInboxClass(child)"
|
2019-08-25 05:34:33 +00:00
|
|
|
tag="li"
|
|
|
|
:to="child.toState"
|
2019-08-14 09:48:44 +00:00
|
|
|
>
|
2019-08-25 05:34:33 +00:00
|
|
|
<a>{{ child.label }}</a>
|
2019-08-14 09:48:44 +00:00
|
|
|
</router-link>
|
|
|
|
</ul>
|
|
|
|
</router-link>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
/* eslint no-console: 0 */
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
|
|
|
|
import router from '../../routes';
|
|
|
|
import auth from '../../api/auth';
|
|
|
|
|
|
|
|
export default {
|
2019-08-25 05:34:33 +00:00
|
|
|
props: {
|
|
|
|
menuItem: {
|
|
|
|
type: Object,
|
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
|
|
|
activeInbox: 'getSelectedInbox',
|
|
|
|
}),
|
|
|
|
getMenuItemClass() {
|
2019-08-25 05:34:33 +00:00
|
|
|
return this.menuItem.cssClass
|
|
|
|
? `side-menu ${this.menuItem.cssClass}`
|
|
|
|
: 'side-menu';
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
computedClass() {
|
|
|
|
// If active Inbox is present
|
|
|
|
// donot highlight conversations
|
|
|
|
if (this.activeInbox) return ' ';
|
|
|
|
|
2019-08-25 05:34:33 +00:00
|
|
|
if (
|
|
|
|
this.$store.state.route.name === 'inbox_conversation' &&
|
|
|
|
this.menuItem.toStateName === 'home'
|
|
|
|
) {
|
2019-08-14 09:48:44 +00:00
|
|
|
return 'active';
|
|
|
|
}
|
|
|
|
return ' ';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
computedInboxClass(child) {
|
|
|
|
if (parseInt(this.activeInbox, 10) === child.channel_id) {
|
|
|
|
return 'active flex-container';
|
|
|
|
}
|
|
|
|
return ' ';
|
|
|
|
},
|
|
|
|
newLinkClick() {
|
|
|
|
router.push({ name: 'settings_inbox_new', params: { page: 'new' } });
|
|
|
|
},
|
|
|
|
showItem(item) {
|
|
|
|
return auth.isAdmin() && item.newLink !== undefined;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|