2020-10-18 18:02:22 +00:00
|
|
|
<template>
|
2021-10-01 09:33:58 +00:00
|
|
|
<div class="px-6">
|
|
|
|
<custom-button
|
|
|
|
class="font-medium rounded-full"
|
|
|
|
:bg-color="widgetColor"
|
|
|
|
:text-color="textColor"
|
|
|
|
@click="startConversation"
|
|
|
|
>
|
|
|
|
<i class="ion-send" />
|
|
|
|
{{ $t('START_CONVERSATION') }}
|
|
|
|
</custom-button>
|
|
|
|
<div class="flex items-center justify-between my-1">
|
|
|
|
<div class="text-black-600">
|
|
|
|
<div class="text-xs">
|
2021-03-13 06:14:28 +00:00
|
|
|
{{
|
2021-03-13 08:36:25 +00:00
|
|
|
isOnline
|
2021-03-13 06:14:28 +00:00
|
|
|
? $t('TEAM_AVAILABILITY.ONLINE')
|
|
|
|
: $t('TEAM_AVAILABILITY.OFFLINE')
|
|
|
|
}}
|
2020-10-18 18:02:22 +00:00
|
|
|
</div>
|
2021-10-01 09:33:58 +00:00
|
|
|
<div class="text-xs">
|
2021-03-13 08:36:25 +00:00
|
|
|
{{ replyWaitMeessage }}
|
2020-10-18 18:02:22 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-03-13 08:36:25 +00:00
|
|
|
<available-agents v-if="isOnline" :agents="availableAgents" />
|
2020-10-18 18:02:22 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
2021-05-24 07:13:03 +00:00
|
|
|
import { getContrastingTextColor } from '@chatwoot/utils';
|
2020-10-18 18:02:22 +00:00
|
|
|
import AvailableAgents from 'widget/components/AvailableAgents.vue';
|
2021-04-07 06:13:16 +00:00
|
|
|
import CustomButton from 'shared/components/Button';
|
2020-10-18 18:02:22 +00:00
|
|
|
import configMixin from 'widget/mixins/configMixin';
|
2021-03-13 08:36:25 +00:00
|
|
|
import availabilityMixin from 'widget/mixins/availability';
|
2020-10-18 18:02:22 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'TeamAvailability',
|
|
|
|
components: {
|
|
|
|
AvailableAgents,
|
2021-04-07 06:13:16 +00:00
|
|
|
CustomButton,
|
2020-10-18 18:02:22 +00:00
|
|
|
},
|
2021-03-13 08:36:25 +00:00
|
|
|
mixins: [configMixin, availabilityMixin],
|
2020-10-18 18:02:22 +00:00
|
|
|
props: {
|
|
|
|
availableAgents: {
|
|
|
|
type: Array,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters({ widgetColor: 'appConfig/getWidgetColor' }),
|
|
|
|
textColor() {
|
|
|
|
return getContrastingTextColor(this.widgetColor);
|
|
|
|
},
|
2021-03-13 08:36:25 +00:00
|
|
|
isOnline() {
|
|
|
|
const { workingHoursEnabled } = this.channelConfig;
|
|
|
|
const anyAgentOnline = this.availableAgents.length > 0;
|
2021-03-13 06:14:28 +00:00
|
|
|
|
2021-03-13 08:36:25 +00:00
|
|
|
if (workingHoursEnabled) {
|
|
|
|
return this.isInBetweenTheWorkingHours;
|
2021-03-13 06:14:28 +00:00
|
|
|
}
|
2021-03-13 08:36:25 +00:00
|
|
|
return anyAgentOnline;
|
|
|
|
},
|
|
|
|
replyWaitMeessage() {
|
|
|
|
const { workingHoursEnabled } = this.channelConfig;
|
2021-03-13 06:14:28 +00:00
|
|
|
|
2021-03-13 08:36:25 +00:00
|
|
|
if (this.isOnline) {
|
|
|
|
return this.replyTimeStatus;
|
2021-03-13 06:14:28 +00:00
|
|
|
}
|
2021-03-13 08:36:25 +00:00
|
|
|
if (workingHoursEnabled) {
|
|
|
|
return this.outOfOfficeMessage;
|
|
|
|
}
|
2021-03-27 07:38:09 +00:00
|
|
|
return '';
|
2021-03-13 06:14:28 +00:00
|
|
|
},
|
2020-10-18 18:02:22 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
startConversation() {
|
|
|
|
this.$emit('start-conversation');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|