From 96fdc357de0f0293f55ade5f3f7962c92dcda362 Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Mon, 17 Nov 2025 16:39:19 +0100 Subject: [PATCH] move getDateStyleClass to AbgabetoolStudent.js from AbgabeStudentDetail.js --- .../Cis/Abgabetool/AbgabeStudentDetail.js | 29 ------------------- .../Cis/Abgabetool/AbgabetoolStudent.js | 29 ++++++++++++++++++- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js b/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js index 96e01a2ed..cca30d490 100644 --- a/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js +++ b/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js @@ -3,7 +3,6 @@ import BsModal from '../../Bootstrap/Modal.js'; import VueDatePicker from '../../vueDatepicker.js.php'; import ApiAbgabe from '../../../api/factory/abgabe.js' -const today = new Date() export const AbgabeStudentDetail = { name: "AbgabeStudentDetail", components: { @@ -214,30 +213,6 @@ export const AbgabeStudentDetail = { } - }, - dateDiffInDays(datum, today){ - const oneDayMs = 1000 * 60 * 60 * 24 - return Math.round((new Date(datum) - new Date(today)) / oneDayMs) - }, - getDateStyleClass(termin, mode) { - const datum = new Date(termin.datum) - const abgabedatum = new Date(termin.abgabedatum) - - // avoid renaming these statuses as their names are used as css keys - // https://wiki.fhcomplete.info/doku.php?id=cis:abgabetool_fuer_studierende - if (termin.abgabedatum === null) { - if(datum < today) { - return 'verpasst' - } else if (datum > today && this.dateDiffInDays(datum, today) <= 12) { - return 'abzugeben' - } else { - return 'standard' - } - } else if(abgabedatum > datum) { - return 'verspaetet' - } else { - return 'abgegeben' - } }, openBeurteilungLink(link) { window.open(link, '_blank') @@ -269,10 +244,6 @@ export const AbgabeStudentDetail = { this.form.kontrollschlagwoerter = newVal.kontrollschlagwoerter ?? '' this.form.seitenanzahl = newVal.seitenanzahl ?? 1 - // get dateStyles for each abgabetermin - newVal?.abgabetermine?.forEach(termin => { - termin.dateStyle = this.getDateStyleClass(termin) - }) } }, computed: { diff --git a/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js b/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js index 5f86d5100..fec6f5b06 100644 --- a/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js +++ b/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js @@ -3,6 +3,7 @@ import VerticalSplit from "../../verticalsplit/verticalsplit.js"; import ApiAbgabe from '../../../api/factory/abgabe.js' import BsModal from "../../Bootstrap/Modal.js"; +const today = new Date() export const AbgabetoolStudent = { name: "AbgabetoolStudent", components: { @@ -46,6 +47,30 @@ export const AbgabetoolStudent = { }; }, methods: { + dateDiffInDays(datum, today){ + const oneDayMs = 1000 * 60 * 60 * 24 + return Math.round((new Date(datum) - new Date(today)) / oneDayMs) + }, + getDateStyleClass(termin) { + const datum = new Date(termin.datum) + const abgabedatum = new Date(termin.abgabedatum) + + // avoid renaming these statuses as their names are used as css keys + // https://wiki.fhcomplete.info/doku.php?id=cis:abgabetool_fuer_studierende + if (termin.abgabedatum === null) { + if(datum < today) { + return 'verpasst' + } else if (datum > today && this.dateDiffInDays(datum, today) <= 12) { + return 'abzugeben' + } else { + return 'standard' + } + } else if(abgabedatum > datum) { + return 'verspaetet' + } else { + return 'abgegeben' + } + }, checkQualityGates(termine) { let qgate1Passed = false let qgate2Passed = false @@ -90,10 +115,12 @@ export const AbgabetoolStudent = { termin.allowedToUpload = termin.upload_allowed } + termin.dateStyle = this.getDateStyleClass(termin) }) + pa.betreuer = this.buildBetreuer(pa) pa.student_uid = this.student_uid - + this.selectedProjektarbeit = pa this.$refs.modalContainerAbgabeDetail.show()