Merge remote-tracking branch 'origin/master'

This commit is contained in:
Manfred Kindl
2018-05-11 16:59:19 +02:00
36 changed files with 601 additions and 283 deletions
-12
View File
@@ -1,12 +0,0 @@
/*
file for adding bootstrap classes, e.g. in case usage of non-bootstrap widgets in a bootstrap page
AVOID USING THIS IF POSSIBLE
*/
$(document).ready(
function()
{
$("input[type=text], select").addClass("form-control");
$("button, input[type=button]").addClass("btn btn-default");
$("table").addClass("table-condensed");
}
);
-327
View File
@@ -1,327 +0,0 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* javascript file for infocenterDetails page
*/
$(document).ready(
function ()
{
//initialise table sorter
addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"], 2);
tablesortAddPager("msgtable", "msgpager", 10);
formatNotizTable();
formatLogTable();
//initialise datepicker
$.datepicker.setDefaults($.datepicker.regional['de']);
$(".dateinput").datepicker({
"dateFormat": "dd.mm.yy"
});
//add submit event to message send link
$("#sendmsglink").click(
function ()
{
$("#sendmsgform").submit();
}
);
//add click events to "formal geprüft" checkboxes
$(".prchbox").click(function ()
{
var boxid = this.id;
var personid = $("#hiddenpersonid").val();
var akteid = boxid.substr(boxid.indexOf("_") + 1);
var checked = this.checked;
saveFormalGeprueft(personid, akteid, checked)
});
//zgv übernehmen
$(".zgvUebernehmen").click(function ()
{
var btn = $(this);
var personid = $("#hiddenpersonid").val();
var prestudentid = this.id.substr(this.id.indexOf("_") + 1);
$('#zgvUebernehmenNotice').remove();
zgvUebernehmen(personid, prestudentid, btn)
});
//zgv speichern
$(".zgvform").on('submit', function (e)
{
e.preventDefault();
var data = $(this).serializeArray();
saveZgv(data);
}
);
//prevent opening modal when Statusgrund not chosen
$(".absageModal").on('show.bs.modal', function (e)
{
var id = this.id.substr(this.id.indexOf("_") + 1);
var statusgrvalue = $("#statusgrselect_" + id + " select[name=statusgrund]").val();
if (statusgrvalue === "null")
{
$("#statusgrselect_" + id).addClass("has-error");
return e.preventDefault();
}
}
);
//remove red mark when statusgrund is selected again
$("select[name=statusgrund]").change(
function ()
{
$(this).parent().removeClass("has-error");
}
);
//save notiz
$("#notizform").on("submit", function (e)
{
e.preventDefault();
var personId = $("#hiddenpersonid").val();
var notizId = $("#notizform :input[name='hiddenNotizId']").val();
var data = $(this).serializeArray();
if (notizId !== '')
{
updateNotiz(notizId, personId, data);
}
else
{
saveNotiz(personId, data);
}
}
);
//update notiz - autofill notizform
$(document).on("click", "#notiztable tbody tr", function ()
{
var notizId = $(this).find("td:eq(3)").html();
var notizTitle = $(this).find("td:eq(1)").text();
var notizContent = this.title;
$("#notizform label:first").text("Notiz ändern").css("color", "red");
$("#notizform :input[type='reset']").css("display", "inline-block");
$("#notizform :input[name='hiddenNotizId']").val(notizId);
$("#notizform :input[name='notiztitel']").val(notizTitle);
$("#notizform :input[name='notiz']").val(notizContent);
}
);
//update notiz - abbrechen-button: reset styles
$("#notizform :input[type='reset']").click(function ()
{
resetNotizFields();
}
);
});
// -----------------------------------------------------------------------------------------------------------------
// ajax calls
function saveFormalGeprueft(personid, akteid, checked)
{
$.ajax({
type: "POST",
dataType: "json",
url: "../saveFormalGeprueft/" + personid,
data: {"akte_id": akteid, "formal_geprueft": checked},
success: function (data, textStatus, jqXHR)
{
if (data === null)
{
$("#formalgeprueftam_" + akteid).text("");
}
else
{
fgdatum = $.datepicker.parseDate("yy-mm-dd", data);
gerfgdatum = $.datepicker.formatDate("dd.mm.yy", fgdatum);
$("#formalgeprueftam_" + akteid).text(gerfgdatum);
}
//refresh doctable tablesorter, formal geprueft changed!
$("#doctable").trigger("update");
refreshLog();
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
});
}
function zgvUebernehmen(personid, prestudentid, btn)
{
$.ajax({
type: "POST",
dataType: "json",
url: "../getLastPrestudentWithZgvJson/" + personid,
success: function (data, textStatus, jqXHR)
{
if (data !== null)
{
var zgvcode = data.zgv_code !== null ? data.zgv_code : "null";
var zgvort = data.zgvort !== null ? data.zgvort : "";
var zgvdatum = data.zgvdatum;
var gerzgvdatum = "";
if (zgvdatum !== null)
{
zgvdatum = $.datepicker.parseDate("yy-mm-dd", data.zgvdatum);
gerzgvdatum = $.datepicker.formatDate("dd.mm.yy", zgvdatum);
}
var zgvnation = data.zgvnation !== null ? data.zgvnation : "null";
$("#zgv_" + prestudentid).val(zgvcode);
$("#zgvort_" + prestudentid).val(zgvort);
$("#zgvdatum_" + prestudentid).val(gerzgvdatum);
$("#zgvnation_" + prestudentid).val(zgvnation);
}
else
{
btn.after("&nbsp;&nbsp;<span id='zgvUebernehmenNotice' class='text-warning'>keine ZGV vorhanden</span>");
}
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
});
}
function saveZgv(data)
{
var prestudentid = data[0].value;
$("#zgvSpeichernNotice").remove();
$.ajax({
type: "POST",
dataType: "json",
data: data,
url: "../saveZgvPruefung/" + prestudentid,
success: function (data, textStatus, jqXHR)
{
if (data === prestudentid)
{
refreshLog();
$("#zgvSpeichern_" + prestudentid).before("<span id='zgvSpeichernNotice' class='text-success'>ZGV erfolgreich gespeichert!</span>&nbsp;&nbsp;");
}
else
{
$("#zgvSpeichern_" + prestudentid).before("<span id='zgvSpeichernNotice' class='text-danger'>Fehler beim Speichern der ZGV!</span>&nbsp;&nbsp;");
}
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
});
}
function saveNotiz(personid, data)
{
$.ajax({
type: "POST",
dataType: "json",
data: data,
url: "../saveNotiz/" + personid,
success: function (data, textStatus, jqXHR)
{
refreshNotizen();
refreshLog();
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
});
}
function updateNotiz(notizId, personId, data)
{
$.ajax({
type: "POST",
dataType: "json",
data: data,
url: "../updateNotiz/" + notizId + "/" + personId,
success: function (data, textStatus, jqXHR)
{
if (data)
{
refreshNotizen();
refreshLog();
resetNotizFields();
}
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
});
}
// -----------------------------------------------------------------------------------------------------------------
// methods executed after ajax (refreshers)
function refreshLog()
{
var personid = $("#hiddenpersonid").val();
$("#logs").load('../reloadLogs/' + personid,
function ()
{
//readd tablesorter
formatLogTable()
}
);
}
function formatLogTable()
{
addTablesorter("logtable", [[0, 1]], ["filter"], 2);
tablesortAddPager("logtable", "logpager", 23);
$("#logtable").addClass("table-condensed");
}
function refreshNotizen()
{
$("#notizform").find("input[type=text], textarea").val("");
var personid = $("#hiddenpersonid").val();
$("#notizen").load('../reloadNotizen/' + personid,
function ()
{
//readd tablesorter
formatNotizTable()
}
);
}
function formatNotizTable()
{
addTablesorter("notiztable", [[0, 1]], ["filter"], 2);
tablesortAddPager("notiztable", "notizpager", 10);
$("#notiztable").addClass("table-condensed");
}
function resetNotizFields()
{
$("#notizform :input[name='hiddenNotizId']").val("");
$("#notizform label:first").text("Notiz hinzufügen").css("color", "black");
$("#notizform :input[type='reset']").css("display", "none");
}
@@ -1,132 +0,0 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Javascript file for infocenter overview page
*/
$(document).ready(function() {
appendTableActionsHtml();
// setTableActions();
});
/**
* adds person table additional actions html (above and beneath it)
*/
function appendTableActionsHtml()
{
var currurl = window.location.href;
var url = currurl.replace(/infocenter\/InfoCenter(.*)/, "Messages/write");
var formHtml = '<form id="sendMsgsForm" method="post" action="'+ url +'" target="_blank"></form>';
$("#datasetActionsTop").before(formHtml);
var selectAllHtml =
'<a href="javascript:void(0)" class="selectAll">' +
'<i class="fa fa-check"></i>&nbsp;Alle</a>&nbsp;&nbsp;' +
'<a href="javascript:void(0)" class="unselectAll">' +
'<i class="fa fa-times"></i>&nbsp;Keinen</a>&nbsp;&nbsp;&nbsp;&nbsp;';
var messageHtml = 'Mit Ausgew&auml;hlten:&nbsp;&nbsp;' +
'<a href="javascript:void(0)" class="sendMsgsLink">' +
'<i class="fa fa-envelope"></i>&nbsp;Nachricht senden</a>';
var personcount = 0;
$.ajax({
url: window.location.pathname.replace('infocenter/InfoCenter', 'Filters/rowNumber'),
method: "GET"
})
.done(function(data, textStatus, jqXHR) {
if (data != null)
{
if (data.rowNumber != null)
{
personcount = data.rowNumber;
var persontext = personcount === 1 ? "Person" : "Personen";
var countHtml = personcount + " " + persontext;
$("#datasetActionsTop, #datasetActionsBottom").append(
"<div class='pull-left'>" + selectAllHtml + "&nbsp;&nbsp;" + messageHtml + "</div>"+
"<div class='pull-right'>" + countHtml + "</div>"+
"<div class='clearfix'></div>"
);
$("#datasetActionsBottom").append("<br><br>");
}
setTableActions();
}
}).fail(function(jqXHR, textStatus, errorThrown) {});
}
/**
* sets functionality for the actions above and beneath the person table
*/
function setTableActions()
{
$(".sendMsgsLink").click(function() {
var idsel = $("#filterTableDataset input:checked[name=PersonId\\[\\]]");
if(idsel.length > 0)
{
var form = $("#sendMsgsForm");
form.find("input[type=hidden]").remove();
for (var i = 0; i < idsel.length; i++)
{
var id = $(idsel[i]).val();
form.append("<input type='hidden' name='person_id[]' value='" + id + "'>");
}
form.submit();
}
});
$(".selectAll").click(function()
{
//select only trs if not filtered by tablesorter
var trs = $("#filterTableDataset tbody tr").not(".filtered");
trs.find("input[name=PersonId\\[\\]]").prop("checked", true);
}
);
$(".unselectAll").click(function()
{
var trs = $("#filterTableDataset tbody tr").not(".filtered");
trs.find("input[name=PersonId\\[\\]]").prop("checked", false);
}
);
}
/**
* Refreshes the side menu
*/
function refreshSideMenu()
{
$.ajax({
url: window.location.pathname+"/setNavigationMenuArray",
method: "GET",
data: {}
})
.done(function(data, textStatus, jqXHR) {
renderSideMenu();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
-86
View File
@@ -1,86 +0,0 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* provides helper functions for adding mottie tablesorter
* enables easier configuration of the tablesorter by providing a common default configuration
*/
/**
* adds tablesorter to specified tableid, german date format, default theme
* @param tableid
* @param sortList columns to sort by, as array of arrays (each array contains column number and 1/0 for asc/desc order)
* @param widgets optional widgets like zebra or filter
* @param minrows optional minimal amount of rows for filter row to be shown (only relevant for filter widget)
*/
function addTablesorter(tableid, sortList, widgets, minrows)
{
$("#" + tableid).tablesorter(
{
theme: "default",
dateFormat: "ddmmyyyy",
sortList: sortList,
widgets: widgets
}
);
if($("#" + tableid + " tr.tablesorter-filter-row").length)
{
//hide filters if less than n datarows (+ 2 for headings and filter row itself), default 0
var minrows = minrows || 0;
if ($("#" + tableid + " tr").length < minrows + 2)
{
$("#" + tableid + " tr.tablesorter-filter-row").hide();
}
}
}
/**
* adds pager for specified tableid. Assumes bootstap icons are available!
* @param tableid
* @param pagerid
* @param size number of rows for each page
*/
function tablesortAddPager(tableid, pagerid, size)
{
var html =
'<div id="' + pagerid + '" class="pager"> ' +
'<form class="form-inline">' +
'<i class="fa fa-step-backward first"></i>&nbsp;' +
'<i class="fa fa-backward prev"></i>' +
'<span class="pagedisplay"></span>' +
'<i class="fa fa-forward next"></i>&nbsp;' +
'<i class="fa fa-step-forward last"></i>' +
'</form>' +
'</div>';
var rowcount = $("#" + tableid + " tr").length;
//not show pager if only one table page
if (rowcount > size)
{
var table = $("#" + tableid);
table.after(html);
table.tablesorterPager(
{
container: $("#" + pagerid),
size: size,
cssDisabled: 'disabled',
savePages: false,
output: '{startRow} {endRow} / {totalRows} Zeilen'
}
);
}
}