mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 20:18:08 +00:00
chore: Update CSAT submit action behaviour (#2556)
* update behaviour of CSAT submit * code cleanup
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form
|
<form
|
||||||
v-if="!isCSATSubmitted"
|
v-if="!isFeedbackSubmitted"
|
||||||
class="feedback-form"
|
class="feedback-form"
|
||||||
@submit.prevent="onSubmit()"
|
@submit.prevent="onSubmit()"
|
||||||
>
|
>
|
||||||
@@ -64,28 +64,30 @@ export default {
|
|||||||
...mapGetters({
|
...mapGetters({
|
||||||
widgetColor: 'appConfig/getWidgetColor',
|
widgetColor: 'appConfig/getWidgetColor',
|
||||||
}),
|
}),
|
||||||
isCSATSubmitted() {
|
isRatingSubmitted() {
|
||||||
return (
|
return this.messageContentAttributes?.csat_survey_response?.rating;
|
||||||
this.messageContentAttributes &&
|
},
|
||||||
this.messageContentAttributes.csat_survey_response
|
isFeedbackSubmitted() {
|
||||||
);
|
return this.messageContentAttributes?.csat_survey_response
|
||||||
|
?.feedback_message;
|
||||||
},
|
},
|
||||||
isButtonDisabled() {
|
isButtonDisabled() {
|
||||||
return !(this.selectedRating && this.feedback);
|
return !(this.selectedRating && this.feedback);
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
return this.isCSATSubmitted
|
return this.isRatingSubmitted
|
||||||
? this.$t('CSAT.SUBMITTED_TITLE')
|
? this.$t('CSAT.SUBMITTED_TITLE')
|
||||||
: this.$t('CSAT.TITLE');
|
: this.$t('CSAT.TITLE');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.isCSATSubmitted) {
|
if (this.isRatingSubmitted) {
|
||||||
const {
|
const {
|
||||||
csat_survey_response: { rating },
|
csat_survey_response: { rating, feedback },
|
||||||
} = this.messageContentAttributes;
|
} = this.messageContentAttributes;
|
||||||
this.selectedRating = rating;
|
this.selectedRating = rating;
|
||||||
|
this.feedback = feedback;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -93,8 +95,8 @@ export default {
|
|||||||
buttonClass(rating) {
|
buttonClass(rating) {
|
||||||
return [
|
return [
|
||||||
{ selected: rating.value === this.selectedRating },
|
{ selected: rating.value === this.selectedRating },
|
||||||
{ disabled: this.isCSATSubmitted },
|
{ disabled: this.isRatingSubmitted },
|
||||||
{ hover: this.isCSATSubmitted },
|
{ hover: this.isRatingSubmitted },
|
||||||
'emoji-button',
|
'emoji-button',
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
@@ -106,6 +108,7 @@ export default {
|
|||||||
},
|
},
|
||||||
selectRating(rating) {
|
selectRating(rating) {
|
||||||
this.selectedRating = rating.value;
|
this.selectedRating = rating.value;
|
||||||
|
this.onSubmit();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user