From 7cdcf31e44c0775f6cd916fac84f25c860c60ca5 Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Tue, 21 May 2024 14:29:55 +0200 Subject: [PATCH] Add comment field --- .../components/substitutions/SubstitutionCard.vue | 14 +++++++++++++- aleksis/apps/chronos/frontend/messages/en.json | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue index 476142fd..70063385 100644 --- a/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue +++ b/aleksis/apps/chronos/frontend/components/substitutions/SubstitutionCard.vue @@ -22,6 +22,8 @@ import createOrPatchMixin from "aleksis.core/mixins/createOrPatchMixin.js"; <v-spacer /> + <v-text-field dense outlined hide-details v-model="comment" :label="$t('chronos.substitutions.overview.comment')" @change="saveComment" /> + <v-autocomplete v-model="teachers" multiple @@ -107,6 +109,7 @@ export default { return { loading: false, teachers: [], + comment: "", cancelled: false, ready: false, }; @@ -162,6 +165,14 @@ export default { }, ]); }, + saveComment() { + this.createOrPatch([ + { + id: this.substitution.id, + comment: this.comment, + }, + ]); + }, changeCancel() { if (this.ready) { this.createOrPatch([ @@ -202,6 +213,7 @@ export default { }, mounted() { this.teachers = this.substitution.teachers.map((teacher) => teacher.id); + this.comment = this.substitution.comment; this.cancelled = this.substitution.cancelled; this.ready = true; }, @@ -212,7 +224,7 @@ export default { .main-body { display: grid; align-items: center; - grid-template-columns: 1fr 1fr 2fr 1fr; + grid-template-columns: 2fr 1fr 2fr 2fr 2fr; gap: 1em; } .vertical { diff --git a/aleksis/apps/chronos/frontend/messages/en.json b/aleksis/apps/chronos/frontend/messages/en.json index b34618b7..c3fe8311 100644 --- a/aleksis/apps/chronos/frontend/messages/en.json +++ b/aleksis/apps/chronos/frontend/messages/en.json @@ -62,7 +62,8 @@ "unedited": "Unedited", "substituted": "Substituted", "cancelled": "Cancelled" - } + }, + "comment": "Comment" } } } -- GitLab