move getDateStyleClass to AbgabetoolStudent.js from AbgabeStudentDetail.js

This commit is contained in:
Johann Hoffmann
2025-11-17 16:39:19 +01:00
parent 6cd0e3a574
commit 96fdc357de
2 changed files with 28 additions and 30 deletions
@@ -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: {
@@ -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()