diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index d5e1f45bd..1c039d42a 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -64,16 +64,19 @@ $this->load->view( +
- - - - - - -
-
+ +
+
@@ -104,9 +107,9 @@ $this->load->view( * PNG icons used in status- and filter buttons * Setting png icons is a workaround to use font-awsome 5.9.0 icons until system can be updated to newer font awsome version. * */ - const ICON_LEHRAUFTRAG_ORDERED = ''; - const ICON_LEHRAUFTRAG_APPROVED = ''; - const ICON_LEHRAUFTRAG_CHANGED = ''; + const ICON_LEHRAUFTRAG_ORDERED = ''; + const ICON_LEHRAUFTRAG_APPROVED = ''; + const ICON_LEHRAUFTRAG_CHANGED = ''; // ----------------------------------------------------------------------------------------------------------------- @@ -275,6 +278,66 @@ $this->load->view( } } + // Tabulator footer element + // ----------------------------------------------------------------------------------------------------------------- + + // Adds a footer with buttons select all / deselect all / download + function func_footerElement(){ + + var footer_html = '
'; + footer_html += '
'; + + footer_html += ''; + + footer_html += ''; + + footer_html += '
'; + footer_html += '
'; + + return footer_html; + } + + // Performs download CSV + function footer_downloadCSV(){ + $('#filterTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output + } + + /* + * Performs select all + * Select all (filtered) rows and ignore rows that are bestellt and erteilt + */ + function footer_selectAll(){ + $('#filterTabulator').tabulator('getRows', true) + .filter(row => row.getData().bestellt != null && // bestellt + row.getData().erteilt != null && // AND erteilt + row.getData().akzeptiert == null && // AND NOT akzeptiert + row.getData().status != 'Geändert') // AND NOT geändert + .forEach((row => row.select())); + } + + /* + * Performs deselect all + * Deselect all (filtered) rows + */ + function footer_deselectAll(){ + $('#filterTabulator').tabulator('deselectRow'); + } + + // Displays number of selected rows on row selection change + function func_rowSelectionChanged(data, rows){ + $('#number-selected').html("Für Annehmen ausgewählt: " + rows.length + ""); + } + // ----------------------------------------------------------------------------------------------------------------- // Tabulator columns format functions // ----------------------------------------------------------------------------------------------------------------- @@ -384,20 +447,6 @@ $this->load->view( $(function() { - // Select all (filtered) rows, where status bestellt AND erteilt has a value and status akzeptiert has no value. - $("#select-all").click(function(){ - $('#filterTabulator').tabulator('getRows', true) - .filter(function(row){ - return row.getData().bestellt != null && row.getData().erteilt != null && row.getData().akzeptiert == null; - }) - .forEach((row => row.select())); - }); - - // Deselect all (filtered) rows - $("#deselect-all").click(function(){ - $('#filterTabulator').tabulator('deselectRow'); - }); - // Show all rows $("#show-all").click(function(){ $('#filterTabulator').tabulator('clearFilter'); @@ -447,6 +496,13 @@ $this->load->view( } }); + // De/activate and un/focus on clicked button + $(".btn-lehrauftrag").click(function() { + + // De/activate and un/focus on clicked button + $(".btn-lehrauftrag").removeClass('focus').removeClass('active'); + $(this).addClass('focus').addClass('active'); + }); // Approve Lehrauftraege $("#accept-lehrauftraege").click(function(){ diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php index d4f3e86c5..1b8170d9a 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftragData.php @@ -326,10 +326,14 @@ $filterWidgetArray = array( selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated selectableCheck: function(row){ return func_selectableCheck(row); - }, + }, + footerElement: func_footerElement(), rowUpdated:function(row){ func_rowUpdated(row); }, + rowSelectionChanged:function(data, rows){ + func_rowSelectionChanged(data, rows); + }, rowFormatter:function(row){ func_rowFormatter(row); },