diff --git a/application/controllers/api/frontend/v1/Abgabe.php b/application/controllers/api/frontend/v1/Abgabe.php index f0744fb99..a6390e97d 100644 --- a/application/controllers/api/frontend/v1/Abgabe.php +++ b/application/controllers/api/frontend/v1/Abgabe.php @@ -531,6 +531,14 @@ class Abgabe extends FHCAPI_Controller $pa->beurteilungLinkNew = $newLink; $pa->beurteilungLinkOld = $oldLink; + // has previously been retrieved via getStudentProjektabgaben but is fetched in advance to avoid having to reload abgaben + $projektarbeitIsCurrent = false; + $returnFunc = function ($result) use (&$projektarbeitIsCurrent) { + $projektarbeitIsCurrent = $result; + }; + Events::trigger('projektarbeit_is_current', $pa->projektarbeit_id, $returnFunc); + $pa->isCurrent = $projektarbeitIsCurrent; + $filterFunc = function($projektabgabe) use ($pa) { return $projektabgabe->projektarbeit_id == $pa->projektarbeit_id; }; diff --git a/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js b/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js index f86fa44d9..b760f567d 100644 --- a/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js +++ b/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js @@ -1,8 +1,8 @@ import BsModal from '../../Bootstrap/Modal.js'; import VueDatePicker from '../../vueDatepicker.js.php'; import ApiAbgabe from '../../../api/factory/abgabe.js' +import { getDateStyleClass } from "./getDateStyleClass.js"; -const today = new Date() export const AbgabeMitarbeiterDetail = { name: "AbgabeMitarbeiterDetail", components: { @@ -125,10 +125,12 @@ export const AbgabeMitarbeiterDetail = { // only insert new abgabe if we actually created a new one, not when saving/editing existing if(!existingTerminRes){ + newTerminRes.dateStyle = getDateStyleClass(newTerminRes, this.notenOptions) this.projektarbeit.abgabetermine.push(newTerminRes) } else { const noteOptExisting = this.allowedNotenOptions.find(opt => opt.note == existingTerminRes.note) existingTerminRes.note = noteOptExisting + termin.dateStyle = getDateStyleClass(termin, this.notenOptions) } this.projektarbeit.abgabetermine.sort((a, b) =>new Date(a.datum) - new Date(b.datum)) @@ -270,40 +272,6 @@ export const AbgabeMitarbeiterDetail = { window.open(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + url) // this.$api.call(ApiAbgabe.getStudentProjektarbeitAbgabeFile(termin.paabgabe_id, this.projektarbeit.student_uid)) }, - getDateStyleClass(termin) { - const zone = 'Europe/Vienna'; - const today = luxon.DateTime.now().setZone(zone); - const datum = luxon.DateTime.fromISO(termin.datum, { zone }).endOf('day'); - const abgabedatum = termin.abgabedatum ? luxon.DateTime.fromISO(termin.abgabedatum, { zone }) : null; - termin.diffindays = datum.diff(today, 'days').days; - const isLate = abgabedatum && abgabedatum > datum; - - // GRADE STATUS - if (termin.note) { - if (termin.note.positiv) return 'bestanden'; - return 'nichtbestanden'; - } - - // ACTION REQUIRED FOR GRADE - if (termin.bezeichnung?.benotbar && datum < today) { - return 'beurteilungerforderlich'; - } - - // SUBMISSION STATUS - if (termin.upload_allowed) { - if (termin.abgabedatum) { - return isLate ? 'verspaetet' : 'abgegeben'; - } - - // no submission yet - if (datum < today) return 'verpasst'; - if (termin.diffindays <= 12) return 'abzugeben'; - return 'standard'; - } - - // GENERIC STATUS - return datum < today ? 'verpasst' : 'standard'; - }, openBeurteilungLink(link) { window.open(link, '_blank') }, @@ -769,20 +737,29 @@ export const AbgabeMitarbeiterDetail = { -