feat: CSAT for all channels (#2749)

This commit is contained in:
Muhsin Keloth
2021-08-23 22:00:47 +05:30
committed by GitHub
parent 5debe9e8ee
commit 6515b69560
23 changed files with 382 additions and 68 deletions

View File

@@ -0,0 +1,31 @@
<template>
<div class="flex items-center">
<i
v-if="showSuccess"
class="ion-checkmark-circled text-3xl text-green-500 mr-1"
/>
<i v-if="showError" class="ion-android-alert text-3xl text-red-600 mr-1" />
<label class="text-base font-medium text-black-800 mt-4 mb-4">
{{ message }}
</label>
</div>
</template>
<script>
export default {
props: {
showSuccess: {
type: Boolean,
default: false,
},
showError: {
type: Boolean,
default: false,
},
message: {
type: String,
required: true,
},
},
};
</script>

View File

@@ -0,0 +1,54 @@
<template>
<div>
<label class="text-base font-medium text-black-800">
{{ $t('SURVEY.FEEDBACK.LABEL') }}
</label>
<text-area
v-model="feedback"
class="my-5"
:placeholder="$t('SURVEY.FEEDBACK.PLACEHOLDER')"
/>
<div class="flex items-center font-medium float-right">
<custom-button @click="onClick">
<spinner v-if="feedback" class="p-0" />
{{ $t('SURVEY.FEEDBACK.BUTTON_TEXT') }}
</custom-button>
</div>
</div>
</template>
<script>
import CustomButton from 'shared/components/Button';
import TextArea from 'shared/components/TextArea.vue';
import Spinner from 'shared/components/Spinner';
export default {
name: 'Feedback',
components: {
CustomButton,
TextArea,
Spinner,
},
props: {
isUpdating: {
type: Boolean,
default: null,
},
isButtonDisabled: {
type: Boolean,
default: null,
},
},
data() {
return {
feedback: '',
};
},
methods: {
onClick() {
this.$emit('sendFeedback', this.feedback);
},
},
};
</script>

View File

@@ -5,7 +5,7 @@
v-for="rating in ratings"
:key="rating.key"
:class="buttonClass(rating)"
@click="selectRating(rating)"
@click="onClick(rating)"
>
{{ rating.emoji }}
</button>
@@ -18,35 +18,28 @@ import { CSAT_RATINGS } from 'shared/constants/messages';
export default {
props: {
messageContentAttributes: {
type: Object,
default: () => {},
selectedRating: {
type: Number,
default: null,
},
},
data() {
return {
email: '',
ratings: CSAT_RATINGS,
selectedRating: null,
};
},
computed: {
isRatingSubmitted() {
return this.messageContentAttributes?.csat_survey_response?.rating;
},
},
methods: {
buttonClass(rating) {
return [
{ selected: rating.value === this.selectedRating },
{ disabled: this.isRatingSubmitted },
{ hover: this.isRatingSubmitted },
{ disabled: !!this.selectedRating },
{ hover: !!this.selectedRating },
'emoji-button shadow-none text-4xl outline-none mr-8',
];
},
selectRating(rating) {
this.selectedRating = rating.value;
onClick(rating) {
this.$emit('selectRating', rating.value);
},
},
};