diff --git a/app/javascript/dashboard/api/inbox/conversation.js b/app/javascript/dashboard/api/inbox/conversation.js index 9f87d2aa5..159e77f0e 100644 --- a/app/javascript/dashboard/api/inbox/conversation.js +++ b/app/javascript/dashboard/api/inbox/conversation.js @@ -6,10 +6,11 @@ class ConversationApi extends ApiClient { super('conversations', { accountScoped: true }); } - get({ inboxId, status, assigneeType, page, labels }) { + get({ inboxId, status, assigneeType, page, labels, teamId }) { return axios.get(this.url, { params: { inbox_id: inboxId, + team_id: teamId, status, assignee_type: assigneeType, page, @@ -56,13 +57,14 @@ class ConversationApi extends ApiClient { return axios.post(`${this.url}/${conversationId}/unmute`); } - meta({ inboxId, status, assigneeType, labels }) { + meta({ inboxId, status, assigneeType, labels, teamId }) { return axios.get(`${this.url}/meta`, { params: { inbox_id: inboxId, status, assignee_type: assigneeType, labels, + team_id: teamId, }, }); } diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 06850ff38..8637c071a 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -80,6 +80,10 @@ export default { type: String, default: '', }, + activeTeam: { + type: Object, + default: () => {}, + }, }, data() { return { @@ -128,12 +132,16 @@ export default { status: this.activeStatus, page: this.currentPage + 1, labels: this.label ? [this.label] : undefined, + teamId: this.activeTeam.name ? this.activeTeam.id : undefined, }; }, pageTitle() { if (this.inbox.name) { return this.inbox.name; } + if (this.activeTeam.name) { + return this.activeTeam.name; + } if (this.label) { return `#${this.label}`; } @@ -162,6 +170,9 @@ export default { }, }, watch: { + activeTeam() { + this.resetAndFetchData(); + }, conversationInbox() { this.resetAndFetchData(); }, diff --git a/app/javascript/dashboard/components/layout/Sidebar.vue b/app/javascript/dashboard/components/layout/Sidebar.vue index c2e6c9117..19c56c2af 100644 --- a/app/javascript/dashboard/components/layout/Sidebar.vue +++ b/app/javascript/dashboard/components/layout/Sidebar.vue @@ -13,6 +13,11 @@ :key="item.toState" :menu-item="item" /> + ({ + id: team.id, + label: team.name, + truncateLabel: true, + toState: frontendURL(`accounts/${this.accountId}/team/${team.id}`), + })), + }; + }, dashboardPath() { return frontendURL(`accounts/${this.accountId}/dashboard`); }, @@ -179,6 +206,7 @@ export default { this.$store.dispatch('labels/get'); this.$store.dispatch('inboxes/get'); this.$store.dispatch('notifications/unReadCount'); + this.$store.dispatch('teams/get'); this.setChatwootUser(); }, methods: { @@ -305,4 +333,8 @@ export default { margin-left: auto; margin-top: auto; } + +.teams-sidebar-menu + .nested.vertical.menu { + padding-left: calc(var(--space-medium) - var(--space-one)); +} diff --git a/app/javascript/dashboard/i18n/default-sidebar.js b/app/javascript/dashboard/i18n/default-sidebar.js index 6ff2741df..c4074e433 100644 --- a/app/javascript/dashboard/i18n/default-sidebar.js +++ b/app/javascript/dashboard/i18n/default-sidebar.js @@ -14,6 +14,8 @@ export const getSidebarItems = accountId => ({ 'profile_settings_index', 'label_conversations', 'conversations_through_label', + 'team_conversations', + 'conversations_through_team', 'notifications_index', ], menuItems: { diff --git a/app/javascript/dashboard/i18n/locale/en/settings.json b/app/javascript/dashboard/i18n/locale/en/settings.json index 779ad71c8..6b42cf3f2 100644 --- a/app/javascript/dashboard/i18n/locale/en/settings.json +++ b/app/javascript/dashboard/i18n/locale/en/settings.json @@ -124,7 +124,8 @@ "CANNED_RESPONSES": "Canned Responses", "INTEGRATIONS": "Integrations", "ACCOUNT_SETTINGS": "Account Settings", - "LABELS": "Labels" + "LABELS": "Labels", + "TEAMS": "Teams" }, "CREATE_ACCOUNT": { "NEW_ACCOUNT": "New Account", diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue index 5323c538f..b6a7b6703 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue @@ -3,6 +3,7 @@