2019-11-26 17:05:26 +00:00
|
|
|
<template>
|
2022-01-12 10:55:27 +00:00
|
|
|
<header class="flex justify-between p-5 w-full">
|
|
|
|
<div class="flex items-center">
|
|
|
|
<button v-if="showBackButton" @click="onBackButtonClick">
|
|
|
|
<fluent-icon icon="chevron-left" size="24" />
|
|
|
|
</button>
|
2020-10-18 18:02:22 +00:00
|
|
|
<img
|
|
|
|
v-if="avatarUrl"
|
2022-01-12 10:55:27 +00:00
|
|
|
class="h-8 w-8 rounded-full mr-3"
|
2020-10-18 18:02:22 +00:00
|
|
|
:src="avatarUrl"
|
|
|
|
alt="avatar"
|
|
|
|
/>
|
|
|
|
<div>
|
|
|
|
<div class="text-black-900 font-medium text-base flex items-center">
|
|
|
|
<span class="mr-1" v-html="title" />
|
|
|
|
<div
|
|
|
|
:class="
|
2022-01-12 10:55:27 +00:00
|
|
|
`h-2 w-2 rounded-full leading-4
|
|
|
|
${isOnline ? 'bg-green-500' : 'hidden'}`
|
2020-10-18 18:02:22 +00:00
|
|
|
"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="text-xs mt-1 text-black-700">
|
2022-01-12 10:55:27 +00:00
|
|
|
{{ replyWaitMessage }}
|
2020-10-18 18:02:22 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-20 06:25:06 +00:00
|
|
|
</div>
|
2020-08-28 12:09:46 +00:00
|
|
|
<header-actions :show-popout-button="showPopoutButton" />
|
2019-11-26 17:05:26 +00:00
|
|
|
</header>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
2022-01-12 10:55:27 +00:00
|
|
|
|
2021-03-13 08:36:25 +00:00
|
|
|
import availabilityMixin from 'widget/mixins/availability';
|
2022-01-12 10:55:27 +00:00
|
|
|
import FluentIcon from 'shared/components/FluentIcon/Index.vue';
|
|
|
|
import HeaderActions from './HeaderActions';
|
|
|
|
import routerMixin from 'widget/mixins/routerMixin';
|
2020-10-18 18:02:22 +00:00
|
|
|
|
2019-11-26 17:05:26 +00:00
|
|
|
export default {
|
|
|
|
name: 'ChatHeader',
|
2020-08-28 12:09:46 +00:00
|
|
|
components: {
|
2022-01-12 10:55:27 +00:00
|
|
|
FluentIcon,
|
2020-08-28 12:09:46 +00:00
|
|
|
HeaderActions,
|
|
|
|
},
|
2022-01-12 10:55:27 +00:00
|
|
|
mixins: [availabilityMixin, routerMixin],
|
2019-11-26 17:05:26 +00:00
|
|
|
props: {
|
2020-04-20 06:25:06 +00:00
|
|
|
avatarUrl: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2019-11-26 17:05:26 +00:00
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-08-28 12:09:46 +00:00
|
|
|
showPopoutButton: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2022-01-12 10:55:27 +00:00
|
|
|
showBackButton: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-10-18 18:02:22 +00:00
|
|
|
availableAgents: {
|
|
|
|
type: Array,
|
|
|
|
default: () => {},
|
|
|
|
},
|
2019-11-26 17:05:26 +00:00
|
|
|
},
|
2020-04-20 06:25:06 +00:00
|
|
|
computed: {
|
2022-01-12 10:55:27 +00:00
|
|
|
...mapGetters({ widgetColor: 'appConfig/getWidgetColor' }),
|
2021-03-13 08:36:25 +00:00
|
|
|
isOnline() {
|
|
|
|
const { workingHoursEnabled } = this.channelConfig;
|
|
|
|
const anyAgentOnline = this.availableAgents.length > 0;
|
|
|
|
|
|
|
|
if (workingHoursEnabled) {
|
|
|
|
return this.isInBetweenTheWorkingHours;
|
|
|
|
}
|
|
|
|
return anyAgentOnline;
|
|
|
|
},
|
2022-01-12 10:55:27 +00:00
|
|
|
replyWaitMessage() {
|
2021-03-13 08:36:25 +00:00
|
|
|
return this.isOnline
|
|
|
|
? this.replyTimeStatus
|
|
|
|
: this.$t('TEAM_AVAILABILITY.OFFLINE');
|
|
|
|
},
|
2020-04-20 06:25:06 +00:00
|
|
|
},
|
2022-01-12 10:55:27 +00:00
|
|
|
methods: {
|
|
|
|
onBackButtonClick() {
|
|
|
|
this.replaceRoute('home');
|
|
|
|
},
|
|
|
|
},
|
2019-11-26 17:05:26 +00:00
|
|
|
};
|
|
|
|
</script>
|