diff --git a/application/views/lehre/lehrauftrag/orderLehrauftrag.php b/application/views/lehre/lehrauftrag/orderLehrauftrag.php index a95bc58d7..c386caeee 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftrag.php @@ -95,20 +95,28 @@ $this->load->view( -
- - - - - - - - - - +
+
+
+ + +
+
+
- load->view('templates/FHC-Footer'); ?> @@ -122,9 +130,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 = ''; // ----------------------------------------------------------------------------------------------------------------- // Mutators - setter methods to manipulate table data when entering the tabulator @@ -322,6 +330,66 @@ $this->load->view( row.getElement().style["pointerEvents"] = "none"; } + // 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 which have status bestellt + */ + function footer_selectAll(){ + $('#filterTabulator').tabulator('getRows', true) + .filter(row => row.getData().personalnummer >= 0 && // NOT dummies + row.getData().bestellt == null || // AND neu + row.getData().bestellt != null && // OR (bestellt + row.getData().betrag != row.getData().vertrag_betrag) // AND geaendert) + .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 Bestellung ausgewählt: " + rows.length + ""); + } + // ----------------------------------------------------------------------------------------------------------------- // Tabulator columns format functions // ----------------------------------------------------------------------------------------------------------------- @@ -450,20 +518,6 @@ $this->load->view( $(function() { - // Select all (filtered) rows and ignore rows which have status bestellt - $("#select-all").click(function(){ - $('#filterTabulator').tabulator('getRows', true) - .filter(row => row.getData().bestellt == null || // neu - row.getData().bestellt != null && // OR bestellt - row.getData().betrag != row.getData().vertrag_betrag) // AND geaendert - .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'); @@ -546,10 +600,21 @@ $(function() { } }); - // Focus on clicked button + // De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag bestellen' $(".btn-lehrauftrag").click(function() { - $(".btn-lehrauftrag").removeClass('focus'); - $(this).addClass('focus'); + + // De/activate and un/focus on clicked button + $(".btn-lehrauftrag").removeClass('focus').removeClass('active'); + $(this).addClass('focus').addClass('active'); + + //Enable button 'Lehrauftrag bestellen' by default + $('#order-lehrauftraege').attr('disabled', false).attr('title', ''); + + // Disable button Lehrauftrag bestellen for dummies + if (this.id == 'show-dummies') + { + $('#order-lehrauftraege').attr('disabled', true).attr('title', 'Lehraufträge ohne Lektorzuteilung können nicht bestellt werden.'); + } }); // Order Lehrauftraege diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 7da3ef3bf..1c620ccf5 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -343,6 +343,7 @@ $filterWidgetArray = array( groupHeader: function(value, count, data, group){ return func_groupHeader(data); }, + footerElement: func_footerElement(), columnCalcs:"both", // show column calculations at top and bottom of table and in groups index: "row_index", // assign specific column as unique id (important for row indexing) selectable: true, // allows row selection @@ -354,6 +355,9 @@ $filterWidgetArray = array( rowUpdated:function(row){ func_rowUpdated(row); }, + rowSelectionChanged:function(data, rows){ + func_rowSelectionChanged(data, rows); + }, rowFormatter:function(row){ func_rowFormatter(row); }, @@ -371,7 +375,7 @@ $filterWidgetArray = array( // column status is built dynamically in funcTableBuilt() row_index: {visible: false}, personalnummer: {visible: false}, - lehreinheit_id: {headerFilter:"input", bottomCalc:"count", + lehreinheit_id: {headerFilter:"input", bottomCalc:"count", width: "7%", bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}}, lehrveranstaltung_id: {headerFilter:"input"}, lv_bezeichnung: {visible: false},