diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue index 5ae646570..3fa555ec4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue @@ -21,12 +21,17 @@ tag-name="textarea"> -
- {{ $t('comment.created_by', [ - pinnedComment.creator.text, - $d(pinnedComment.updatedAt.datetime, 'long') - ]) - }} +
+ +
+ +
@@ -62,7 +67,8 @@ export default { formData: { type: "accompanying_period_comment", content: '' - } + }, + loading: false } }, computed: { @@ -83,33 +89,37 @@ export default { }, methods: { onContentChange() { + this.loading = true; let lastRecordedContent = this.formData.content; setTimeout(() => { - if (lastRecordedContent === this.formData.content) { - if (this.pinnedComment) { - let body = this.formData; - Object.assign(body, {id: this.pinnedComment.id}); + if (this.formData.content !== '') { + if (lastRecordedContent === this.formData.content) { + if (this.pinnedComment) { + let body = this.formData; + Object.assign(body, {id: this.pinnedComment.id}); - this.$store.dispatch('updatePinnedComment', body) - .catch(({name, violations}) => { - if (name === 'ValidationException' || name === 'AccessException') { - violations.forEach((violation) => this.$toast.open({message: violation})); - } else { - this.$toast.open({message: 'An error occurred'}) - } - }); - } else { - this.$store.dispatch('addPinnedComment', this.formData) - .catch(({name, violations}) => { - if (name === 'ValidationException' || name === 'AccessException') { - violations.forEach((violation) => this.$toast.open({message: violation})); - } else { - this.$toast.open({message: 'An error occurred'}) - } - }); + this.$store.dispatch('updatePinnedComment', body) + .catch(({name, violations}) => { + if (name === 'ValidationException' || name === 'AccessException') { + violations.forEach((violation) => this.$toast.open({message: violation})); + } else { + this.$toast.open({message: 'An error occurred'}) + } + }); + } else { + this.$store.dispatch('addPinnedComment', this.formData) + .catch(({name, violations}) => { + if (name === 'ValidationException' || name === 'AccessException') { + violations.forEach((violation) => this.$toast.open({message: violation})); + } else { + this.$toast.open({message: 'An error occurred'}) + } + }); + } + lastRecordedContent = null; } - lastRecordedContent = null; } + this.loading = false; }, 3000); }, removeComment() { @@ -130,4 +140,12 @@ export default { div.ck-editor.ck-reset { margin: 0.6em 0; } +div.sub-comment { + display: flex; + justify-content: space-between; + div.loading { + margin-right: 6px; + margin-left: 6px; + } +}