From 2198930185458ad2fa9610cf35d5e11e536f346a Mon Sep 17 00:00:00 2001 From: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com> Date: Mon, 13 Jun 2022 12:14:27 +0530 Subject: [PATCH] feat: Add snooze, reopen option to bulk actions (#4831) Co-authored-by: Pranav Raj S --- .../assets/scss/_utility-helpers.scss | 6 + .../dashboard/components/ChatList.vue | 60 ++++--- .../widgets/conversation/ConversationCard.vue | 3 +- .../conversationBulkActions/AgentSelector.vue | 47 +++-- .../{Actions.vue => Index.vue} | 85 +++++++-- .../conversationBulkActions/UpdateActions.vue | 166 ++++++++++++++++++ .../dashboard/i18n/locale/en/bulkActions.json | 33 ++-- .../shared/assets/stylesheets/z-index.scss | 1 + .../FluentIcon/dashboard-icons.json | 1 + 9 files changed, 331 insertions(+), 71 deletions(-) rename app/javascript/dashboard/components/widgets/conversation/conversationBulkActions/{Actions.vue => Index.vue} (61%) create mode 100644 app/javascript/dashboard/components/widgets/conversation/conversationBulkActions/UpdateActions.vue diff --git a/app/javascript/dashboard/assets/scss/_utility-helpers.scss b/app/javascript/dashboard/assets/scss/_utility-helpers.scss index 71977cf2b..4120af396 100644 --- a/app/javascript/dashboard/assets/scss/_utility-helpers.scss +++ b/app/javascript/dashboard/assets/scss/_utility-helpers.scss @@ -60,3 +60,9 @@ text-overflow: ellipsis; white-space: nowrap; } + +.flex-between { + align-items: center; + display: flex; + justify-content: space-between; +} diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 90eaa7b86..6f6b1961c 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -84,7 +84,18 @@

{{ $t('CHAT_LIST.LIST.404') }}

- +

{{ $t('CHAT_LIST.EOF') }} @@ -136,16 +143,6 @@ @applyFilter="onApplyFilter" /> - -

@@ -164,7 +161,7 @@ import advancedFilterTypes from './widgets/conversation/advancedFilterItems'; import filterQueryGenerator from '../helper/filterQueryGenerator.js'; import AddCustomViews from 'dashboard/routes/dashboard/customviews/AddCustomViews'; import DeleteCustomViews from 'dashboard/routes/dashboard/customviews/DeleteCustomViews.vue'; -import ConversationBulkActions from './widgets/conversation/conversationBulkActions/Actions.vue'; +import ConversationBulkActions from './widgets/conversation/conversationBulkActions/Index.vue'; import alertMixin from 'shared/mixins/alertMixin'; import { @@ -252,6 +249,13 @@ export default { } return {}; }, + showEndOfListMessage() { + return ( + this.conversationList.length && + this.hasCurrentPageEndReached && + !this.chatListLoading + ); + }, assigneeTabItems() { const ASSIGNEE_TYPE_TAB_KEYS = { me: 'mineCount', @@ -363,8 +367,10 @@ export default { }, allConversationsSelected() { return ( - JSON.stringify(this.selectedConversations) === - JSON.stringify(this.conversationList.map(item => item.id)) + this.conversationList.length === this.selectedConversations.length && + this.conversationList.every(el => + this.selectedConversations.includes(el.id) + ) ); }, uniqueInboxes() { @@ -592,21 +598,27 @@ export default { this.showAlert(this.$t('BULK_ACTION.ASSIGN_FAILED')); } }, - async onResolveConversations() { + async onUpdateConversations(status) { try { await this.$store.dispatch('bulkActions/process', { type: 'Conversation', ids: this.selectedConversations, fields: { - status: 'resolved', + status, }, }); this.selectedConversations = []; - this.showAlert(this.$t('BULK_ACTION.RESOLVE_SUCCESFUL')); - } catch (error) { - this.showAlert(this.$t('BULK_ACTION.RESOLVE_FAILED')); + this.showAlert(this.$t('BULK_ACTION.UPDATE.UPDATE_SUCCESFUL')); + } catch (err) { + this.showAlert(this.$t('BULK_ACTION.UPDATE.UPDATE_FAILED')); } }, + allSelectedConversationsStatus(status) { + if (!this.selectedConversations.length) return false; + return this.selectedConversations.every(item => { + return this.$store.getters.getConversationById(item).status === status; + }); + }, }, }; diff --git a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue index ee12b989a..7b90ef6eb 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue @@ -11,14 +11,13 @@ @mouseleave="onCardLeave" @click="cardClick(chat)" > -