Chatwoot/app/javascript/dashboard/mixins/agentMixin.js
Pranav Raj S e849759e15
feat: Add Command bar for improved productivity (#3352)
Co-authored-by: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com>
2021-11-15 17:22:44 +05:30

40 lines
958 B
JavaScript

import { mapGetters } from 'vuex';
export default {
computed: {
assignableAgents() {
return this.$store.getters['inboxAssignableAgents/getAssignableAgents'](
this.inboxId
);
},
...mapGetters({ currentUser: 'getCurrentUser' }),
isAgentSelected() {
return this.currentChat?.meta?.assignee;
},
agentsList() {
const agents = this.assignableAgents || [];
return [
...(this.isAgentSelected
? [
{
confirmed: true,
name: 'None',
id: 0,
role: 'agent',
account_id: 0,
email: 'None',
},
]
: []),
...agents,
].map(item =>
item.id === this.currentUser.id
? {
...item,
availability_status: this.currentUser.availability_status,
}
: item
);
},
},
};