diff --git a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php
index 6dbd9e2a7..067a988c6 100644
--- a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php
+++ b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php
@@ -4,7 +4,7 @@ const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
$STUDIENSEMESTER = $studiensemester_selected;
$STUDIENGAENGE_ENTITLED = implode(', ', $studiengaenge_entitled); // alle STG mit Lese- und Schreibberechtigung
-$ORGANISATIONSEINHEITEN_SCHREIBBERECHTIGT = "'". implode('\',\'', $oes_schreibberechtigt). "'"; // alle OE nur mit Schreibberechtigung; singlequote für jeden string notwendig
+$ORGANISATIONSEINHEITEN_SCHREIBBERECHTIGT = "'" . implode('\',\'', $oes_schreibberechtigt) . "'"; // alle OE nur mit Schreibberechtigung; singlequote für jeden string notwendig
$LANGUAGE_INDEX = getUserLanguage() == 'German' ? '1' : '2';
$query = '
@@ -109,9 +109,8 @@ $query = '
LIMIT 1)
END "empfehlungsanfrageAm",';
-if ($configFachbereichsleitung === TRUE)
-{
- $query.= ' CASE
+if ($configFachbereichsleitung === TRUE) {
+ $query .= ' CASE
WHEN (anrechnungen.empfehlung_anrechnung IS NULL AND anrechnungen.status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_STGL . '\') THEN NULL
ELSE
(SELECT COALESCE(
@@ -136,10 +135,8 @@ if ($configFachbereichsleitung === TRUE)
) as tmp_empfehlungsanfrageEmpfaenger
)
END "empfehlungsanfrageAn"';
-}
-else
-{
- $query.= ' CASE
+} else {
+ $query .= ' CASE
WHEN (anrechnungen.empfehlung_anrechnung IS NULL AND anrechnungen.status_kurzbz = \'' . ANRECHNUNGSTATUS_PROGRESSED_BY_STGL . '\') THEN NULL
ELSE
(SELECT COALESCE(
@@ -164,7 +161,7 @@ else
END "empfehlungsanfrageAn"';
}
-$query.= ' FROM anrechnungen
+$query .= ' FROM anrechnungen
JOIN lehre.tbl_anrechnungstatus as anrechnungstatus ON (anrechnungstatus.status_kurzbz = anrechnungen.status_kurzbz)
WHERE studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
AND studiengang_kz IN (' . $STUDIENGAENGE_ENTITLED . ')
@@ -190,8 +187,8 @@ $filterWidgetArray = array(
ucfirst($this->p->t('lehre', 'lehrveranstaltung')),
'ECTS (LV)',
'ECTS (LV + Bisher)',
- 'ECTS (Bisher schulisch)',
- 'ECTS (Bisher beruflich',
+ 'ECTS (Bisher schulisch)',
+ 'ECTS (Bisher beruflich',
ucfirst($this->p->t('global', 'begruendung')),
ucfirst($this->p->t('person', 'studentIn')),
ucfirst($this->p->t('anrechnung', 'nachweisdokumente')),
@@ -201,13 +198,38 @@ $filterWidgetArray = array(
ucfirst($this->p->t('anrechnung', 'empfehlung')),
'status_kurzbz',
'Status',
- 'PrestudentID',
+ 'PrestudentID',
ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAm')),
ucfirst($this->p->t('anrechnung', 'empfehlungsanfrageAn'))
),
'datasetRepOptions' => '{
-
+height: func_height(this),
+layout: "fitColumns", // fit columns to width of table
+layoutColumnsOnNewData:true,
+persistenceID: "approveAnrechnungUebersicht_V1",
+autoResize: false, // prevent auto resizing of table (false to allow adapting table size when cols are (de-)activated
+index: "anrechnung_id", // assign specific column as unique id (important for row indexing)
+selectable: true, // allow row selection
+selectableRangeMode: "click", // allow range selection using shift end click on end of range
+selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
+tableWidgetFooter: {
+ selectButtons: true // tableWidgetFooter properties are checked in _renderTabulatorFooterHTML function
+},
+selectableCheck: function(row){
+ return func_selectableCheck(row);
+},
+rowFormatter:function(row){
+ func_rowFormatter(row,this);
+},
+columnDefaults:{
+
+ //columnDefaults tooltip did not work
+
+ tooltip:function(e, cell, onRendered){
+ return func_tooltips(cell);
+ },
+},
height: func_height(this),
layout: "fitColumns", // fit columns to width of table
persistenceID: "approveAnrechnungUebersicht_V1",
@@ -232,7 +254,7 @@ $filterWidgetArray = array(
tooltip:function(e, cell, onRendered){
return func_tooltips(cell);
},
- headerFilterPlaceholder: " ",
+ //headerFilterPlaceholder: " ",
}
}', // tabulator properties
@@ -274,4 +296,4 @@ $filterWidgetArray = array(
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
-?>
+?>
\ No newline at end of file
diff --git a/application/views/widgets/table/table.php b/application/views/widgets/table/table.php
index 6cd49c61c..33a13b1da 100644
--- a/application/views/widgets/table/table.php
+++ b/application/views/widgets/table/table.php
@@ -4,15 +4,15 @@
-
-
+
+
load->view('widgets/table/tableHelpsite') ?>
-
+
-
-
+
\ No newline at end of file
diff --git a/public/js/lehre/anrechnung/adminAnrechnung.js b/public/js/lehre/anrechnung/adminAnrechnung.js
index 3c5ac3b5a..30f5960ce 100644
--- a/public/js/lehre/anrechnung/adminAnrechnung.js
+++ b/public/js/lehre/anrechnung/adminAnrechnung.js
@@ -3,245 +3,261 @@
// Add Edit and Update Buttons to table rows
function func_tableBuilt(table) {
- table.tabulator("addColumn",
- {
- title: "Aktion",
- align: "center",
- width: 150,
- formatter: addActionButtons,
- }, false // place column right
- );
+ table.tabulator(
+ "addColumn",
+ {
+ title: "Aktion",
+ align: "center",
+ width: 150,
+ formatter: addActionButtons,
+ },
+ false // place column right
+ );
+ // fully redrawing the table after adding the Details column
+ table.tabulator("redraw", true);
}
// Returns relative height (depending on screen size)
-function func_height(table){
- return $(window).height() * 0.50;
+function func_height(table) {
+ return $(window).height() * 0.5;
}
// Converts string date postgre style to string DD.MM.YYYY.
// This will allow correct filtering.
-var formatDate = function(cell, formatterParams){
- let postgreDate = cell.getValue();
- if (postgreDate != null)
- {
- var d = new Date(postgreDate);
- return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
- }
-}
+var formatDate = function (cell, formatterParams) {
+ let postgreDate = cell.getValue();
+ if (postgreDate != null) {
+ var d = new Date(postgreDate);
+ return (
+ ("0" + d.getDate()).slice(-2) +
+ "." +
+ ("0" + (d.getMonth() + 1)).slice(-2) +
+ "." +
+ d.getFullYear()
+ );
+ }
+};
// Create Edit and Update Buttons for table rows
-var addActionButtons = function(cell) {
+var addActionButtons = function (cell) {
+ // Create edit button
+ var editBtn = document.createElement("button");
+ editBtn.type = "button";
+ editBtn.innerHTML = '';
+ editBtn.classList.add("azrEditBtn");
+ editBtn.classList.add("btn");
+ editBtn.classList.add("btn-outline-secondary");
+ editBtn.addEventListener("click", function () {
+ adminAnrechnung.editRow(cell);
+ });
- // Create edit button
- var editBtn = document.createElement("button");
- editBtn.type = "button";
- editBtn.innerHTML = "";
- editBtn.classList.add("azrEditBtn");
- editBtn.classList.add("btn");
- editBtn.classList.add("btn-outline-secondary");
- editBtn.addEventListener("click", function(){
- adminAnrechnung.editRow(cell);
- });
+ // Create delete button
+ var delBtn = document.createElement("button");
+ delBtn.type = "button";
+ delBtn.innerHTML = '';
+ delBtn.classList.add("azrDeleteBtn");
+ delBtn.classList.add("btn");
+ delBtn.classList.add("btn-outline-secondary");
+ delBtn.style.marginLeft = "5px";
+ delBtn.addEventListener("click", function () {
+ adminAnrechnung.deleteRow(cell);
+ });
+ // Add buttons to cell
+ var buttonHolder = document.createElement("span");
+ buttonHolder.appendChild(editBtn);
+ buttonHolder.appendChild(delBtn);
-
- // Create delete button
- var delBtn= document.createElement("button");
- delBtn.type = "button";
- delBtn.innerHTML = "";
- delBtn.classList.add("azrDeleteBtn");
- delBtn.classList.add("btn");
- delBtn.classList.add("btn-outline-secondary");
- delBtn.style.marginLeft = '5px';
- delBtn.addEventListener("click", function(){
- adminAnrechnung.deleteRow(cell);
- });
-
- // Add buttons to cell
- var buttonHolder = document.createElement("span");
- buttonHolder.appendChild(editBtn);
- buttonHolder.appendChild(delBtn);
-
- return buttonHolder;
-}
+ return buttonHolder;
+};
// ---------------------------------------------------------------------------------------------------------------------
$(function () {
+ $(document).on("tableInit", function (event, tabulatorInstance) {
+ // tablutBuilt has to be attached as a callback the the tabulator in tabulator5
+ func_tableBuilt($("#tableWidgetTabulator"));
+ });
- $(document).on("tableInit", function(event,tabulatorInstance) {
- // tablutBuilt has to be attached as a callback the the tabulator in tabulator5
- func_tableBuilt($("#tableWidgetTabulator"))
- });
+ // Empty Modal fields on 'Anrechnungszeitraum hinzufuegen'
+ $(document).on("click", ".azrOpenModal", function () {
+ let defaultStudiensemester_kurzbz = $(
+ ".modal-body #defaultStudiensemester_kurzbz"
+ ).val();
- // Empty Modal fields on 'Anrechnungszeitraum hinzufuegen'
- $(document).on('click', '.azrOpenModal', function(){
+ $(".modal-header #azrModalLabel").text(
+ FHC_PhrasesLib.t("anrechnung", "anrechnungszeitraumHinzufuegen")
+ );
- let defaultStudiensemester_kurzbz = $('.modal-body #defaultStudiensemester_kurzbz').val();
+ $(".modal-body #anrechnungszeitraum_id").val("");
+ $(".modal-body #studiensemester")
+ .val(defaultStudiensemester_kurzbz)
+ .change();
+ $(".modal-body #azrStart").val("");
+ $(".modal-body #azrEnde").val("");
+ });
- $('.modal-header #azrModalLabel').text(FHC_PhrasesLib.t("anrechnung", "anrechnungszeitraumHinzufuegen"));
-
- $('.modal-body #anrechnungszeitraum_id').val('');
- $('.modal-body #studiensemester').val(defaultStudiensemester_kurzbz).change();
- $('.modal-body #azrStart').val('');
- $('.modal-body #azrEnde').val('');
-
- });
+ // Insert Anrechnungszeitraum
+ $(document).on("click", "#azrInsertBtn", function () {
+ var studiensemester_kurzbz = $(".modal-body #studiensemester").val();
+ var anrechnungstart = $(".modal-body #azrStart").val();
+ var anrechnungende = $(".modal-body #azrEnde").val();
// Insert Anrechnungszeitraum
- $(document).on('click', '#azrInsertBtn', function(){
- var studiensemester_kurzbz = $('.modal-body #studiensemester').val();
- var anrechnungstart = $('.modal-body #azrStart').val();
- var anrechnungende = $('.modal-body #azrEnde').val();
-
- // Insert Anrechnungszeitraum
- adminAnrechnung.insertAzr(studiensemester_kurzbz, anrechnungstart, anrechnungende);
- });
-
-})
+ adminAnrechnung.insertAzr(
+ studiensemester_kurzbz,
+ anrechnungstart,
+ anrechnungende
+ );
+ });
+});
var adminAnrechnung = {
- insertAzr: function(studiensemester_kurzbz, anrechnungstart, anrechnungende){
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/save",
- {
- studiensemester_kurzbz: studiensemester_kurzbz,
- anrechnungstart: anrechnungstart,
- anrechnungende: anrechnungende
- },
- {
- successCallback: function (data, textStatus, jqXHR)
+ insertAzr: function (
+ studiensemester_kurzbz,
+ anrechnungstart,
+ anrechnungende
+ ) {
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/save",
+ {
+ studiensemester_kurzbz: studiensemester_kurzbz,
+ anrechnungstart: anrechnungstart,
+ anrechnungende: anrechnungende,
+ },
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.isError(data)) {
+ FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
+ }
+
+ if (FHC_AjaxClient.hasData(data)) {
+ data = FHC_AjaxClient.getData(data);
+
+ // Update row
+ $("#tableWidgetTabulator").tabulator(
+ "addData",
+ [
{
- if (FHC_AjaxClient.isError(data))
- {
- FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
- }
-
- if (FHC_AjaxClient.hasData(data))
- {
- data = FHC_AjaxClient.getData(data);
-
- // Update row
- $('#tableWidgetTabulator').tabulator('addData', [{
- anrechnungszeitraum_id: data.anrechnungszeitraum_id,
- studiensemester_kurzbz: studiensemester_kurzbz,
- anrechnungstart: anrechnungstart,
- anrechnungende: anrechnungende
- }], true); // true to add row on top
-
- // Close Modal
- $('#azrModal').modal('hide');
-
- // Success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "gespeichert"));
- }
+ anrechnungszeitraum_id: data.anrechnungszeitraum_id,
+ studiensemester_kurzbz: studiensemester_kurzbz,
+ anrechnungstart: anrechnungstart,
+ anrechnungende: anrechnungende,
},
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
- );
- },
- editRow: function (cell){
- // Open Modal
- $('#azrModal').modal('show');
+ ],
+ true
+ ); // true to add row on top
- let row = cell.getRow();
- var anrechnungszeitraum_id = row.getData().anrechnungszeitraum_id;
- var studiensemester_kurzbz = row.getData().studiensemester_kurzbz;
- var anrechnungstart = row.getData().anrechnungstart;
- var anrechnungende = row.getData().anrechnungende;
+ // Close Modal
+ $("#azrModal").modal("hide");
- $('.modal-header #azrModalLabel').text('Anrechnungszeitraum bearbeiten');
+ // Success message
+ FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "gespeichert"));
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ },
+ editRow: function (cell) {
+ // Open Modal
+ $("#azrModal").modal("show");
- $('.modal-body #anrechnungszeitraum_id').val(anrechnungszeitraum_id);
- $('.modal-body #studiensemester').val(studiensemester_kurzbz).change();
- $('.modal-body #azrStart').val(anrechnungstart);
- $('.modal-body #azrEnde').val(anrechnungende);
+ let row = cell.getRow();
+ var anrechnungszeitraum_id = row.getData().anrechnungszeitraum_id;
+ var studiensemester_kurzbz = row.getData().studiensemester_kurzbz;
+ var anrechnungstart = row.getData().anrechnungstart;
+ var anrechnungende = row.getData().anrechnungende;
- },
- updateAzr: function (anrechnungszeitraum_id, studiensemester_kurzbz, anrechnungstart, anrechnungende) {
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/edit",
- {
+ $(".modal-header #azrModalLabel").text("Anrechnungszeitraum bearbeiten");
+
+ $(".modal-body #anrechnungszeitraum_id").val(anrechnungszeitraum_id);
+ $(".modal-body #studiensemester").val(studiensemester_kurzbz).change();
+ $(".modal-body #azrStart").val(anrechnungstart);
+ $(".modal-body #azrEnde").val(anrechnungende);
+ },
+ updateAzr: function (
+ anrechnungszeitraum_id,
+ studiensemester_kurzbz,
+ anrechnungstart,
+ anrechnungende
+ ) {
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/edit",
+ {
+ anrechnungszeitraum_id: anrechnungszeitraum_id,
+ studiensemester_kurzbz: studiensemester_kurzbz,
+ anrechnungstart: anrechnungstart,
+ anrechnungende: anrechnungende,
+ },
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.isError(data)) {
+ FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
+ }
+
+ if (FHC_AjaxClient.hasData(data)) {
+ // Update row
+ $("#tableWidgetTabulator").tabulator("updateData", [
+ {
anrechnungszeitraum_id: anrechnungszeitraum_id,
studiensemester_kurzbz: studiensemester_kurzbz,
anrechnungstart: anrechnungstart,
- anrechnungende: anrechnungende
- },
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (FHC_AjaxClient.isError(data))
- {
- FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
- }
+ anrechnungende: anrechnungende,
+ },
+ ]);
- if (FHC_AjaxClient.hasData(data))
- {
- // Update row
- $('#tableWidgetTabulator').tabulator('updateData', [{
- anrechnungszeitraum_id: anrechnungszeitraum_id,
- studiensemester_kurzbz: studiensemester_kurzbz,
- anrechnungstart: anrechnungstart,
- anrechnungende: anrechnungende
- }]);
+ // Close Modal
+ $("#azrModal").modal("hide");
- // Close Modal
- $('#azrModal').modal('hide');
+ // Success message
+ FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "gespeichert"));
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ },
+ deleteAzr: function (anrechnungszeitraum_id) {
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/delete",
+ {
+ anrechnungszeitraum_id: anrechnungszeitraum_id,
+ },
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.isError(data)) {
+ FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
+ }
- // Success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "gespeichert"));
+ if (FHC_AjaxClient.hasData(data)) {
+ let row = $("#tableWidgetTabulator").tabulator(
+ "getRow",
+ anrechnungszeitraum_id
+ );
+ row.delete(anrechnungszeitraum_id);
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
- );
- },
- deleteAzr: function(anrechnungszeitraum_id){
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/delete",
- {
- anrechnungszeitraum_id: anrechnungszeitraum_id
- },
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (FHC_AjaxClient.isError(data))
- {
- FHC_DialogLib.alertWarning(FHC_AjaxClient.getError(data));
- }
-
- if (FHC_AjaxClient.hasData(data))
- {
- let row = $('#tableWidgetTabulator').tabulator('getRow', anrechnungszeitraum_id);
- row.delete(anrechnungszeitraum_id);
-
- // Success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "geloescht"));
-
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
- );
- },
- deleteRow: function (cell){
- if(!confirm(FHC_PhrasesLib.t("ui", "frageSicherLoeschen")))
- {
- return;
- }
-
- // Delete Anrechnungszeitraum
- adminAnrechnung.deleteAzr(cell.getRow().getData().anrechnungszeitraum_id);
+ // Success message
+ FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "geloescht"));
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ },
+ deleteRow: function (cell) {
+ if (!confirm(FHC_PhrasesLib.t("ui", "frageSicherLoeschen"))) {
+ return;
}
-}
\ No newline at end of file
+
+ // Delete Anrechnungszeitraum
+ adminAnrechnung.deleteAzr(cell.getRow().getData().anrechnungszeitraum_id);
+ },
+};
diff --git a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js
index 8f04c562c..a98149040 100644
--- a/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js
+++ b/public/js/lehre/anrechnung/approveAnrechnungUebersicht.js
@@ -1,239 +1,277 @@
-const BASE_URL = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
+const BASE_URL =
+ FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
const CALLED_PATH = FHC_JS_DATA_STORAGE_OBJECT.called_path;
-const CONTROLLER_URL = BASE_URL + '/' + CALLED_PATH;
-const APPROVE_ANRECHNUNG_DETAIL_URI = "lehre/anrechnung/ApproveAnrechnungDetail";
+const CONTROLLER_URL = BASE_URL + "/" + CALLED_PATH;
+const APPROVE_ANRECHNUNG_DETAIL_URI =
+ "lehre/anrechnung/ApproveAnrechnungDetail";
-const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
-const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
-const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
-const ANRECHNUNGSTATUS_APPROVED = 'approved';
-const ANRECHNUNGSTATUS_REJECTED = 'rejected';
+const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = "inProgressDP";
+const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = "inProgressKF";
+const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = "inProgressLektor";
+const ANRECHNUNGSTATUS_APPROVED = "approved";
+const ANRECHNUNGSTATUS_REJECTED = "rejected";
const COLOR_LIGHTGREY = "#f5f5f5";
-const COLOR_DANGER = '#f2dede';
+const COLOR_DANGER = "#f2dede";
var tabulator = null; // Set in tableBuilt function.
// Array with accumulated LV ECTS by Prestudent. Used to find out if max ECTS are exceeded.
var selectedPrestudentWithAccumulatedLvEcts = [];
-
-
-
// -----------------------------------------------------------------------------------------------------------------
// Mutators - setter methods to manipulate table data when entering the tabulator
// -----------------------------------------------------------------------------------------------------------------
// Converts string date postgre style to string DD.MM.YYYY.
// This will allow correct filtering.
-var mut_formatStringDate = function(value, data, type, params, component) {
- if (value != null)
- {
- var d = new Date(value);
- return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
- }
-}
+var mut_formatStringDate = function (value, data, type, params, component) {
+ if (value != null) {
+ var d = new Date(value);
+ return (
+ ("0" + d.getDate()).slice(-2) +
+ "." +
+ ("0" + (d.getMonth() + 1)).slice(-2) +
+ "." +
+ d.getFullYear()
+ );
+ }
+};
// TABULATOR FUNCTIONS
// ---------------------------------------------------------------------------------------------------------------------
// Returns relative height (depending on screen size)
-function func_height(table){
- return $(window).height() * 0.50;
+function func_height(table) {
+ return $(window).height() * 0.5;
}
// Filters boolean values
-function hf_filterTrueFalse(headerValue, rowValue){
+function hf_filterTrueFalse(headerValue, rowValue) {
+ if ("ja".startsWith(headerValue) || "yes".startsWith(headerValue)) {
+ return rowValue == "true";
+ }
- if ('ja'.startsWith(headerValue) || 'yes'.startsWith(headerValue))
- {
- return rowValue == 'true';
- }
+ if ("nein".startsWith(headerValue) || "no".startsWith(headerValue)) {
+ return rowValue == "false";
+ }
- if ('nein'.startsWith(headerValue) || 'no'.startsWith(headerValue))
- {
- return rowValue == 'false';
- }
-
- if (headerValue = '-')
- {
- return rowValue == null;
- }
+ if ((headerValue = "-")) {
+ return rowValue == null;
+ }
}
// Filters schreibberechtigt boolean values
-function hf_schreibberechtigt(headerValue, rowValue){
-
- return rowValue == headerValue.toString();
+function hf_schreibberechtigt(headerValue, rowValue) {
+ return rowValue == headerValue.toString();
}
// Adds column details
// Sets focus on filterbutton, if table starts with stored filter.
function func_tableBuilt(table) {
- // Store table in global var
- tabulator = table;
- table.tabulator("addColumn",{
- title: "Details",
- field: 'details',
- hozAlign: 'center',
- width: 100,
- formatter: "link",
- formatterParams:{
- label:"Details",
- url:function(cell){
- return BASE_URL + "/" + APPROVE_ANRECHNUNG_DETAIL_URI + "?anrechnung_id=" + cell.getData().anrechnung_id
- },
- target:"_blank"
- }
- }, true); // place column on the very left
+ // Store table in global var
+ tabulator = table;
+ table.tabulator(
+ "addColumn",
+ {
+ title: "Details",
+ field: "details",
+ hozAlign: "center",
+ width: 100,
+ formatter: "link",
+ formatterParams: {
+ label: "Details",
+ url: function (cell) {
+ return (
+ BASE_URL +
+ "/" +
+ APPROVE_ANRECHNUNG_DETAIL_URI +
+ "?anrechnung_id=" +
+ cell.getData().anrechnung_id
+ );
+ },
+ target: "_blank",
+ },
+ },
+ true
+ ); // place column on the very left
- // Set focus on filterbutton
-
- let filters = table.find("#tableWidgetTabulator").tabulator("getFilters");
- if (filters.length > 0){
- approveAnrechnung.focusFilterbuttonIfTableStartsWithStoredFilter(filters);
- }
+ // Set focus on filterbutton
+
+ let filters = table.find("#tableWidgetTabulator").tabulator("getFilters");
+ if (filters.length > 0) {
+ approveAnrechnung.focusFilterbuttonIfTableStartsWithStoredFilter(filters);
+ }
+
+ // fully redrawing the table after adding the Details column
+ table.tabulator("redraw", true);
}
/**
* Formats column ECTS (LV + Bisher).
*/
-var format_ectsSumBisherUndNeu = function(cell, formatterParams, onRendered){
- let row = cell.getRow();
- let rowData = row.getData();
+var format_ectsSumBisherUndNeu = function (cell, formatterParams, onRendered) {
+ let row = cell.getRow();
+ let rowData = row.getData();
- let begruendung_id = (rowData.begruendung_id);
- let ectsSumBisherUndNeuTotal = (rowData.ectsSumSchulisch + rowData.ectsSumBeruflich);
- let ectsSumBisherUndNeuSchulisch = rowData.ectsSumSchulisch;
- let ectsSumBisherUndNeuBeruflich = rowData.ectsSumBeruflich;
+ let begruendung_id = rowData.begruendung_id;
+ let ectsSumBisherUndNeuTotal =
+ rowData.ectsSumSchulisch + rowData.ectsSumBeruflich;
+ let ectsSumBisherUndNeuSchulisch = rowData.ectsSumSchulisch;
+ let ectsSumBisherUndNeuBeruflich = rowData.ectsSumBeruflich;
- // If exists, add accumulated LV ECTS to bisherige ECTS
- if (selectedPrestudentWithAccumulatedLvEcts.length > 0)
- {
- let selectedPrestudent = selectedPrestudentWithAccumulatedLvEcts.find(x => x.prestudent_id === rowData.prestudent_id);
+ // If exists, add accumulated LV ECTS to bisherige ECTS
+ if (selectedPrestudentWithAccumulatedLvEcts.length > 0) {
+ let selectedPrestudent = selectedPrestudentWithAccumulatedLvEcts.find(
+ (x) => x.prestudent_id === rowData.prestudent_id
+ );
- if (selectedPrestudent != undefined)
- {
- ectsSumBisherUndNeuTotal = (rowData.ectsSumSchulisch + rowData.ectsSumBeruflich) + selectedPrestudent.ectsSumAnzurechnendeLvsSchulisch + selectedPrestudent.ectsSumAnzurechnendeLvsBeruflich;
- ectsSumBisherUndNeuSchulisch = rowData.ectsSumSchulisch + selectedPrestudent.ectsSumAnzurechnendeLvsSchulisch;
- ectsSumBisherUndNeuBeruflich = rowData.ectsSumBeruflich + selectedPrestudent.ectsSumAnzurechnendeLvsBeruflich;
- }
-
- // Color column if maximum ECTS exceeded
- if (begruendung_id != 5 && row.isSelected())
- {
-
- if (
- (ectsSumBisherUndNeuSchulisch + ectsSumBisherUndNeuBeruflich) > 90 ||
- ectsSumBisherUndNeuSchulisch > 60 ||
- ectsSumBisherUndNeuBeruflich > 60
- )
- {
- cell.getElement().style["background-color"] = COLOR_DANGER;
- }
- }
- else
- {
- cell.getElement().style.removeProperty('background-color');
- }
+ if (selectedPrestudent != undefined) {
+ ectsSumBisherUndNeuTotal =
+ rowData.ectsSumSchulisch +
+ rowData.ectsSumBeruflich +
+ selectedPrestudent.ectsSumAnzurechnendeLvsSchulisch +
+ selectedPrestudent.ectsSumAnzurechnendeLvsBeruflich;
+ ectsSumBisherUndNeuSchulisch =
+ rowData.ectsSumSchulisch +
+ selectedPrestudent.ectsSumAnzurechnendeLvsSchulisch;
+ ectsSumBisherUndNeuBeruflich =
+ rowData.ectsSumBeruflich +
+ selectedPrestudent.ectsSumAnzurechnendeLvsBeruflich;
}
- // If max ECTS is exceeded, format font color / weight
- ectsSumBisherUndNeuTotal = (ectsSumBisherUndNeuTotal > 90) ? "" + ectsSumBisherUndNeuTotal + "" : ectsSumBisherUndNeuTotal;
- ectsSumBisherUndNeuSchulisch = (ectsSumBisherUndNeuSchulisch > 60) ? "" + ectsSumBisherUndNeuSchulisch + "" : ectsSumBisherUndNeuSchulisch;
- ectsSumBisherUndNeuBeruflich = (ectsSumBisherUndNeuBeruflich > 60) ? "" + ectsSumBisherUndNeuBeruflich + "" : ectsSumBisherUndNeuBeruflich;
+ // Color column if maximum ECTS exceeded
+ if (begruendung_id != 5 && row.isSelected()) {
+ if (
+ ectsSumBisherUndNeuSchulisch + ectsSumBisherUndNeuBeruflich > 90 ||
+ ectsSumBisherUndNeuSchulisch > 60 ||
+ ectsSumBisherUndNeuBeruflich > 60
+ ) {
+ cell.getElement().style["background-color"] = COLOR_DANGER;
+ }
+ } else {
+ cell.getElement().style.removeProperty("background-color");
+ }
+ }
- return "T: " + ectsSumBisherUndNeuTotal + " [ S: " + ectsSumBisherUndNeuSchulisch + " | B: " + ectsSumBisherUndNeuBeruflich + " ]";
-}
+ // If max ECTS is exceeded, format font color / weight
+ ectsSumBisherUndNeuTotal =
+ ectsSumBisherUndNeuTotal > 90
+ ? "" +
+ ectsSumBisherUndNeuTotal +
+ ""
+ : ectsSumBisherUndNeuTotal;
+ ectsSumBisherUndNeuSchulisch =
+ ectsSumBisherUndNeuSchulisch > 60
+ ? "" +
+ ectsSumBisherUndNeuSchulisch +
+ ""
+ : ectsSumBisherUndNeuSchulisch;
+ ectsSumBisherUndNeuBeruflich =
+ ectsSumBisherUndNeuBeruflich > 60
+ ? "" +
+ ectsSumBisherUndNeuBeruflich +
+ ""
+ : ectsSumBisherUndNeuBeruflich;
+
+ return (
+ "T: " +
+ ectsSumBisherUndNeuTotal +
+ " [ S: " +
+ ectsSumBisherUndNeuSchulisch +
+ " | B: " +
+ ectsSumBisherUndNeuBeruflich +
+ " ]"
+ );
+};
// Formats the rows
-function func_rowFormatter(row){
-
- let status_kurzbz = row.getData().status_kurzbz;
+function func_rowFormatter(row) {
+ let status_kurzbz = row.getData().status_kurzbz;
- // If status is anything else then 'Bearbeitet von STGL-Leitung'
- if (status_kurzbz != ANRECHNUNGSTATUS_PROGRESSED_BY_STGL)
- {
- // Disable new selection of updated rows
- row.getElement().style["pointerEvents"] = "none";
+ // If status is anything else then 'Bearbeitet von STGL-Leitung'
+ if (status_kurzbz != ANRECHNUNGSTATUS_PROGRESSED_BY_STGL) {
+ // Disable new selection of updated rows
+ row.getElement().style["pointerEvents"] = "none";
- // ...but leave url links selectable
- row.getCell('dokument_bezeichnung').getElement().firstChild.style["pointerEvents"] = "auto";
- row.getCell('details').getElement().firstChild.style["pointerEvents"] = "auto";
-
- // Color background grey
- row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
+ // ...but leave url links selectable
+ row.getCell("dokument_bezeichnung").getElement().firstChild.style[
+ "pointerEvents"
+ ] = "auto";
+ if (row.getCell("details")) {
+ row.getCell("details").getElement().firstChild.style["pointerEvents"] =
+ "auto";
}
+
+ // Color background grey
+ row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
+ }
}
// Formats row selectable/unselectable
-function func_selectableCheck(row){
- let status_kurzbz = row.getData().status_kurzbz;
+function func_selectableCheck(row) {
+ let status_kurzbz = row.getData().status_kurzbz;
- return (
- status_kurzbz != ANRECHNUNGSTATUS_APPROVED &&
- status_kurzbz != ANRECHNUNGSTATUS_REJECTED &&
- status_kurzbz != ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR
- );
+ return (
+ status_kurzbz != ANRECHNUNGSTATUS_APPROVED &&
+ status_kurzbz != ANRECHNUNGSTATUS_REJECTED &&
+ status_kurzbz != ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR
+ );
}
// Calculate dynamically sum of all LV ECTS by Student and display, when maximum ECTS are exceeded.
// data = selected data, rows = selected rows
-function func_rowSelectionChanged(data, rows, tabulatorInstance){
-
- if (tabulator != null)
- {
- // Sum up over all anzurechnenden LV-ECTS by Prestudent
- selectedPrestudentWithAccumulatedLvEcts = approveAnrechnung.getSumLvEctsByPreStudent(data);
+function func_rowSelectionChanged(data, rows, tabulatorInstance) {
+ if (tabulator != null) {
+ // Sum up over all anzurechnenden LV-ECTS by Prestudent
+ selectedPrestudentWithAccumulatedLvEcts =
+ approveAnrechnung.getSumLvEctsByPreStudent(data);
- // Loop through all active rows
-
- var rowManager = tabulatorInstance.rowManager;
+ // Loop through all active rows
- for (var i = 0; i < rowManager.activeRows.length; i++) {
+ var rowManager = tabulatorInstance.rowManager;
- // Reinitialize row -> triggers formatters.
- rowManager.activeRows[i].reinitialize();
-
-
- }
-
- // Show number of selected rows.
- approveAnrechnung.showNumberSelectedRows(rows);
+ for (var i = 0; i < rowManager.activeRows.length; i++) {
+ // Reinitialize row -> triggers formatters.
+ rowManager.activeRows[i].reinitialize();
}
+
+ // Show number of selected rows.
+ approveAnrechnung.showNumberSelectedRows(rows);
+ }
}
// Returns tooltip
-function func_tooltips(){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
- console.log("here");
- // console.log("TOOLTIP DEBUG",cell);
- // // Return tooltip if row is unselectable
- // if (true || !func_selectableCheck(cell.getRow())){
- // return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status';
- // }
+function func_tooltips() {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
+ console.log("here");
+ // console.log("TOOLTIP DEBUG",cell);
+ // // Return tooltip if row is unselectable
+ // if (true || !func_selectableCheck(cell.getRow())){
+ // return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status';
+ // }
}
// Formats empfehlung_anrechnung
-var format_empfehlung_anrechnung = function(cell, formatterParams){
- return (cell.getValue() == null)
- ? '-'
- : (cell.getValue() == 'true')
- ? FHC_PhrasesLib.t("ui", "ja")
- : FHC_PhrasesLib.t("ui", "nein");
-}
+var format_empfehlung_anrechnung = function (cell, formatterParams) {
+ return cell.getValue() == null
+ ? "-"
+ : cell.getValue() == "true"
+ ? FHC_PhrasesLib.t("ui", "ja")
+ : FHC_PhrasesLib.t("ui", "nein");
+};
/**
* Returns formatter params for field dokument_bezeichnung (= Spalte Nachweisdokumente)
* NOTE: Returning a formatter param object fixes the problem, that tabulator did not know the url after refreshing the page.
*/
-function paramLookup_dokBez(cell){
- return {
- labelField: 'dokument_bezeichnung',
- url: CONTROLLER_URL + '/download?dms_id=' + cell.getData().dms_id,
- target: '_blank'
- }
+function paramLookup_dokBez(cell) {
+ return {
+ labelField: "dokument_bezeichnung",
+ url: CONTROLLER_URL + "/download?dms_id=" + cell.getData().dms_id,
+ target: "_blank",
+ };
}
/*
@@ -241,565 +279,605 @@ function paramLookup_dokBez(cell){
* Select all (filtered) rows that are progressed by stg leiter.
* (Ignore rows that are approved, rejected or in request for recommendation)
*/
-function tableWidgetHook_selectAllButton(tableWidgetDiv){
- var resultRows = tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
- .filter(row =>
- row.getData().status_kurzbz == ANRECHNUNGSTATUS_PROGRESSED_BY_STGL
- );
+function tableWidgetHook_selectAllButton(tableWidgetDiv) {
+ var resultRows = tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("getRows", true)
+ .filter(
+ (row) =>
+ row.getData().status_kurzbz == ANRECHNUNGSTATUS_PROGRESSED_BY_STGL
+ );
- tableWidgetDiv.find("#tableWidgetTabulator").tabulator('selectRow', resultRows);
+ tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("selectRow", resultRows);
}
+$(function () {
+ const genehmigung_panel = $("#approveAnrechnungUebersicht-genehmigung-panel");
+ const begruendung_panel = $("#approveAnrechnungUebersicht-begruendung-panel");
+ const hasReadOnlyAccess = $("#formApproveAnrechnungUebersicht").data(
+ "readonly"
+ );
+ const hasCreateAnrechnungAccess = $("#formApproveAnrechnungUebersicht").data(
+ "createaccess"
+ );
+ // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
+ $(document).on("tableInit", function (event, tabulatorInstance) {
+ func_tableBuilt($("#tableWidgetTabulator"));
+ // event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5
+ $("#tableWidgetTabulator").tabulator(
+ "on",
+ "rowSelectionChanged",
+ (data, rows) => {
+ func_rowSelectionChanged(data, rows, tabulatorInstance);
+ }
+ );
+ });
+ // Pruefen ob Promise unterstuetzt wird
+ // Tabulator funktioniert nicht mit IE
+ var canPromise = !!window.Promise;
+ if (!canPromise) {
+ alert(
+ "Diese Seite kann mit ihrem Browser nicht angezeigt werden. Bitte verwenden Sie Firefox, Chrome oder Edge um die Seite anzuzeigen"
+ );
+ window.location.href = "about:blank";
+ return;
+ }
+ // Redraw table on resize to fit tabulators height to windows height
+ window.addEventListener("resize", function () {
+ $("#tableWidgetTabulator").tabulator("setHeight", $(window).height() * 0.5);
+ $("#tableWidgetTabulator").tabulator("redraw", true);
+ });
-$(function(){
- const genehmigung_panel = $('#approveAnrechnungUebersicht-genehmigung-panel');
- const begruendung_panel = $('#approveAnrechnungUebersicht-begruendung-panel');
- const hasReadOnlyAccess = $('#formApproveAnrechnungUebersicht').data('readonly');
- const hasCreateAnrechnungAccess = $('#formApproveAnrechnungUebersicht').data('createaccess');
-
- // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
- $(document).on("tableInit", function(event,tabulatorInstance) {
-
- func_tableBuilt($("#tableWidgetTabulator"))
-
- // event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5
- $("#tableWidgetTabulator").tabulator("on","rowSelectionChanged",(data,rows)=>{func_rowSelectionChanged(data,rows,tabulatorInstance)});
-
- });
-
- // Pruefen ob Promise unterstuetzt wird
- // Tabulator funktioniert nicht mit IE
- var canPromise = !! window.Promise;
- if(!canPromise)
- {
- alert("Diese Seite kann mit ihrem Browser nicht angezeigt werden. Bitte verwenden Sie Firefox, Chrome oder Edge um die Seite anzuzeigen");
- window.location.href='about:blank';
+ if (hasReadOnlyAccess) {
+ approveAnrechnung.disableEditElements();
+ }
+
+ if (!hasCreateAnrechnungAccess) {
+ approveAnrechnung.disableCreateAnrechnungButton();
+ }
+
+ //! this function should not be needed in the approveAnrechnungUebersicht
+ // Set status alert color
+ approveAnrechnung.setStatusAlertColor();
+
+ // Show only rows that are in progress by STGL
+ $("#show-inProgressDP").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ },
+ ]);
+ });
+
+ // Show only rows that are in progress by lector
+ $("#show-inProgressLektor").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
+ },
+ { field: "empfehlung_anrechnung", type: "=", value: null },
+ ]);
+ });
+
+ // Show only rows with empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
+ $("#show-recommended").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ },
+ { field: "empfehlung_anrechnung", type: "=", value: "true" },
+ ]);
+ });
+
+ // Show only rows with nicht empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
+ $("#show-not-recommended").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ },
+ { field: "empfehlung_anrechnung", type: "=", value: "false" },
+ ]);
+ });
+
+ // Show only rows with genehmigte anrechnungen
+ $("#show-approved").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "status_kurzbz", type: "=", value: ANRECHNUNGSTATUS_APPROVED },
+ ]);
+ });
+
+ // Show only rows with abgelehnte anrechnungen
+ $("#show-rejected").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "status_kurzbz", type: "=", value: ANRECHNUNGSTATUS_REJECTED },
+ ]);
+ });
+
+ /**
+ * Show all rows: clear filter and blur button
+ * Bootstrap button remains in activated style, even when clicking various times.
+ * This function "resets" button style and clear all tabulators filter.
+ * NOTE: MUST be after all other filters
+ */
+ $(".btn-clearfilter").click(function () {
+ if ($(this).hasClass("active")) {
+ $("#tableWidgetTabulator").tabulator("clearFilter");
+ $(this).blur();
+ }
+ });
+
+ // Ask if Approve Anrechnungen
+ $("#approveAnrechnungUebersicht-approve-anrechnungen-ask").click(function () {
+ begruendung_panel.css("display", "none");
+
+ if (genehmigung_panel.is(":hidden")) {
+ // Show begruendung panel if is hidden
+ genehmigung_panel.slideDown(400, function () {
+ $("html, body").animate(
+ {
+ scrollTop: genehmigung_panel.offset().top, // Move genehmigung panel bottom up to be visible within window screen
+ },
+ 400
+ );
+ });
+
+ return;
+ }
+ });
+
+ // Approve Anrechnungen
+ $("#approveAnrechnungUebersicht-approve-anrechnungen-confirm").click(
+ function (e) {
+ // Avoid bubbling click event to sibling break button
+ e.stopImmediatePropagation();
+
+ // Get selected rows data
+ let selected_data = $("#tableWidgetTabulator").tabulator(
+ "getSelectedData"
+ );
+
+ // Alert and exit if no anrechnung is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen")
+ );
return;
+ }
+
+ // Prepare data object for ajax call
+ let data = {
+ data: selected_data,
+ };
+
+ // Hide genehmigung panel again
+ genehmigung_panel.slideUp("slow");
+
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/approve",
+ data,
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.isError(data)) {
+ // Print error message
+ FHC_DialogLib.alertError(FHC_AjaxClient.getError(data));
+ } else if (FHC_AjaxClient.hasData(data)) {
+ data = FHC_AjaxClient.getData(data);
+
+ var prestudenten = Object.keys(data.prestudenten);
+
+ // Find intersection of selected and in fact updated Anrechnungen (in case server did not approve all).
+ var updatedData = selected_data.filter((x) =>
+ prestudenten.some((prestudent) => x.prestudent_id == prestudent)
+ );
+
+ // Sum up over all anzurechnenden LV-ECTS by Prestudent
+ var sumLvEctsByPrestudent =
+ approveAnrechnung.getSumLvEctsByPreStudent(updatedData);
+
+ // Loop through Prestudenten
+ // key = Prestudent, value = Approved Anrechnungen of Prestudent
+ Object.entries(data.prestudenten).forEach(([key, value]) => {
+ var rowsToDeselect = [];
+
+ // Get accumulated sum of all LV ECTS
+ var sumLvEcts = sumLvEctsByPrestudent.find(
+ (x) => x.prestudent_id == key
+ );
+
+ // Get ALL rows of that Prestudent
+ var rows = $("#tableWidgetTabulator").tabulator(
+ "searchRows",
+ "prestudent_id",
+ "=",
+ key
+ );
+
+ // Loop through the rows
+ rows.forEach((row) => {
+ var updateData = {};
+
+ // If Anrechnung was approved...
+ if (
+ value.findIndex(
+ (anrechnung_id) =>
+ row.getData().anrechnung_id == anrechnung_id
+ ) !== -1
+ ) {
+ // ...update status
+ updateData.status_kurzbz = data.status_kurzbz;
+ updateData.status_bezeichnung = data.status_bezeichnung;
+
+ // ...and store row to be deselected later on
+ rowsToDeselect.push(row);
+ }
+
+ // Update 'Bisher schulische ECTS' and 'Bisher berufliche ECTS' with the Sum of new approved ECTS
+ (updateData.ectsSumSchulisch =
+ row.getData().ectsSumSchulisch +
+ sumLvEcts.ectsSumAnzurechnendeLvsSchulisch),
+ (updateData.ectsSumBeruflich =
+ row.getData().ectsSumBeruflich +
+ sumLvEcts.ectsSumAnzurechnendeLvsBeruflich);
+
+ // Update row
+ row.update(updateData);
+
+ // Reformat row
+ row.reformat();
+ });
+
+ // Deselect rows
+ $("#tableWidgetTabulator").tabulator(
+ "deselectRow",
+ rowsToDeselect
+ );
+ });
+
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ FHC_PhrasesLib.t("ui", "anrechnungenWurdenGenehmigt")
+ );
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ }
+ );
+
+ // Ask if Reject Anrechnungen
+ $("#approveAnrechnungUebersicht-reject-anrechnungen-ask").click(function () {
+ genehmigung_panel.css("display", "none");
+
+ if (begruendung_panel.is(":hidden")) {
+ // Show begruendung panel if is hidden
+ begruendung_panel.slideDown(400, function () {
+ $("html, body").animate(
+ {
+ scrollTop: begruendung_panel.offset().top, // Move begruendung panel bottom up to be visible within window screen
+ },
+ 400
+ );
+ });
+
+ return;
+ }
+ });
+
+ // Reject Anrechnungen
+ $("#approveAnrechnungUebersicht-reject-anrechnungen-confirm").click(function (
+ e
+ ) {
+ // Avoid bubbling click event to sibling break button
+ e.stopImmediatePropagation();
+
+ let begruendung = $("#approveAnrechnungUebersicht-begruendung").val();
+
+ genehmigung_panel.css("display", "none");
+
+ // Check if begruendung is given
+ if (!begruendung.trim()) {
+ // empty or white spaces only
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteBegruendungAngeben")
+ );
+ return;
}
- // Redraw table on resize to fit tabulators height to windows height
- window.addEventListener('resize', function(){
- $('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
- $('#tableWidgetTabulator').tabulator('redraw', true);
- });
-
- if (hasReadOnlyAccess)
- {
- approveAnrechnung.disableEditElements();
- }
-
- if (!hasCreateAnrechnungAccess)
- {
- approveAnrechnung.disableCreateAnrechnungButton();
- }
-
- //! this function should not be needed in the approveAnrechnungUebersicht
- // Set status alert color
- approveAnrechnung.setStatusAlertColor();
-
- // Show only rows that are in progress by STGL
- $("#show-inProgressDP").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL},
- ]
- );
- });
-
- // Show only rows that are in progress by lector
- $("#show-inProgressLektor").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR},
- {field: 'empfehlung_anrechnung', type: '=', value: null}
- ]
- );
- });
-
- // Show only rows with empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
- $("#show-recommended").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL},
- {field: 'empfehlung_anrechnung', type: '=', value: 'true'}
- ]
- );
- });
-
- // Show only rows with nicht empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
- $("#show-not-recommended").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter', [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL},
- {field: 'empfehlung_anrechnung', type: '=', value: 'false'},
- ]
- );
- });
-
- // Show only rows with genehmigte anrechnungen
- $("#show-approved").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_APPROVED}
- ]
- );
- });
-
- // Show only rows with abgelehnte anrechnungen
- $("#show-rejected").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_REJECTED}
- ]
- );
- });
-
- /**
- * Show all rows: clear filter and blur button
- * Bootstrap button remains in activated style, even when clicking various times.
- * This function "resets" button style and clear all tabulators filter.
- * NOTE: MUST be after all other filters
- */
- $(".btn-clearfilter").click(function(){
- if($(this).hasClass('active'))
- {
- $('#tableWidgetTabulator').tabulator('clearFilter');
- $(this).blur();
- }
- })
-
- // Ask if Approve Anrechnungen
- $("#approveAnrechnungUebersicht-approve-anrechnungen-ask").click(function(){
-
- begruendung_panel.css('display', 'none');
-
- if (genehmigung_panel.is(":hidden"))
- {
- // Show begruendung panel if is hidden
- genehmigung_panel.slideDown(400, function() {
- $('html, body').animate({
- scrollTop: genehmigung_panel.offset().top // Move genehmigung panel bottom up to be visible within window screen
- }, 400);
- });
-
- return;
- }
- });
-
- // Approve Anrechnungen
- $("#approveAnrechnungUebersicht-approve-anrechnungen-confirm").click(function(e){
-
- // Avoid bubbling click event to sibling break button
- e.stopImmediatePropagation();
-
- // Get selected rows data
- let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData');
-
- // Alert and exit if no anrechnung is selected
- if (selected_data.length == 0)
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen"));
- return;
- }
-
- // Prepare data object for ajax call
- let data = {
- 'data': selected_data
+ // Get selected rows data
+ let selected_data = $("#tableWidgetTabulator")
+ .tabulator("getSelectedData")
+ .map(function (data) {
+ // reduce to necessary fields
+ return {
+ anrechnung_id: data.anrechnung_id,
+ begruendung: begruendung,
};
+ });
- // Hide genehmigung panel again
- genehmigung_panel.slideUp('slow');
+ // Alert and exit if no anrechnung is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen")
+ );
+ return;
+ }
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/approve",
- data,
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (FHC_AjaxClient.isError(data))
- {
- // Print error message
- FHC_DialogLib.alertError(FHC_AjaxClient.getError(data));
- }
- else if (FHC_AjaxClient.hasData(data))
- {
- data = FHC_AjaxClient.getData(data);
+ // Prepare data object for ajax call
+ let data = {
+ data: selected_data,
+ };
- var prestudenten = Object.keys(data.prestudenten);
+ // Hide begruendung panel again
+ begruendung_panel.slideUp("slow");
- // Find intersection of selected and in fact updated Anrechnungen (in case server did not approve all).
- var updatedData = selected_data.filter(x => prestudenten.some(prestudent => x.prestudent_id == prestudent));
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/reject",
+ data,
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.isError(data)) {
+ // Print error message
+ FHC_DialogLib.alertError(FHC_AjaxClient.getError(data));
+ } else if (FHC_AjaxClient.hasData(data)) {
+ data = FHC_AjaxClient.getData(data);
- // Sum up over all anzurechnenden LV-ECTS by Prestudent
- var sumLvEctsByPrestudent = approveAnrechnung.getSumLvEctsByPreStudent(updatedData);
+ // Update status 'genehmigt'
+ $("#tableWidgetTabulator").tabulator("updateData", data);
- // Loop through Prestudenten
- // key = Prestudent, value = Approved Anrechnungen of Prestudent
- Object.entries(data.prestudenten).forEach(([key, value]) => {
+ // Deselect rows
+ var indexesToDeselect = data.map((x) => x.anrechnung_id);
+ $("#tableWidgetTabulator").tabulator(
+ "deselectRow",
+ indexesToDeselect
+ );
- var rowsToDeselect = [];
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ FHC_PhrasesLib.t("ui", "anrechnungenWurdenAbgelehnt")
+ );
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ });
- // Get accumulated sum of all LV ECTS
- var sumLvEcts = sumLvEctsByPrestudent.find(x => x.prestudent_id == key);
+ // Request Recommendation for Anrechnungen
+ $("#approveAnrechnungUebersicht-request-recommendation").click(function () {
+ // Get selected rows data
+ let selected_data = $("#tableWidgetTabulator").tabulator("getSelectedData");
- // Get ALL rows of that Prestudent
- var rows = $('#tableWidgetTabulator').tabulator('searchRows', 'prestudent_id', '=', key);
+ // If some of selected anrechnungen has already been recommended...
+ if (selected_data.some((data) => data.empfehlung_anrechnung !== null)) {
+ // ...confirm before requesting recommendation
+ if (
+ !confirm(
+ FHC_PhrasesLib.t(
+ "anrechnung",
+ "confirmTextAntragHatBereitsEmpfehlung"
+ )
+ )
+ ) {
+ return;
+ }
+ }
- // Loop through the rows
- rows.forEach(row => {
- var updateData = {};
+ // Reduce to necessary fields
+ selected_data = selected_data.map((data) => ({
+ anrechnung_id: data.anrechnung_id,
+ }));
- // If Anrechnung was approved...
- if ((value.findIndex(anrechnung_id => row.getData().anrechnung_id == anrechnung_id)) !== -1)
- {
- // ...update status
- updateData.status_kurzbz = data.status_kurzbz;
- updateData.status_bezeichnung = data.status_bezeichnung;
+ // Alert and exit if no anrechnung is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen")
+ );
+ return;
+ }
- // ...and store row to be deselected later on
- rowsToDeselect.push(row);
- }
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/requestRecommendation",
+ { data: selected_data },
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (FHC_AjaxClient.isError(data)) {
+ // Print error message
+ FHC_DialogLib.alertError(FHC_AjaxClient.getError(data));
+ } else if (FHC_AjaxClient.hasData(data)) {
+ data = FHC_AjaxClient.getData(data);
- // Update 'Bisher schulische ECTS' and 'Bisher berufliche ECTS' with the Sum of new approved ECTS
- updateData.ectsSumSchulisch = row.getData().ectsSumSchulisch + sumLvEcts.ectsSumAnzurechnendeLvsSchulisch,
- updateData.ectsSumBeruflich = row.getData().ectsSumBeruflich + sumLvEcts.ectsSumAnzurechnendeLvsBeruflich
-
-
- // Update row
- row.update(updateData);
-
- // Reformat row
- row.reformat();
-
- })
-
- // Deselect rows
- $("#tableWidgetTabulator").tabulator('deselectRow', rowsToDeselect);
-
- })
-
- // Print success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "anrechnungenWurdenGenehmigt"));
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
+ // Print info message, if not all selected recommendations were requested
+ if (data.length < selected_data.length) {
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t(
+ "ui",
+ "empfehlungWurdeAngefordertAusnahmeWoKeineLektoren",
+ [
+ selected_data.length,
+ data.length,
+ selected_data.length - data.length,
+ ]
+ )
+ );
+ } else {
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ FHC_PhrasesLib.t("ui", "empfehlungWurdeAngefordert")
+ );
}
- );
- });
- // Ask if Reject Anrechnungen
- $("#approveAnrechnungUebersicht-reject-anrechnungen-ask").click(function(){
+ //Update status 'genehmigt'
+ $("#tableWidgetTabulator").tabulator("updateData", data);
- genehmigung_panel.css('display', 'none');
+ // Deselect rows
+ var indexesToDeselect = data.map((x) => x.anrechnung_id);
+ $("#tableWidgetTabulator").tabulator(
+ "deselectRow",
+ indexesToDeselect
+ );
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ });
- if (begruendung_panel.is(":hidden"))
- {
- // Show begruendung panel if is hidden
- begruendung_panel.slideDown(400, function() {
- $('html, body').animate({
- scrollTop: begruendung_panel.offset().top // Move begruendung panel bottom up to be visible within window screen
- }, 400);
- });
+ // Break Genehmigung abgeben
+ $("#approveAnrechnungUebersicht-empfehlung-abbrechen").click(function () {
+ genehmigung_panel.slideUp("slow");
+ });
- return;
- }
- });
-
- // Reject Anrechnungen
- $("#approveAnrechnungUebersicht-reject-anrechnungen-confirm").click(function(e){
-
- // Avoid bubbling click event to sibling break button
- e.stopImmediatePropagation();
-
- let begruendung = $('#approveAnrechnungUebersicht-begruendung').val();
-
- genehmigung_panel.css('display', 'none');
-
- // Check if begruendung is given
- if (!begruendung.trim()) // empty or white spaces only
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteBegruendungAngeben"));
- return;
- }
-
- // Get selected rows data
- let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
- .map(function(data){
- // reduce to necessary fields
- return {
- 'anrechnung_id' : data.anrechnung_id,
- 'begruendung' : begruendung
- }
- });
-
- // Alert and exit if no anrechnung is selected
- if (selected_data.length == 0)
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen"));
- return;
- }
-
- // Prepare data object for ajax call
- let data = {
- 'data': selected_data
- };
-
- // Hide begruendung panel again
- begruendung_panel.slideUp('slow');
-
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/reject",
- data,
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (FHC_AjaxClient.isError(data))
- {
- // Print error message
- FHC_DialogLib.alertError(FHC_AjaxClient.getError(data));
- }
- else if (FHC_AjaxClient.hasData(data))
- {
- data = FHC_AjaxClient.getData(data);
-
- // Update status 'genehmigt'
- $('#tableWidgetTabulator').tabulator('updateData', data);
-
- // Deselect rows
- var indexesToDeselect = data.map(x => x.anrechnung_id);
- $("#tableWidgetTabulator").tabulator('deselectRow', indexesToDeselect);
-
- // Print success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "anrechnungenWurdenAbgelehnt"));
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
- );
- });
-
- // Request Recommendation for Anrechnungen
- $("#approveAnrechnungUebersicht-request-recommendation").click(function(){
-
- // Get selected rows data
- let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData');
-
- // If some of selected anrechnungen has already been recommended...
- if (selected_data.some((data) => data.empfehlung_anrechnung !== null))
- {
- // ...confirm before requesting recommendation
- if(!confirm(FHC_PhrasesLib.t("anrechnung", "confirmTextAntragHatBereitsEmpfehlung")))
- {
- return;
- }
- }
-
- // Reduce to necessary fields
- selected_data = selected_data.map(data => ({'anrechnung_id' : data.anrechnung_id}));
-
- // Alert and exit if no anrechnung is selected
- if (selected_data.length == 0)
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen"));
- return;
- }
-
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/requestRecommendation",
- {data: selected_data},
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (FHC_AjaxClient.isError(data))
- {
- // Print error message
- FHC_DialogLib.alertError(FHC_AjaxClient.getError(data));
- }
- else if (FHC_AjaxClient.hasData(data))
- {
- data = FHC_AjaxClient.getData(data);
-
- // Print info message, if not all selected recommendations were requested
- if (data.length < selected_data.length){
- FHC_DialogLib.alertInfo(
- FHC_PhrasesLib.t(
- "ui", "empfehlungWurdeAngefordertAusnahmeWoKeineLektoren",
- [selected_data.length, data.length, selected_data.length - data.length])
- );
- }
- else
- {
- // Print success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "empfehlungWurdeAngefordert"));
- }
-
- //Update status 'genehmigt'
- $('#tableWidgetTabulator').tabulator('updateData', data);
-
- // Deselect rows
- var indexesToDeselect = data.map(x => x.anrechnung_id);
- $("#tableWidgetTabulator").tabulator('deselectRow', indexesToDeselect);
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
- );
- });
-
- // Break Genehmigung abgeben
- $('#approveAnrechnungUebersicht-empfehlung-abbrechen').click(function(){
- genehmigung_panel.slideUp('slow');
- })
-
- // Break Ablehnung abgeben
- $('#approveAnrechnungUebersicht-begruendung-abbrechen').click(function(){
- begruendung_panel.slideUp('slow');
- })
-
- // Copy Begruendung into textarea
- $(".btn-copyIntoTextarea").click(function(){
- approveAnrechnung.copyIntoTextarea(this);
- })
+ // Break Ablehnung abgeben
+ $("#approveAnrechnungUebersicht-begruendung-abbrechen").click(function () {
+ begruendung_panel.slideUp("slow");
+ });
+ // Copy Begruendung into textarea
+ $(".btn-copyIntoTextarea").click(function () {
+ approveAnrechnung.copyIntoTextarea(this);
+ });
});
var approveAnrechnung = {
- setStatusAlertColor: function () {
- let status_kurzbz = $('#requestAnrechnung-status_kurzbz').data('status_kurzbz');
+ setStatusAlertColor: function () {
+ let status_kurzbz = $("#requestAnrechnung-status_kurzbz").data(
+ "status_kurzbz"
+ );
- switch (status_kurzbz) {
- case ANRECHNUNGSTATUS_APPROVED:
- $('#requestAnrechnung-status_kurzbz').closest('div').addClass('bg-success-subtle');
- break;
- case ANRECHNUNGSTATUS_REJECTED:
- $('#requestAnrechnung-status_kurzbz').closest('div').addClass('bg-danger-subtle');
- break;
- case '':
- $('#requestAnrechnung-status_kurzbz').closest('div').addClass('bg-info-subtle');
- break;
- default:
- $('#requestAnrechnung-status_kurzbz').closest('div').addClass('bg-warning-subtle');
- }
- },
- disableEditElements: function()
- {
- // Disable:
- // ...button Empfehlung anfordern
- $('#approveAnrechnungUebersicht-request-recommendation')
- .prop('disabled', true)
- .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
- // ...button Ablehnen
- $('#approveAnrechnungUebersicht-reject-anrechnungen-ask')
- .prop('disabled', true)
- .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
- // ...button Genehmigen
- $('#approveAnrechnungUebersicht-approve-anrechnungen-ask')
- .prop('disabled', true)
- .attr('title', FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
-
- },
- disableCreateAnrechnungButton: function()
- {
- // Disable button Antrag anlegen
- $('#approveAnrechnungUebersicht-create-anrechnung')
- .removeAttr('href')
- .css({'color': 'grey', 'pointer-events': 'none'}); // property disabled does not work for link
- },
- copyIntoTextarea: function(elem){
-
- // Find closest textarea
- let textarea = $(elem).closest('div').find('textarea');
-
- // Copy begruendung into textarea and set focus
- textarea.val($.trim($(elem).parent().text())).focus();
- },
- focusFilterbuttonIfTableStartsWithStoredFilter(filters){
- switch (filters[0].value) {
- case ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR:
- $("#show-inProgressLektor").addClass('active');
- break;
- case ANRECHNUNGSTATUS_APPROVED:
- $("#show-approved").addClass('active');
- break;
- case ANRECHNUNGSTATUS_REJECTED:
- $("#show-rejected").addClass('active');
- break;
- case ANRECHNUNGSTATUS_PROGRESSED_BY_STGL:
- if (filters.length > 1)
- {
- if (filters[1].field == 'empfehlung_anrechnung')
- {
- if (filters[1].value === 'true')
- {
- $("#show-recommended").addClass('active');
- }
- else
- {
- $("#show-not-recommended").addClass('active');
- }
- }
- }
- else
- {
- $("#show-inProgressDP").addClass('active');
- }
-
- break;
-
- }
- },
- getSumLvEctsByPreStudent(data){
-
- var result = [];
-
- // Berechne für jeden Prestudenten die kumulierte Summe aller selektierten LV ECTS
- data.reduce((prev, curr) => {
-
- if (!prev[curr.prestudent_id])
- {
- prev[curr.prestudent_id] = {
- prestudent_id: curr.prestudent_id,
- ectsSumAnzurechnendeLvsSchulisch: 0,
- ectsSumAnzurechnendeLvsBeruflich: 0
- };
-
- result.push(prev[curr.prestudent_id])
- }
-
- // Kumulierte Summe aller selektierten LVs, die angerechnet werden sollen, getrennt nach
- // schulischer und beruflicher Qualifikation.
- // Ausgenommen ist die universitäre Qualifikation (5), da diese unbegrenzt möglich sind.
- if (curr.begruendung_id != 5)
- {
- if (curr.begruendung_id == 4)
- {
- prev[curr.prestudent_id].ectsSumAnzurechnendeLvsBeruflich += curr.ects;
- }
- else
- {
- prev[curr.prestudent_id].ectsSumAnzurechnendeLvsSchulisch += curr.ects;
- }
- }
-
- return prev;
-
- }, {});
-
- return result;
- },
- showNumberSelectedRows(rows){
- $('#number-selected').html("Ausgewählte Zeilen: " + rows.length + "");
+ switch (status_kurzbz) {
+ case ANRECHNUNGSTATUS_APPROVED:
+ $("#requestAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-success-subtle");
+ break;
+ case ANRECHNUNGSTATUS_REJECTED:
+ $("#requestAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-danger-subtle");
+ break;
+ case "":
+ $("#requestAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-info-subtle");
+ break;
+ default:
+ $("#requestAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-warning-subtle");
}
-}
+ },
+ disableEditElements: function () {
+ // Disable:
+ // ...button Empfehlung anfordern
+ $("#approveAnrechnungUebersicht-request-recommendation")
+ .prop("disabled", true)
+ .attr("title", FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
+ // ...button Ablehnen
+ $("#approveAnrechnungUebersicht-reject-anrechnungen-ask")
+ .prop("disabled", true)
+ .attr("title", FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
+ // ...button Genehmigen
+ $("#approveAnrechnungUebersicht-approve-anrechnungen-ask")
+ .prop("disabled", true)
+ .attr("title", FHC_PhrasesLib.t("ui", "nurLeseberechtigung"));
+ },
+ disableCreateAnrechnungButton: function () {
+ // Disable button Antrag anlegen
+ $("#approveAnrechnungUebersicht-create-anrechnung")
+ .removeAttr("href")
+ .css({ color: "grey", "pointer-events": "none" }); // property disabled does not work for link
+ },
+ copyIntoTextarea: function (elem) {
+ // Find closest textarea
+ let textarea = $(elem).closest("div").find("textarea");
+
+ // Copy begruendung into textarea and set focus
+ textarea.val($.trim($(elem).parent().text())).focus();
+ },
+ focusFilterbuttonIfTableStartsWithStoredFilter(filters) {
+ switch (filters[0].value) {
+ case ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR:
+ $("#show-inProgressLektor").addClass("active");
+ break;
+ case ANRECHNUNGSTATUS_APPROVED:
+ $("#show-approved").addClass("active");
+ break;
+ case ANRECHNUNGSTATUS_REJECTED:
+ $("#show-rejected").addClass("active");
+ break;
+ case ANRECHNUNGSTATUS_PROGRESSED_BY_STGL:
+ if (filters.length > 1) {
+ if (filters[1].field == "empfehlung_anrechnung") {
+ if (filters[1].value === "true") {
+ $("#show-recommended").addClass("active");
+ } else {
+ $("#show-not-recommended").addClass("active");
+ }
+ }
+ } else {
+ $("#show-inProgressDP").addClass("active");
+ }
+
+ break;
+ }
+ },
+ getSumLvEctsByPreStudent(data) {
+ var result = [];
+
+ // Berechne für jeden Prestudenten die kumulierte Summe aller selektierten LV ECTS
+ data.reduce((prev, curr) => {
+ if (!prev[curr.prestudent_id]) {
+ prev[curr.prestudent_id] = {
+ prestudent_id: curr.prestudent_id,
+ ectsSumAnzurechnendeLvsSchulisch: 0,
+ ectsSumAnzurechnendeLvsBeruflich: 0,
+ };
+
+ result.push(prev[curr.prestudent_id]);
+ }
+
+ // Kumulierte Summe aller selektierten LVs, die angerechnet werden sollen, getrennt nach
+ // schulischer und beruflicher Qualifikation.
+ // Ausgenommen ist die universitäre Qualifikation (5), da diese unbegrenzt möglich sind.
+ if (curr.begruendung_id != 5) {
+ if (curr.begruendung_id == 4) {
+ prev[curr.prestudent_id].ectsSumAnzurechnendeLvsBeruflich +=
+ curr.ects;
+ } else {
+ prev[curr.prestudent_id].ectsSumAnzurechnendeLvsSchulisch +=
+ curr.ects;
+ }
+ }
+
+ return prev;
+ }, {});
+
+ return result;
+ },
+ showNumberSelectedRows(rows) {
+ $("#number-selected").html(
+ "Ausgewählte Zeilen: " + rows.length + ""
+ );
+ },
+};
diff --git a/public/js/lehre/anrechnung/reviewAnrechnungUebersicht.js b/public/js/lehre/anrechnung/reviewAnrechnungUebersicht.js
index ff6ae5839..4a89dfdd1 100644
--- a/public/js/lehre/anrechnung/reviewAnrechnungUebersicht.js
+++ b/public/js/lehre/anrechnung/reviewAnrechnungUebersicht.js
@@ -1,13 +1,14 @@
-const BASE_URL = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
+const BASE_URL =
+ FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
const CALLED_PATH = FHC_JS_DATA_STORAGE_OBJECT.called_path;
-const CONTROLLER_URL = BASE_URL + '/' + CALLED_PATH;
+const CONTROLLER_URL = BASE_URL + "/" + CALLED_PATH;
const APPROVE_ANRECHNUNG_DETAIL_URI = "lehre/anrechnung/ReviewAnrechnungDetail";
-const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP';
-const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF';
-const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor';
-const ANRECHNUNGSTATUS_APPROVED = 'approved';
-const ANRECHNUNGSTATUS_REJECTED = 'rejected';
+const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = "inProgressDP";
+const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = "inProgressKF";
+const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = "inProgressLektor";
+const ANRECHNUNGSTATUS_APPROVED = "approved";
+const ANRECHNUNGSTATUS_REJECTED = "rejected";
const COLOR_LIGHTGREY = "#f5f5f5";
@@ -17,134 +18,152 @@ const COLOR_LIGHTGREY = "#f5f5f5";
// Converts string date postgre style to string DD.MM.YYYY.
// This will allow correct filtering.
-var mut_formatStringDate = function(value, data, type, params, component) {
- if (value != null)
- {
- var d = new Date(value);
- return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
- }
-}
+var mut_formatStringDate = function (value, data, type, params, component) {
+ if (value != null) {
+ var d = new Date(value);
+ return (
+ ("0" + d.getDate()).slice(-2) +
+ "." +
+ ("0" + (d.getMonth() + 1)).slice(-2) +
+ "." +
+ d.getFullYear()
+ );
+ }
+};
// TABULATOR FUNCTIONS
// ---------------------------------------------------------------------------------------------------------------------
// Returns relative height (depending on screen size)
-function func_height(table){
- return $(window).height() * 0.50;
+function func_height(table) {
+ return $(window).height() * 0.5;
}
// Filters boolean values
-function hf_filterTrueFalse(headerValue, rowValue){
+function hf_filterTrueFalse(headerValue, rowValue) {
+ if ("ja".startsWith(headerValue) || "yes".startsWith(headerValue)) {
+ return rowValue == "true";
+ }
- if ('ja'.startsWith(headerValue) || 'yes'.startsWith(headerValue))
- {
- return rowValue == 'true';
- }
+ if ("nein".startsWith(headerValue) || "no".startsWith(headerValue)) {
+ return rowValue == "false";
+ }
- if ('nein'.startsWith(headerValue) || 'no'.startsWith(headerValue))
- {
- return rowValue == 'false';
- }
-
- if (headerValue = '-')
- {
- return rowValue == null;
- }
+ if ((headerValue = "-")) {
+ return rowValue == null;
+ }
}
// Filters empfehlungsberechtigt boolean values
-function hf_empfehlungsberechtigt(headerValue, rowValue){
-
- return rowValue == headerValue.toString();
+function hf_empfehlungsberechtigt(headerValue, rowValue) {
+ return rowValue == headerValue.toString();
}
// Adds column details
function func_tableBuilt(table) {
- table.tabulator("addColumn",
- {
- title: "Details",
- field: 'details',
- align: "center",
- width: 100,
- formatter: "link",
- formatterParams:{
- label:"Details",
- url:function(cell){
- return BASE_URL + "/" + APPROVE_ANRECHNUNG_DETAIL_URI + "?anrechnung_id=" + cell.getData().anrechnung_id
- },
- target:"_blank"
- }
- }, true // place column on the very left
- );
+ table.tabulator(
+ "addColumn",
+ {
+ title: "Details",
+ field: "details",
+ align: "center",
+ width: 100,
+ formatter: "link",
+ formatterParams: {
+ label: "Details",
+ url: function (cell) {
+ return (
+ BASE_URL +
+ "/" +
+ APPROVE_ANRECHNUNG_DETAIL_URI +
+ "?anrechnung_id=" +
+ cell.getData().anrechnung_id
+ );
+ },
+ target: "_blank",
+ },
+ },
+ true // place column on the very left
+ );
+ // fully redrawing the table after adding the Details column
+ table.tabulator("redraw", true);
}
// Formats the rows
-function func_rowFormatter(row){
- let status_kurzbz = row.getData().status_kurzbz;
- let empfehlungsberechtigt = row.getData().empfehlungsberechtigt;
+function func_rowFormatter(row) {
+ let status_kurzbz = row.getData().status_kurzbz;
+ let empfehlungsberechtigt = row.getData().empfehlungsberechtigt;
- row.getCells().forEach(function(cell){
- if (status_kurzbz != ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR || empfehlungsberechtigt == "false")
- {
- row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
- }
- });
+ row.getCells().forEach(function (cell) {
+ if (
+ status_kurzbz != ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR ||
+ empfehlungsberechtigt == "false"
+ ) {
+ row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
+ }
+ });
}
// Formats row selectable/unselectable
-function func_selectableCheck(row){
- let status_kurzbz = row.getData().status_kurzbz;
- let empfehlungsberechtigt = row.getData().empfehlungsberechtigt;
+function func_selectableCheck(row) {
+ let status_kurzbz = row.getData().status_kurzbz;
+ let empfehlungsberechtigt = row.getData().empfehlungsberechtigt;
- return (
- status_kurzbz == ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR || empfehlungsberechtigt == "false"
- );
+ return (
+ status_kurzbz == ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR ||
+ empfehlungsberechtigt == "false"
+ );
}
// Performes after row was updated
-function func_rowUpdated(row){
- // Refresh row formatters
- row.reformat();
+function func_rowUpdated(row) {
+ // Refresh row formatters
+ row.reformat();
- // Deselect and disable new selection of updated rows
- row.deselect();
- row.getElement().style["pointerEvents"] = "none";
+ // Deselect and disable new selection of updated rows
+ row.deselect();
+ row.getElement().style["pointerEvents"] = "none";
- // ...but leave url links selectable
- row.getCell('dokument_bezeichnung').getElement().firstChild.style["pointerEvents"] = "auto";
- row.getCell('details').getElement().firstChild.style["pointerEvents"] = "auto";
+ // ...but leave url links selectable
+ row.getCell("dokument_bezeichnung").getElement().firstChild.style[
+ "pointerEvents"
+ ] = "auto";
+ if (row.getCell("detils")) {
+ row.getCell("details").getElement().firstChild.style["pointerEvents"] =
+ "auto";
+ }
}
// Returns tooltip
-function func_tooltips(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration functionfunction
-
- // Return tooltip if row is unselectable
- if (!func_selectableCheck(cell.getRow())){
- return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + 'Status';
- }
+function func_tooltips(e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration functionfunction
+
+ // Return tooltip if row is unselectable
+ if (!func_selectableCheck(cell.getRow())) {
+ return FHC_PhrasesLib.t("ui", "nichtSelektierbarAufgrundVon") + "Status";
+ }
}
// Formats empfehlung_anrechnung
-var format_empfehlung_anrechnung = function(cell, formatterParams){
- return (cell.getValue() == null)
- ? '-'
- : (cell.getValue() == 'true')
- ? FHC_PhrasesLib.t("ui", "ja")
- : FHC_PhrasesLib.t("ui", "nein");
-}
+var format_empfehlung_anrechnung = function (cell, formatterParams) {
+ return cell.getValue() == null
+ ? "-"
+ : cell.getValue() == "true"
+ ? FHC_PhrasesLib.t("ui", "ja")
+ : FHC_PhrasesLib.t("ui", "nein");
+};
/**
* Returns formatter params for field dokument_bezeichnung (= Spalte Nachweisdokumente)
* NOTE: Returning a formatter param object fixes the problem, that tabulator did not know the url after refreshing the page.
*/
-function paramLookup_dokBez(cell){
- return {
- labelField: 'dokument_bezeichnung',
- url: CONTROLLER_URL + '/download?dms_id=' + cell.getData().dms_id,
- target: '_blank'
- }
+function paramLookup_dokBez(cell) {
+ return {
+ labelField: "dokument_bezeichnung",
+ url: CONTROLLER_URL + "/download?dms_id=" + cell.getData().dms_id,
+ target: "_blank",
+ };
}
/*
@@ -152,319 +171,338 @@ function paramLookup_dokBez(cell){
* Select all (filtered) rows that are progressed by stg leiter.
* (Ignore rows that are approved, rejected or in request for recommendation)
*/
-function tableWidgetHook_selectAllButton(tableWidgetDiv){
-
- var resultRows = tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
- .filter(row =>
- row.getData().status_kurzbz == ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR
- );
+function tableWidgetHook_selectAllButton(tableWidgetDiv) {
+ var resultRows = tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("getRows", true)
+ .filter(
+ (row) =>
+ row.getData().status_kurzbz == ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR
+ );
- tableWidgetDiv.find("#tableWidgetTabulator").tabulator('selectRow', resultRows);
+ tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("selectRow", resultRows);
}
+$(function () {
+ const empfehlung_panel = $("#reviewAnrechnungUebersicht-empfehlung-panel");
+ const begruendung_panel = $("#reviewAnrechnungUebersicht-begruendung-panel");
-$(function(){
+ // Pruefen ob Promise unterstuetzt wird
+ // Tabulator funktioniert nicht mit IE
+ var canPromise = !!window.Promise;
+ if (!canPromise) {
+ alert(
+ "Diese Seite kann mit ihrem Browser nicht angezeigt werden. Bitte verwenden Sie Firefox, Chrome oder Edge um die Seite anzuzeigen"
+ );
+ window.location.href = "about:blank";
+ return;
+ }
- const empfehlung_panel = $('#reviewAnrechnungUebersicht-empfehlung-panel');
- const begruendung_panel = $('#reviewAnrechnungUebersicht-begruendung-panel');
+ $(document).on("tableInit", function (event, tabulatorInstance) {
+ func_tableBuilt($("#tableWidgetTabulator"));
- // Pruefen ob Promise unterstuetzt wird
- // Tabulator funktioniert nicht mit IE
- var canPromise = !! window.Promise;
- if(!canPromise)
- {
- alert("Diese Seite kann mit ihrem Browser nicht angezeigt werden. Bitte verwenden Sie Firefox, Chrome oder Edge um die Seite anzuzeigen");
- window.location.href='about:blank';
- return;
+ // event rowUpdated needs to be attached as a callback to the tableBuilt event in tabulator5
+ $("#tableWidgetTabulator").tabulator("on", "rowUpdated", (row) => {
+ func_rowUpdated(row);
+ });
+ });
+
+ // Redraw table on resize to fit tabulators height to windows height
+ window.addEventListener("resize", function () {
+ $("#tableWidgetTabulator").tabulator("setHeight", $(window).height() * 0.5);
+ $("#tableWidgetTabulator").tabulator("redraw", true);
+ });
+
+ // Set status alert color
+ reviewAnrechnung.setStatusAlertColor();
+
+ // Show only rows with anrechnungen ohne Empfehlung
+ $("#show-need-recommendation").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR,
+ },
+ ]);
+ });
+
+ // Show only rows with empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
+ $("#show-recommended").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ },
+ { field: "empfehlung_anrechnung", type: "=", value: "true" },
+ ]);
+ });
+
+ // Show only rows with nicht empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
+ $("#show-not-recommended").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ {
+ field: "status_kurzbz",
+ type: "=",
+ value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL,
+ },
+ { field: "empfehlung_anrechnung", type: "=", value: "false" },
+ ]);
+ });
+
+ // Show only rows with genehmigte anrechnungen
+ $("#show-approved").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "status_kurzbz", type: "=", value: ANRECHNUNGSTATUS_APPROVED },
+ ]);
+ });
+
+ // Show only rows with abgelehnte anrechnungen
+ $("#show-rejected").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "status_kurzbz", type: "=", value: ANRECHNUNGSTATUS_REJECTED },
+ ]);
+ });
+
+ /**
+ * Show all rows: clear filter and blur button
+ * Bootstrap button remains in activated style, even when clicking various times.
+ * This function "resets" button style and clear all tabulators filter.
+ * NOTE: MUST be after all other filters
+ */
+ $(".btn-clearfilter").click(function () {
+ if ($(this).hasClass("active")) {
+ $("#tableWidgetTabulator").tabulator("clearFilter");
+ $(this).blur();
}
+ });
+ // Ask ifRecommend Anrechnungen
+ $("#reviewAnrechnungUebersicht-recommend-anrechnungen-ask").click(
+ function () {
+ begruendung_panel.css("display", "none");
- $(document).on("tableInit", function(event,tabulatorInstance) {
-
- func_tableBuilt($("#tableWidgetTabulator"))
-
- // event rowUpdated needs to be attached as a callback to the tableBuilt event in tabulator5
- $("#tableWidgetTabulator").tabulator("on","rowUpdated",(row)=>{func_rowUpdated(row)})
-
- });
-
- // Redraw table on resize to fit tabulators height to windows height
- window.addEventListener('resize', function(){
- $('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
- $('#tableWidgetTabulator').tabulator('redraw', true);
- });
-
- // Set status alert color
- reviewAnrechnung.setStatusAlertColor();
-
- // Show only rows with anrechnungen ohne Empfehlung
- $("#show-need-recommendation").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR}
- ]
- );
- });
-
- // Show only rows with empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
- $("#show-recommended").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL},
- {field: 'empfehlung_anrechnung', type: '=', value: 'true'}
- ]
- );
- });
-
- // Show only rows with nicht empfohlene + noch nicht genehmigte/abgelehnte anrechnungen
- $("#show-not-recommended").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter', [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_PROGRESSED_BY_STGL},
- {field: 'empfehlung_anrechnung', type: '=', value: 'false'},
- ]
- );
- });
-
- // Show only rows with genehmigte anrechnungen
- $("#show-approved").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_APPROVED}
- ]
- );
- });
-
- // Show only rows with abgelehnte anrechnungen
- $("#show-rejected").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'status_kurzbz', type: '=', value: ANRECHNUNGSTATUS_REJECTED}
- ]
- );
- });
-
- /**
- * Show all rows: clear filter and blur button
- * Bootstrap button remains in activated style, even when clicking various times.
- * This function "resets" button style and clear all tabulators filter.
- * NOTE: MUST be after all other filters
- */
- $(".btn-clearfilter").click(function(){
- if($(this).hasClass('active'))
- {
- $('#tableWidgetTabulator').tabulator('clearFilter');
- $(this).blur();
- }
- })
-
- // Ask ifRecommend Anrechnungen
- $("#reviewAnrechnungUebersicht-recommend-anrechnungen-ask").click(function(){
-
- begruendung_panel.css('display', 'none');
-
- if (empfehlung_panel.is(":hidden"))
- {
- // Show begruendung panel if is hidden
- empfehlung_panel.slideDown(400, function() {
- $('html, body').animate({
- scrollTop: empfehlung_panel.offset().top // Move empfehlung panel bottom up to be visible within window screen
- }, 400);
- });
- return;
- }
- });
-
- // Recommend Anrechnungen
- $("#reviewAnrechnungUebersicht-recommend-anrechnungen-confirm").click(function(e){
-
- // Avoid bubbling click event to sibling break button
- e.stopImmediatePropagation();
-
- // Get selected rows data
- let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
- .map(function(data){
- // reduce to necessary fields
- return {
- 'anrechnung_id' : data.anrechnung_id,
- }
- });
-
- // Alert and exit if no anrechnung is selected
- if (selected_data.length == 0)
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen"));
- return;
- }
-
-
- // Prepare data object for ajax call
- let data = {
- 'data': selected_data
- };
-
- // Hide empfehlung panel again
- empfehlung_panel.slideUp('slow');
-
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/recommend",
- data,
+ if (empfehlung_panel.is(":hidden")) {
+ // Show begruendung panel if is hidden
+ empfehlung_panel.slideDown(400, function () {
+ $("html, body").animate(
{
- successCallback: function (data, textStatus, jqXHR)
- {
- if (data.error && data.retval != null)
- {
- // Print error message
- FHC_DialogLib.alertWarning(data.retval);
- }
+ scrollTop: empfehlung_panel.offset().top, // Move empfehlung panel bottom up to be visible within window screen
+ },
+ 400
+ );
+ });
+ return;
+ }
+ }
+ );
- if (!data.error && data.retval != null)
- {
- // Update status 'genehmigt'
- $('#tableWidgetTabulator').tabulator('updateData', data.retval);
+ // Recommend Anrechnungen
+ $("#reviewAnrechnungUebersicht-recommend-anrechnungen-confirm").click(
+ function (e) {
+ // Avoid bubbling click event to sibling break button
+ e.stopImmediatePropagation();
- // Print success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "anrechnungenWurdenEmpfohlen"));
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
+ // Get selected rows data
+ let selected_data = $("#tableWidgetTabulator")
+ .tabulator("getSelectedData")
+ .map(function (data) {
+ // reduce to necessary fields
+ return {
+ anrechnung_id: data.anrechnung_id,
+ };
+ });
+
+ // Alert and exit if no anrechnung is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen")
);
- });
+ return;
+ }
- // Ask if Dont recommend Anrechnungen
- $("#reviewAnrechnungUebersicht-dont-recommend-anrechnungen-ask").click(function(){
+ // Prepare data object for ajax call
+ let data = {
+ data: selected_data,
+ };
- empfehlung_panel.css('display', 'none');
+ // Hide empfehlung panel again
+ empfehlung_panel.slideUp("slow");
- if (begruendung_panel.is(":hidden"))
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/recommend",
+ data,
{
- // Show begruendung panel if is hidden
- begruendung_panel.slideDown(400, function() {
- $('html, body').animate({
- scrollTop: begruendung_panel.offset().top // Move genehmigung panel bottom up to be visible within window screen
- }, 400);
- });
- return;
+ successCallback: function (data, textStatus, jqXHR) {
+ if (data.error && data.retval != null) {
+ // Print error message
+ FHC_DialogLib.alertWarning(data.retval);
+ }
+
+ if (!data.error && data.retval != null) {
+ // Update status 'genehmigt'
+ $("#tableWidgetTabulator").tabulator("updateData", data.retval);
+
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ FHC_PhrasesLib.t("ui", "anrechnungenWurdenEmpfohlen")
+ );
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
}
- });
+ );
+ }
+ );
- // Dont recommend Anrechnungen
- $("#reviewAnrechnungUebersicht-dont-recommend-anrechnungen-confirm").click(function(e){
+ // Ask if Dont recommend Anrechnungen
+ $("#reviewAnrechnungUebersicht-dont-recommend-anrechnungen-ask").click(
+ function () {
+ empfehlung_panel.css("display", "none");
- // Avoid bubbling click event to sibling break button
- e.stopImmediatePropagation();
-
- let begruendung = $('#reviewAnrechnungUebersicht-begruendung').val();
-
- empfehlung_panel.css('display', 'none');
-
- // Check if begruendung is given
- if (!begruendung.trim()) // empty or white spaces only
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteBegruendungAngeben"));
- return;
- }
-
- // Get selected rows data and add begruendung
- let selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
- .map(function(data){
- // reduce to necessary fields
- return {
- 'anrechnung_id' : data.anrechnung_id,
- 'begruendung' : begruendung
- }
- });
-
- // Alert and exit if no anrechnung is selected
- if (selected_data.length == 0)
- {
- FHC_DialogLib.alertInfo(FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen"));
- return;
- }
-
- // Prepare data object for ajax call
- let data = {
- 'data': selected_data
- };
-
- // Hide begruendung panel again
- begruendung_panel.slideUp('slow');
-
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/dontRecommend",
- data,
+ if (begruendung_panel.is(":hidden")) {
+ // Show begruendung panel if is hidden
+ begruendung_panel.slideDown(400, function () {
+ $("html, body").animate(
{
- successCallback: function (data, textStatus, jqXHR)
- {
- if (data.error && data.retval != null)
- {
- // Print error message
- FHC_DialogLib.alertWarning(data.retval);
- }
+ scrollTop: begruendung_panel.offset().top, // Move genehmigung panel bottom up to be visible within window screen
+ },
+ 400
+ );
+ });
+ return;
+ }
+ }
+ );
- if (!data.error && data.retval != null)
- {
- // Update status 'genehmigt'
- $('#tableWidgetTabulator').tabulator('updateData', data.retval);
+ // Dont recommend Anrechnungen
+ $("#reviewAnrechnungUebersicht-dont-recommend-anrechnungen-confirm").click(
+ function (e) {
+ // Avoid bubbling click event to sibling break button
+ e.stopImmediatePropagation();
- // Print success message
- FHC_DialogLib.alertSuccess(FHC_PhrasesLib.t("ui", "anrechnungenWurdenNichtEmpfohlen"));
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
- }
- }
+ let begruendung = $("#reviewAnrechnungUebersicht-begruendung").val();
+
+ empfehlung_panel.css("display", "none");
+
+ // Check if begruendung is given
+ if (!begruendung.trim()) {
+ // empty or white spaces only
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteBegruendungAngeben")
);
- });
+ return;
+ }
- // Break Empfehlung abgeben
- $('#reviewAnrechnungUebersicht-empfehlung-abbrechen').click(function(){
- empfehlung_panel.slideUp('slow');
+ // Get selected rows data and add begruendung
+ let selected_data = $("#tableWidgetTabulator")
+ .tabulator("getSelectedData")
+ .map(function (data) {
+ // reduce to necessary fields
+ return {
+ anrechnung_id: data.anrechnung_id,
+ begruendung: begruendung,
+ };
+ });
- })
+ // Alert and exit if no anrechnung is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ FHC_PhrasesLib.t("ui", "bitteMindEinenAntragWaehlen")
+ );
+ return;
+ }
- // Break Begruendung abgeben
- $('#reviewAnrechnungUebersicht-begruendung-abbrechen').click(function(){
+ // Prepare data object for ajax call
+ let data = {
+ data: selected_data,
+ };
- begruendung_panel.slideUp('slow');
+ // Hide begruendung panel again
+ begruendung_panel.slideUp("slow");
- })
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/dontRecommend",
+ data,
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (data.error && data.retval != null) {
+ // Print error message
+ FHC_DialogLib.alertWarning(data.retval);
+ }
- // Copy Begruendung into textarea
- $(".btn-copyIntoTextarea").click(function(){
- reviewAnrechnung.copyIntoTextarea(this);
- })
+ if (!data.error && data.retval != null) {
+ // Update status 'genehmigt'
+ $("#tableWidgetTabulator").tabulator("updateData", data.retval);
+
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ FHC_PhrasesLib.t("ui", "anrechnungenWurdenNichtEmpfohlen")
+ );
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(FHC_PhrasesLib.t("ui", "systemfehler"));
+ },
+ }
+ );
+ }
+ );
+
+ // Break Empfehlung abgeben
+ $("#reviewAnrechnungUebersicht-empfehlung-abbrechen").click(function () {
+ empfehlung_panel.slideUp("slow");
+ });
+
+ // Break Begruendung abgeben
+ $("#reviewAnrechnungUebersicht-begruendung-abbrechen").click(function () {
+ begruendung_panel.slideUp("slow");
+ });
+
+ // Copy Begruendung into textarea
+ $(".btn-copyIntoTextarea").click(function () {
+ reviewAnrechnung.copyIntoTextarea(this);
+ });
});
var reviewAnrechnung = {
- setStatusAlertColor: function () {
- let status_kurzbz = $('#reviewAnrechnung-status_kurzbz').data('status_kurzbz');
+ setStatusAlertColor: function () {
+ let status_kurzbz = $("#reviewAnrechnung-status_kurzbz").data(
+ "status_kurzbz"
+ );
- switch (status_kurzbz) {
- case ANRECHNUNGSTATUS_APPROVED:
- $('#reviewAnrechnung-status_kurzbz').closest('div').addClass('bg-success-subtle');
- break;
- case ANRECHNUNGSTATUS_REJECTED:
- $('#reviewAnrechnung-status_kurzbz').closest('div').addClass('bg-danger-subtle');
- break;
- case '':
- $('#reviewAnrechnung-status_kurzbz').closest('div').addClass('bg-info-subtle');
- break;
- default:
- $('#reviewAnrechnung-status_kurzbz').closest('div').addClass('bg-warning-subtle');
- }
- },
- copyIntoTextarea: function(elem){
-
- // Find closest textarea
- let textarea = $(elem).closest('div').find('textarea');
-
- // Copy begruendung into textarea and set focus
- textarea.val($.trim($(elem).parent().text())).focus();
+ switch (status_kurzbz) {
+ case ANRECHNUNGSTATUS_APPROVED:
+ $("#reviewAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-success-subtle");
+ break;
+ case ANRECHNUNGSTATUS_REJECTED:
+ $("#reviewAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-danger-subtle");
+ break;
+ case "":
+ $("#reviewAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-info-subtle");
+ break;
+ default:
+ $("#reviewAnrechnung-status_kurzbz")
+ .closest("div")
+ .addClass("bg-warning-subtle");
}
-}
+ },
+ copyIntoTextarea: function (elem) {
+ // Find closest textarea
+ let textarea = $(elem).closest("div").find("textarea");
+
+ // Copy begruendung into textarea and set focus
+ textarea.val($.trim($(elem).parent().text())).focus();
+ },
+};
diff --git a/public/js/lehre/lehrauftrag/acceptLehrauftrag.js b/public/js/lehre/lehrauftrag/acceptLehrauftrag.js
index f50229d49..0e0cbb4a1 100644
--- a/public/js/lehre/lehrauftrag/acceptLehrauftrag.js
+++ b/public/js/lehre/lehrauftrag/acceptLehrauftrag.js
@@ -11,28 +11,34 @@ const APP_ROOT = FHC_JS_DATA_STORAGE_OBJECT.app_root;
const COLOR_LIGHTGREY = "#f5f5f5";
-const TABLE_CANCELLED_LEHRAUFTRAG = '[tableuniqueid = cancelledLehrauftrag] #tableWidgetTabulator';
-const TABLE_ACCEPT_LEHRAUFTRAG = '[tableuniqueid = acceptLehrauftrag] #tableWidgetTabulator';
+const TABLE_CANCELLED_LEHRAUFTRAG =
+ "[tableuniqueid = cancelledLehrauftrag] #tableWidgetTabulator";
+const TABLE_ACCEPT_LEHRAUFTRAG =
+ "[tableuniqueid = acceptLehrauftrag] #tableWidgetTabulator";
/**
* 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_CANCELLED = '
';
+const ICON_LEHRAUFTRAG_ORDERED =
+ '
';
+const ICON_LEHRAUFTRAG_APPROVED =
+ '
';
+const ICON_LEHRAUFTRAG_CHANGED =
+ '
';
+const ICON_LEHRAUFTRAG_CANCELLED =
+ '
';
// Fields that should not be provided in the column picker
var tableWidgetBlacklistArray_columnUnselectable = [
- 'status',
- 'row_index',
- 'betrag',
- 'vertrag_id',
- 'vertrag_stunden',
- 'vertrag_betrag',
- 'storniert_von', // fields from cancelledLehrauftragData
- 'letzterStatus_vorStorniert' // fields from cancelledLehrauftragData
+ "status",
+ "row_index",
+ "betrag",
+ "vertrag_id",
+ "vertrag_stunden",
+ "vertrag_betrag",
+ "storniert_von", // fields from cancelledLehrauftragData
+ "letzterStatus_vorStorniert", // fields from cancelledLehrauftragData
];
// -----------------------------------------------------------------------------------------------------------------
@@ -41,56 +47,64 @@ var tableWidgetBlacklistArray_columnUnselectable = [
// Converts string date postgre style to string DD.MM.YYYY.
// This will allow correct filtering.
-var mut_formatStringDate = function(value, data, type, params, component) {
- if (value != null)
- {
- var d = new Date(value);
- return ("0" + (d.getDate())).slice(-2) + "." + ("0"+(d.getMonth()+1)).slice(-2) + "." + d.getFullYear();
- }
-}
+var mut_formatStringDate = function (value, data, type, params, component) {
+ if (value != null) {
+ var d = new Date(value);
+ return (
+ ("0" + d.getDate()).slice(-2) +
+ "." +
+ ("0" + (d.getMonth() + 1)).slice(-2) +
+ "." +
+ d.getFullYear()
+ );
+ }
+};
// -----------------------------------------------------------------------------------------------------------------
// Formatters - changes display information, not the data itself
// -----------------------------------------------------------------------------------------------------------------
// Formats null values to a string number '0.00'
-var form_formatNulltoStringNumber = function(cell, formatterParams, onRendered){
- if (cell.getValue() == null){
- if (formatterParams.precision == 1)
- {
- return '0.0';
- }
- return '0.00';
- }
- else {
- return cell.getValue();
- }
-}
+var form_formatNulltoStringNumber = function (
+ cell,
+ formatterParams,
+ onRendered
+) {
+ if (cell.getValue() == null) {
+ if (formatterParams.precision == 1) {
+ return "0.0";
+ }
+ return "0.00";
+ } else {
+ return cell.getValue();
+ }
+};
// -----------------------------------------------------------------------------------------------------------------
// Header filter
// -----------------------------------------------------------------------------------------------------------------
// Filters values using comparison operator or just by string comparison
-function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filterParams){
+function hf_filterStringnumberWithOperator(
+ headerValue,
+ rowValue,
+ rowData,
+ filterParams
+) {
+ // If string starts with <, <=, >, >=, !=, ==, compare values with that operator
+ var operator = "";
+ if (headerValue.match(/([<=>!]{1,2})/g)) {
+ var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
+ operator = operator_arr[0];
- // If string starts with <, <=, >, >=, !=, ==, compare values with that operator
- var operator = '';
- if (headerValue.match(/([<=>!]{1,2})/g)) {
- var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
- operator = operator_arr[0];
+ headerValue = headerValue.replace(operator, "").trim();
- headerValue = headerValue
- .replace(operator, '')
- .trim()
- ;
+ // return if value comparison is true
+ return eval(rowValue + operator + headerValue);
+ }
- // return if value comparison is true
- return eval(rowValue + operator + headerValue);
- }
-
- // If just a stringnumber, return if exact match found
- return parseFloat(rowValue) == headerValue;
+ // If just a stringnumber, return if exact match found
+ return parseFloat(rowValue) == headerValue;
}
// -----------------------------------------------------------------------------------------------------------------
@@ -98,175 +112,161 @@ function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filte
// -----------------------------------------------------------------------------------------------------------------
// Returns relative height (depending on screen size)
-function func_height(table){
- return $(window).height() * 0.50;
+function func_height(table) {
+ return $(window).height() * 0.5;
}
// Formats the rows
-function func_rowFormatter(row){
- var bestellt = row.getData().bestellt;
- var erteilt = row.getData().erteilt;
- var akzeptiert = row.getData().akzeptiert;
+function func_rowFormatter(row) {
+ var bestellt = row.getData().bestellt;
+ var erteilt = row.getData().erteilt;
+ var akzeptiert = row.getData().akzeptiert;
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- /*
+ /*
Formats the color of the rows depending on their status
- orange: geaendert
- default: bestellte und erteilte (= zu akzeptierende)
- green: akzeptierte
- grey: all other (marks unselectable)
*/
- row.getCells().forEach(function(cell){
- if (bestellt != null && (betrag != vertrag_betrag) ||
- bestellt != null && stunden != vertrag_stunden)
- {
- cell.getElement().classList.add('bg-warning'); // geaenderte
- }
- else if(bestellt != null && erteilt != null && akzeptiert == null)
- {
- return; // bestellte + erteilte
- }
- else if(bestellt != null && erteilt != null && akzeptiert != null)
- {
- cell.getElement().classList.add('bg-success') // akzeptierte
- }
- else
- {
- row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
- }
- });
+ row.getCells().forEach(function (cell) {
+ if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ cell.getElement().classList.add("bg-warning"); // geaenderte
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ return; // bestellte + erteilte
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ cell.getElement().classList.add("bg-success"); // akzeptierte
+ } else {
+ row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
+ }
+ });
}
// Formats row selectable/unselectable
-function func_selectableCheck(row){
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+function func_selectableCheck(row) {
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- var is_storniert = row.getData().storniert != undefined;
+ var is_storniert = row.getData().storniert != undefined;
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- // only allow to select bestellte && erteilte && nicht geaenderte Lehraufträge
- return row.getData().bestellt != null && // bestellt
- row.getData().erteilt != null && // AND erteilt
- row.getData().akzeptiert == null && // AND nicht akzeptiert
- betrag == vertrag_betrag &&
- stunden == vertrag_stunden && // AND nicht geaendert
- !is_storniert; // AND nicht storniert
+ // only allow to select bestellte && erteilte && nicht geaenderte Lehraufträge
+ return (
+ row.getData().bestellt != null && // bestellt
+ row.getData().erteilt != null && // AND erteilt
+ row.getData().akzeptiert == null && // AND nicht akzeptiert
+ betrag == vertrag_betrag &&
+ stunden == vertrag_stunden && // AND nicht geaendert
+ !is_storniert
+ ); // AND nicht storniert
}
// Adds column status
function func_tableBuilt(table) {
- // Add status column to table
- table.addColumn(
- {
- title: "",
- field: "status",
- width:40,
- align:"center",
- downloadTitle: 'Status',
- formatter: status_formatter,
- tooltip: status_tooltip
- }, true
- );
+ // Add status column to table
+ table.addColumn(
+ {
+ title: "",
+ field: "status",
+ width: 40,
+ align: "center",
+ downloadTitle: "Status",
+ formatter: status_formatter,
+ tooltip: status_tooltip,
+ },
+ true
+ );
+
+ // fully redrawing the table after adding the Details column
+ table.tabulator("redraw", true);
}
// Sets status values into column status
-function func_renderStarted(table){
- // Set literally status to each row - this enables sorting by status despite using icons
- table.getRows().forEach(function(row){
- var bestellt = row.getData().bestellt;
- var erteilt = row.getData().erteilt;
- var akzeptiert = row.getData().akzeptiert;
+function func_renderStarted(table) {
+ // Set literally status to each row - this enables sorting by status despite using icons
+ table.getRows().forEach(function (row) {
+ var bestellt = row.getData().bestellt;
+ var erteilt = row.getData().erteilt;
+ var akzeptiert = row.getData().akzeptiert;
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- if ((bestellt != null && betrag != vertrag_betrag) ||
- (bestellt != null && stunden != vertrag_stunden))
- {
- row.getData().status = 'Geändert'; // geaendert
- }
- else if (bestellt == null && erteilt == null && akzeptiert == null)
- {
- row.getData().status = 'Neu'; // neu
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null)
- {
- row.getData().status = 'Bestellt'; // bestellt
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null)
- {
- row.getData().status = 'Erteilt'; // erteilt
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null)
- {
- row.getData().status = 'Akzeptiert'; // akzeptiert
- }
- else
- {
- row.getData().status = null; // default
- }
- });
+ if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ row.getData().status = "Geändert"; // geaendert
+ } else if (bestellt == null && erteilt == null && akzeptiert == null) {
+ row.getData().status = "Neu"; // neu
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ row.getData().status = "Bestellt"; // bestellt
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ row.getData().status = "Erteilt"; // erteilt
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ row.getData().status = "Akzeptiert"; // akzeptiert
+ } else {
+ row.getData().status = null; // default
+ }
+ });
}
// Performes after row was updated
-function func_rowUpdated(row){
+function func_rowUpdated(row) {
+ // Refresh status icon and row color
+ row.reformat(); // retriggers cell formatters and rowFormatter callback
- // Refresh status icon and row color
- row.reformat(); // retriggers cell formatters and rowFormatter callback
-
- // Deselect and disable new selection of updated rows
- row.deselect();
- row.getElement().style["pointerEvents"] = "none";
+ // Deselect and disable new selection of updated rows
+ row.deselect();
+ row.getElement().style["pointerEvents"] = "none";
}
// Hide betrag, if lector has inkludierte Lehre
-function func_renderComplete(table){
-
- // Check if the lectors actual Verwendung has inkludierte Lehre
- FHC_AjaxClient.ajaxCallGet(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/checkInkludierteLehre",
- null,
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- // If lector has inkludierte Lehre, hide the column betrag
- if (data.retval)
- {
- table.hideColumn("betrag");
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator.");
- }
- }
- );
+function func_renderComplete(table) {
+ // Check if the lectors actual Verwendung has inkludierte Lehre
+ FHC_AjaxClient.ajaxCallGet(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/checkInkludierteLehre",
+ null,
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ // If lector has inkludierte Lehre, hide the column betrag
+ if (data.retval) {
+ table.hideColumn("betrag");
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(
+ "Systemfehler
Bitte kontaktieren Sie Ihren Administrator."
+ );
+ },
+ }
+ );
}
// TableWidget Footer element
@@ -276,386 +276,408 @@ function func_renderComplete(table){
* Hook to overwrite TableWigdgets select-all-button behaviour
* Select all (filtered) rows and ignore rows that are bestellt and erteilt
*/
-function tableWidgetHook_selectAllButton(tableWidgetDiv){
- var resultRows = tableWidgetDiv.find("#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
+function tableWidgetHook_selectAllButton(tableWidgetDiv) {
+ var resultRows = tableWidgetDiv
+ .find("#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
- tableWidgetDiv.find("#tableWidgetTabulator").tabulator('selectRow', resultRows);
+ tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("selectRow", resultRows);
}
// -----------------------------------------------------------------------------------------------------------------
// Tabulator columns format functions
// -----------------------------------------------------------------------------------------------------------------
// Generates status icons
-status_formatter = function(cell, formatterParams, onRendered){
+status_formatter = function (cell, formatterParams, onRendered) {
+ var bestellt = cell.getRow().getData().bestellt;
+ var erteilt = cell.getRow().getData().erteilt;
+ var akzeptiert = cell.getRow().getData().akzeptiert;
+ var is_storniert = cell.getRow().getData().storniert != undefined;
- var bestellt = cell.getRow().getData().bestellt;
- var erteilt = cell.getRow().getData().erteilt;
- 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))
- {
- return ""; // kein Vertrag
- }
- else if (bestellt != null && (betrag != vertrag_betrag) ||
- bestellt != null && stunden != vertrag_stunden)
- {
- return ICON_LEHRAUFTRAG_CHANGED; // geaendert
- // return "";
- }
- else if (bestellt == null && erteilt == null && akzeptiert == null && !is_storniert)
- {
- return ""; // neu
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null)
- {
- return ICON_LEHRAUFTRAG_ORDERED; // bestellt
- // return "";
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null)
- {
- return ICON_LEHRAUFTRAG_APPROVED; // erteilt
- // return "";
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null)
- {
- return ""; // akzeptiert
- // return "";
- }
- else if (is_storniert)
- {
- return ICON_LEHRAUFTRAG_CANCELLED; // storniert
- }
- else
- {
- return ""; // default
- }
+ // commented icons would be so nice to have with fontawsome 5.11...
+ if (bestellt != null && isNaN(vertrag_betrag)) {
+ return ""; // kein Vertrag
+ } else if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ return ICON_LEHRAUFTRAG_CHANGED; // geaendert
+ // return "";
+ } else if (
+ bestellt == null &&
+ erteilt == null &&
+ akzeptiert == null &&
+ !is_storniert
+ ) {
+ return ""; // neu
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ return ICON_LEHRAUFTRAG_ORDERED; // bestellt
+ // return "";
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ return ICON_LEHRAUFTRAG_APPROVED; // erteilt
+ // return "";
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ return ""; // akzeptiert
+ // return "";
+ } else if (is_storniert) {
+ return ICON_LEHRAUFTRAG_CANCELLED; // storniert
+ } else {
+ return ""; // default
+ }
};
// Generates status tooltip
-status_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+status_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- var bestellt = cell.getRow().getData().bestellt;
- var erteilt = cell.getRow().getData().erteilt;
- var akzeptiert = cell.getRow().getData().akzeptiert;
- var is_storniert = cell.getRow().getData().storniert != undefined;
- var letzterStatus_vorStorniert = cell.getRow().getData().letzterStatus_vorStorniert;
+ var bestellt = cell.getRow().getData().bestellt;
+ var erteilt = cell.getRow().getData().erteilt;
+ var akzeptiert = cell.getRow().getData().akzeptiert;
+ var is_storniert = cell.getRow().getData().storniert != undefined;
+ 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"
+ ) {
+ letzterStatus_vorStorniert = "angenommen";
+ }
- if (letzterStatus_vorStorniert != undefined && letzterStatus_vorStorniert == 'akzeptiert')
- {
- letzterStatus_vorStorniert = 'angenommen';
- }
+ var text = FHC_PhrasesLib.t("ui", "lehrauftragInBearbeitung");
- var text = FHC_PhrasesLib.t("ui", "lehrauftragInBearbeitung");
-
- if (bestellt != null && erteilt == null && akzeptiert == null
- && (betrag != vertrag_betrag || stunden != vertrag_stunden)) // geaendert (when never erteilt before)
- {
- text += FHC_PhrasesLib.t("ui", "wartetAufErteilung");;
- return text;
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null
- && (betrag != vertrag_betrag || stunden != vertrag_stunden)) // geaendert (when has been erteilt once)
- {
- text += FHC_PhrasesLib.t("ui", "wartetAufErneuteErteilung");
- return text;
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null) // bestellt
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusBestellt");
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null) // erteilt
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusErteilt");
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null) // akzeptiert
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusAngenommen");
- }
- else if (is_storniert) // storniert
- {
- return FHC_PhrasesLib.t("ui", "vertragWurdeStorniert");
- }
-}
+ if (
+ bestellt != null &&
+ erteilt == null &&
+ akzeptiert == null &&
+ (betrag != vertrag_betrag || stunden != vertrag_stunden)
+ ) {
+ // geaendert (when never erteilt before)
+ text += FHC_PhrasesLib.t("ui", "wartetAufErteilung");
+ return text;
+ } else if (
+ bestellt != null &&
+ erteilt != null &&
+ akzeptiert == null &&
+ (betrag != vertrag_betrag || stunden != vertrag_stunden)
+ ) {
+ // geaendert (when has been erteilt once)
+ text += FHC_PhrasesLib.t("ui", "wartetAufErneuteErteilung");
+ return text;
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ // bestellt
+ return FHC_PhrasesLib.t("ui", "letzterStatusBestellt");
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ // erteilt
+ return FHC_PhrasesLib.t("ui", "letzterStatusErteilt");
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ // akzeptiert
+ return FHC_PhrasesLib.t("ui", "letzterStatusAngenommen");
+ } else if (is_storniert) {
+ // storniert
+ return FHC_PhrasesLib.t("ui", "vertragWurdeStorniert");
+ }
+};
// Generates bestellt tooltip
-bestellt_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+bestellt_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().bestellt_von != null)
- {
- return FHC_PhrasesLib.t("ui", "bestelltVon") + cell.getRow().getData().bestellt_von;
- }
-}
+ if (cell.getRow().getData().bestellt_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "bestelltVon") +
+ cell.getRow().getData().bestellt_von
+ );
+ }
+};
// Generates erteilt tooltip
-erteilt_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+erteilt_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().erteilt_von != null) {
- return FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von;
- }
-}
+ if (cell.getRow().getData().erteilt_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von
+ );
+ }
+};
// Generates akzeptiert tooltip
-akzeptiert_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+akzeptiert_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().akzeptiert_von != null) {
- return FHC_PhrasesLib.t("ui", "angenommenVon") + cell.getRow().getData().akzeptiert_von;
- }
-}
+ if (cell.getRow().getData().akzeptiert_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "angenommenVon") +
+ cell.getRow().getData().akzeptiert_von
+ );
+ }
+};
// Generates storniert tooltip
-storniert_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
-
- if (cell.getRow().getData().storniert_von != null) {
- return FHC_PhrasesLib.t("ui", "storniertVon") + cell.getRow().getData().storniert_von;
- }
-}
+storniert_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
-$(function() {
- // Pruefen ob Promise unterstuetzt wird
- // Tabulator funktioniert nicht mit IE
+ if (cell.getRow().getData().storniert_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "storniertVon") +
+ cell.getRow().getData().storniert_von
+ );
+ }
+};
+$(function () {
+ // Pruefen ob Promise unterstuetzt wird
+ // Tabulator funktioniert nicht mit IE
- // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
- $(document).on("tableInit", function(event,tabulatorInstance) {
-
- //passing the tabulator instance because the acceptLehrauftrag site loads two tabulator tables
- func_tableBuilt(tabulatorInstance)
-
- // using the tabulator instance instead of the jquery object because the site loads two different tabulator tables
- let uniqueTableID = tabulatorInstance.parentElement.parentElement.parentElement.attributes.tableUniqueId.value;
- switch(uniqueTableID){
- case "cancelledLehrauftrag":
- tabulatorInstance.on("renderComplete",()=>{func_renderComplete(tabulatorInstance)});
- break;
- case "acceptLehrauftrag":
- tabulatorInstance.on("renderComplete",()=>{func_renderComplete(tabulatorInstance)});
- tabulatorInstance.on("renderStarted",()=>{func_renderStarted(tabulatorInstance)});
- tabulatorInstance.on("rowUpdated",(row)=>{func_rowUpdated(row)});
- break;
- default: break;
- }
-
- });
+ // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
+ $(document).on("tableInit", function (event, tabulatorInstance) {
+ //passing the tabulator instance because the acceptLehrauftrag site loads two tabulator tables
+ func_tableBuilt(tabulatorInstance);
- var canPromise = !! window.Promise;
- if(!canPromise)
- {
- alert("Diese Seite kann mit ihrem Browser nicht angezeigt werden. Bitte verwenden Sie Firefox, Chrome oder Edge um die Seite anzuzeigen");
- window.location.href='about:blank';
- return;
- }
+ // using the tabulator instance instead of the jquery object because the site loads two different tabulator tables
+ let uniqueTableID =
+ tabulatorInstance.parentElement.parentElement.parentElement.attributes
+ .tableUniqueId.value;
+ switch (uniqueTableID) {
+ case "cancelledLehrauftrag":
+ tabulatorInstance.on("renderComplete", () => {
+ func_renderComplete(tabulatorInstance);
+ });
+ break;
+ case "acceptLehrauftrag":
+ tabulatorInstance.on("renderComplete", () => {
+ func_renderComplete(tabulatorInstance);
+ });
+ tabulatorInstance.on("renderStarted", () => {
+ func_renderStarted(tabulatorInstance);
+ });
+ tabulatorInstance.on("rowUpdated", (row) => {
+ func_rowUpdated(row);
+ });
+ break;
+ default:
+ break;
+ }
+ });
- // Redraw table on resize to fit tabulators height to windows height
- window.addEventListener('resize', function(){
- $('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
- $('#tableWidgetTabulator').tabulator('redraw', true);
- });
+ var canPromise = !!window.Promise;
+ if (!canPromise) {
+ alert(
+ "Diese Seite kann mit ihrem Browser nicht angezeigt werden. Bitte verwenden Sie Firefox, Chrome oder Edge um die Seite anzuzeigen"
+ );
+ window.location.href = "about:blank";
+ return;
+ }
- // Show all rows
- $("#show-all").click(function(){
- $('#tableWidgetTabulator').tabulator('clearFilter');
- });
+ // Redraw table on resize to fit tabulators height to windows height
+ window.addEventListener("resize", function () {
+ $("#tableWidgetTabulator").tabulator("setHeight", $(window).height() * 0.5);
+ $("#tableWidgetTabulator").tabulator("redraw", true);
+ });
- // 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 all rows
+ $("#show-all").click(function () {
+ $("#tableWidgetTabulator").tabulator("clearFilter");
+ });
- // 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 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 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 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
+ ]);
+ });
- // Set png-icons into filter-buttons
- $(".btn-lehrauftrag").each(function(){
- switch(this.id) {
- case 'show-ordered':
- this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
- break;
- case 'show-approved':
- this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
- break;
- case 'show-cancelled':
- this.innerHTML = ICON_LEHRAUFTRAG_CANCELLED;
- break;
- }
- });
+ // 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 },
+ ]);
+ });
- // De/activate and un/focus on clicked button
- $(".btn-lehrauftrag").click(function() {
+ // Set png-icons into filter-buttons
+ $(".btn-lehrauftrag").each(function () {
+ switch (this.id) {
+ case "show-ordered":
+ this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
+ break;
+ case "show-approved":
+ this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
+ break;
+ case "show-cancelled":
+ this.innerHTML = ICON_LEHRAUFTRAG_CANCELLED;
+ break;
+ }
+ });
- // 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").click(function () {
+ // De/activate and un/focus on clicked button
+ $(".btn-lehrauftrag").removeClass("focus").removeClass("active");
+ $(this).addClass("focus").addClass("active");
+ });
- // Performs download PDF accepted Lehrauftraege
- $("#ul-download-pdf").on('click', 'li', function(){
- var uid = $("#uid").val();
- var studiensemester = $('#studiensemester').val();
+ // Performs download PDF accepted Lehrauftraege
+ $("#ul-download-pdf").on("click", "li", function () {
+ var uid = $("#uid").val();
+ var studiensemester = $("#studiensemester").val();
- if ($(this).attr('value') != null && $(this).attr('value') != '')
- {
- var selected = $(this).attr('value');
+ if ($(this).attr("value") != null && $(this).attr("value") != "") {
+ var selected = $(this).attr("value");
- if (selected == 'etw' || selected == 'lehrgang')
- {
- window.open(APP_ROOT + 'cis/private/pdfExport.php' +
- '?xml=lehrauftrag_annehmen.xml.php' +
- '&xsl=Lehrauftrag' +
- '&xsl_oe_kurzbz=' + selected +
- '&stg_kz=' +
- '&uid=' + uid +
- '&ss=' + studiensemester, '_parent'
- );
- }
- }
- });
+ if (selected == "etw" || selected == "lehrgang") {
+ window.open(
+ APP_ROOT +
+ "cis/private/pdfExport.php" +
+ "?xml=lehrauftrag_annehmen.xml.php" +
+ "&xsl=Lehrauftrag" +
+ "&xsl_oe_kurzbz=" +
+ selected +
+ "&stg_kz=" +
+ "&uid=" +
+ uid +
+ "&ss=" +
+ studiensemester,
+ "_parent"
+ );
+ }
+ }
+ });
- // Redraw table stornierte lehrauftraege on button click
- $('#collapseCancelledLehrauftraege').on('shown.bs.collapse', function () {
- $('[tableuniqueid = cancelledLehrauftrag] #tableWidgetTabulator').tabulator('redraw', true);
- });
+ // Redraw table stornierte lehrauftraege on button click
+ $("#collapseCancelledLehrauftraege").on("shown.bs.collapse", function () {
+ $("[tableuniqueid = cancelledLehrauftrag] #tableWidgetTabulator").tabulator(
+ "redraw",
+ true
+ );
+ });
- // Approve Lehrauftraege
- $("#accept-lehrauftraege").click(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 && data.retval != null) {
+ // Print error message
+ FHC_DialogLib.alertWarning(data.retval);
+ }
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/acceptLehrauftrag",
- data,
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (data.error && data.retval != null)
- {
- // Print error message
- FHC_DialogLib.alertWarning(data.retval);
- }
+ if (!data.error && data.retval != null) {
+ // Update status 'Erteilt'
+ $("#tableWidgetTabulator").tabulator("updateData", data.retval);
- if (!data.error && data.retval != null)
- {
- // Update status 'Erteilt'
- $('#tableWidgetTabulator').tabulator('updateData', data.retval);
-
- // Print success message
- 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('');
-
- });
+ // Print success message
+ 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("");
+ });
});
diff --git a/public/js/lehre/lehrauftrag/approveLehrauftrag.js b/public/js/lehre/lehrauftrag/approveLehrauftrag.js
index 6ce0414fa..9cb979c62 100644
--- a/public/js/lehre/lehrauftrag/approveLehrauftrag.js
+++ b/public/js/lehre/lehrauftrag/approveLehrauftrag.js
@@ -4,7 +4,6 @@
* Lehrauftraege erteilen - Tabulator: approveLehrauftragData.php
*/
-
// -----------------------------------------------------------------------------------------------------------------
// Global vars
// -----------------------------------------------------------------------------------------------------------------
@@ -15,19 +14,22 @@ const COLOR_LIGHTGREY = "#f5f5f5";
* 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 =
+ '
';
// Fields that should not be provided in the column picker
var tableWidgetBlacklistArray_columnUnselectable = [
- 'status',
- 'row_index',
- 'personalnummer',
- 'betrag',
- 'vertrag_id',
- 'vertrag_stunden',
- 'vertrag_betrag'
+ "status",
+ "row_index",
+ "personalnummer",
+ "betrag",
+ "vertrag_id",
+ "vertrag_stunden",
+ "vertrag_betrag",
];
// -----------------------------------------------------------------------------------------------------------------
@@ -36,56 +38,55 @@ var tableWidgetBlacklistArray_columnUnselectable = [
// Converts string date postgre style to string DD.MM.YYYY.
// This will allow correct filtering.
-var mut_formatStringDate = function(value, data, type, params, component) {
- if (value != null)
- {
- var d = new Date(value);
- return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
- }
-}
+var mut_formatStringDate = function (value, data, type, params, component) {
+ if (value != null) {
+ var d = new Date(value);
+ return (
+ ("0" + d.getDate()).slice(-2) +
+ "." +
+ ("0" + (d.getMonth() + 1)).slice(-2) +
+ "." +
+ d.getFullYear()
+ );
+ }
+};
// -----------------------------------------------------------------------------------------------------------------
// Formatters - changes display information, not the data itself
// -----------------------------------------------------------------------------------------------------------------
// Formats null values to a string number '0.00'
-var form_formatNulltoStringNumber = function(cell, formatterParams){
- if (cell.getValue() == null){
- if (formatterParams.precision == 1)
- {
- return '0.0';
- }
- return '0.00';
+var form_formatNulltoStringNumber = function (cell, formatterParams) {
+ if (cell.getValue() == null) {
+ if (formatterParams.precision == 1) {
+ return "0.0";
}
- else {
- return cell.getValue();
- }
-}
+ return "0.00";
+ } else {
+ return cell.getValue();
+ }
+};
// -----------------------------------------------------------------------------------------------------------------
// Header filter
// -----------------------------------------------------------------------------------------------------------------
// Filters values using comparison operator or just by string comparison
-function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
+function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData) {
+ // If string starts with <, <=, >, >=, !=, ==, compare values with that operator
+ var operator = "";
+ if (headerValue.match(/([<=>!]{1,2})/g)) {
+ var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
+ operator = operator_arr[0];
- // If string starts with <, <=, >, >=, !=, ==, compare values with that operator
- var operator = '';
- if (headerValue.match(/([<=>!]{1,2})/g)) {
- var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
- operator = operator_arr[0];
+ headerValue = headerValue.replace(operator, "").trim();
- headerValue = headerValue
- .replace(operator, '')
- .trim()
- ;
+ // return if value comparison is true
+ return eval(rowValue + operator + headerValue);
+ }
- // return if value comparison is true
- return eval(rowValue + operator + headerValue);
- }
-
- // If just a stringnumber, return if exact match found
- return parseFloat(rowValue) == headerValue;
+ // If just a stringnumber, return if exact match found
+ return parseFloat(rowValue) == headerValue;
}
// -----------------------------------------------------------------------------------------------------------------
@@ -93,13 +94,13 @@ function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData){
// -----------------------------------------------------------------------------------------------------------------
// Filters bestellte initially
-function func_initialFilter(){
- return [
- {field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector
- {field: 'bestellt', type: '!=', value: null}, // AND bestellt
- {field: 'erteilt', type: '=', value: null}, // AND NOT erteilt
- {field: 'akzeptiert', type: '=', value: null} // AND NOT akzeptiert
- ]
+function func_initialFilter() {
+ return [
+ { field: "personalnummer", type: ">=", value: 0 }, // NOT dummy lector
+ { field: "bestellt", type: "!=", value: null }, // AND bestellt
+ { field: "erteilt", type: "=", value: null }, // AND NOT erteilt
+ { field: "akzeptiert", type: "=", value: null }, // AND NOT akzeptiert
+ ];
}
// -----------------------------------------------------------------------------------------------------------------
@@ -107,19 +108,144 @@ function func_initialFilter(){
// -----------------------------------------------------------------------------------------------------------------
// Returns relative height (depending on screen size)
-function func_height(table){
- return $(window).height() * 0.50;
+function func_height(table) {
+ return $(window).height() * 0.5;
}
// Formats the group header
-function func_groupHeader(data){
- return data[0].lv_bezeichnung + " " + ' ( LV-ID: ' + data[0].lehrveranstaltung_id + ' )'; // change name to lehrveranstaltung;
-};
+function func_groupHeader(data) {
+ return (
+ data[0].lv_bezeichnung +
+ " " +
+ " ( LV-ID: " +
+ data[0].lehrveranstaltung_id +
+ " )"
+ ); // change name to lehrveranstaltung;
+}
// Formats the rows
-function func_rowFormatter(row){
- var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
+function func_rowFormatter(row) {
+ var is_dummy =
+ row.getData().personalnummer <= 0 && row.getData().personalnummer != null;
+ var bestellt = row.getData().bestellt;
+ var erteilt = row.getData().erteilt;
+ var akzeptiert = row.getData().akzeptiert;
+
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
+
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
+
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
+
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
+
+ /*
+ Formats the color of the rows depending on their status
+ - blue: dummy lectors
+ - orange: geaendert
+ - default (white) : bestellte
+ - green: akzeptiert
+ - grey: all other (marks unselectable)
+ */
+ row.getCells().forEach(function (cell) {
+ if (is_dummy) {
+ cell.getElement().classList.add("bg-info"); // dummy lectors
+ } else if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null &&
+ stunden != vertrag_stunden &&
+ !row._row.element.classList.contains("tabulator-calcs"))
+ ) {
+ // exclude calculation rows
+ cell.getElement().classList.add("bg-warning"); // geaenderte
+ } else if (bestellt != null && erteilt == null) {
+ return; // bestellt
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ cell.getElement().classList.add("bg-success"); // akzeptiert
+ }
+
+ // default color is already set in the Tabulator5.css file that gets loaded the Header flag tabulator5
+ // row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
+ });
+}
+
+// Formats row selectable/unselectable
+function func_selectableCheck(row) {
+ var is_dummy =
+ row.getData().personalnummer <= 0 && row.getData().personalnummer != null;
+
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
+
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
+
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
+
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
+
+ // only allow to select bestellte Lehraufträge
+ return (
+ !is_dummy && // NOT dummy lector
+ row.getData().bestellt != null && // AND NOT neue
+ row.getData().erteilt == null && // AND bestellt
+ betrag == vertrag_betrag &&
+ stunden == vertrag_stunden
+ ); // AND nicht geändert
+}
+
+// Adds column status
+function func_tableBuilt(table) {
+ // Add status column to table
+ table.tabulator(
+ "addColumn",
+ {
+ title: "",
+ field: "status",
+ width: 40,
+ align: "center",
+ downloadTitle: "Status",
+ formatter: status_formatter,
+ tooltip: status_tooltip,
+ },
+ true
+ );
+
+ // fully redrawing the table after adding the Details column
+ table.tabulator("redraw", true);
+}
+
+// Sets status values into column status
+function func_renderStarted(table) {
+ // set literally status to each row - this enables sorting by status despite using icons
+ table.getRows().forEach(function (row) {
var bestellt = row.getData().bestellt;
var erteilt = row.getData().erteilt;
var akzeptiert = row.getData().akzeptiert;
@@ -130,185 +256,49 @@ function func_rowFormatter(row){
var betrag = parseFloat(row.getData().betrag);
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- if (isNaN(betrag))
- {
- betrag = 0;
+ if (isNaN(betrag)) {
+ betrag = 0;
}
- if (isNaN(stunden))
- {
- stunden = 0;
+ if (isNaN(stunden)) {
+ stunden = 0;
}
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
}
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
}
- /*
- Formats the color of the rows depending on their status
- - blue: dummy lectors
- - orange: geaendert
- - default (white) : bestellte
- - green: akzeptiert
- - grey: all other (marks unselectable)
- */
- row.getCells().forEach(function(cell){
- if(is_dummy)
- {
- cell.getElement().classList.add('bg-info'); // dummy lectors
- }
- else if (bestellt != null && (betrag != vertrag_betrag) ||
- bestellt != null && stunden != vertrag_stunden &&
- !row._row.element.classList.contains('tabulator-calcs')) // exclude calculation rows
- {
- cell.getElement().classList.add('bg-warning'); // geaenderte
- }
- else if(bestellt != null && erteilt == null)
- {
- return; // bestellt
- }
- else if(bestellt != null && erteilt != null && akzeptiert != null)
- {
- cell.getElement().classList.add('bg-success') // akzeptiert
- }
-
- // default color is already set in the Tabulator5.css file that gets loaded the Header flag tabulator5
- // row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
-
- });
-}
-
-// Formats row selectable/unselectable
-function func_selectableCheck(row){
- var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
-
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
-
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
-
- if (isNaN(betrag))
- {
- betrag = 0;
+ if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ row.getData().status = "Geändert"; // geaendert
+ } else if (bestellt == null && erteilt == null && akzeptiert == null) {
+ row.getData().status = "Neu"; // neu
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ row.getData().status = "Bestellt"; // bestellt
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ row.getData().status = "Erteilt"; // erteilt
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ row.getData().status = "Akzeptiert"; // akzeptiert
+ } else {
+ row.getData().status = null; // default
}
-
- if (isNaN(stunden))
- {
- stunden = 0;
- }
-
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
-
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
-
- // only allow to select bestellte Lehraufträge
- return !is_dummy && // NOT dummy lector
- row.getData().bestellt != null && // AND NOT neue
- row.getData().erteilt == null && // AND bestellt
- betrag == vertrag_betrag &&
- stunden == vertrag_stunden; // AND nicht geändert
-}
-
-// Adds column status
-function func_tableBuilt(table) {
- // Add status column to table
- table.tabulator("addColumn",
- {
- title: "",
- field: "status",
- width:40,
- align:"center",
- downloadTitle: 'Status',
- formatter: status_formatter,
- tooltip: status_tooltip
- }, true
- );
-}
-
-// Sets status values into column status
-function func_renderStarted(table){
- // set literally status to each row - this enables sorting by status despite using icons
- table.getRows().forEach(function(row){
- var bestellt = row.getData().bestellt;
- var erteilt = row.getData().erteilt;
- var akzeptiert = row.getData().akzeptiert;
-
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
-
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
-
- if (isNaN(betrag))
- {
- betrag = 0;
- }
-
- if (isNaN(stunden))
- {
- stunden = 0;
- }
-
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
-
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
-
- if ((bestellt != null && betrag != vertrag_betrag) ||
- (bestellt != null && stunden != vertrag_stunden))
- {
- row.getData().status = 'Geändert'; // geaendert
- }
- else if (bestellt == null && erteilt == null && akzeptiert == null)
- {
- row.getData().status = 'Neu'; // neu
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null)
- {
- row.getData().status = 'Bestellt'; // bestellt
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null)
- {
- row.getData().status = 'Erteilt'; // erteilt
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null)
- {
- row.getData().status = 'Akzeptiert'; // akzeptiert
- }
- else
- {
- row.getData().status = null; // default
- }
- });
+ });
}
// Performes after row was updated
-function func_rowUpdated(row){
+function func_rowUpdated(row) {
+ // Refresh status icon and row color
+ row.reformat(); // retriggers cell formatters and rowFormatter callback
- // Refresh status icon and row color
- row.reformat(); // retriggers cell formatters and rowFormatter callback
-
- // Deselect and disable new selection of updated rows
- row.deselect();
- row.getElement().style["pointerEvents"] = "none";
+ // Deselect and disable new selection of updated rows
+ row.deselect();
+ row.getElement().style["pointerEvents"] = "none";
}
// TableWidget Footer element
@@ -318,378 +308,369 @@ function func_rowUpdated(row){
* Hook to overwrite TableWigdgets select-all-button behaviour
* Select all (filtered) rows that are bestellt
*/
-function tableWidgetHook_selectAllButton(tableWidgetDiv){
- var resultRows = tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
- .filter(row => row.getData().personalnummer >= 0 && // NOT dummies
- row.getData().bestellt != null && // AND bestellt
- row.getData().erteilt == null && // AND NOT erteilt
- row.getData().status != 'Geändert'); // AND NOT geaendert
+function tableWidgetHook_selectAllButton(tableWidgetDiv) {
+ var resultRows = tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("getRows", true)
+ .filter(
+ (row) =>
+ row.getData().personalnummer >= 0 && // NOT dummies
+ row.getData().bestellt != null && // AND bestellt
+ row.getData().erteilt == null && // AND NOT erteilt
+ row.getData().status != "Geändert"
+ ); // AND NOT geaendert
- tableWidgetDiv.find("#tableWidgetTabulator").tabulator('selectRow', resultRows);
+ tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("selectRow", resultRows);
}
// -----------------------------------------------------------------------------------------------------------------
// Tabulator columns format functions
// -----------------------------------------------------------------------------------------------------------------
// Generates status icons
-status_formatter = function(cell, formatterParams, onRendered){
- var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
+status_formatter = function (cell, formatterParams, onRendered) {
+ var is_dummy =
+ cell.getRow().getData().personalnummer <= 0 &&
+ cell.getRow().getData().personalnummer != null;
- var bestellt = cell.getRow().getData().bestellt;
- var erteilt = cell.getRow().getData().erteilt;
- var akzeptiert = cell.getRow().getData().akzeptiert;
+ var bestellt = cell.getRow().getData().bestellt;
+ var erteilt = cell.getRow().getData().erteilt;
+ var akzeptiert = cell.getRow().getData().akzeptiert;
- 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 (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- // commented icons would be so nice to have with fontawsome 5.11...
- if (is_dummy)
- {
- return ""; // dummy lector
- }
- else if (bestellt != null && (betrag != vertrag_betrag) || // geaendert
- bestellt != null && stunden != vertrag_stunden) // geaendert ((if betrag is 0 or null)
- {
- return ICON_LEHRAUFTRAG_CHANGED; // geaendert
- // return "";
- }
- else if (bestellt == null && erteilt == null && akzeptiert == null)
- {
- return ""; // neu
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null)
- {
- return ICON_LEHRAUFTRAG_ORDERED; // bestellt
- // return "";
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null)
- {
- return ICON_LEHRAUFTRAG_APPROVED; // erteilt
- // return "";
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null)
- {
- return ""; // akzeptiert
- // return "";
- }
- else
- {
- return ""; // default
- }
+ // commented icons would be so nice to have with fontawsome 5.11...
+ if (is_dummy) {
+ return ""; // dummy lector
+ } else if (
+ (bestellt != null && betrag != vertrag_betrag) || // geaendert
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ // geaendert ((if betrag is 0 or null)
+ return ICON_LEHRAUFTRAG_CHANGED; // geaendert
+ // return "";
+ } else if (bestellt == null && erteilt == null && akzeptiert == null) {
+ return ""; // neu
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ return ICON_LEHRAUFTRAG_ORDERED; // bestellt
+ // return "";
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ return ICON_LEHRAUFTRAG_APPROVED; // erteilt
+ // return "";
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ return ""; // akzeptiert
+ // return "";
+ } else {
+ return ""; // default
+ }
};
// Generates status tooltip
-status_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
-
- var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
+status_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- var bestellt = cell.getRow().getData().bestellt;
- var erteilt = cell.getRow().getData().erteilt;
- var akzeptiert = cell.getRow().getData().akzeptiert;
+ var is_dummy =
+ cell.getRow().getData().personalnummer <= 0 &&
+ cell.getRow().getData().personalnummer != null;
- var betrag = parseFloat(cell.getRow().getData().betrag);
- var stunden = parseFloat(cell.getRow().getData().stunden);
+ var bestellt = cell.getRow().getData().bestellt;
+ var erteilt = cell.getRow().getData().erteilt;
+ var akzeptiert = cell.getRow().getData().akzeptiert;
- var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
- var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
+ var betrag = parseFloat(cell.getRow().getData().betrag);
+ var stunden = parseFloat(cell.getRow().getData().stunden);
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
+ var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
- if (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden)){
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- var text = FHC_PhrasesLib.t("ui", "stundenStundensatzGeaendert");
- text += "\n";
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (is_dummy) // dummy (no lector)
- {
- return FHC_PhrasesLib.t("ui", "neuerLehrauftragOhneLektorVerplant");
- }
- else if ((bestellt != null && erteilt == null && betrag != vertrag_betrag) ||
- (bestellt != null && erteilt == null && stunden != vertrag_stunden)) // geaendert (when never erteilt before)
- {
- return text += FHC_PhrasesLib.t("ui", "wartetAufBestellung");
- }
- else if ((bestellt != null && erteilt != null && betrag != vertrag_betrag) ||
- (bestellt != null && erteilt != null && stunden != vertrag_stunden)) // geaendert (when has been erteilt once)
- {
- return text += FHC_PhrasesLib.t("ui", "wartetAufErneuteBestellung");
- }
- else if (bestellt == null) // neu
- {
- return FHC_PhrasesLib.t("ui", "neuerLehrauftragWartetAufBestellung");
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null) // bestellt
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusBestellt");
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null) // erteilt
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusErteilt");
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null) // akzeptiert
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusAngenommen");
- }
-}
+ var text = FHC_PhrasesLib.t("ui", "stundenStundensatzGeaendert");
+ text += "\n";
+
+ if (is_dummy) {
+ // dummy (no lector)
+ return FHC_PhrasesLib.t("ui", "neuerLehrauftragOhneLektorVerplant");
+ } else if (
+ (bestellt != null && erteilt == null && betrag != vertrag_betrag) ||
+ (bestellt != null && erteilt == null && stunden != vertrag_stunden)
+ ) {
+ // geaendert (when never erteilt before)
+ return (text += FHC_PhrasesLib.t("ui", "wartetAufBestellung"));
+ } else if (
+ (bestellt != null && erteilt != null && betrag != vertrag_betrag) ||
+ (bestellt != null && erteilt != null && stunden != vertrag_stunden)
+ ) {
+ // geaendert (when has been erteilt once)
+ return (text += FHC_PhrasesLib.t("ui", "wartetAufErneuteBestellung"));
+ } else if (bestellt == null) {
+ // neu
+ return FHC_PhrasesLib.t("ui", "neuerLehrauftragWartetAufBestellung");
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ // bestellt
+ return FHC_PhrasesLib.t("ui", "letzterStatusBestellt");
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ // erteilt
+ return FHC_PhrasesLib.t("ui", "letzterStatusErteilt");
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ // akzeptiert
+ return FHC_PhrasesLib.t("ui", "letzterStatusAngenommen");
+ }
+};
// Generates bestellt tooltipPhrase
-bestellt_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
-
- if (cell.getRow().getData().bestellt_von != null)
- {
- return FHC_PhrasesLib.t("ui", "bestelltVon") + cell.getRow().getData().bestellt_von;
- }
-}
+bestellt_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
+
+ if (cell.getRow().getData().bestellt_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "bestelltVon") +
+ cell.getRow().getData().bestellt_von
+ );
+ }
+};
// Generates erteilt tooltip
-erteilt_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+erteilt_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().erteilt_von != null) {
- return FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von;
- }
-}
+ if (cell.getRow().getData().erteilt_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von
+ );
+ }
+};
// Generates akzeptiert tooltip
-akzeptiert_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+akzeptiert_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().akzeptiert_von != null) {
- return FHC_PhrasesLib.t("ui", "angenommenVon") + cell.getRow().getData().akzeptiert_von;
+ if (cell.getRow().getData().akzeptiert_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "angenommenVon") +
+ cell.getRow().getData().akzeptiert_von
+ );
+ }
+};
+$(function () {
+ // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
+ $(document).on("tableInit", function (event, tabulatorInstance) {
+ func_tableBuilt($("#tableWidgetTabulator"));
+
+ // event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5
+ $("#tableWidgetTabulator").tabulator("on", "renderStarted", () =>
+ func_renderStarted(tabulatorInstance)
+ );
+ $("#tableWidgetTabulator").tabulator("on", "rowUpdated", (row) =>
+ func_rowUpdated(row)
+ );
+ });
+
+ // Redraw table on resize to fit tabulators height to windows height
+ window.addEventListener("resize", function () {
+ $("#tableWidgetTabulator").tabulator("setHeight", $(window).height() * 0.5);
+ $("#tableWidgetTabulator").tabulator("redraw", true);
+ });
+
+ // Show all rows
+ $("#show-all").click(function () {
+ $("#tableWidgetTabulator").tabulator("clearFilter");
+ });
+
+ // Show only rows with new lehrauftraege (not dummy lectors)
+ $("#show-new").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "personalnummer", type: ">=", value: 0 },
+ { 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: "personalnummer", type: ">=", value: 0 },
+ { 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 },
+ { field: "erteilt", type: "!=", value: null },
+ { field: "akzeptiert", type: "=", value: null },
+ ]);
+ });
+
+ // Show only rows with accepted 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 dummy lectors
+ $("#show-dummies").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "personalnummer", type: "!=", value: null },
+ { field: "personalnummer", type: "<=", value: 0 },
+ ]);
+ });
+
+ // Show only rows with dummy lectors
+ $("#show-changed").click(function () {
+ // needs custom filter to compare fields betrag and vertrag_betrag
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "personalnummer", type: ">=", value: 0 }, // NOT dummy lector AND
+ { field: "bestellt", type: "!=", value: null }, // bestellt AND
+ { field: "status", type: "=", value: "Geändert" }, // geaendert
+ ]);
+ });
+
+ // Set png-icons into filter-buttons
+ $(".btn-lehrauftrag").each(function () {
+ switch (this.id) {
+ case "show-ordered":
+ this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
+ break;
+ case "show-approved":
+ this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
+ break;
+ case "show-changed":
+ this.innerHTML = ICON_LEHRAUFTRAG_CHANGED;
+ break;
}
-}
-$(function() {
+ });
- // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
- $(document).on("tableInit", function(event,tabulatorInstance) {
-
- func_tableBuilt($("#tableWidgetTabulator"))
-
- // event rowSelectionChanged needs to be attached as a callback to the tableBuilt event in tabulator5
- $("#tableWidgetTabulator").tabulator("on","renderStarted",()=>func_renderStarted(tabulatorInstance));
- $("#tableWidgetTabulator").tabulator("on","rowUpdated",(row)=>func_rowUpdated(row));
-
- });
+ // De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag erteilen'
+ $(".btn-lehrauftrag").click(function () {
+ // De/activate and un/focus on clicked button
+ $(".btn-lehrauftrag").removeClass("focus").removeClass("active");
+ $(this).addClass("focus").addClass("active");
- // Redraw table on resize to fit tabulators height to windows height
- window.addEventListener('resize', function(){
- $('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
- $('#tableWidgetTabulator').tabulator('redraw', true);
- });
+ // Enable button 'Lehrauftrag bestellen' by default
+ $("#approve-lehrauftraege").attr("disabled", false).attr("title", "");
- // Show all rows
- $("#show-all").click(function(){
- $('#tableWidgetTabulator').tabulator('clearFilter');
- });
-
- // Show only rows with new lehrauftraege (not dummy lectors)
- $("#show-new").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'personalnummer', type: '>=', value: 0},
- {field: 'bestellt', type: '=', value: null},
- {field: 'erteilt', type: '=', value: null},
- {field: 'akzeptiert', type: '=', value: null}
- ]
+ // Disable button Lehrauftrag bestellen for dummies
+ if (this.id == "show-dummies") {
+ $("#approve-lehrauftraege")
+ .attr("disabled", true)
+ .attr(
+ "title",
+ "Lehraufträge ohne Lektorzuteilung können nicht bestellt werden."
);
- });
+ }
+ });
- // Show only rows with ordered lehrauftraege
- $("#show-ordered").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'personalnummer', type: '>=', value: 0},
- {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},
- {field: 'erteilt', type: '!=', value: null},
- {field: 'akzeptiert', type: '=', value: null}
- ]
- );
- });
-
- // Show only rows with accepted 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 dummy lectors
- $("#show-dummies").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'personalnummer', type: '!=', value: null},
- {field: 'personalnummer', type: '<=', value: 0},
- ]
- );
- });
-
- // Show only rows with dummy lectors
- $("#show-changed").click(function(){
- // needs custom filter to compare fields betrag and vertrag_betrag
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector AND
- {field: 'bestellt', type: '!=', value: null}, // bestellt AND
- {field: 'status', type: '=', value: 'Geändert'} // geaendert
- ]
- );
- });
-
- // Set png-icons into filter-buttons
- $(".btn-lehrauftrag").each(function(){
- switch(this.id) {
- case 'show-ordered':
- this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
- break;
- case 'show-approved':
- this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
- break;
- case 'show-changed':
- this.innerHTML = ICON_LEHRAUFTRAG_CHANGED;
- break;
- }
- });
-
- // De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag erteilen'
- $(".btn-lehrauftrag").click(function() {
-
- // 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
- $('#approve-lehrauftraege').attr('disabled', false).attr('title', '');
-
- // Disable button Lehrauftrag bestellen for dummies
- if (this.id == 'show-dummies')
- {
- $('#approve-lehrauftraege').attr('disabled', true).attr('title', 'Lehraufträge ohne Lektorzuteilung können nicht bestellt werden.');
- }
- });
-
- // Approve Lehrauftraege
- $("#approve-lehrauftraege").click(function(){
-
- var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
- .filter(function(val){
- // filter pseudo lines of groupBy (e.g. the bottom calculations lines)
- return val.row_index != null || typeof(val.row_index) !== 'undefined';
- })
- .map(function(data){
- // reduce to necessary fields
- return {
- 'row_index': data.row_index,
- 'mitarbeiter_uid' : data.mitarbeiter_uid,
- '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');
- return;
- }
-
- /*
- * Prepare data object for ajax call
- * NOTE: Stringify to send only ONE post param (json string) instead of many single post params.
- * This avoids issues with POST param limitation.
- */
- var data = {
- 'selected_data': JSON.stringify(selected_data)
+ // Approve Lehrauftraege
+ $("#approve-lehrauftraege").click(function () {
+ var selected_data = $("#tableWidgetTabulator")
+ .tabulator("getSelectedData")
+ .filter(function (val) {
+ // filter pseudo lines of groupBy (e.g. the bottom calculations lines)
+ return val.row_index != null || typeof val.row_index !== "undefined";
+ })
+ .map(function (data) {
+ // reduce to necessary fields
+ return {
+ row_index: data.row_index,
+ mitarbeiter_uid: data.mitarbeiter_uid,
+ vertrag_id: data.vertrag_id,
};
+ });
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/approveLehrauftrag",
- data,
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (!data.error && data.retval != null)
- {
- // Update status 'Erteilt'
- $('#tableWidgetTabulator').tabulator('updateData', data.retval);
+ // Alert and exit if no lehraufgang is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ "Bitte wählen Sie erst zumindest einen Lehrauftrag"
+ );
+ return;
+ }
- // Print success message
- FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden erteilt.");
- }
+ /*
+ * Prepare data object for ajax call
+ * NOTE: Stringify to send only ONE post param (json string) instead of many single post params.
+ * This avoids issues with POST param limitation.
+ */
+ var data = {
+ selected_data: JSON.stringify(selected_data),
+ };
- if (data.error && data.retval != null)
- {
- // Print error message
- FHC_DialogLib.alertError(data.retval);
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator.");
- }
- }
- );
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/approveLehrauftrag",
+ data,
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (!data.error && data.retval != null) {
+ // Update status 'Erteilt'
+ $("#tableWidgetTabulator").tabulator("updateData", data.retval);
- });
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ data.retval.length + " Lehraufträge wurden erteilt."
+ );
+ }
+
+ if (data.error && data.retval != null) {
+ // Print error message
+ FHC_DialogLib.alertError(data.retval);
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(
+ "Systemfehler
Bitte kontaktieren Sie Ihren Administrator."
+ );
+ },
+ }
+ );
+ });
});
diff --git a/public/js/lehre/lehrauftrag/orderLehrauftrag.js b/public/js/lehre/lehrauftrag/orderLehrauftrag.js
index 9eb5da144..4dc266139 100644
--- a/public/js/lehre/lehrauftrag/orderLehrauftrag.js
+++ b/public/js/lehre/lehrauftrag/orderLehrauftrag.js
@@ -14,19 +14,22 @@ const COLOR_LIGHTGREY = "#f5f5f5";
* 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 =
+ '
';
// Fields that should not be provided in the column picker
var tableWidgetBlacklistArray_columnUnselectable = [
- 'status',
- 'row_index',
- 'personalnummer',
- 'betrag',
- 'vertrag_id',
- 'vertrag_stunden',
- 'vertrag_betrag'
+ "status",
+ "row_index",
+ "personalnummer",
+ "betrag",
+ "vertrag_id",
+ "vertrag_stunden",
+ "vertrag_betrag",
];
// -----------------------------------------------------------------------------------------------------------------
@@ -35,60 +38,68 @@ var tableWidgetBlacklistArray_columnUnselectable = [
// Converts string date postgre style to string DD.MM.YYYY.
// This will allow correct filtering.
-var mut_formatStringDate = function(value, data, type, params, component) {
- if (value != null)
- {
- var d = new Date(value);
- return ("0" + (d.getDate())).slice(-2) + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
- }
-}
+var mut_formatStringDate = function (value, data, type, params, component) {
+ if (value != null) {
+ var d = new Date(value);
+ return (
+ ("0" + d.getDate()).slice(-2) +
+ "." +
+ ("0" + (d.getMonth() + 1)).slice(-2) +
+ "." +
+ d.getFullYear()
+ );
+ }
+};
// -----------------------------------------------------------------------------------------------------------------
// Formatters - changes display information, not the data itself
// -----------------------------------------------------------------------------------------------------------------
// Formats null values to a string number '0.00'
-var form_formatNulltoStringNumber = function(cell, formatterParams, onRendered){
- //cell - the cell component
- //formatterParams - parameters set for the column
- //onRendered - function to call when the formatter has been rendered
+var form_formatNulltoStringNumber = function (
+ cell,
+ formatterParams,
+ onRendered
+) {
+ //cell - the cell component
+ //formatterParams - parameters set for the column
+ //onRendered - function to call when the formatter has been rendered
- if (cell.getValue() == null){
- if (formatterParams.precision == 1)
- {
- return '0.0';
- }
- return '0.00';
- }
- else {
- return cell.getValue();
- }
-}
+ if (cell.getValue() == null) {
+ if (formatterParams.precision == 1) {
+ return "0.0";
+ }
+ return "0.00";
+ } else {
+ return cell.getValue();
+ }
+};
// -----------------------------------------------------------------------------------------------------------------
// Header filter
// -----------------------------------------------------------------------------------------------------------------
// Filters values using comparison operator or just by string comparison
-function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filterParams){
+function hf_filterStringnumberWithOperator(
+ headerValue,
+ rowValue,
+ rowData,
+ filterParams
+) {
+ // If string starts with <, <=, >, >=, !=, ==, compare values with that operator
+ var operator = "";
+ if (headerValue.match(/([<=>!]{1,2})/g)) {
+ var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
+ operator = operator_arr[0];
- // If string starts with <, <=, >, >=, !=, ==, compare values with that operator
- var operator = '';
- if (headerValue.match(/([<=>!]{1,2})/g)) {
- var operator_arr = headerValue.match(/([<=>!]{1,2})/g);
- operator = operator_arr[0];
+ headerValue = headerValue.replace(operator, "").trim();
- headerValue = headerValue
- .replace(operator, '')
- .trim()
- ;
+ // return if value comparison is true
+ return eval(rowValue + operator + headerValue);
+ }
- // return if value comparison is true
- return eval(rowValue + operator + headerValue);
- }
-
- // If just a stringnumber, return if exact match found
- return parseFloat(rowValue) == headerValue;
+ // If just a stringnumber, return if exact match found
+ return parseFloat(rowValue) == headerValue;
}
// -----------------------------------------------------------------------------------------------------------------
@@ -101,21 +112,20 @@ function hf_filterStringnumberWithOperator(headerValue, rowValue, rowData, filte
* it is processed before the callback tableBuilt, where the status is going to be built.
* The callback dataLoaded is processed after tableBuild and provides the status.
*/
-function func_dataLoaded(data, table){
-
- table.setFilter([
- [
- {field: 'personalnummer', type: '>', value: 0}, // not dummy
- {field: 'personalnummer', type: '=', value: null} // include projektbetreuer
- ],
- {field: 'mitarbeiter_uid', type: '!=', value: null}, // AND is Mitarbeiter
- {field: 'stunden', type: '!=', value: null}, // AND has Semesterstunden (not null and not 0)
- {field: 'stunden', type: '!=', value: 0},
- [
- {field: 'status', type: '=', value: 'Neu'}, // AND neu
- {field: 'status', type: '=', value: 'Geändert'} // OR geaendert
- ]
- ]);
+function func_dataLoaded(data, table) {
+ table.setFilter([
+ [
+ { field: "personalnummer", type: ">", value: 0 }, // not dummy
+ { field: "personalnummer", type: "=", value: null }, // include projektbetreuer
+ ],
+ { field: "mitarbeiter_uid", type: "!=", value: null }, // AND is Mitarbeiter
+ { field: "stunden", type: "!=", value: null }, // AND has Semesterstunden (not null and not 0)
+ { field: "stunden", type: "!=", value: 0 },
+ [
+ { field: "status", type: "=", value: "Neu" }, // AND neu
+ { field: "status", type: "=", value: "Geändert" }, // OR geaendert
+ ],
+ ]);
}
// -----------------------------------------------------------------------------------------------------------------
@@ -123,52 +133,55 @@ function func_dataLoaded(data, table){
// -----------------------------------------------------------------------------------------------------------------
// Returns relative height (depending on screen size)
-function func_height(table){
- return $(window).height() * 0.50;
+function func_height(table) {
+ return $(window).height() * 0.5;
}
// Formats the group header
function func_groupHeader(data) {
- return data[0].lv_bezeichnung + " " + ' ( LV-ID: ' + data[0].lehrveranstaltung_id + ' )'; // change name to lehrveranstaltung;
+ return (
+ data[0].lv_bezeichnung +
+ " " +
+ " ( LV-ID: " +
+ data[0].lehrveranstaltung_id +
+ " )"
+ ); // change name to lehrveranstaltung;
}
// Formats the rows
-function func_rowFormatter(row){
- var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
- var is_mitarbeiter = row.getData().mitarbeiter_uid != null;
- var has_stunden = row.getData().stunden != 0 && row.getData().stunden != null;
+function func_rowFormatter(row) {
+ var is_dummy =
+ row.getData().personalnummer <= 0 && row.getData().personalnummer != null;
+ var is_mitarbeiter = row.getData().mitarbeiter_uid != null;
+ var has_stunden = row.getData().stunden != 0 && row.getData().stunden != null;
- var bestellt = row.getData().bestellt;
- var erteilt = row.getData().erteilt;
- var akzeptiert = row.getData().akzeptiert;
+ var bestellt = row.getData().bestellt;
+ var erteilt = row.getData().erteilt;
+ var akzeptiert = row.getData().akzeptiert;
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- if (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- /*
+ /*
Formats the color of the rows depending on their status
- blue: dummy lectors
- bold: geaendert
@@ -176,167 +189,151 @@ function func_rowFormatter(row){
- green: akzeptiert
- grey: all other (marks unselectable), not mitarbeiter, has no semesterstunden
*/
- row.getCells().forEach(function(cell){
- if(is_dummy)
- {
- cell.getElement().classList.add('bg-info'); // dummy lectors
- }
- else if ((!is_mitarbeiter || !has_stunden) && akzeptiert == null)
- {
- row.getElement().style["background-color"] = COLOR_LIGHTGREY;
- }
- else if (bestellt != null && (betrag != vertrag_betrag) ||
- bestellt != null && stunden != vertrag_stunden &&
- !row._row.element.classList.contains('tabulator-calcs')) // exclude calculation rows
- {
- row.getElement().style['font-weight'] = 'bold'; // geaendert
- }
- else if(bestellt == null)
- {
- return; // neu und erteilt
- }
- else if(bestellt != null && erteilt != null && akzeptiert != null)
- {
- cell.getElement().classList.add('bg-success') // akzeptiert
- }
-
- // default color is already set in the Tabulator5.css file that gets loaded the Header flag tabulator5
- // row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
-
- });
+ row.getCells().forEach(function (cell) {
+ if (is_dummy) {
+ cell.getElement().classList.add("bg-info"); // dummy lectors
+ } else if ((!is_mitarbeiter || !has_stunden) && akzeptiert == null) {
+ row.getElement().style["background-color"] = COLOR_LIGHTGREY;
+ } else if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null &&
+ stunden != vertrag_stunden &&
+ !row._row.element.classList.contains("tabulator-calcs"))
+ ) {
+ // exclude calculation rows
+ row.getElement().style["font-weight"] = "bold"; // geaendert
+ } else if (bestellt == null) {
+ return; // neu und erteilt
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ cell.getElement().classList.add("bg-success"); // akzeptiert
+ }
+
+ // default color is already set in the Tabulator5.css file that gets loaded the Header flag tabulator5
+ // row.getElement().style["background-color"] = COLOR_LIGHTGREY; // default
+ });
}
// Formats row selectable/unselectable
-function func_selectableCheck(row){
- var is_dummy = (row.getData().personalnummer <= 0 && row.getData().personalnummer != null);
- var is_mitarbeiter = row.getData().mitarbeiter_uid != null;
- var has_stunden = row.getData().stunden != 0 && row.getData().stunden != null;
+function func_selectableCheck(row) {
+ var is_dummy =
+ row.getData().personalnummer <= 0 && row.getData().personalnummer != null;
+ var is_mitarbeiter = row.getData().mitarbeiter_uid != null;
+ var has_stunden = row.getData().stunden != 0 && row.getData().stunden != null;
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- if (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- // Only allow to select neue and geaenderte
- return !is_dummy && // NOT dummy lector
- is_mitarbeiter && // AND is Mitarbeiter
- has_stunden && // AND has Semesterstunden (not null and not 0)
- ((row.getData().bestellt == null) || // AND neue
- (row.getData().bestellt != null && betrag != vertrag_betrag) || // OR geaenderte
- (row.getData().bestellt != null && stunden != vertrag_stunden));
+ // Only allow to select neue and geaenderte
+ return (
+ !is_dummy && // NOT dummy lector
+ is_mitarbeiter && // AND is Mitarbeiter
+ has_stunden && // AND has Semesterstunden (not null and not 0)
+ (row.getData().bestellt == null || // AND neue
+ (row.getData().bestellt != null && betrag != vertrag_betrag) || // OR geaenderte
+ (row.getData().bestellt != null && stunden != vertrag_stunden))
+ );
}
// Adds column status
function func_tableBuilt(table) {
- // Add status column to table
- table.tabulator("addColumn",
- {
- title: "",
- field: "status",
- width:40,
- align:"center",
- downloadTitle: 'Status',
- formatter: status_formatter,
- tooltip: status_tooltip
- }, true
- );
+ // Add status column to table
+ table.tabulator(
+ "addColumn",
+ {
+ title: "",
+ field: "status",
+ width: 40,
+ align: "center",
+ downloadTitle: "Status",
+ formatter: status_formatter,
+ tooltip: status_tooltip,
+ },
+ true
+ );
+
+ // fully redrawing the table after adding the Details column
+ table.tabulator("redraw", true);
}
// Sets status values into column status
-function func_renderStarted(table){
- // set literally status to each row - this enables sorting by status despite using icons
- table.getRows().forEach(function(row){
- var bestellt = row.getData().bestellt;
- var erteilt = row.getData().erteilt;
- var akzeptiert = row.getData().akzeptiert;
+function func_renderStarted(table) {
+ // set literally status to each row - this enables sorting by status despite using icons
+ table.getRows().forEach(function (row) {
+ var bestellt = row.getData().bestellt;
+ var erteilt = row.getData().erteilt;
+ var akzeptiert = row.getData().akzeptiert;
- var stunden = parseFloat(row.getData().stunden);
- var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
+ var stunden = parseFloat(row.getData().stunden);
+ var vertrag_stunden = parseFloat(row.getData().vertrag_stunden);
- var betrag = parseFloat(row.getData().betrag);
- var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
+ var betrag = parseFloat(row.getData().betrag);
+ var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- if (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- if ((bestellt != null && betrag != vertrag_betrag) ||
- (bestellt != null && stunden != vertrag_stunden))
- {
- row.getData().status = 'Geändert'; // geaendert
- }
- else if (bestellt == null && erteilt == null && akzeptiert == null)
- {
- row.getData().status = 'Neu'; // neu
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null)
- {
- row.getData().status = 'Bestellt'; // bestellt
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null)
- {
- row.getData().status = 'Erteilt'; // erteilt
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null)
- {
- row.getData().status = 'Akzeptiert'; // akzeptiert
- }
- else
- {
- row.getData().status = null; // default
- }
- });
+ if (
+ (bestellt != null && betrag != vertrag_betrag) ||
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ row.getData().status = "Geändert"; // geaendert
+ } else if (bestellt == null && erteilt == null && akzeptiert == null) {
+ row.getData().status = "Neu"; // neu
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ row.getData().status = "Bestellt"; // bestellt
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ row.getData().status = "Erteilt"; // erteilt
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ row.getData().status = "Akzeptiert"; // akzeptiert
+ } else {
+ row.getData().status = null; // default
+ }
+ });
}
// Performes after row was updated
-function func_rowUpdated(row){
+function func_rowUpdated(row) {
+ // Refresh status icon and row color
+ row.reformat(); // retriggers cell formatters and rowFormatter callback
- // Refresh status icon and row color
- row.reformat(); // retriggers cell formatters and rowFormatter callback
+ // Format font-weight normal (needed after geaenderte were bestellt)
+ row.getElement().style["font-weight"] = "normal";
- // Format font-weight normal (needed after geaenderte were bestellt)
- row.getElement().style['font-weight'] = 'normal';
-
- // Deselect and disable new selection of updated rows (ordering done)
- row.deselect();
- row.getElement().style["pointerEvents"] = "none";
+ // Deselect and disable new selection of updated rows (ordering done)
+ row.deselect();
+ row.getElement().style["pointerEvents"] = "none";
}
// TableWidget Footer element
@@ -346,435 +343,424 @@ function func_rowUpdated(row){
* Hook to overwrite TableWigdgets select-all-button behaviour
* Select all (filtered) rows and ignore rows which have status bestellt
*/
-function tableWidgetHook_selectAllButton(tableWidgetDiv){
- var resultRows = tableWidgetDiv.find("#tableWidgetTabulator").tabulator('getRows', true)
- .filter(row => (
- row.getData().personalnummer > 0 || // not dummies
- row.getData().personalnummer == null) && // include Projektbetreuer
- row.getData().mitarbeiter_uid != null && // AND is Mitarbeiter
- row.getData().stunden != null && // AND has Semesterstunden (not null and not 0)
- row.getData().stunden != 0 &&
- (
- (row.getData().bestellt == null) || // AND neu
- (row.getData().bestellt != null && // OR (bestellt
- row.getData().status == 'Geändert') // AND geaendert)
- )
- );
+function tableWidgetHook_selectAllButton(tableWidgetDiv) {
+ var resultRows = tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("getRows", true)
+ .filter(
+ (row) =>
+ (row.getData().personalnummer > 0 || // not dummies
+ row.getData().personalnummer == null) && // include Projektbetreuer
+ row.getData().mitarbeiter_uid != null && // AND is Mitarbeiter
+ row.getData().stunden != null && // AND has Semesterstunden (not null and not 0)
+ row.getData().stunden != 0 &&
+ (row.getData().bestellt == null || // AND neu
+ (row.getData().bestellt != null && // OR (bestellt
+ row.getData().status == "Geändert")) // AND geaendert)
+ );
- tableWidgetDiv.find("#tableWidgetTabulator").tabulator('selectRow', resultRows);
+ tableWidgetDiv
+ .find("#tableWidgetTabulator")
+ .tabulator("selectRow", resultRows);
}
// -----------------------------------------------------------------------------------------------------------------
// Tabulator columns format functions
// -----------------------------------------------------------------------------------------------------------------
// Generates status icons
-status_formatter = function(cell, formatterParams, onRendered){
- var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
+status_formatter = function (cell, formatterParams, onRendered) {
+ var is_dummy =
+ cell.getRow().getData().personalnummer <= 0 &&
+ cell.getRow().getData().personalnummer != null;
- var bestellt = cell.getRow().getData().bestellt;
- var erteilt = cell.getRow().getData().erteilt;
- var akzeptiert = cell.getRow().getData().akzeptiert;
+ var bestellt = cell.getRow().getData().bestellt;
+ var erteilt = cell.getRow().getData().erteilt;
+ var akzeptiert = cell.getRow().getData().akzeptiert;
- 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 (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- // commented icons would be so nice to have with fontawsome 5.11...
- if (is_dummy)
- {
- return ""; // dummy lector
- }
- else if (bestellt != null && isNaN(vertrag_betrag))
- {
- return ""; // kein Vertrag
- }
- else if (bestellt != null && (betrag != vertrag_betrag) || // geaendert
- bestellt != null && stunden != vertrag_stunden) // geaendert ((if betrag is 0 or null)
- {
- return ICON_LEHRAUFTRAG_CHANGED; // geaendert
- // return "";
- }
- else if (bestellt == null && erteilt == null && akzeptiert == null)
- {
- return ""; // neu
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null)
- {
- return ICON_LEHRAUFTRAG_ORDERED; // bestellt
- // return "";
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null)
- {
- return ICON_LEHRAUFTRAG_APPROVED; // erteilt
- // return "";
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null)
- {
- return ""; // akzeptiert
- }
- else
- {
- return ""; // default
- }
+ // commented icons would be so nice to have with fontawsome 5.11...
+ if (is_dummy) {
+ return ""; // dummy lector
+ } else if (bestellt != null && isNaN(vertrag_betrag)) {
+ return ""; // kein Vertrag
+ } else if (
+ (bestellt != null && betrag != vertrag_betrag) || // geaendert
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ // geaendert ((if betrag is 0 or null)
+ return ICON_LEHRAUFTRAG_CHANGED; // geaendert
+ // return "";
+ } else if (bestellt == null && erteilt == null && akzeptiert == null) {
+ return ""; // neu
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ return ICON_LEHRAUFTRAG_ORDERED; // bestellt
+ // return "";
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ return ICON_LEHRAUFTRAG_APPROVED; // erteilt
+ // return "";
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ return ""; // akzeptiert
+ } else {
+ return ""; // default
+ }
};
// Generates status tooltip
-status_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+status_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- var is_dummy = (cell.getRow().getData().personalnummer <= 0 && cell.getRow().getData().personalnummer != null);
- var is_mitarbeiter = cell.getRow().getData().mitarbeiter_uid != null;
- var has_stunden = cell.getRow().getData().stunden != 0 && cell.getRow().getData().stunden != null;
+ var is_dummy =
+ cell.getRow().getData().personalnummer <= 0 &&
+ cell.getRow().getData().personalnummer != null;
+ var is_mitarbeiter = cell.getRow().getData().mitarbeiter_uid != null;
+ var has_stunden =
+ cell.getRow().getData().stunden != 0 &&
+ cell.getRow().getData().stunden != null;
- var bestellt = cell.getRow().getData().bestellt;
- var erteilt = cell.getRow().getData().erteilt;
- var akzeptiert = cell.getRow().getData().akzeptiert;
+ var bestellt = cell.getRow().getData().bestellt;
+ var erteilt = cell.getRow().getData().erteilt;
+ var akzeptiert = cell.getRow().getData().akzeptiert;
- var betrag = parseFloat(cell.getRow().getData().betrag);
- var stunden = parseFloat(cell.getRow().getData().stunden);
- var stundensatz = parseFloat(cell.getRow().getData().stundensatz);
+ var betrag = parseFloat(cell.getRow().getData().betrag);
+ var stunden = parseFloat(cell.getRow().getData().stunden);
+ var stundensatz = parseFloat(cell.getRow().getData().stundensatz);
- var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
- var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
- var vertrag_stundensatz = 0;
+ var vertrag_betrag = parseFloat(cell.getRow().getData().vertrag_betrag);
+ var vertrag_stunden = parseFloat(cell.getRow().getData().vertrag_stunden);
+ var vertrag_stundensatz = 0;
- if (isNaN(betrag))
- {
- betrag = 0;
- }
+ if (isNaN(betrag)) {
+ betrag = 0;
+ }
- if (isNaN(stunden))
- {
- stunden = 0;
- }
+ if (isNaN(stunden)) {
+ stunden = 0;
+ }
- if (isNaN(vertrag_stunden))
- {
- vertrag_stunden = 0;
- }
+ if (isNaN(vertrag_stunden)) {
+ vertrag_stunden = 0;
+ }
- if (isNaN(vertrag_betrag))
- {
- vertrag_betrag = 0;
- }
+ if (isNaN(vertrag_betrag)) {
+ vertrag_betrag = 0;
+ }
- // Calculate vertrag stundensatz
- if (vertrag_stunden != 0)
- {
- vertrag_stundensatz = vertrag_betrag/vertrag_stunden;
- }
+ // Calculate vertrag stundensatz
+ if (vertrag_stunden != 0) {
+ vertrag_stundensatz = vertrag_betrag / vertrag_stunden;
+ }
- // Return tooltip message
- if (is_dummy) // dummy (no lector)
- {
- return FHC_PhrasesLib.t("ui", "neuerLehrauftragOhneLektorVerplant");
- }
- else if (!is_mitarbeiter)
- {
- return 'Lektor ist nicht als Mitarbeiter erfasst.'
- }
- else if (!has_stunden)
- {
- return 'Es wurden noch keine Stunden zugeteilt.'
- }
- else if (vertrag_betrag == 0) // neu
- {
- return FHC_PhrasesLib.t("ui", "neuerLehrauftragWartetAufBestellung");
- }
- else if (betrag != vertrag_betrag || // geaendert
- bestellt != null && stunden != vertrag_stunden) // geaendert (if betrag is 0 or null)
- {
- var text = FHC_PhrasesLib.t("ui", "nachAenderungStundensatzStunden",
- new Array(stundensatz, stunden));
- text += "\n";
- text += FHC_PhrasesLib.t("ui", "vorAenderungStundensatzStunden",
- new Array(vertrag_stundensatz, vertrag_stunden));
- return text;
- }
- else if (bestellt != null && erteilt == null && akzeptiert == null) // bestellt
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusBestellt");
- }
- else if (bestellt != null && erteilt != null && akzeptiert == null) // erteilt
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusErteilt");
- }
- else if (bestellt != null && erteilt != null && akzeptiert != null) // akzeptiert
- {
- return FHC_PhrasesLib.t("ui", "letzterStatusAngenommen");
- }
-}
+ // Return tooltip message
+ if (is_dummy) {
+ // dummy (no lector)
+ return FHC_PhrasesLib.t("ui", "neuerLehrauftragOhneLektorVerplant");
+ } else if (!is_mitarbeiter) {
+ return "Lektor ist nicht als Mitarbeiter erfasst.";
+ } else if (!has_stunden) {
+ return "Es wurden noch keine Stunden zugeteilt.";
+ } else if (vertrag_betrag == 0) {
+ // neu
+ return FHC_PhrasesLib.t("ui", "neuerLehrauftragWartetAufBestellung");
+ } else if (
+ betrag != vertrag_betrag || // geaendert
+ (bestellt != null && stunden != vertrag_stunden)
+ ) {
+ // geaendert (if betrag is 0 or null)
+ var text = FHC_PhrasesLib.t(
+ "ui",
+ "nachAenderungStundensatzStunden",
+ new Array(stundensatz, stunden)
+ );
+ text += "\n";
+ text += FHC_PhrasesLib.t(
+ "ui",
+ "vorAenderungStundensatzStunden",
+ new Array(vertrag_stundensatz, vertrag_stunden)
+ );
+ return text;
+ } else if (bestellt != null && erteilt == null && akzeptiert == null) {
+ // bestellt
+ return FHC_PhrasesLib.t("ui", "letzterStatusBestellt");
+ } else if (bestellt != null && erteilt != null && akzeptiert == null) {
+ // erteilt
+ return FHC_PhrasesLib.t("ui", "letzterStatusErteilt");
+ } else if (bestellt != null && erteilt != null && akzeptiert != null) {
+ // akzeptiert
+ return FHC_PhrasesLib.t("ui", "letzterStatusAngenommen");
+ }
+};
// Generates bestellt tooltip
-bestellt_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+bestellt_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().bestellt_von != null)
- {
- return FHC_PhrasesLib.t("ui", "bestelltVon") + cell.getRow().getData().bestellt_von;
- }
-}
+ if (cell.getRow().getData().bestellt_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "bestelltVon") +
+ cell.getRow().getData().bestellt_von
+ );
+ }
+};
// Generates erteilt tooltip
-erteilt_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+erteilt_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().erteilt_von != null) {
- return FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von;
- }
-}
+ if (cell.getRow().getData().erteilt_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "erteiltVon") + cell.getRow().getData().erteilt_von
+ );
+ }
+};
// Generates akzeptiert tooltip
-akzeptiert_tooltip = function(e, cell, onRendered){
- //e - mouseover event
- //cell - cell component
- //onRendered - onRendered callback registration function
+akzeptiert_tooltip = function (e, cell, onRendered) {
+ //e - mouseover event
+ //cell - cell component
+ //onRendered - onRendered callback registration function
- if (cell.getRow().getData().akzeptiert_von != null) {
- return FHC_PhrasesLib.t("ui", "angenommenVon") + cell.getRow().getData().akzeptiert_von;
- }
-}
+ if (cell.getRow().getData().akzeptiert_von != null) {
+ return (
+ FHC_PhrasesLib.t("ui", "angenommenVon") +
+ cell.getRow().getData().akzeptiert_von
+ );
+ }
+};
-$(function() {
+$(function () {
+ // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
+ $(document).on("tableInit", function (event, tabulatorInstance) {
+ func_tableBuilt($("#tableWidgetTabulator"));
- // tableInit is called in the jquery_wrapper when the tableBuilt event was finished
- $(document).on("tableInit", function(event,tabulatorInstance) {
-
- func_tableBuilt($("#tableWidgetTabulator"))
-
- // event rowUpdated needs to be attached as a callback to the tableBuilt event in tabulator5
- $("#tableWidgetTabulator").tabulator("on","rowUpdated",(row)=>{func_rowUpdated(row)});
-
- // event renderStarted needs to be attached as a callback to the tableBuilt event in tabulator5
- $("#tableWidgetTabulator").tabulator("on","renderStarted",()=>{func_renderStarted(tabulatorInstance)});
-
- // event dataLoaded needs to be attached as a callback to the tableBuilt event in tabulator5
- $("#tableWidgetTabulator").tabulator("on","dataLoaded",(data)=>{func_dataLoaded(data,tabulatorInstance)});
-
+ // event rowUpdated needs to be attached as a callback to the tableBuilt event in tabulator5
+ $("#tableWidgetTabulator").tabulator("on", "rowUpdated", (row) => {
+ func_rowUpdated(row);
});
- // Redraw table on resize to fit tabulators height to windows height
- window.addEventListener('resize', function(){
- $('#tableWidgetTabulator').tabulator('setHeight', $(window).height() * 0.50);
- $('#tableWidgetTabulator').tabulator('redraw', true);
- });
+ // event renderStarted needs to be attached as a callback to the tableBuilt event in tabulator5
+ $("#tableWidgetTabulator").tabulator("on", "renderStarted", () => {
+ func_renderStarted(tabulatorInstance);
+ });
- // Show all rows
- $("#show-all").click(function(){
- $('#tableWidgetTabulator').tabulator('clearFilter');
- });
+ // event dataLoaded needs to be attached as a callback to the tableBuilt event in tabulator5
+ $("#tableWidgetTabulator").tabulator("on", "dataLoaded", (data) => {
+ func_dataLoaded(data, tabulatorInstance);
+ });
+ });
- // Show only rows with new lehrauftraege (not dummy lectors or external projektbetreuer; stunden not 0 or null)
- $("#show-new").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- [
- {field: 'personalnummer', type: '>', value: 0}, // not dummy lector
- {field: 'personalnummer', type: '=', value: null} // include Projektbetreuer
- ],
- {field: 'mitarbeiter_uid', type: '!=', value: null}, // AND is Mitarbeiter
- {field: 'stunden', type: '!=', value: null}, // AND has Semesterstunden (not null and not 0)
- {field: 'stunden', type: '!=', value: 0},
- {field: 'bestellt', type: '=', value: null},
- {field: 'erteilt', type: '=', value: null},
- {field: 'akzeptiert', type: '=', value: null}
- ]
- );
- });
+ // Redraw table on resize to fit tabulators height to windows height
+ window.addEventListener("resize", function () {
+ $("#tableWidgetTabulator").tabulator("setHeight", $(window).height() * 0.5);
+ $("#tableWidgetTabulator").tabulator("redraw", true);
+ });
- // Show only rows with ordered lehrauftraege
- $("#show-ordered").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- [
- {field: 'personalnummer', type: '>', value: 0}, // not dummy lector
- {field: 'personalnummer', type: '=', value: null} // include Projektbetreuer
- ],
- {field: 'bestellt', type: '!=', value: null},
- {field: 'erteilt', type: '=', value: null},
- {field: 'akzeptiert', type: '=', value: null}
- ]
- );
- });
+ // Show all rows
+ $("#show-all").click(function () {
+ $("#tableWidgetTabulator").tabulator("clearFilter");
+ });
- // Show only rows with erteilte lehrauftraege
- $("#show-approved").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'bestellt', type: '!=', value: null},
- {field: 'erteilt', type: '!=', value: null},
- {field: 'akzeptiert', type: '=', value: null}
- ]
- );
- });
+ // Show only rows with new lehrauftraege (not dummy lectors or external projektbetreuer; stunden not 0 or null)
+ $("#show-new").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ [
+ { field: "personalnummer", type: ">", value: 0 }, // not dummy lector
+ { field: "personalnummer", type: "=", value: null }, // include Projektbetreuer
+ ],
+ { field: "mitarbeiter_uid", type: "!=", value: null }, // AND is Mitarbeiter
+ { field: "stunden", type: "!=", value: null }, // AND has Semesterstunden (not null and not 0)
+ { field: "stunden", type: "!=", value: 0 },
+ { 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}
- ]
- );
- });
+ // Show only rows with ordered lehrauftraege
+ $("#show-ordered").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ [
+ { field: "personalnummer", type: ">", value: 0 }, // not dummy lector
+ { field: "personalnummer", type: "=", value: null }, // include Projektbetreuer
+ ],
+ { field: "bestellt", type: "!=", value: null },
+ { field: "erteilt", type: "=", value: null },
+ { field: "akzeptiert", type: "=", value: null },
+ ]);
+ });
- // Show only rows with geaenderte lectors
- $("#show-changed").click(function(){
- // needs custom filter to compare fields betrag and vertrag_betrag
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- [
- {field: 'personalnummer', type: '>', value: 0}, // NOT dummy lector
- {field: 'personalnummer', type: '=', value: null} // include Projektbetreuer
- ],
- {field: 'mitarbeiter_uid', type: '!=', value: null}, // AND is Mitarbeiter
- {field: 'stunden', type: '!=', value: null}, // AND has Semesterstunden (not null and not 0)
- {field: 'stunden', type: '!=', value: 0},
- {field: 'bestellt', type: '!=', value: null}, // bestellt AND
- {field: 'status', type: '=', value: 'Geändert'} // geaendert
- ]
- );
- });
+ // Show only rows with erteilte lehrauftraege
+ $("#show-approved").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "bestellt", type: "!=", value: null },
+ { field: "erteilt", type: "!=", value: null },
+ { field: "akzeptiert", type: "=", value: null },
+ ]);
+ });
- // Show only rows with dummy lectors
- $("#show-dummies").click(function(){
- $('#tableWidgetTabulator').tabulator('setFilter',
- [
- {field: 'personalnummer', type: '!=', value: null},
- {field: 'personalnummer', type: '<=', value: 0},
- ]
- );
- });
+ // 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(){
- switch(this.id) {
- case 'show-ordered':
- this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
- break;
- case 'show-approved':
- this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
- break;
- case 'show-changed':
- this.innerHTML = ICON_LEHRAUFTRAG_CHANGED;
- break;
- }
- });
+ // Show only rows with geaenderte lectors
+ $("#show-changed").click(function () {
+ // needs custom filter to compare fields betrag and vertrag_betrag
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ [
+ { field: "personalnummer", type: ">", value: 0 }, // NOT dummy lector
+ { field: "personalnummer", type: "=", value: null }, // include Projektbetreuer
+ ],
+ { field: "mitarbeiter_uid", type: "!=", value: null }, // AND is Mitarbeiter
+ { field: "stunden", type: "!=", value: null }, // AND has Semesterstunden (not null and not 0)
+ { field: "stunden", type: "!=", value: 0 },
+ { field: "bestellt", type: "!=", value: null }, // bestellt AND
+ { field: "status", type: "=", value: "Geändert" }, // geaendert
+ ]);
+ });
- // De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag bestellen'
- $(".btn-lehrauftrag").click(function() {
+ // Show only rows with dummy lectors
+ $("#show-dummies").click(function () {
+ $("#tableWidgetTabulator").tabulator("setFilter", [
+ { field: "personalnummer", type: "!=", value: null },
+ { field: "personalnummer", type: "<=", value: 0 },
+ ]);
+ });
- // De/activate and un/focus on clicked button
- $(".btn-lehrauftrag").removeClass('focus').removeClass('active');
- $(this).addClass('focus').addClass('active');
+ // Set png-icons into filter-buttons
+ $(".btn-lehrauftrag").each(function () {
+ switch (this.id) {
+ case "show-ordered":
+ this.innerHTML = ICON_LEHRAUFTRAG_ORDERED;
+ break;
+ case "show-approved":
+ this.innerHTML = ICON_LEHRAUFTRAG_APPROVED;
+ break;
+ case "show-changed":
+ this.innerHTML = ICON_LEHRAUFTRAG_CHANGED;
+ break;
+ }
+ });
- //Enable button 'Lehrauftrag bestellen' by default
- $('#order-lehrauftraege').attr('disabled', false).attr('title', '');
+ // De/activate and un/focus on clicked button, En-/Disable 'Lehrauftrag bestellen'
+ $(".btn-lehrauftrag").click(function () {
+ // De/activate and un/focus on clicked button
+ $(".btn-lehrauftrag").removeClass("focus").removeClass("active");
+ $(this).addClass("focus").addClass("active");
- // 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.');
- }
- });
+ //Enable button 'Lehrauftrag bestellen' by default
+ $("#order-lehrauftraege").attr("disabled", false).attr("title", "");
- // Order Lehrauftraege
- $("#order-lehrauftraege").click(function(){
+ // 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."
+ );
+ }
+ });
- var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
- .filter(function(val){
- // filter pseudo lines of groupBy (e.g. the bottom calculations lines)
- return val.row_index != null || typeof(val.row_index) !== 'undefined';
- })
- .map(function(data){
- // reduce to necessary fields
- return {
- 'row_index' : data.row_index,
- 'lehreinheit_id' : data.lehreinheit_id,
- 'lehrveranstaltung_id' : data.lehrveranstaltung_id,
- 'person_id' : data.person_id,
- 'mitarbeiter_uid' : data.mitarbeiter_uid,
- 'vertrag_id' : data.vertrag_id,
- 'projektarbeit_id' : data.projektarbeit_id,
- 'stunden' : data.stunden,
- 'betrag' : data.betrag,
- 'studiensemester_kurzbz' : data.studiensemester_kurzbz,
- 'studiengang_kz' : data.studiengang_kz,
- 'lv_oe_kurzbz' : data.lv_oe_kurzbz
- }
- });
+ // Order Lehrauftraege
+ $("#order-lehrauftraege").click(function () {
+ var selected_data = $("#tableWidgetTabulator")
+ .tabulator("getSelectedData")
+ .filter(function (val) {
+ // filter pseudo lines of groupBy (e.g. the bottom calculations lines)
+ return val.row_index != null || typeof val.row_index !== "undefined";
+ })
+ .map(function (data) {
+ // reduce to necessary fields
+ return {
+ row_index: data.row_index,
+ lehreinheit_id: data.lehreinheit_id,
+ lehrveranstaltung_id: data.lehrveranstaltung_id,
+ person_id: data.person_id,
+ mitarbeiter_uid: data.mitarbeiter_uid,
+ vertrag_id: data.vertrag_id,
+ projektarbeit_id: data.projektarbeit_id,
+ stunden: data.stunden,
+ betrag: data.betrag,
+ studiensemester_kurzbz: data.studiensemester_kurzbz,
+ studiengang_kz: data.studiengang_kz,
+ lv_oe_kurzbz: data.lv_oe_kurzbz,
+ };
+ });
- // Alert and exit if no lehraufgang is selected
- if (selected_data.length == 0)
- {
- FHC_DialogLib.alertInfo('Bitte wählen Sie erst zumindest einen Lehrauftrag');
- return;
- }
+ // Alert and exit if no lehraufgang is selected
+ if (selected_data.length == 0) {
+ FHC_DialogLib.alertInfo(
+ "Bitte wählen Sie erst zumindest einen Lehrauftrag"
+ );
+ return;
+ }
- /*
- * Prepare data object for ajax call
- * NOTE: Stringify to send only ONE post param (json string) instead of many single post params.
- * This avoids issues with POST param limitation.
- */
- var data = {
- 'selected_data': JSON.stringify(selected_data)
- };
+ /*
+ * Prepare data object for ajax call
+ * NOTE: Stringify to send only ONE post param (json string) instead of many single post params.
+ * This avoids issues with POST param limitation.
+ */
+ var data = {
+ selected_data: JSON.stringify(selected_data),
+ };
- FHC_AjaxClient.ajaxCallPost(
- FHC_JS_DATA_STORAGE_OBJECT.called_path + "/orderLehrauftrag",
- data,
- {
- successCallback: function (data, textStatus, jqXHR)
- {
- if (!data.error && data.retval != null)
- {
- // Update status 'Bestellt'
- $('#tableWidgetTabulator').tabulator('updateData', data.retval);
+ FHC_AjaxClient.ajaxCallPost(
+ FHC_JS_DATA_STORAGE_OBJECT.called_path + "/orderLehrauftrag",
+ data,
+ {
+ successCallback: function (data, textStatus, jqXHR) {
+ if (!data.error && data.retval != null) {
+ // Update status 'Bestellt'
+ $("#tableWidgetTabulator").tabulator("updateData", data.retval);
- // Print success message
- FHC_DialogLib.alertSuccess("Alle " + data.retval.length + " Lehraufträge wurden bestellt.")
- }
+ // Print success message
+ FHC_DialogLib.alertSuccess(
+ "Alle " + data.retval.length + " Lehraufträge wurden bestellt."
+ );
+ }
- if (data.error && data.retval != null)
- {
- // Print error message
- FHC_DialogLib.alertError(data.retval);
- }
- },
- errorCallback: function (jqXHR, textStatus, errorThrown)
- {
- FHC_DialogLib.alertError("Sytemfehler
Bitte kontaktieren Sie Ihren Administrator.");
- }
- }
- );
- });
+ if (data.error && data.retval != null) {
+ // Print error message
+ FHC_DialogLib.alertError(data.retval);
+ }
+ },
+ errorCallback: function (jqXHR, textStatus, errorThrown) {
+ FHC_DialogLib.alertError(
+ "Sytemfehler
Bitte kontaktieren Sie Ihren Administrator."
+ );
+ },
+ }
+ );
+ });
});