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 8b3dee5c3..0534551ba 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue @@ -14,7 +14,7 @@ {{ $t('comment.created_by', [ - pinnedComment.creator.text, - $d(pinnedComment.createdAt.datetime, 'long') - ]) }} + pinnedComment.creator.text, + $d(pinnedComment.createdAt.datetime, 'long') + ]) + }} -
+
@@ -60,7 +58,7 @@ export default { data() { return { editor: ClassicEditor, - formdata: { + formData: { type: "accompanying_period_comment", content: '' } @@ -72,7 +70,7 @@ export default { }, content: { set(value) { - this.formdata.content = value; + this.formData.content = value; }, get() { return (this.pinnedComment)? this.pinnedComment.content : {}; @@ -87,7 +85,7 @@ export default { console.log('content changed'); console.log(this.pinnedComment) if (this.pinnedComment) { - let body = this.formdata; + let body = this.formData; Object.assign(body, {id: this.pinnedComment.id}) this.$store.dispatch('updatePinnedComment', body) .catch(({name, violations}) => { @@ -98,7 +96,7 @@ export default { } }); } else { - this.$store.dispatch('addPinnedComment', this.formdata) + this.$store.dispatch('addPinnedComment', this.formData) .catch(({name, violations}) => { if (name === 'ValidationException' || name === 'AccessException') { violations.forEach((violation) => this.$toast.open({message: violation})); @@ -108,27 +106,8 @@ export default { }); } }, - submitform() { //TODO deprecated, to remove - console.log(this.formdata) - 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('postFirstComment', 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'}) - // } - // }); - }, removeComment() { - this.$store.dispatch('postFirstComment', {}) + this.$store.dispatch('removePinnedComment', {}) .catch(({name, violations}) => { if (name === 'ValidationException' || name === 'AccessException') { violations.forEach((violation) => this.$toast.open({message: violation})); @@ -139,11 +118,6 @@ export default { } } } -/* -* TODO -* - [x] delete button in ul record_actions, but not in form -* - [ ] display updatedAt => pinnedComment fetch PATCH content changes MUST NOT change object id !! -*/