diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonNotes.vue b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonNotes.vue index 8f40f71b60199a8c10e577d0ae006fbb1af5a7c5..880e92f4c03eb41a042f1ace474611de0ab5617e 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonNotes.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonNotes.vue @@ -1,33 +1,24 @@ +<script setup> +import AbsenceReasonChip from "aleksis.apps.kolego/components/AbsenceReasonChip.vue"; +</script> + <template> <div class="d-flex align-center justify-space-between justify-md-end flex-wrap gap" > - <!-- eslint-disable @intlify/vue-i18n/no-raw-text --> - <v-chip dense color="success"> - <v-chip small dense class="mr-2" color="green darken-3 white--text"> - {{ documentation.participations.length }} - </v-chip> - Schüler - </v-chip> - <v-chip dense color="warning"> - <v-chip small dense class="mr-2" color="orange darken-3 white--text" - >3</v-chip - > - entschuldigt + <v-chip dense color="success" outlined v-if="total > 0"> + {{ $t("alsijil.coursebook.present_number", { present, total })}} </v-chip> - <v-chip dense color="error"> - <v-chip small dense class="mr-2" color="red darken-3 white--text" - >1</v-chip - > - unentschuldigt - </v-chip> - <v-chip dense color="grey lighten-1"> - <v-chip small dense class="mr-2" color="grey darken-1 white--text" - >4</v-chip - > - Hausaufgaben vergessen - </v-chip> - <!-- eslint-enable @intlify/vue-i18n/no-raw-text --> + <absence-reason-chip + v-for="participation in absences" + :absence-reason="participation.absenceReason" + dense + > + <template #prepend> + {{ participation.person.fullName }}: + </template> + </absence-reason-chip> + <manage-students-trigger v-bind="documentationPartProps" /> </div> </template> @@ -40,6 +31,18 @@ export default { name: "LessonNotes", components: { ManageStudentsTrigger }, mixins: [documentationPartMixin], + computed: { + total() { + return this.documentation.participations.length; + }, + present() { + return this.documentation.participations.filter(p => p.absenceReason === null).length; + }, + absences() { + // Get all course attendants who have an absence reason + return this.documentation.participations.filter(p => p.absenceReason !== null); + }, + }, }; </script> diff --git a/aleksis/apps/alsijil/frontend/messages/de.json b/aleksis/apps/alsijil/frontend/messages/de.json index f9b0b0f24764b407229c25cfcc5c5a18e9f2cc4e..31ae2d9763a98f946aa896a9ab79d5fc8d514a0f 100644 --- a/aleksis/apps/alsijil/frontend/messages/de.json +++ b/aleksis/apps/alsijil/frontend/messages/de.json @@ -49,7 +49,8 @@ } } }, - "title_plural": "Kursbuch" + "title_plural": "Kursbuch", + "present_number": "{present}/{total} anwesend" }, "excuse_types": { "menu_title": "Entschuldigungsarten" diff --git a/aleksis/apps/alsijil/frontend/messages/en.json b/aleksis/apps/alsijil/frontend/messages/en.json index 4f17201251a67936819498514b54d3ca3b592fbe..71a509cfec66659437760a1c2ab2fc41ad35cd3c 100644 --- a/aleksis/apps/alsijil/frontend/messages/en.json +++ b/aleksis/apps/alsijil/frontend/messages/en.json @@ -74,6 +74,7 @@ "courses": "Courses", "filter_for_obj": "Filter for group and course" }, + "present_number": "{present}/{total} present", "no_data": "No lessons for the selected groups and courses in this period", "no_results": "No search results for {search}" }