chore: Update availability status everywhere if the user changes the status from the account menu (#2581)
* add agent mixin * apply agent mixin in components * review fixes * fix specs
This commit is contained in:
parent
4a2195aeda
commit
64e69a85f8
5 changed files with 140 additions and 26 deletions
35
app/javascript/dashboard/mixins/agentMixin.js
Normal file
35
app/javascript/dashboard/mixins/agentMixin.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
assignableAgents() {
|
||||
return this.$store.getters['inboxAssignableAgents/getAssignableAgents'](
|
||||
this.inboxId
|
||||
);
|
||||
},
|
||||
...mapGetters({
|
||||
currentUser: 'getCurrentUser',
|
||||
}),
|
||||
agentsList() {
|
||||
const agents = this.assignableAgents || [];
|
||||
return [
|
||||
{
|
||||
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
|
||||
);
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue