diff --git a/application/controllers/api/frontend/v1/Noten.php b/application/controllers/api/frontend/v1/Noten.php index 98ba825a8..15ea11b11 100644 --- a/application/controllers/api/frontend/v1/Noten.php +++ b/application/controllers/api/frontend/v1/Noten.php @@ -68,7 +68,8 @@ class Noten extends FHCAPI_Controller 'person', 'benotungstool', 'lehre', - 'ui' + 'ui', + 'password' ]); $this->load->model('education/LePruefung_model', 'LePruefungModel'); @@ -461,7 +462,7 @@ class Noten extends FHCAPI_Controller } if(!$this->AuthLib->checkUserAuthByUsernamePassword(getAuthUID(), $result->password)->retval) { - $this->terminateWithError($this->p->t('global', 'wrongPassword'), 'general'); + $this->terminateWithError($this->p->t('password', 'wrongPassword'), 'general'); } $lv_id = $result->lv_id; diff --git a/public/js/components/Cis/Benotungstool/Benotungstool.js b/public/js/components/Cis/Benotungstool/Benotungstool.js index b0b5969b8..ecc1aaca6 100644 --- a/public/js/components/Cis/Benotungstool/Benotungstool.js +++ b/public/js/components/Cis/Benotungstool/Benotungstool.js @@ -1235,18 +1235,31 @@ export const Benotungstool = { return value }, - saveNote(e, cell) { // Notenvorschlag freigeben + async saveNote(e, cell) { // Notenvorschlag freigeben const row = cell.getRow() const data = row.getData() - + if(!data.note_vorschlag) return - + // if vorschlag is the same as lv_note do nothing if(data.note_vorschlag == data.lv_note) return - + // if the student already has pruefungen disable this part if(data.pruefungen.length) return - + + // confirm before writing the LV-Gesamtnote + const noteOption = this.notenOptions.find(opt => opt.note == data.note_vorschlag) + const noteBezeichnung = noteOption ? noteOption.bezeichnung : data.note_vorschlag + const dateLocale = this.$p.user_language?.value === 'English' ? 'en-GB' : 'de-AT' + const benotungsdatum = new Date().toLocaleString(dateLocale) + if(await this.$fhcAlert.confirm({ + message: this.$p.t('benotungstool/c4notenvorschlagUebernehmenConfirm', [noteBezeichnung, data.vorname, data.nachname, data.uid, benotungsdatum]), + acceptClass: 'p-button-primary', + rejectClass: 'p-button-secondary' + }) === false) { + return + } + this.loading = true this.$api.call(ApiNoten.saveNotenvorschlag(this.lv_id, this.sem_kurzbz, data.uid, data.note_vorschlag, data.punkte)) .then((res) => { @@ -2596,6 +2609,24 @@ export const Benotungstool = { }, []) : [] return cs }, + // Row-by-row preview for the Noten-freigeben modal, over the exact set that + // saveStudentenNoten will release (changedNoten). Freigabe releases the LV-Note + // (lv_note); it does not itself write the Zeugnisnote (that is a separate übernahme). + // So we compare what is currently on record in the Zeugnis (note) against the + // LV-Note that is about to be freigegeben (lv_note), and flag any mismatch. + freigabeSummary() { + return this.changedNoten.map(s => { + const zeugnisOpt = this.notenOptions?.find(opt => opt.note == s.note) + const releaseOpt = this.notenOptions?.find(opt => opt.note == s.lv_note) + return { + uid: s.uid, + name: `${s.vorname} ${s.nachname}`, + currentNote: zeugnisOpt ? zeugnisOpt.bezeichnung : (s.note || '—'), + releasedNote: releaseOpt ? releaseOpt.bezeichnung : (s.lv_note || '—'), + changed: (s.note ?? '') != (s.lv_note ?? '') + } + }) + }, getNotenfreigabeHinweistext() { return this.$capitalize(this.$p.t('benotungstool/notenfreigabeHinweistextv4')) }, @@ -2717,6 +2748,35 @@ export const Benotungstool = {
| {{ $capitalize($p.t('benotungstool/c4student')) }} | +{{ $capitalize($p.t('benotungstool/c4freigabeSummaryCurrent')) }} | ++ | {{ $capitalize($p.t('benotungstool/c4freigabeSummaryReleased')) }} | +
|---|---|---|---|
| {{ row.name }} ({{ row.uid }}) | +{{ row.currentNote }} | ++ | {{ row.releasedNote }} | +