feat: Add the ability to save filters for contact (#3791)

This commit is contained in:
Sivin Varghese
2022-01-22 03:41:59 +05:30
committed by GitHub
parent 693f2531ab
commit 504fc24fb3
12 changed files with 203 additions and 31 deletions

View File

@@ -57,6 +57,9 @@ export default {
hasSecondaryMenu() {
return this.menuConfig.menuItems && this.menuConfig.menuItems.length;
},
contactCustomViews() {
return this.customViews.filter(view => view.filter_type === 'contact');
},
accessibleMenuItems() {
if (!this.currentRole) {
return [];
@@ -157,7 +160,7 @@ export default {
customViewsSection() {
return {
icon: 'folder',
label: 'CUSTOM_VIEWS',
label: 'CUSTOM_VIEWS_FOLDER',
hasSubMenu: true,
key: 'custom_view',
children: this.customViews
@@ -172,8 +175,27 @@ export default {
})),
};
},
contactCustomViewsSection() {
return {
icon: 'folder',
label: 'CUSTOM_VIEWS_SEGMENTS',
hasSubMenu: true,
key: 'custom_view',
children: this.customViews
.filter(view => view.filter_type === 'contact')
.map(view => ({
id: view.id,
label: view.name,
truncateLabel: true,
toState: frontendURL(
`accounts/${this.accountId}/contacts/custom_view/${view.id}`
),
})),
};
},
additionalSecondaryMenuItems() {
let conversationMenuItems = [this.inboxSection, this.labelSection];
let contactMenuItems = [this.contactLabelSection];
if (this.teams.length) {
conversationMenuItems = [this.teamSection, ...conversationMenuItems];
}
@@ -183,9 +205,15 @@ export default {
...conversationMenuItems,
];
}
if (this.contactCustomViews.length) {
contactMenuItems = [
this.contactCustomViewsSection,
...contactMenuItems,
];
}
return {
conversations: conversationMenuItems,
contacts: [this.contactLabelSection],
contacts: contactMenuItems,
};
},
},