mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 06:54:04 +00:00
ensure tabulator is rendered after required phrases are loaded, apply optionalTabulatorOptions column visibility if set and localstorage does not already contain user preferences
This commit is contained in:
@@ -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"/>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@@ -108,7 +124,7 @@ export default {
|
||||
:all-semester="!!stdsem"
|
||||
:endpoint="endpoint"
|
||||
@copied="reload"
|
||||
:optionalTabulatorOptions="tabulatorOptions"
|
||||
:optionalTabulatorOptions="tabulatorOptionsTeacher"
|
||||
@loaded="onTeacherLoaded"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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: `
|
||||
<div class="stv-details-noten-repeater d-flex flex-column">
|
||||
<core-filter-cmpt
|
||||
v-if="renderTabulator"
|
||||
ref="table"
|
||||
:title="$p.t('stv/grades_title_repeater')"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
|
||||
@@ -28,11 +28,28 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
renderTabulator: false,
|
||||
setOptinalTabulatorOptionsVisibility: false,
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: "dataProcessed",
|
||||
handler: () => 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: `
|
||||
<div class="stv-details-noten-teacher d-flex flex-column">
|
||||
<core-filter-cmpt
|
||||
v-if="renderTabulator"
|
||||
ref="table"
|
||||
:title="$p.t('stv/grades_title_teacher')"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
|
||||
@@ -34,6 +34,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
renderTabulator: false,
|
||||
setOptinalTabulatorOptionsVisibility: false,
|
||||
tabulatorEvents: [
|
||||
{
|
||||
event: "dataLoaded",
|
||||
@@ -53,6 +55,21 @@ export default {
|
||||
{
|
||||
event: "rowDeselected",
|
||||
handler: row => 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: `
|
||||
<div class="stv-details-noten-zeugnis h-100 d-flex flex-column">
|
||||
<core-filter-cmpt
|
||||
v-if="renderTabulator"
|
||||
ref="table"
|
||||
:title="$p.t('stv/grades_title_zeugnis')"
|
||||
:tabulator-options="tabulatorOptions"
|
||||
|
||||
Reference in New Issue
Block a user