From f2b5e328bb6bd3fa614288bce96eea258e8c7bf8 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:44:37 +0530 Subject: [PATCH] feat: Update agent and team multi-select with new multi-select dropdown (#2516) * feat: Update agent/team multiselect styles * Component name fixes * Adds key control for our multiselect dropdown and component name spell fix * Minor fixes * Review fixes * Minor fixes * Minor fixes * Review fixes Co-authored-by: Muhsin Keloth Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> --- .../dashboard/i18n/locale/en/agentMgmt.json | 17 ++++ .../dashboard/conversation/ContactPanel.vue | 79 +++++++++++-------- .../ui/MultiselectDropdown.stories.js | 2 +- ...ctDropdown.vue => MultiselectDropdown.vue} | 6 +- .../ui/MultiselectDropdownItems.vue | 54 +++++++++++-- 5 files changed, 117 insertions(+), 41 deletions(-) rename app/javascript/shared/components/ui/{MutiselectDropdown.vue => MultiselectDropdown.vue} (97%) diff --git a/app/javascript/dashboard/i18n/locale/en/agentMgmt.json b/app/javascript/dashboard/i18n/locale/en/agentMgmt.json index dcc8c9fda..0f965c717 100644 --- a/app/javascript/dashboard/i18n/locale/en/agentMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/agentMgmt.json @@ -91,6 +91,23 @@ }, "SEARCH": { "NO_RESULTS": "No results found." + }, + "MULTI_SELECTOR": { + "PLACEHOLDER": "None", + "TITLE": { + "AGENT": "Select agent", + "TEAM": "Select team" + }, + "SEARCH": { + "NO_RESULTS": { + "AGENT": "No agents found", + "TEAM": "No teams found" + }, + "PLACEHOLDER": { + "AGENT": "Search agents", + "TEAM": "Search teams" + } + } } } } diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue index f2e7a8870..0231d3e01 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue @@ -24,27 +24,21 @@ - - - {{ $t('AGENT_MGMT.SEARCH.NO_RESULTS') }} - + :selected-item="assignedAgent" + :multiselector-title="$t('AGENT_MGMT.MULTI_SELECTOR.TITLE.AGENT')" + :multiselector-placeholder=" + $t('AGENT_MGMT.MULTI_SELECTOR.PLACEHOLDER') + " + :no-search-result=" + $t('AGENT_MGMT.MULTI_SELECTOR.SEARCH.NO_RESULTS.AGENT') + " + :input-placeholder=" + $t('AGENT_MGMT.MULTI_SELECTOR.SEARCH.PLACEHOLDER.AGENT') + " + @click="onClickAssignAgent" + />
- - {{ $t('AGENT_MGMT.SEARCH.NO_RESULTS') }} - + :selected-item="assignedTeam" + :multiselector-title="$t('AGENT_MGMT.MULTI_SELECTOR.TITLE.TEAM')" + :multiselector-placeholder=" + $t('AGENT_MGMT.MULTI_SELECTOR.PLACEHOLDER') + " + :no-search-result=" + $t('AGENT_MGMT.MULTI_SELECTOR.SEARCH.NO_RESULTS.TEAM') + " + :input-placeholder=" + $t('AGENT_MGMT.MULTI_SELECTOR.SEARCH.PLACEHOLDER.TEAM') + " + @click="onClickAssignTeam" + />
@@ -138,7 +134,7 @@ import ContactDetailsItem from './ContactDetailsItem.vue'; import ContactInfo from './contact/ContactInfo'; import ConversationLabels from './labels/LabelBox.vue'; import ContactCustomAttributes from './ContactCustomAttributes'; -import AvailabilityStatusBadge from 'dashboard/components/widgets/conversation/AvailabilityStatusBadge.vue'; +import MultiselectDropdown from 'shared/components/ui/MultiselectDropdown.vue'; import flag from 'country-code-emoji'; @@ -149,7 +145,7 @@ export default { ContactDetailsItem, ContactInfo, ConversationLabels, - AvailabilityStatusBadge, + MultiselectDropdown, }, mixins: [alertMixin, agentMixin], props: { @@ -330,6 +326,21 @@ export default { }; this.assignedAgent = selfAssign; }, + onClickAssignAgent(selectedItem) { + if (this.assignedAgent && this.assignedAgent.id === selectedItem.id) { + this.assignedAgent = null; + } else { + this.assignedAgent = selectedItem; + } + }, + + onClickAssignTeam(selectedItemTeam) { + if (this.assignedTeam && this.assignedTeam.id === selectedItemTeam.id) { + this.assignedTeam = null; + } else { + this.assignedTeam = selectedItemTeam; + } + }, }, }; diff --git a/app/javascript/shared/components/ui/MultiselectDropdown.stories.js b/app/javascript/shared/components/ui/MultiselectDropdown.stories.js index ff3f366f0..8b067e489 100644 --- a/app/javascript/shared/components/ui/MultiselectDropdown.stories.js +++ b/app/javascript/shared/components/ui/MultiselectDropdown.stories.js @@ -1,5 +1,5 @@ import { action } from '@storybook/addon-actions'; -import Dropdown from './MutiselectDropdown'; +import Dropdown from './MultiselectDropdown'; export default { title: 'Components/Dropdown/Multiselect Dropdown', diff --git a/app/javascript/shared/components/ui/MutiselectDropdown.vue b/app/javascript/shared/components/ui/MultiselectDropdown.vue similarity index 97% rename from app/javascript/shared/components/ui/MutiselectDropdown.vue rename to app/javascript/shared/components/ui/MultiselectDropdown.vue index 5f99a8dbd..cf90179b2 100644 --- a/app/javascript/shared/components/ui/MutiselectDropdown.vue +++ b/app/javascript/shared/components/ui/MultiselectDropdown.vue @@ -1,5 +1,9 @@