diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index 7e4e01aef..e575fd680 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -133,7 +133,7 @@ $this->load->view( - +
load->view('lehre/lehrauftrag/acceptLehrauftragData.php'); ?> @@ -146,10 +146,18 @@ $this->load->view(
'; - footer_html += '
'; + footer_html += ''; - footer_html += ''; + footer_html += ''; - footer_html += '
'; - footer_html += '
'; + footer_html += ''; + footer_html += ''; - return footer_html; + return footer_html; } // Performs download CSV function footer_downloadCSV(){ - $('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output + $('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output } /* @@ -286,12 +287,12 @@ function footer_downloadCSV(){ * Select all (filtered) rows and ignore rows that are bestellt and erteilt */ function footer_selectAll(){ - $('#tableWidgetTabulator').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())); + $('#tableWidgetTabulator').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())); } /* @@ -299,12 +300,12 @@ function footer_selectAll(){ * Deselect all (filtered) rows */ function footer_deselectAll(){ - $('#tableWidgetTabulator').tabulator('deselectRow'); + $('#tableWidgetTabulator').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 + ""); + $('#number-selected').html("Für Annehmen ausgewählt: " + rows.length + ""); } // ----------------------------------------------------------------------------------------------------------------- @@ -318,16 +319,16 @@ status_formatter = function(cell, formatterParams, onRendered){ var akzeptiert = cell.getRow().getData().akzeptiert; var is_storniert = cell.getRow().getData().storniert != undefined; - var stunden = parseFloat(cell.getRow().getData().stunden); - var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden); + var stunden = parseFloat(cell.getRow().getData().stunden); + var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden); - var betrag = parseFloat(cell.getRow().getData().betrag); - var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag); + var betrag = parseFloat(cell.getRow().getData().betrag); + var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag); - if (isNaN(betrag)) - { - betrag = 0; - } + if (isNaN(betrag)) + { + betrag = 0; + } // commented icons would be so nice to have with fontawsome 5.11... if (bestellt != null && isNaN(vertrag_betrag)) @@ -378,16 +379,16 @@ status_tooltip = function(cell){ var letzterStatus_vorStorniert = cell.getRow().getData().letzterStatus_vorStorniert; - var stunden = parseFloat(cell.getRow().getData().stunden); - var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden); + var stunden = parseFloat(cell.getRow().getData().stunden); + var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden); - var betrag = parseFloat(cell.getRow().getData().betrag); - var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag); + var betrag = parseFloat(cell.getRow().getData().betrag); + var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag); - if (isNaN(betrag)) - { - betrag = 0; - } + if (isNaN(betrag)) + { + betrag = 0; + } if (letzterStatus_vorStorniert != undefined && letzterStatus_vorStorniert == 'akzeptiert') { @@ -429,24 +430,24 @@ status_tooltip = function(cell){ // Generates bestellt tooltip bestellt_tooltip = function(cell){ - if (cell.getRow().getData().bestellt_von != null) - { - return 'Bestellt von: ' + cell.getRow().getData().bestellt_von; - } + if (cell.getRow().getData().bestellt_von != null) + { + return 'Bestellt von: ' + cell.getRow().getData().bestellt_von; + } } // Generates erteilt tooltip erteilt_tooltip = function(cell){ - if (cell.getRow().getData().erteilt_von != null) { - return 'Erteilt von: ' + cell.getRow().getData().erteilt_von; - } + if (cell.getRow().getData().erteilt_von != null) { + return 'Erteilt von: ' + cell.getRow().getData().erteilt_von; + } } // Generates akzeptiert tooltip akzeptiert_tooltip = function(cell){ - if (cell.getRow().getData().akzeptiert_von != null) { - return 'Angenommen von: ' + cell.getRow().getData().akzeptiert_von; - } + if (cell.getRow().getData().akzeptiert_von != null) { + return 'Angenommen von: ' + cell.getRow().getData().akzeptiert_von; + } } // Generates storniert tooltip @@ -457,43 +458,42 @@ storniert_tooltip = function(cell){ } $(function() { + // Show all rows + $("#show-all").click(function(){ + $('#tableWidgetTabulator').tabulator('clearFilter'); + }); - // Show all rows - $("#show-all").click(function(){ - $('#tableWidgetTabulator').tabulator('clearFilter'); - }); + // Show only rows with ordered lehrauftraege + $("#show-ordered").click(function(){ + $('#tableWidgetTabulator').tabulator('setFilter', + [ + {field: 'bestellt', type: '!=', value: null}, + {field: 'erteilt', type: '=', value: null}, + {field: 'akzeptiert', type: '=', value: null} + ] + ); + }); - // Show only rows with ordered lehrauftraege - $("#show-ordered").click(function(){ - $('#tableWidgetTabulator').tabulator('setFilter', - [ - {field: 'bestellt', type: '!=', value: null}, - {field: 'erteilt', type: '=', value: null}, - {field: 'akzeptiert', type: '=', value: null} - ] - ); - }); + // Show only rows with erteilte lehrauftraege + $("#show-approved").click(function(){ + $('#tableWidgetTabulator').tabulator('setFilter', [ + {field: 'bestellt', type: '!=', value: null}, // filter when is bestellt + {field: 'erteilt', type: '!=', value: null}, // and is erteilt + {field: 'akzeptiert', type: '=', value: null} // and is not akzeptiert + ] + ); + }); - // Show only rows with erteilte lehrauftraege - $("#show-approved").click(function(){ - $('#tableWidgetTabulator').tabulator('setFilter', [ - {field: 'bestellt', type: '!=', value: null}, // filter when is bestellt - {field: 'erteilt', type: '!=', value: null}, // and is erteilt - {field: 'akzeptiert', type: '=', value: null} // and is not akzeptiert - ] - ); - }); - - // Show only rows with akzeptierte lehrauftraege - $("#show-accepted").click(function(){ - $('#tableWidgetTabulator').tabulator('setFilter', - [ - {field: 'bestellt', type: '!=', value: null}, - {field: 'erteilt', type: '!=', value: null}, - {field: 'akzeptiert', type: '!=', value: null} - ] - ); - }); + // Show only rows with akzeptierte lehrauftraege + $("#show-accepted").click(function(){ + $('#tableWidgetTabulator').tabulator('setFilter', + [ + {field: 'bestellt', type: '!=', value: null}, + {field: 'erteilt', type: '!=', value: null}, + {field: 'akzeptiert', type: '!=', value: null} + ] + ); + }); // Set png-icons into filter-buttons $(".btn-lehrauftrag").each(function(){ @@ -510,13 +510,13 @@ $(function() { } }); - // De/activate and un/focus on clicked button - $(".btn-lehrauftrag").click(function() { + // 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'); - }); + // De/activate and un/focus on clicked button + $(".btn-lehrauftrag").removeClass('focus').removeClass('active'); + $(this).addClass('focus').addClass('active'); + }); // Redraw table stornierte lehrauftraege on button click $('#collapseCancelledLehrauftraege').on('shown.bs.collapse', function () { @@ -526,73 +526,73 @@ $(function() { // Approve Lehrauftraege $("#accept-lehrauftraege").click(function(){ - // Get selected rows data - var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData') - .map(function(data){ - // reduce to necessary fields - return { - 'row_index' : data.row_index, - 'vertrag_id' : data.vertrag_id - } - }); + // Get selected rows data + var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData') + .map(function(data){ + // reduce to necessary fields + return { + 'row_index' : data.row_index, + 'vertrag_id' : data.vertrag_id + } + }); - // Alert and exit if no lehraufgang is selected - if (selected_data.length == 0) - { - FHC_DialogLib.alertInfo('Bitte wählen Sie erst zumindest einen Lehrauftrag'); + // Alert and exit if no lehraufgang is selected + if (selected_data.length == 0) + { + FHC_DialogLib.alertInfo('Bitte wählen Sie erst zumindest einen Lehrauftrag'); - // Emtpy password field - $("#password").val(''); + // Emtpy password field + $("#password").val(''); - return; - } + return; + } - // Get password for verification - var password = $("#password").val(); - if (password == '') - { - FHC_DialogLib.alertInfo('Bitte verifizieren Sie sich mit Ihrem Login Passwort.'); + // Get password for verification + var password = $("#password").val(); + if (password == '') + { + FHC_DialogLib.alertInfo('Bitte verifizieren Sie sich mit Ihrem Login Passwort.'); - // Focus on password field - $("#password").focus(); + // Focus on password field + $("#password").focus(); - return; - } + return; + } - // Prepare data object for ajax call - var data = { - 'password': password, - 'selected_data': selected_data - }; + // Prepare data object for ajax call + var data = { + 'password': password, + 'selected_data': selected_data + }; - FHC_AjaxClient.ajaxCallPost( - FHC_JS_DATA_STORAGE_OBJECT.called_path + "/acceptLehrauftrag", - data, - { - successCallback: function (data, textStatus, jqXHR) - { - if (data.error) - { - // Password not verified - FHC_DialogLib.alertWarning(data.retval); - } - if (!data.error && data.retval != null) - { - // Update status 'Erteilt' - $('#tableWidgetTabulator').tabulator('updateData', data.retval); - FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden akzeptiert."); - } - }, - errorCallback: function (jqXHR, textStatus, errorThrown) - { - FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator."); - } - } - ); + FHC_AjaxClient.ajaxCallPost( + FHC_JS_DATA_STORAGE_OBJECT.called_path + "/acceptLehrauftrag", + data, + { + successCallback: function (data, textStatus, jqXHR) + { + if (data.error) + { + // Password not verified + FHC_DialogLib.alertWarning(data.retval); + } + if (!data.error && data.retval != null) + { + // Update status 'Erteilt' + $('#tableWidgetTabulator').tabulator('updateData', data.retval); + FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden akzeptiert."); + } + }, + errorCallback: function (jqXHR, textStatus, errorThrown) + { + FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator."); + } + } + ); - // Empty password field - $("#password").val(''); + // Empty password field + $("#password").val(''); - }); + }); });