mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-22 06:29:27 +00:00
move getDateStyleClass to AbgabetoolStudent.js from AbgabeStudentDetail.js
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user