mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 20:48:07 +00:00
feat: Right click context menu action to change the priority (#6947)
* Right click context menu action to change the priority * Review comments * Update Index.vue * Remove selected priority from menu * Code cleanup * Update conversation.json
This commit is contained in:
@@ -125,6 +125,7 @@
|
|||||||
@update-conversation-status="toggleConversationStatus"
|
@update-conversation-status="toggleConversationStatus"
|
||||||
@context-menu-toggle="onContextMenuToggle"
|
@context-menu-toggle="onContextMenuToggle"
|
||||||
@mark-as-unread="markAsUnread"
|
@mark-as-unread="markAsUnread"
|
||||||
|
@assign-priority="assignPriority"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div v-if="chatListLoading" class="text-center">
|
<div v-if="chatListLoading" class="text-center">
|
||||||
@@ -670,6 +671,22 @@ export default {
|
|||||||
this.showAlert(this.$t('BULK_ACTION.ASSIGN_FAILED'));
|
this.showAlert(this.$t('BULK_ACTION.ASSIGN_FAILED'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async assignPriority(priority, conversationId = null) {
|
||||||
|
this.$store.dispatch('setCurrentChatPriority', {
|
||||||
|
priority,
|
||||||
|
conversationId,
|
||||||
|
});
|
||||||
|
this.$store
|
||||||
|
.dispatch('assignPriority', { conversationId, priority })
|
||||||
|
.then(() => {
|
||||||
|
this.showAlert(
|
||||||
|
this.$t('CONVERSATION.PRIORITY.CHANGE_PRIORITY.SUCCESSFUL', {
|
||||||
|
priority,
|
||||||
|
conversationId,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
async markAsUnread(conversationId) {
|
async markAsUnread(conversationId) {
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('markMessagesUnread', {
|
await this.$store.dispatch('markMessagesUnread', {
|
||||||
|
|||||||
@@ -109,12 +109,14 @@
|
|||||||
<conversation-context-menu
|
<conversation-context-menu
|
||||||
:status="chat.status"
|
:status="chat.status"
|
||||||
:inbox-id="inbox.id"
|
:inbox-id="inbox.id"
|
||||||
|
:priority="chat.priority"
|
||||||
:has-unread-messages="hasUnread"
|
:has-unread-messages="hasUnread"
|
||||||
@update-conversation="onUpdateConversation"
|
@update-conversation="onUpdateConversation"
|
||||||
@assign-agent="onAssignAgent"
|
@assign-agent="onAssignAgent"
|
||||||
@assign-label="onAssignLabel"
|
@assign-label="onAssignLabel"
|
||||||
@assign-team="onAssignTeam"
|
@assign-team="onAssignTeam"
|
||||||
@mark-as-unread="markAsUnread"
|
@mark-as-unread="markAsUnread"
|
||||||
|
@assign-priority="assignPriority"
|
||||||
/>
|
/>
|
||||||
</woot-context-menu>
|
</woot-context-menu>
|
||||||
</div>
|
</div>
|
||||||
@@ -375,6 +377,10 @@ export default {
|
|||||||
this.$emit('mark-as-unread', this.chat.id);
|
this.$emit('mark-as-unread', this.chat.id);
|
||||||
this.closeContextMenu();
|
this.closeContextMenu();
|
||||||
},
|
},
|
||||||
|
async assignPriority(priority) {
|
||||||
|
this.$emit('assign-priority', priority, this.chat.id);
|
||||||
|
this.closeContextMenu();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -23,6 +23,14 @@
|
|||||||
@click="snoozeConversation(option.snoozedUntil)"
|
@click="snoozeConversation(option.snoozedUntil)"
|
||||||
/>
|
/>
|
||||||
</menu-item-with-submenu>
|
</menu-item-with-submenu>
|
||||||
|
<menu-item-with-submenu :option="priorityConfig">
|
||||||
|
<menu-item
|
||||||
|
v-for="(option, i) in priorityConfig.options"
|
||||||
|
:key="i"
|
||||||
|
:option="option"
|
||||||
|
@click="assignPriority(option.key)"
|
||||||
|
/>
|
||||||
|
</menu-item-with-submenu>
|
||||||
<menu-item-with-submenu
|
<menu-item-with-submenu
|
||||||
:option="labelMenuConfig"
|
:option="labelMenuConfig"
|
||||||
:sub-menu-available="!!labels.length"
|
:sub-menu-available="!!labels.length"
|
||||||
@@ -93,6 +101,10 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
priority: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -140,6 +152,33 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
priorityConfig: {
|
||||||
|
key: 'priority',
|
||||||
|
label: this.$t('CONVERSATION.PRIORITY.TITLE'),
|
||||||
|
icon: 'warning',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: this.$t('CONVERSATION.PRIORITY.OPTIONS.NONE'),
|
||||||
|
key: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('CONVERSATION.PRIORITY.OPTIONS.URGENT'),
|
||||||
|
key: 'urgent',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('CONVERSATION.PRIORITY.OPTIONS.HIGH'),
|
||||||
|
key: 'high',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('CONVERSATION.PRIORITY.OPTIONS.MEDIUM'),
|
||||||
|
key: 'medium',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: this.$t('CONVERSATION.PRIORITY.OPTIONS.LOW'),
|
||||||
|
key: 'low',
|
||||||
|
},
|
||||||
|
].filter(item => item.key !== this.priority),
|
||||||
|
},
|
||||||
labelMenuConfig: {
|
labelMenuConfig: {
|
||||||
key: 'label',
|
key: 'label',
|
||||||
icon: 'tag',
|
icon: 'tag',
|
||||||
@@ -193,6 +232,9 @@ export default {
|
|||||||
this.snoozeTimes[snoozedUntil] || null
|
this.snoozeTimes[snoozedUntil] || null
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
assignPriority(priority) {
|
||||||
|
this.$emit('assign-priority', priority);
|
||||||
|
},
|
||||||
show(key) {
|
show(key) {
|
||||||
// If the conversation status is same as the action, then don't display the option
|
// If the conversation status is same as the action, then don't display the option
|
||||||
// i.e.: Don't show an option to resolve if the conversation is already resolved.
|
// i.e.: Don't show an option to resolve if the conversation is already resolved.
|
||||||
|
|||||||
Reference in New Issue
Block a user