diff --git a/app/javascript/dashboard/i18n/locale/en/generalSettings.json b/app/javascript/dashboard/i18n/locale/en/generalSettings.json index 367b35b1c..7ed6d8925 100644 --- a/app/javascript/dashboard/i18n/locale/en/generalSettings.json +++ b/app/javascript/dashboard/i18n/locale/en/generalSettings.json @@ -101,6 +101,7 @@ "REPORTS": "Reports", "CONVERSATION": "Conversation", "CHANGE_ASSIGNEE": "Change Assignee", + "CHANGE_PRIORITY": "Change Priority", "CHANGE_TEAM": "Change Team", "ADD_LABEL": "Add label to the conversation", "REMOVE_LABEL": "Remove label from the conversation", @@ -126,6 +127,7 @@ "GO_TO_NOTIFICATIONS": "Go to Notifications", "ADD_LABELS_TO_CONVERSATION": "Add label to the conversation", "ASSIGN_AN_AGENT": "Assign an agent", + "ASSIGN_PRIORITY": "Assign priority", "ASSIGN_A_TEAM": "Assign a team", "MUTE_CONVERSATION": "Mute conversation", "UNMUTE_CONVERSATION": "Unmute conversation", diff --git a/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js b/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js index d0d0bb633..4a4bd9cf0 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js +++ b/app/javascript/dashboard/routes/dashboard/commands/CommandBarIcons.js @@ -26,3 +26,36 @@ export const ICON_LABELS = ``; export const ICON_INBOXES = ``; export const ICON_APPS = ``; +export const ICON_ASSIGN_PRIORITY = ``; +export const ICON_PRIORITY_URGENT = ` + + + + + + + + +`; +export const ICON_PRIORITY_HIGH = ` + + + + +`; + +export const ICON_PRIORITY_MEDIUM = ` + + + +`; + +export const ICON_PRIORITY_LOW = ` + + +`; + +export const ICON_PRIORITY_NONE = ` + + +`; diff --git a/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js b/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js index 7090406ce..01bd6a2f5 100644 --- a/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js +++ b/app/javascript/dashboard/routes/dashboard/commands/conversationHotKeys.js @@ -12,6 +12,7 @@ import { import { ICON_ADD_LABEL, ICON_ASSIGN_AGENT, + ICON_ASSIGN_PRIORITY, ICON_ASSIGN_TEAM, ICON_MUTE_CONVERSATION, ICON_REMOVE_LABEL, @@ -23,6 +24,11 @@ import { ICON_SNOOZE_UNTIL_NEXT_WEEK, ICON_SNOOZE_UNTIL_TOMORRROW, ICON_UNMUTE_CONVERSATION, + ICON_PRIORITY_URGENT, + ICON_PRIORITY_HIGH, + ICON_PRIORITY_LOW, + ICON_PRIORITY_MEDIUM, + ICON_PRIORITY_NONE, } from './CommandBarIcons'; const OPEN_CONVERSATION_ACTIONS = [ @@ -145,6 +151,35 @@ export default { } return this.prepareActions(actions); }, + priorityOptions() { + return [ + { + label: this.$t('CONVERSATION.PRIORITY.OPTIONS.NONE'), + key: null, + icon: ICON_PRIORITY_NONE, + }, + { + label: this.$t('CONVERSATION.PRIORITY.OPTIONS.URGENT'), + key: 'urgent', + icon: ICON_PRIORITY_URGENT, + }, + { + label: this.$t('CONVERSATION.PRIORITY.OPTIONS.HIGH'), + key: 'high', + icon: ICON_PRIORITY_HIGH, + }, + { + label: this.$t('CONVERSATION.PRIORITY.OPTIONS.MEDIUM'), + key: 'medium', + icon: ICON_PRIORITY_MEDIUM, + }, + { + label: this.$t('CONVERSATION.PRIORITY.OPTIONS.LOW'), + key: 'low', + icon: ICON_PRIORITY_LOW, + }, + ].filter(item => item.key !== this.currentChat?.priority); + }, assignAgentActions() { const agentOptions = this.agentsList.map(agent => ({ id: `agent-${agent.id}`, @@ -166,6 +201,27 @@ export default { ...agentOptions, ]; }, + assignPriorityActions() { + const options = this.priorityOptions.map(priority => ({ + id: `priority-${priority.key}`, + title: priority.label, + parent: 'assign_priority', + section: this.$t('COMMAND_BAR.SECTIONS.CHANGE_PRIORITY'), + priority: priority, + icon: priority.icon, + handler: this.onChangePriority, + })); + return [ + { + id: 'assign_priority', + title: this.$t('COMMAND_BAR.COMMANDS.ASSIGN_PRIORITY'), + section: this.$t('COMMAND_BAR.SECTIONS.CONVERSATION'), + icon: ICON_ASSIGN_PRIORITY, + children: options.map(option => option.id), + }, + ...options, + ]; + }, assignTeamActions() { const teamOptions = this.teamsList.map(team => ({ id: `team-${team.id}`, @@ -248,6 +304,7 @@ export default { ...this.assignAgentActions, ...this.assignTeamActions, ...this.labelActions, + ...this.assignPriorityActions, ]; } @@ -262,6 +319,12 @@ export default { agentId: action.agentInfo.id, }); }, + onChangePriority(action) { + this.$store.dispatch('assignPriority', { + conversationId: this.currentChat.id, + priority: action.priority.key, + }); + }, onChangeTeam(action) { this.$store.dispatch('assignTeam', { conversationId: this.currentChat.id,