From 74e2d1dcc5d813254d5e3215a8f46d2ed237fbd8 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Thu, 6 Aug 2026 07:46:16 +0200 Subject: [PATCH] ensure tabulator is rendered after required phrases are loaded, apply optionalTabulatorOptions column visibility if set and localstorage does not already contain user preferences --- .../js/components/LVVerwaltung/Tabs/Noten.js | 22 +++++++++++-- .../Details/Noten/Repeater.js | 5 +-- .../Details/Noten/Teacher.js | 29 ++++++++++++++-- .../Details/Noten/Zeugnis.js | 33 +++++++++++++++++-- 4 files changed, 79 insertions(+), 10 deletions(-) diff --git a/public/js/components/LVVerwaltung/Tabs/Noten.js b/public/js/components/LVVerwaltung/Tabs/Noten.js index 8b01a017d..07a428d01 100644 --- a/public/js/components/LVVerwaltung/Tabs/Noten.js +++ b/public/js/components/LVVerwaltung/Tabs/Noten.js @@ -25,18 +25,34 @@ export default { return { stdsem: '', endpoint: ApiLVNoten, - tabulatorOptions: { + tabulatorOptionsZeugnis: { visibleColumns: { vorname: true, nachname: true, + uid: true, lehrveranstaltung_bezeichnung: false }, headerFilter: { vorname: true, nachname: true, + uid: true, lehrveranstaltung_bezeichnung: false }, persistenceZeugnisID: 'lv-details-noten-zeugnis-2025120401', + }, + tabulatorOptionsTeacher: { + visibleColumns: { + vorname: true, + nachname: true, + student_uid: true, + lehrveranstaltung_bezeichnung: false + }, + headerFilter: { + vorname: true, + nachname: true, + student_uid: true, + lehrveranstaltung_bezeichnung: false + }, persistenceTeacherID: 'lv-details-noten-teacher-2025120401', }, zeugnisLoaded: false, @@ -98,7 +114,7 @@ export default { :id="modelValue.lehrveranstaltung_id" :all-semester="!!stdsem" :endpoint="endpoint" - :optionalTabulatorOptions="tabulatorOptions" + :optionalTabulatorOptions="tabulatorOptionsZeugnis" @loaded="onZeugnisLoaded"/>
@@ -108,7 +124,7 @@ export default { :all-semester="!!stdsem" :endpoint="endpoint" @copied="reload" - :optionalTabulatorOptions="tabulatorOptions" + :optionalTabulatorOptions="tabulatorOptionsTeacher" @loaded="onTeacherLoaded"/>
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js index eaa34c1c7..ab7dedb3e 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Noten/Repeater.js @@ -21,6 +21,7 @@ export default { }, data() { return { + renderTabulator: false, tabulatorEvents: [] }; }, @@ -118,13 +119,13 @@ export default { created() { this.$p.loadCategory(['global', 'stv', 'lehre', 'profil']) .then(() => { - if (this.$refs.table.tableBuilt) - this.$refs.table.tabulator.columnManager.setColumns(this.tabulatorOptions.columns); + this.renderTabulator = true }); }, template: `
this.$emit("loaded"), }, + { + event: "tableBuilt", + handler: () => { + if(this.optionalTabulatorOptions?.visibleColumns + && this.setOptinalTabulatorOptionsVisibility) + { + for(let key in this.optionalTabulatorOptions.visibleColumns) { + if(this.optionalTabulatorOptions.visibleColumns[key]) + this.$refs.table.tabulator.showColumn(key); + else + this.$refs.table.tabulator.hideColumn(key); + } + } + } + } ] }; }, @@ -86,6 +103,8 @@ export default { { field: 'studiensemester_kurzbz', title: this.$p.t('lehre/studiensemester'), visible: false }, { field: 'note', title: this.$p.t('stv/grades_numericgrade'), visible: false }, { field: 'student_uid', title: this.$p.t('profil/studentIn'), visible: false }, + { field: 'vorname', title: this.$p.t('person/vorname'), visible: false }, + { field: 'nachname', title: this.$p.t('person/nachname'), visible: false }, { field: 'lehrveranstaltung_id', title: this.$p.t('lehre/lehrveranstaltung_id'), visible: false }, { field: 'punkte', title: this.$p.t('stv/grades_points'), visible: false } ], @@ -132,13 +151,19 @@ export default { created() { this.$p.loadCategory(['stv', 'lehre', 'profil']) .then(() => { - if (this.$refs.table.tableBuilt) - this.$refs.table.tabulator.columnManager.setColumns(this.tabulatorOptions.columns); + this.renderTabulator = true; }); + + if(this?.optionalTabulatorOptions) + { + const localStorageKey = 'tabulator-' + this.optionalTabulatorOptions.persistenceTeacherID + '-columns'; + this.setOptinalTabulatorOptionsVisibility = (window.localStorage.getItem(localStorageKey) === null) ? true : false; + } }, template: `
row.getElement().style.zIndex = '' + }, + { + event: "tableBuilt", + handler: () => { + if(this.optionalTabulatorOptions?.visibleColumns + && this.setOptinalTabulatorOptionsVisibility) + { + for(let key in this.optionalTabulatorOptions.visibleColumns) { + if(this.optionalTabulatorOptions.visibleColumns[key]) + this.$refs.table.tabulator.showColumn(key); + else + this.$refs.table.tabulator.hideColumn(key); + } + } + } } ], stdsem: '', @@ -205,7 +222,10 @@ export default { { field: 'lehrform', title: this.$p.t('lehre/lehrform'), visible: false }, { field: 'kurzbz', title: this.$p.t('lehre/kurzbz'), visible: false }, { field: 'punkte', title: this.$p.t('stv/grades_points'), visible: false }, - { field: 'lehrveranstaltung_bezeichnung_english', title: this.$p.t('stv/grades_lehrveranstaltung_bezeichnung_english'), visible: false } + { field: 'lehrveranstaltung_bezeichnung_english', title: this.$p.t('stv/grades_lehrveranstaltung_bezeichnung_english'), visible: false }, + { field: 'uid', title: this.$p.t('person/uid'), visible: false }, + { field: 'vorname', title: this.$p.t('person/vorname'), visible: false }, + { field: 'nachname', title: this.$p.t('person/nachname'), visible: false } ]; const hasDocuments = ['both', 'inline'].includes(this.config.documents); @@ -215,6 +235,7 @@ export default { columns.push({ field: 'actions', title: this.$p.t('global/actions'), + minWidth: 120, cssClass: "overflow-visible", headerSort: false, formatter: cell => { @@ -308,13 +329,19 @@ export default { created() { this.$p.loadCategory(['global', 'stv', 'lehre', 'person']) .then(() => { - if (this.$refs.table.tableBuilt) - this.$refs.table.tabulator.columnManager.setColumns(this.tabulatorOptions.columns); + this.renderTabulator = true; }); + + if(this?.optionalTabulatorOptions) + { + const localStorageKey = 'tabulator-' + this.optionalTabulatorOptions.persistenceZeugnisID + '-columns'; + this.setOptinalTabulatorOptionsVisibility = (window.localStorage.getItem(localStorageKey) === null) ? true : false; + } }, template: `