diff --git a/application/config/lvverwaltung.php b/application/config/lvverwaltung.php index 4fe09bff3..d315c9b38 100644 --- a/application/config/lvverwaltung.php +++ b/application/config/lvverwaltung.php @@ -8,4 +8,15 @@ $config['lvverwaltung_tags'] = [ ]; */ -$config['lvverwaltung_tags'] = []; \ No newline at end of file +$config['lvverwaltung_tags'] = []; + +# Additional columns: +/* +$config["list_columns"] = [ + 'fieldname' => [ + 'js' => 'path/to/snippet.js', // tabulator config snippet (eg: return { name: 'Name', field: 'fieldname' }; ) + // NOTE: 'default' & 'joins' like in stv.php config are currently not available here + ] +]; +*/ + diff --git a/application/controllers/js/Tabulatorcolumns.php b/application/controllers/js/Tabulatorcolumns.php index 0f0cea707..1a4621219 100644 --- a/application/controllers/js/Tabulatorcolumns.php +++ b/application/controllers/js/Tabulatorcolumns.php @@ -26,7 +26,8 @@ class Tabulatorcolumns extends Auth_Controller public function __construct() { parent::__construct([ - 'stv' => ['admin:r', 'assistenz:r'] + 'stv' => ['admin:r', 'assistenz:r'], + 'lvverwaltung' => ['admin:r', 'assistenz:r'] ]); } diff --git a/application/views/jssnippets/tabulatorcolumns/lvverwaltung.js b/application/views/jssnippets/tabulatorcolumns/lvverwaltung.js new file mode 100644 index 000000000..60d156a8a --- /dev/null +++ b/application/views/jssnippets/tabulatorcolumns/lvverwaltung.js @@ -0,0 +1,266 @@ +return [ + { + title: 'kurzbz', + titlePhrase: 'lehre/kurzbz', + field: "lv_kurzbz", + headerFilterFuncParams: { field: 'lv_kurzbz' }, + headerFilter: true, + formatter(cell, + formatterParams) { + const rowData = cell.getRow().getData(); + const iconKey = (rowData.lehrtyp_kurzbz || '').toLowerCase(); + const lvkurzbz = (cell.getValue()).toUpperCase(); + + const parentspan = document.createElement('span'); + const span = document.createElement('span'); + + span.classList.add('lv_table_icon', `icon-${iconKey}`); + span.title = iconKey || 'LV-Teil'; + + parentspan.appendChild(span); + parentspan.appendChild(document.createTextNode(` ${lvkurzbz}`)); + + return parentspan; + }, + cellClick(e, + cell) { + cell.getRow().treeToggle(); + } + }, + { + title: 'Tags', + field: 'tags', + tooltip: false, + headerFilter: "input", + headerFilterFunc: "tagHeaderFilter", + headerFilterFuncParams: { field: 'tags' }, + formatter: "tagFormatter", + width: 150, + }, + { + title: 'lehrveranstaltung_id', + titlePhrase: 'lehre/lehrveranstaltung_id', + field: "lehrveranstaltung_id", + headerFilterFuncParams: { field: 'lehrveranstaltung_id' }, + headerFilter: true, + visible: false + }, + { + title: 'bezeichnung', + titlePhrase: 'ui/bezeichnung', + field: "lv_bezeichnung", + headerFilter: true, + headerFilterFuncParams: { field: 'lv_bezeichnung' } + }, + { + title: 'bezeichnungeng', + titlePhrase: 'lehre/bezeichnungeng', + field: "lv_bezeichnung_english", + headerFilter: true, + headerFilterFuncParams: { field: 'lv_bezeichnung_english' }, + visible: false + }, + { + title: 'studiengangskennzahlLehre', + titlePhrase: 'lehre/studiengangskennzahlLehre', + field: "lv_studiengang_kz", + headerFilter: true, + headerFilterFuncParams: { field: 'lv_studiengang_kz' }, + visible: false + }, + { + title: 'studiengang', + titlePhrase: 'lehre/studiengang', + field: "studiengang", + headerFilter: true, + headerFilterFuncParams: { field: 'studiengang' }, + visible: false + }, + { + title: 'semester', + titlePhrase: 'lehre/semester', + field: "semester", + headerFilter: true, + headerFilterFuncParams: { field: 'semester' } + }, + { + title: 'sprache', + titlePhrase: 'global/sprache', + field: "sprache", + headerFilter: true, + headerFilterFuncParams: { field: 'sprache' }, + visible: false + }, + { + title: 'ects', + titlePhrase: 'lehre/ects', + field: "lv_ects", + headerFilter: true, + headerFilterFuncParams: { field: 'lv_ects' }, + visible: false + }, + { + title: 'semesterstunden', + titlePhrase: 'lehre/semesterstunden', + field: "semesterstunden", + headerFilter: true, + headerFilterFuncParams: { field: 'semesterstunden' }, + visible: false + }, + { + title: 'anmerkung', + titlePhrase: 'global/anmerkung', + field: "anmerkung", + headerFilter: true, + headerFilterFuncParams: { field: 'anmerkung' }, + visible: false + }, + { + title: 'lehre', + titlePhrase: 'lehre/lehre', + field: "lehre", + headerFilter: true, + headerFilterFuncParams: { field: 'lehre' }, + formatter: 'ja_nein', + visible: false + }, + { + title: 'aktiv', + titlePhrase: 'person/aktiv', + field: "aktiv", + headerFilter: true, + headerFilterFuncParams: { field: 'aktiv' }, + formatter: 'ja_nein', + visible: false + }, + { + title: 'organisationsform', + titlePhrase: 'lehre/organisationsform', + field: "orgform_kurzbz", + headerFilter: true, + headerFilterFuncParams: { field: 'orgform_kurzbz' } + }, + { + title: 'studienplan_id', + titlePhrase: 'ui/studienplan_id', + field: "studienplan_id", + headerFilter: true, + headerFilterFuncParams: { field: 'studienplan_id' }, + visible: false + }, + { + title: 'studienplan', + titlePhrase: 'lehre/studienplan', + field: "studienplan_bezeichnung", + headerFilter: true, + headerFilterFuncParams: { field: 'studienplan_bezeichnung' }, + visible: false + }, + { + title: 'lehrtyp', + titlePhrase: 'lehre/lehrtyp', + field: "lehrtyp_kurzbz", + headerFilter: true, + headerFilterFuncParams: { field: 'lehrtyp_kurzbz' }, + visible: false + }, + { + title: 'lehrform', + titlePhrase: 'lehre/lehrform', + field: "lehrform_kurzbz", + headerFilter: true, + headerFilterFuncParams: { field: 'lehrform_kurzbz'} }, + { + title: 'leplanstunden', + titlePhrase: 'lehre/leplanstunden', + field: "le_planstunden", + headerFilter: true, + headerFilterFuncParams: { field: 'le_planstunden' }, + visible: false + }, + { + title: 'lehreinheit_id', + titlePhrase: 'lehre/lehreinheit_id', + field: "lehreinheit_id", + headerFilter: true, + headerFilterFuncParams: { field: 'lehreinheit_id' }, + visible: false + }, + { + title: 'studiensemester', + titlePhrase: 'lehre/studiensemester', + field: "studiensemester_kurzbz", + headerFilter: true, + headerFilterFuncParams: { field: 'studiensemester_kurzbz' }, + visible: false + }, + { + title: 'unr', + titlePhrase: 'lehre/unr', + field: "unr", + headerFilter: true, + headerFilterFuncParams: { field: 'unr' }, + visible: false + }, + { + title: 'organisationseinheit', + titlePhrase: 'lehre/organisationseinheit', + field: "fachbereich", + headerFilter: true, + headerFilterFuncParams: { field: 'fachbereich' }, + visible: false + }, + { + title: 'stundenblockung', + titlePhrase: 'lehre/stundenblockung', + field: "stundenblockung", + headerFilter: true, + headerFilterFuncParams: { field: 'stundenblockung' }, + visible: false + }, + { + title: 'wochenrhythmus', + titlePhrase: 'lehre/wochenrhythmus', + field: "wochenrythmus", + headerFilter: true, + headerFilterFuncParams: { field: 'wochenrythmus' }, + visible: false + }, + { + title: 'startkw', + titlePhrase: 'lehre/startkw', + field: "start_kw", + headerFilter: true, + headerFilterFuncParams: { field: 'startkw' }, + visible: false + }, + { + title: 'raumtyp', + titlePhrase: 'lehre/raumtyp', + field: "raumtyp", + headerFilter: true, + headerFilterFuncParams: { field: 'raumtyp' }, + visible: false + }, + { + title: 'raumtypalternativ', + titlePhrase: 'lehre/raumtypalternativ', + field: "raumtypalternativ", + headerFilter: true, + headerFilterFuncParams: { field: 'raumtypalternativ' }, + visible: false + }, + { + title: 'gruppen', + titlePhrase: 'lehre/gruppen', + field: "gruppen", + headerFilter: true, + headerFilterFuncParams: { field: 'gruppen'} }, + { + title: 'lehrende', + titlePhrase: 'lehre/lehrende', + field: "lektoren", + headerFilter: true, + headerFilterFuncParams: { field: ['lektoren', 'vorname', 'nachname'] } + }, +]; diff --git a/public/js/components/LVVerwaltung/Setup/Table.js b/public/js/components/LVVerwaltung/Setup/Table.js index 1ea53e49a..17572ed6b 100644 --- a/public/js/components/LVVerwaltung/Setup/Table.js +++ b/public/js/components/LVVerwaltung/Setup/Table.js @@ -12,6 +12,8 @@ import ApiTag from "../../../api/lehrveranstaltung/tag.js"; import ApiLehreinheit from "../../../api/lehrveranstaltung/lehreinheit.js"; import ApiTreemenu from "../../../api/factory/treemenu.js"; +import LvvColumns from '../../../../../index.ci.php/js/tabulatorcolumns/lvverwaltung'; + export default { name: "LVVerwaltungTable", components: { @@ -191,91 +193,21 @@ export default { ]; }, - columns: [ - { - title: this.$p.t('lehre', 'kurzbz'), - field: "lv_kurzbz", - headerFilterFuncParams: {field: 'lv_kurzbz'}, - headerFilter: true, - formatter: (cell, formatterParams) => { - const rowData = cell.getRow().getData(); - const iconKey = (rowData.lehrtyp_kurzbz || '').toLowerCase(); - const lvkurzbz = (cell.getValue()).toUpperCase(); - - const parentspan = document.createElement('span'); - const span = document.createElement('span'); - - - span.classList.add('lv_table_icon', `icon-${iconKey}`); - span.title = iconKey || 'LV-Teil'; - - parentspan.appendChild(span); - parentspan.appendChild(document.createTextNode(` ${lvkurzbz}`)); - - return parentspan - }, - - cellClick: (e, cell) => { - cell.getRow().treeToggle(); - } - }, - { - title: 'Tags', - field: 'tags', - tooltip: false, - headerFilter: "input", - headerFilterFunc: tagHeaderFilter, - headerFilterFuncParams: {field: 'tags'}, - formatter: (cell) => tagFormatter(cell, this.$refs.tagComponent), - width: 150, - }, - { - title: this.$p.t('lehre', 'lehrveranstaltung_id'), - field: "lehrveranstaltung_id", - headerFilterFuncParams: {field: 'lehrveranstaltung_id'}, - headerFilter: true, - visible: false - }, - {title: this.$p.t('ui', 'bezeichnung'), field: "lv_bezeichnung", headerFilter: true, headerFilterFuncParams: {field: 'lv_bezeichnung'}}, - {title: this.$p.t('lehre', 'bezeichnungeng'), field: "lv_bezeichnung_english", headerFilter: true, headerFilterFuncParams: {field: 'lv_bezeichnung_english'}, visible: false}, - { - title: this.$p.t('lehre', 'studiengangskennzahlLehre'), - field: "lv_studiengang_kz", - headerFilter: true, - headerFilterFuncParams: {field: 'lv_studiengang_kz'}, - visible: false - }, - {title: this.$p.t('lehre', 'studiengang'), field: "studiengang", headerFilter: true, headerFilterFuncParams: {field: 'studiengang'}, visible: false}, - {title: this.$p.t('lehre', 'semester'), field: "semester", headerFilter: true, headerFilterFuncParams: {field: 'semester'}}, - {title: this.$p.t('global', 'sprache'), field: "sprache", headerFilter: true, headerFilterFuncParams: {field: 'sprache'}, visible: false}, - {title: this.$p.t('lehre', 'ects'), field: "lv_ects", headerFilter: true, headerFilterFuncParams: {field: 'lv_ects'}, visible: false}, - {title: this.$p.t('lehre', 'semesterstunden'), field: "semesterstunden", headerFilter: true, headerFilterFuncParams: {field: 'semesterstunden'}, visible: false}, - {title: this.$p.t('global', 'anmerkung'), field: "anmerkung", headerFilter: true, headerFilterFuncParams: {field: 'anmerkung'}, visible: false}, - {title: this.$p.t('lehre', 'lehre'), field: "lehre", headerFilter: true, headerFilterFuncParams: {field: 'lehre'}, formatter: (cell) => cell.getValue() ? this.toUpperCase(this.$p.t('ui', 'ja')) : this.toUpperCase(this.$p.t('ui', 'nein')), visible: false}, - {title: this.$p.t('person', 'aktiv'), field: "aktiv", headerFilter: true, headerFilterFuncParams: {field: 'aktiv'}, formatter: (cell) => cell.getValue() ? this.toUpperCase(this.$p.t('ui', 'ja')) : this.toUpperCase(this.$p.t('ui', 'nein')), visible: false}, - {title: this.$p.t('lehre', 'organisationsform'), field: "orgform_kurzbz", headerFilter: true, headerFilterFuncParams: {field: 'orgform_kurzbz'}}, - {title: this.$p.t('ui', 'studienplan_id'), field: "studienplan_id", headerFilter: true, headerFilterFuncParams: {field: 'studienplan_id'}, visible: false}, - {title: this.$p.t('lehre', 'studienplan'), field: "studienplan_bezeichnung", headerFilter: true, headerFilterFuncParams: {field: 'studienplan_bezeichnung'}, visible: false}, - {title: this.$p.t('lehre', 'lehrtyp'), field: "lehrtyp_kurzbz", headerFilter: true, headerFilterFuncParams: {field: 'lehrtyp_kurzbz'}, visible: false}, - {title: this.$p.t('lehre', 'lehrform'), field: "lehrform_kurzbz", headerFilter: true, headerFilterFuncParams: {field: 'lehrform_kurzbz'}}, - {title: this.$p.t('lehre', 'leplanstunden'), field: "le_planstunden", headerFilter: true, headerFilterFuncParams: {field: 'le_planstunden'}, visible: false}, - {title: this.$p.t('lehre', 'lehreinheit_id'), field: "lehreinheit_id", headerFilter: true, headerFilterFuncParams: {field: 'lehreinheit_id'}, visible: false}, - {title: this.$p.t('lehre', 'studiensemester'), field: "studiensemester_kurzbz", headerFilter: true, headerFilterFuncParams: {field: 'studiensemester_kurzbz'}, visible: false}, - {title: this.$p.t('lehre', 'unr'), field: "unr", headerFilter: true, headerFilterFuncParams: {field: 'unr'}, visible: false}, - {title: this.$p.t('lehre', 'organisationseinheit'), field: "fachbereich", headerFilter: true, headerFilterFuncParams: {field: 'fachbereich'}, visible: false}, - {title: this.$p.t('lehre', 'stundenblockung'), field: "stundenblockung", headerFilter: true, headerFilterFuncParams: {field: 'stundenblockung'}, visible: false}, - {title: this.$p.t('lehre', 'wochenrhythmus'), field: "wochenrythmus", headerFilter: true, headerFilterFuncParams: {field: 'wochenrythmus'}, visible: false}, - {title: this.$p.t('lehre', 'startkw'), field: "start_kw", headerFilter: true, headerFilterFuncParams: {field: 'startkw'}, visible: false}, - {title: this.$p.t('lehre', 'raumtyp'), field: "raumtyp", headerFilter: true, headerFilterFuncParams: {field: 'raumtyp'}, visible: false}, - {title: this.$p.t('lehre', 'raumtypalternativ'), field: "raumtypalternativ", headerFilter: true, headerFilterFuncParams: {field: 'raumtypalternativ'}, visible: false}, - {title: this.$p.t('lehre', 'gruppen'), field: "gruppen", headerFilter: true, headerFilterFuncParams: {field: 'gruppen'}}, - {title: this.$p.t('lehre', 'lehrende'), field: "lektoren", headerFilter: true, headerFilterFuncParams: {field: ['lektoren', 'vorname', 'nachname']}}, - ], + columns: LvvColumns, + locale: true } } }, - + created() { + Tabulator.extendModule("format", "formatters", { + tagHeaderFilter, + tagFormatter: cell => tagFormatter(cell, this.$refs.tagComponent), + ja_nein: cell => cell.getValue() + ? this.toUpperCase(this.$p.t('ui', 'ja')) + : this.toUpperCase(this.$p.t('ui', 'nein')) + }); + }, mounted() { if (this.shouldAutoLoad()) {