2019-11-26 17:05:26 +00:00
|
|
|
<template>
|
2022-04-01 15:29:03 +00:00
|
|
|
<header
|
|
|
|
class="flex justify-between p-5 w-full"
|
|
|
|
:class="$dm('bg-white', 'dark:bg-slate-900')"
|
|
|
|
>
|
2022-01-12 10:55:27 +00:00
|
|
|
<div class="flex items-center">
|
|
|
|
<button v-if="showBackButton" @click="onBackButtonClick">
|
2022-04-01 15:29:03 +00:00
|
|
|
<fluent-icon
|
|
|
|
icon="chevron-left"
|
|
|
|
size="24"
|
|
|
|
:class="$dm('text-black-900', 'dark:text-slate-50')"
|
|
|
|
/>
|
2022-01-12 10:55:27 +00:00
|
|
|
</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>
|
2022-04-01 15:29:03 +00:00
|
|
|
<div
|
|
|
|
class="font-medium text-base flex items-center"
|
|
|
|
:class="$dm('text-black-900', 'dark:text-slate-50')"
|
|
|
|
>
|
2022-04-21 05:57:28 +00:00
|
|
|
<span v-dompurify-html="title" class="mr-1" />
|
2020-10-18 18:02:22 +00:00
|
|
|
<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>
|
2022-04-01 15:29:03 +00:00
|
|
|
<div
|
|
|
|
class="text-xs mt-1"
|
|
|
|
:class="$dm('text-black-700', 'dark:text-slate-400')"
|
|
|
|
>
|
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';
|
2022-04-01 15:29:03 +00:00
|
|
|
import darkMixin from 'widget/mixins/darkModeMixin.js';
|
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-04-01 15:29:03 +00:00
|
|
|
mixins: [availabilityMixin, routerMixin, darkMixin],
|
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-04-01 15:29:03 +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>
|