mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Noten Tab: header/inline edit
This commit is contained in:
@@ -94,7 +94,10 @@ class Config extends FHCAPI_Controller
|
||||
$result['grades'] = [
|
||||
'title' => $this->p->t('stv', 'tab_grades'),
|
||||
'component' => './Stv/Studentenverwaltung/Details/Noten.js',
|
||||
'showOnlyWithUid' => true
|
||||
'showOnlyWithUid' => true,
|
||||
'config' => [
|
||||
'edit' => 'both', // Possible values: both|header|inline
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,14 @@ export default {
|
||||
NotenTeacher,
|
||||
NotenRepeater
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
config: this.config
|
||||
}
|
||||
},
|
||||
props: {
|
||||
modelValue: Object
|
||||
modelValue: Object,
|
||||
config: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -6,6 +6,9 @@ export default {
|
||||
CoreFilterCmpt,
|
||||
ZeugnisActions
|
||||
},
|
||||
inject: [
|
||||
'config'
|
||||
],
|
||||
props: {
|
||||
student: Object,
|
||||
allSemester: Boolean
|
||||
@@ -13,11 +16,89 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
tabulatorEvents: [],
|
||||
stdsem: ''
|
||||
stdsem: '',
|
||||
lastGradeList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
tabulatorOptions() {
|
||||
const listPromise = this.$fhcApi.factory
|
||||
.stv.grades.list()
|
||||
.then(res => res.data.map(({bezeichnung: label, note: value}) => ({label, value})));
|
||||
|
||||
let gradeField = {
|
||||
field: 'note',
|
||||
title: 'Note',
|
||||
formatter: cell => cell.getData().note_bezeichnung,
|
||||
tooltip: (evt, cell) => cell.getData().note_bezeichnung
|
||||
};
|
||||
if (['both', 'inline'].includes(this.config.edit)) {
|
||||
gradeField = {...gradeField, ...{
|
||||
editor: 'list',
|
||||
editorParams: {
|
||||
valuesLookup: (cell, filterTerm) => listPromise,
|
||||
placeholderLoading: "Loading Remote Data...", // TODO(chris): phrase
|
||||
},
|
||||
cellEdited: cell => {
|
||||
// get row data
|
||||
const {lehrveranstaltung_id, uid: student_uid, studiensemester_kurzbz} = cell.getData();
|
||||
// get changed value
|
||||
const note = cell.getValue();
|
||||
|
||||
listPromise
|
||||
// get bezeichnung
|
||||
.then(list => list.find(el => el.value == note))
|
||||
.then(found => found ? found.label : Promise.reject({message: 'not found'}))
|
||||
// prepare data object
|
||||
.then(note_bezeichnung => ({
|
||||
lehrveranstaltung_id,
|
||||
student_uid,
|
||||
studiensemester_kurzbz,
|
||||
note,
|
||||
note_bezeichnung
|
||||
}))
|
||||
// send to backend
|
||||
.then(this.$fhcApi.factory.stv.grades.updateCertificate)
|
||||
// get bezeichnung again
|
||||
.then(() => listPromise)
|
||||
.then(list => list.find(el => el.value == note))
|
||||
.then(found => found ? found.label : Promise.reject({message: 'not found'}))
|
||||
// update other fields in row
|
||||
.then(note_bezeichnung => cell.getRow().update({note_bezeichnung}))
|
||||
.then(() => cell.getRow().reformat())
|
||||
// cleanup
|
||||
.then(cell.clearEdited)
|
||||
.catch(err => {
|
||||
cell.restoreOldValue();
|
||||
cell.clearEdited();
|
||||
this.$fhcAlert.handleFormValidation(err);
|
||||
});
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
const columns = [
|
||||
{ field: 'zeugnis', title: 'Zeugnis', formatter: 'tickCross' },
|
||||
{ field: 'lehrveranstaltung_bezeichnung', title: 'Lehrveranstaltung' },
|
||||
gradeField,
|
||||
{ field: 'uebernahmedatum', title: 'Übernahmedatum', visible: false },
|
||||
{ field: 'benotungsdatum', title: 'Benotungsdatum', visible: false },
|
||||
{ field: 'benotungsdatum-iso', title: 'Benotungsdatum ISO', visible: false },
|
||||
{ field: 'studiensemester_kurzbz', title: 'Studiensemester', visible: false },
|
||||
{ field: 'note_number', title: 'Note Numerisch', visible: false, formatter: cell => cell.getData().note, tooltip: (evt, cell) => cell.getData().note },
|
||||
{ field: 'lehrveranstaltung_id', title: 'Lehrveranstaltung ID', visible: false },
|
||||
{ field: 'studiengang', title: 'Studiengang', visible: false },
|
||||
{ field: 'studiengang_kz', title: 'Studiengang Kennzahl', visible: false },
|
||||
{ field: 'studiengang_lv', title: 'StudiengangLV', visible: false },
|
||||
{ field: 'studiengang_kz_lv', title: 'Studiengang_kzLV', visible: false },
|
||||
{ field: 'semester_lv', title: 'SemesterLV', visible: false },
|
||||
{ field: 'ects_lv', title: 'ECTS', visible: false },
|
||||
{ field: 'lehrform', title: 'Lehrform', visible: false },
|
||||
{ field: 'kurzbz', title: 'Kurzbz', visible: false },
|
||||
{ field: 'punkte', title: 'Punkte', visible: false },
|
||||
{ field: 'lehrveranstaltung_bezeichnung_english', title: 'Englisch', visible: false }
|
||||
];
|
||||
|
||||
return {
|
||||
ajaxURL: 'dummy',
|
||||
ajaxRequestFunc: (url, config, params) => {
|
||||
@@ -32,27 +113,7 @@ export default {
|
||||
ajaxResponse: (url, params, response) => {
|
||||
return response.data || [];
|
||||
},
|
||||
columns: [
|
||||
{ field: 'zeugnis', title: 'Zeugnis', formatter: 'tickCross' },
|
||||
{ field: 'lehrveranstaltung_bezeichnung', title: 'Lehrveranstaltung' },
|
||||
{ field: 'note_bezeichnung', title: 'Note' },
|
||||
{ field: 'uebernahmedatum', title: 'Übernahmedatum', visible: false },
|
||||
{ field: 'benotungsdatum', title: 'Benotungsdatum', visible: false },
|
||||
{ field: 'benotungsdatum-iso', title: 'Benotungsdatum ISO', visible: false },
|
||||
{ field: 'studiensemester_kurzbz', title: 'Studiensemester', visible: false },
|
||||
{ field: 'note', title: 'Note Numerisch', visible: false },
|
||||
{ field: 'lehrveranstaltung_id', title: 'Lehrveranstaltung ID', visible: false },
|
||||
{ field: 'studiengang', title: 'Studiengang', visible: false },
|
||||
{ field: 'studiengang_kz', title: 'Studiengang Kennzahl', visible: false },
|
||||
{ field: 'studiengang_lv', title: 'StudiengangLV', visible: false },
|
||||
{ field: 'studiengang_kz_lv', title: 'Studiengang_kzLV', visible: false },
|
||||
{ field: 'semester_lv', title: 'SemesterLV', visible: false },
|
||||
{ field: 'ects_lv', title: 'ECTS', visible: false },
|
||||
{ field: 'lehrform', title: 'Lehrform', visible: false },
|
||||
{ field: 'kurzbz', title: 'Kurzbz', visible: false },
|
||||
{ field: 'punkte', title: 'Punkte', visible: false },
|
||||
{ field: 'lehrveranstaltung_bezeichnung_english', title: 'Englisch', visible: false }
|
||||
],
|
||||
columns,
|
||||
layout: 'fitDataStretch',
|
||||
height: '100%',
|
||||
selectable: 1,
|
||||
@@ -90,7 +151,7 @@ export default {
|
||||
:side-menu="false"
|
||||
reload
|
||||
>
|
||||
<template #actions="{selected}">
|
||||
<template v-if="['both', 'header'].includes(config.edit)" #actions="{selected}">
|
||||
<zeugnis-actions :selected="selected" @set-grades="setGrades"></zeugnis-actions>
|
||||
</template>
|
||||
</core-filter-cmpt>
|
||||
|
||||
@@ -2,6 +2,9 @@ export default {
|
||||
emits: [
|
||||
'setGrades'
|
||||
],
|
||||
inject: [
|
||||
'config'
|
||||
],
|
||||
props: {
|
||||
selected: Array
|
||||
},
|
||||
@@ -44,7 +47,7 @@ export default {
|
||||
// TODO(chris): phrases
|
||||
template: `
|
||||
<div class="stv-details-noten-zeugnis-actions">
|
||||
<select class="form-select" v-model="current" :disabled="!selected.length">
|
||||
<select v-if="['both', 'header'].includes(config.edit)" class="form-select" v-model="current" :disabled="!selected.length">
|
||||
<option value="" disabled>Note setzen</option>
|
||||
<option v-for="grade in grades" :key="grade.note" :value="grade.note">{{ grade.bezeichnung }}</option>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user