diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index d5c7c358b..4cd6a0e07 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -156,12 +156,12 @@ class InfoCenter extends VileSci_Controller /** * Saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not. + * @param $person_id */ - public function saveFormalGeprueft() + public function saveFormalGeprueft($person_id) { - $akte_id = $this->input->get('akte_id'); - $formalgeprueft = $this->input->get('formal_geprueft'); - $person_id = $this->input->get('person_id'); + $akte_id = $this->input->post('akte_id'); + $formalgeprueft = $this->input->post('formal_geprueft'); if (!isset($akte_id) || !isset($formalgeprueft) || !isset($person_id)) show_error('Parameters not set!'); @@ -191,7 +191,9 @@ class InfoCenter extends VileSci_Controller ) ); - redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'#DokPruef'); + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($timestamp)); } /** @@ -260,7 +262,9 @@ class InfoCenter extends VileSci_Controller $this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id)); - $this->_redirectToStart($prestudent_id, 'ZgvPruef'); + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($result->retval)); } /** @@ -385,7 +389,35 @@ class InfoCenter extends VileSci_Controller $this->_log($person_id, 'savenotiz', array($titel)); - redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'#NotizAkt'); + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($result->retval)); + } + + /** + * Loads Notizen view for a person, helper for reloading after ajax request + * @param $person_id + */ + public function reloadNotizen($person_id) + { + $notizen = $this->NotizModel->getNotiz($person_id); + + if (isError($notizen)) + { + show_error($notizen->retval); + } + + $this->load->view('system/infocenter/notizen.php', array('notizen' => $notizen->retval)); + } + + /** + * Loads Logs view for a person, helper for reloading after ajax request + * @param $person_id + */ + public function reloadLogs($person_id) + { + $logs = $this->personloglib->getLogs($person_id); + $this->load->view('system/infocenter/logs.php', array('logs' => $logs)); } /** @@ -675,7 +707,7 @@ class InfoCenter extends VileSci_Controller // Interessenten come first, otherwise by bewerbungsdatum desc, then by prestudent_id desc usort($zgvpruefungen, function ($a, $b) { - $bewdatesort = strcmp($b->prestudentstatus->bewerbung_abgeschicktamum, $a->prestudentstatus->bewerbung_abgeschicktamum); + $bewdatesort = isset($a->prestudentstatus) && isset($b->prestudentstatus) ? strcmp($b->prestudentstatus->bewerbung_abgeschicktamum, $a->prestudentstatus->bewerbung_abgeschicktamum) : 0; $defaultsort = $bewdatesort === 0 ? (int)$b->prestudent_id - (int)$a->prestudent_id : $bewdatesort; if (!isset($a->prestudentstatus->status_kurzbz) || !isset($b->prestudentstatus->status_kurzbz)) return $defaultsort; diff --git a/application/views/system/infocenter/addNotiz.php b/application/views/system/infocenter/addNotiz.php index 25af11897..8c5574344 100644 --- a/application/views/system/infocenter/addNotiz.php +++ b/application/views/system/infocenter/addNotiz.php @@ -1,4 +1,4 @@ -
+
diff --git a/application/views/system/infocenter/dokpruefung.php b/application/views/system/infocenter/dokpruefung.php index 1c303e3c2..8261a2ebd 100644 --- a/application/views/system/infocenter/dokpruefung.php +++ b/application/views/system/infocenter/dokpruefung.php @@ -22,9 +22,11 @@ erstelltam), 'd.m.Y') ?> langtext ?> - /> + > + formal_geprueft_amum) ? date_format(date_create($dokument->formal_geprueft_amum), 'd.m.Y') : ''; ?> + diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index da6abaf78..299138e5c 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -129,10 +129,14 @@
+
load->view('system/infocenter/addNotiz.php'); ?> +
+
load->view('system/infocenter/notizen.php'); ?> +
-
+
load->view('system/infocenter/logs.php'); ?>
@@ -144,26 +148,6 @@
- - load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index 2c2aeb79d..ef0102a50 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -27,7 +27,8 @@ class="panel-collapse collapse">
+ action="#" class="zgvform"> +
@@ -193,7 +194,7 @@
-
diff --git a/include/js/bootstrapper.js b/include/js/bootstrapper.js index 47cd6d609..8697e17ad 100644 --- a/include/js/bootstrapper.js +++ b/include/js/bootstrapper.js @@ -7,6 +7,6 @@ $(document).ready( { $("input[type=text], select").addClass("form-control"); $("button, input[type=button]").addClass("btn btn-default"); - $("table").addClass('table-condensed'); + $("table").addClass("table-condensed"); } ); diff --git a/include/js/infocenter/infocenterDetails.js b/include/js/infocenter/infocenterDetails.js index e460f04e8..47812323d 100644 --- a/include/js/infocenter/infocenterDetails.js +++ b/include/js/infocenter/infocenterDetails.js @@ -23,12 +23,10 @@ $(document).ready( addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]); addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]); addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"], 2); - addTablesorter("logtable", [[0, 1]], ["filter"], 2); - addTablesorter("notiztable", [[0, 1]], ["filter"], 2); + tablesortAddPager("msgtable", "msgpager", 10); - //add pager - tablesortAddPager("logtable", "logpager", 23); - tablesortAddPager("notiztable", "notizpager", 10); + formatNotizTable(); + formatLogTable(); //initialise datepicker $.datepicker.setDefaults($.datepicker.regional['de']); @@ -36,16 +34,6 @@ $(document).ready( "dateFormat": "dd.mm.yy" }); - //add click events to "formal geprüft" checkboxes -/* $(".prchbox input[type=checkbox]").click( - function() - { - var akteid = this.; - var personid = ; - window.location = "../saveFormalGeprueft?akte_id="+akteid+"&formal_geprueft=" + this.checked + "&person_id="+personid; - } - );*/ - //add submit event to message send link $("#sendmsglink").click( function () @@ -54,14 +42,43 @@ $(document).ready( } ); + //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(); + var statusgrvalue = $("#statusgrselect_" + id + " select[name=statusgrund]").val(); if (statusgrvalue === "null") { - $("#statusgrselect_"+id).addClass("has-error"); + $("#statusgrselect_" + id).addClass("has-error"); return e.preventDefault(); } } @@ -75,47 +92,172 @@ $(document).ready( } ); - //zgv uebernehmen ajax - if ($(".zgvUebernehmen")) - { - $(".zgvUebernehmen").click(function() { - var btn = $(this); + //save notiz + $("#notizform").on("submit", function (e) + { + e.preventDefault(); var personid = $("#hiddenpersonid").val(); - var prestudentid = this.id.substr(this.id.indexOf("_") + 1); - $('#nearzgv').remove(); + var data = $(this).serializeArray(); + saveNotiz(personid, data); + } + ) + }); - $.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("  keine ZGV vorhanden"); - } - }, - error: function(jqXHR, textStatus, errorThrown) { - alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText); - } - }); - }); +// ----------------------------------------------------------------------------------------------------------------- +// 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("  keine ZGV vorhanden"); + } + }, + 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("ZGV erfolgreich gespeichert!  "); + } + else + { + $("#zgvSpeichern_" + prestudentid).before("Fehler beim Speichern der ZGV!  "); + } + }, + 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); + } + }); +} + +// ----------------------------------------------------------------------------------------------------------------- +// 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"); +}