2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
|
|
|
<div class="conv-header">
|
2021-03-02 17:14:04 +00:00
|
|
|
<div class="user">
|
2019-08-14 09:48:44 +00:00
|
|
|
<Thumbnail
|
2020-06-02 17:29:02 +00:00
|
|
|
:src="currentContact.thumbnail"
|
2019-08-14 09:48:44 +00:00
|
|
|
size="40px"
|
2020-07-04 14:16:17 +00:00
|
|
|
:badge="chatMetadata.channel"
|
2020-06-02 17:29:02 +00:00
|
|
|
:username="currentContact.name"
|
2020-07-04 06:12:47 +00:00
|
|
|
:status="currentContact.availability_status"
|
2019-08-14 09:48:44 +00:00
|
|
|
/>
|
2019-11-14 08:16:43 +00:00
|
|
|
<div class="user--profile__meta">
|
2021-03-02 17:14:04 +00:00
|
|
|
<h3 class="user--name text-truncate">
|
2020-06-02 17:29:02 +00:00
|
|
|
{{ currentContact.name }}
|
2019-11-14 08:16:43 +00:00
|
|
|
</h3>
|
2021-05-20 08:21:46 +00:00
|
|
|
<woot-button
|
|
|
|
class="user--profile__button"
|
|
|
|
size="small"
|
|
|
|
variant="link"
|
2020-08-17 05:55:13 +00:00
|
|
|
@click="$emit('contact-panel-toggle')"
|
2019-11-14 08:16:43 +00:00
|
|
|
>
|
2020-08-17 05:55:13 +00:00
|
|
|
{{
|
2021-03-02 17:14:04 +00:00
|
|
|
`${
|
|
|
|
isContactPanelOpen
|
|
|
|
? $t('CONVERSATION.HEADER.CLOSE')
|
|
|
|
: $t('CONVERSATION.HEADER.OPEN')
|
|
|
|
} ${$t('CONVERSATION.HEADER.DETAILS')}`
|
2020-08-17 05:55:13 +00:00
|
|
|
}}
|
2021-05-20 08:21:46 +00:00
|
|
|
</woot-button>
|
2019-11-14 08:16:43 +00:00
|
|
|
</div>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
2020-08-17 05:55:13 +00:00
|
|
|
<div
|
2020-09-03 08:41:07 +00:00
|
|
|
class="header-actions-wrap"
|
|
|
|
:class="{ 'has-open-sidebar': isContactPanelOpen }"
|
2020-08-17 05:55:13 +00:00
|
|
|
>
|
2021-04-07 06:15:33 +00:00
|
|
|
<div class="multiselect-box multiselect-wrap--small">
|
|
|
|
<i class="icon ion-headphone" />
|
2019-08-14 09:48:44 +00:00
|
|
|
<multiselect
|
|
|
|
v-model="currentChat.meta.assignee"
|
2021-04-09 09:02:29 +00:00
|
|
|
:loading="uiFlags.isFetching"
|
2020-12-08 18:01:25 +00:00
|
|
|
:allow-empty="true"
|
2021-04-19 16:54:45 +00:00
|
|
|
deselect-label=""
|
2019-08-14 09:48:44 +00:00
|
|
|
:options="agentList"
|
2020-12-08 18:01:25 +00:00
|
|
|
:placeholder="$t('CONVERSATION.ASSIGNMENT.SELECT_AGENT')"
|
2021-04-19 16:54:45 +00:00
|
|
|
select-label=""
|
2020-10-13 07:33:55 +00:00
|
|
|
label="name"
|
2020-07-04 14:16:17 +00:00
|
|
|
selected-label
|
2019-08-14 09:48:44 +00:00
|
|
|
track-by="id"
|
2019-10-27 13:31:59 +00:00
|
|
|
@select="assignAgent"
|
2019-08-14 09:48:44 +00:00
|
|
|
@remove="removeAgent"
|
2019-11-10 17:28:55 +00:00
|
|
|
>
|
2021-04-21 06:48:48 +00:00
|
|
|
<template slot="option" slot-scope="props">
|
|
|
|
<div class="option__desc">
|
|
|
|
<availability-status-badge
|
|
|
|
:status="props.option.availability_status"
|
|
|
|
/>
|
|
|
|
<span class="option__title">{{ props.option.name }}</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
2019-11-10 17:28:55 +00:00
|
|
|
<span slot="noResult">{{ $t('AGENT_MGMT.SEARCH.NO_RESULTS') }}</span>
|
|
|
|
</multiselect>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
2020-08-17 05:55:13 +00:00
|
|
|
<more-actions :conversation-id="currentChat.id" />
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
2020-08-17 05:55:13 +00:00
|
|
|
import MoreActions from './MoreActions';
|
2019-08-14 09:48:44 +00:00
|
|
|
import Thumbnail from '../Thumbnail';
|
2021-04-21 06:48:48 +00:00
|
|
|
import AvailabilityStatusBadge from '../conversation/AvailabilityStatusBadge';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
export default {
|
2019-10-27 13:31:59 +00:00
|
|
|
components: {
|
2020-08-17 05:55:13 +00:00
|
|
|
MoreActions,
|
2019-10-27 13:31:59 +00:00
|
|
|
Thumbnail,
|
2021-04-21 06:48:48 +00:00
|
|
|
AvailabilityStatusBadge,
|
2019-10-27 13:31:59 +00:00
|
|
|
},
|
|
|
|
|
2019-11-14 08:16:43 +00:00
|
|
|
props: {
|
|
|
|
chat: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
isContactPanelOpen: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
currentChatAssignee: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
2021-04-22 17:47:29 +00:00
|
|
|
getAgents: 'inboxAssignableAgents/getAssignableAgents',
|
|
|
|
uiFlags: 'inboxAssignableAgents/getUIFlags',
|
2019-08-14 09:48:44 +00:00
|
|
|
currentChat: 'getSelectedChat',
|
|
|
|
}),
|
2020-06-02 17:29:02 +00:00
|
|
|
|
2020-07-04 14:16:17 +00:00
|
|
|
chatMetadata() {
|
|
|
|
return this.chat.meta;
|
|
|
|
},
|
|
|
|
|
2020-06-02 17:29:02 +00:00
|
|
|
currentContact() {
|
|
|
|
return this.$store.getters['contacts/getContact'](
|
|
|
|
this.chat.meta.sender.id
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
agentList() {
|
2021-04-09 09:02:29 +00:00
|
|
|
const { inbox_id: inboxId } = this.chat;
|
|
|
|
const agents = this.getAgents(inboxId) || [];
|
2019-08-14 09:48:44 +00:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
confirmed: true,
|
2020-10-13 07:33:55 +00:00
|
|
|
name: 'None',
|
2019-08-14 09:48:44 +00:00
|
|
|
id: 0,
|
|
|
|
role: 'agent',
|
|
|
|
account_id: 0,
|
|
|
|
email: 'None',
|
|
|
|
},
|
2021-04-09 09:02:29 +00:00
|
|
|
...agents,
|
2019-08-14 09:48:44 +00:00
|
|
|
];
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
assignAgent(agent) {
|
2019-10-27 13:31:59 +00:00
|
|
|
this.$store
|
|
|
|
.dispatch('assignAgent', {
|
|
|
|
conversationId: this.currentChat.id,
|
|
|
|
agentId: agent.id,
|
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
bus.$emit('newToastMessage', this.$t('CONVERSATION.CHANGE_AGENT'));
|
|
|
|
});
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2019-11-14 08:16:43 +00:00
|
|
|
removeAgent() {},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
2020-01-01 17:00:43 +00:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.text-truncate {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2021-03-09 09:56:03 +00:00
|
|
|
|
|
|
|
.conv-header {
|
|
|
|
flex: 0 0 var(--space-jumbo);
|
|
|
|
}
|
2021-04-21 06:48:48 +00:00
|
|
|
|
|
|
|
.option__desc {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.option__desc {
|
|
|
|
&::v-deep .status-badge {
|
|
|
|
margin-right: var(--space-small);
|
|
|
|
min-width: 0;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
}
|
2020-01-01 17:00:43 +00:00
|
|
|
</style>
|