diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php new file mode 100644 index 000000000..72773b11c --- /dev/null +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -0,0 +1,421 @@ + 'lehre/anrechnung_empfehlen:rw', + 'download' => 'lehre/anrechnung_empfehlen:rw', + 'recommend' => 'lehre/anrechnung_empfehlen:rw', + 'dontRecommend' => 'lehre/anrechnung_empfehlen:rw' + ) + ); + + // Load models + $this->load->model('education/Anrechnung_model', 'AnrechnungModel'); + $this->load->model('education/Anrechnungstatus_model', 'AnrechnungstatusModel'); + $this->load->model('content/DmsVersion_model', 'DmsVersionModel'); + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + $this->load->model('person/Notiz_model', 'NotizModel'); + $this->load->model('person/Person_model', 'PersonModel'); + + // Load libraries + $this->load->library('WidgetLib'); + $this->load->library('PermissionLib'); + $this->load->library('AnrechnungLib'); + $this->load->library('DmsLib'); + + // Load helpers + $this->load->helper('form'); + $this->load->helper('url'); + $this->load->helper('hlp_sancho_helper'); + + // Load language phrases + $this->loadPhrases( + array( + 'global', + 'ui', + 'anrechnung', + 'person', + 'lehre', + 'table' + ) + ); + + $this->_setAuthUID(); + + $this->setControllerId(); + } + + public function index() + { + $anrechnung_id = $this->input->get('anrechnung_id'); + + if (!is_numeric($anrechnung_id)) + { + show_error('Missing correct parameter'); + } + + // Get Anrechung data + if (!$anrechnungData = getData($this->anrechnunglib->getAnrechnungData($anrechnung_id))) + { + show_error('Missing data for Anrechnung.'); + } + + // Get Empfehlung data + if(!$empfehlungData = getData($this->anrechnunglib->getEmpfehlungData($anrechnung_id))) + { + show_error('Missing data for recommendation'); + } + + $viewData = array( + 'antragData' => $this->anrechnunglib->getAntragData( + $student_uid = $this->PrestudentModel->getUID($anrechnungData->prestudent_id), + $anrechnungData->studiensemester_kurzbz, + $anrechnungData->lehrveranstaltung_id + ), + 'anrechnungData' => $anrechnungData, + 'empfehlungData' => $empfehlungData + ); + + $this->load->view('lehre/anrechnung/approveAnrechnungDetail.php', $viewData); + } + + /** + * Approve Anrechnungen. + */ + public function approve() + { + $data = $this->input->post('data'); + + if(isEmptyArray($data)) + { + return $this->outputJsonError('Fehler beim Übertragen der Daten.'); + } + + // Get statusbezeichnung for 'approved' + $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig'); + $approved = getData($this->AnrechnungstatusModel->load('approved'))[0]; + $approved = getUserLanguage() == 'German' + ? $approved->bezeichnung_mehrsprachig[0] + : $approved->bezeichnung_mehrsprachig[1]; + + foreach ($data as $item) + { + // Approve Anrechnung + if(getData($this->anrechnunglib->approveAnrechnung($item['anrechnung_id']))) + { + $json[]= array( + 'anrechnung_id' => $item['anrechnung_id'], + 'status_kurzbz' => self::ANRECHNUNGSTATUS_APPROVED, + 'status_bezeichnung' => $approved + ); + + if(!$this->_sendSanchoMailToStudent($item['anrechnung_id'], self::ANRECHNUNGSTATUS_APPROVED)) + { + show_error('Failed sending mail'); + } + } + } + + // Output json to ajax + if (isset($json) && !isEmptyArray($json)) + { + return $this->outputJsonSuccess($json); + } + else + { + return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.'); + } + } + + /** + * Reject Anrechnungen. + */ + public function reject() + { + $data = $this->input->post('data'); + + if(isEmptyArray($data)) + { + return $this->outputJsonError('Fehler beim Übertragen der Daten.'); + } + + // Get statusbezeichnung for 'rejected' + $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig'); + $rejected = getData($this->AnrechnungstatusModel->load('rejected'))[0]; + $rejected = getUserLanguage() == 'German' + ? $rejected->bezeichnung_mehrsprachig[0] + : $rejected->bezeichnung_mehrsprachig[1]; + + foreach ($data as $item) + { + // Reject Anrechnung + if(getData($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung']))) + { + $json[]= array( + 'anrechnung_id' => $item['anrechnung_id'], + 'status_kurzbz' => self::ANRECHNUNGSTATUS_REJECTED, + 'status_bezeichnung' => $rejected + ); + + if(!$this->_sendSanchoMailToStudent($item['anrechnung_id'], self::ANRECHNUNGSTATUS_REJECTED)) + { + show_error('Failed sending mail'); + } + } + } + + // Output json to ajax + if (isset($json) && !isEmptyArray($json)) + { + return $this->outputJsonSuccess($json); + } + else + { + return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.'); + } + } + + /** + * Request recommendation for Anrechnungen. + */ + public function requestRecommendation() + { + $data = $this->input->post('data'); + + if(isEmptyArray($data)) + { + return $this->outputJsonError('Fehler beim Übertragen der Daten.'); + } + + // Get statusbezeichnung for 'inProgressLektor' + $this->AnrechnungstatusModel->addSelect('bezeichnung_mehrsprachig'); + $inProgressLektor = getData($this->AnrechnungstatusModel->load('inProgressLektor'))[0]; + $inProgressLektor = getUserLanguage() == 'German' + ? $inProgressLektor->bezeichnung_mehrsprachig[0] + : $inProgressLektor->bezeichnung_mehrsprachig[1]; + + foreach ($data as $item) + { + // Approve Anrechnung + if(getData($this->anrechnunglib->requestRecommendation($item['anrechnung_id']))) + { + $json[]= array( + 'anrechnung_id' => $item['anrechnung_id'], + 'status_kurzbz' => self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR, + 'status_bezeichnung' => $inProgressLektor, + 'empfehlung_anrechnung' => null + ); + } + } + + // Output json to ajax + if (isset($json) && !isEmptyArray($json)) + { + /** + * Send mails to lectors + * NOTE: mails are sent at the end to ensure sending only ONE mail to each LV-Leitung or lector + * even if they are required for more recommendations + * */ + if (!$this->_sendSanchoMailToLectors($json)) + { + show_error('Failed sending emails'); + } + + return $this->outputJsonSuccess($json); + } + else + { + return $this->outputJsonError('Es wurden keine Empfehlungen angefordert'); + } + } + + /** + * Download and open uploaded document (Nachweisdokument). + */ + public function download() + { + $dms_id = $this->input->get('dms_id'); + + if (!is_numeric($dms_id)) + { + show_error('Wrong parameter'); + } + + $this->dmslib->download($dms_id); + } + + /** + * Retrieve the UID of the logged user and checks if it is valid + */ + private function _setAuthUID() + { + $this->_uid = getAuthUID(); + + if (!$this->_uid) show_error('User authentification failed'); + } + + /** + * Send mail to student to inform if Anrechnung was approved or rejected + * @param $mail_params + */ + private function _sendSanchoMailToStudent($anrechnung_id, $status_kurzbz) + { + $result = getData($this->anrechnunglib->getStudentData($anrechnung_id))[0]; + + // Get student name and mail address + $to = $result->uid. '@'. DOMAIN; + + $anrede = $result->geschlecht == 'w' ? 'Sehr geehrte Frau ' : 'Sehr geehrter Herr '; + // Prepare mail content + $body_fields = array( + 'anrede_name' => $anrede. $result->vorname. ' '. $result->nachname, + 'lehrveranstaltung_bezeichnung' => $result->lv_bezeichnung, + 'stattgegeben_nichtstattgegeben' => $status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED + ? 'stattgegeben' + : 'nicht stattgegeben' + ); + + sendSanchoMail( + 'AnrechnungGenehmigen', + $body_fields, + $to, + 'Ihr Antrag auf Anerkennung nachgewiesener Kenntnisse wurde abgeschlossen' + ); + + return true; + } + + /** + * Send mail to lectors asking for recommendation. (first to LV-Leitung, if not present to all lectors of lv) + * @param $mail_params + * @return bool + */ + private function _sendSanchoMailToLectors($mail_params) + { + // Get Lehrveranstaltungen + $anrechnung_arr = array(); + + foreach ($mail_params as $item) + { + $this->AnrechnungModel->addSelect('lehrveranstaltung_id, studiensemester_kurzbz'); + $anrechnung_arr[]= array( + 'lehrveranstaltung_id' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->lehrveranstaltung_id, + 'studiensemester_kurzbz' => $this->AnrechnungModel->load($item['anrechnung_id'])->retval[0]->studiensemester_kurzbz + ); + } + + $anrechnung_arr = array_unique($anrechnung_arr, SORT_REGULAR); + + + /** + * Get lectors (prio for LV-Leitung, if not present to all lectors of LV. + * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector. + * **/ + $lector_arr = $this->_getLectors($anrechnung_arr); + + // Send mail to lectors + foreach ($lector_arr as $lector) + { + $to = $lector->uid; + $vorname = $lector->vorname; + + // Get full name of stgl + $this->load->model('person/Person_model', 'PersonModel'); + if (!$stgl_name = getData($this->PersonModel->getFullName($this->_uid))) + { + show_error ('Failed retrieving person'); + } + + // Link to Antrag genehmigen + $url = + CIS_ROOT. 'cis/index.php?menu='. + CIS_ROOT. 'cis/menu.php?content_id=&content='. + CIS_ROOT. index_page(). self::REVIEW_ANRECHNUNG_URI; + + // Prepare mail content + $body_fields = array( + 'vorname' => $vorname, + 'stgl_name' => $stgl_name, + 'link' => anchor($url, 'Anrechnungsanträge Übersicht') + ); + + sendSanchoMail( + 'AnrechnungEmpfehlungAnfordern', + $body_fields, + $to, + 'Neue LV-Anrechnungsanträge benötigen Deine Empfehlung' + ); + } + return true; + } + + /** + * Get lectors (prio for LV-Leitung, if not present to all lectors of LV. + * Anyway this function will receive a unique array to avoid sending more mails to one and the same lector. + * @param $anrechnung_arr + * @return array + */ + private function _getLectors($anrechnung_arr) + { + $lector_arr = array(); + + // Get lectors + foreach($anrechnung_arr as $anrechnung) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + $result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']); + + if (!$result = getData($result)) + { + show_error('Failed retrieving lectors of Lehrveranstaltung'); + } + + // Check if lv has LV-Leitung + $key = array_search(true, array_column($result, 'lvleiter')); + + // If lv has LV-Leitung, keep only the one + if ($key !== false) + { + $lector_arr[]= $result[$key]; + } + // ...otherwise keep all lectors + else + { + $lector_arr = array_merge($lector_arr, $result); + } + } + + /** + * NOTE: This step is only done to make the array unique by uid, vorname and nachname in the following step + * (e.g. if same lector is ones LV-Leitung and another time not, then array_unique would leave both. + * But we wish to send only one email by to that one person) + * **/ + foreach ($lector_arr as $lector) + { + unset($lector->lvleiter); + } + + // Now make the lector array aka mail receivers unique + $lector_arr = array_unique($lector_arr, SORT_REGULAR); + + return $lector_arr; + + } + +} \ No newline at end of file diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index dd8b796c7..c2f7d5f4a 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -201,6 +201,7 @@ class AnrechnungLib $empfehlung_data->empfehlung = null; $empfehlung_data->empfehlung_von = '-'; $empfehlung_data->empfehlung_am = '-'; + $empfehlung_data->empfehlung_angefordert_am = '-'; $empfehlung_data->notiz = ''; // Begruendung, if not recommended @@ -209,6 +210,16 @@ class AnrechnungLib show_error('Failed loading Anrechnung'); } + // Get date, where recommendation was last requested + $result = $this->ci->AnrechnungModel->getLastAnrechnungstatus( + $anrechnung_id, + self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR // when STLG asks for recommendation, status is set to in progress lektor + ); + if ($result = getData($result)[0]) + { + $empfehlung_data->empfehlung_angefordert_am = (new DateTime($result->insertamum))->format('d.m.Y'); + } + if (is_null($anrechnung->empfehlung_anrechnung)) { return success($empfehlung_data); diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php new file mode 100644 index 000000000..4469efc7f --- /dev/null +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -0,0 +1,204 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => $this->p->t('anrechnung', 'anrechnungenGenehmigen'), + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'ajaxlib' => true, + 'dialoglib' => true, + 'phrases' => array( + 'global' => array( + 'anerkennungNachgewiesenerKenntnisse', + 'antragStellen' + ), + 'ui' => array( + 'hilfeZuDieserSeite', + 'hochladen' + ), + 'person' => array( + 'student', + 'personenkennzeichen' + ), + 'lehre' => array( + 'studiensemester', + 'studiengang', + 'lehrveranstaltung', + 'ects', + 'lektor', + ) + ), + 'customCSSs' => array( + 'public/css/Tabulator.css' + ), + 'customJSs' => array( + 'public/js/bootstrapper.js', + 'public/js/lehre/anrechnung/approveAnrechnungDetail.js' + + ) + ) +); +?> + + +
+
+ +
+ +
+ +
+
+
+
+ + +
+
+
+
+ p->t('anrechnung', 'antrag'); ?> + p->t('anrechnung', 'antragdatum'); ?>: anrechnung_id) ? $anrechnungData->insertamum : '-' ?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
p->t('person', 'student'); ?>vorname . ' ' . $antragData->nachname; ?>
p->t('person', 'personenkennzeichen'); ?>matrikelnr ?>
p->t('lehre', 'studiensemester'); ?>studiensemester_kurzbz ?>
p->t('lehre', 'studiengang'); ?>stg_bezeichnung ?>
p->t('lehre', 'lehrveranstaltung'); ?>lv_bezeichnung ?>
p->t('lehre', 'ects'); ?>ects ?>
p->t('lehre', 'lektorInnen'); ?> + lektoren) - 1 ?> + lektoren as $key => $lektor): ?> + vorname . ' ' . $lektor->nachname; + echo $key === $len ? '' : ', ' ?> + +
p->t('anrechnung', 'herkunftDerKenntnisse'); ?>anmerkung ?>
p->t('anrechnung', 'nachweisdokumente'); ?> + dokumentname ?> +
+
+
+
+ +
+
+
+ +
+ +
+ p->t('anrechnung', 'empfehlung'); ?> +
+ p->t('anrechnung', 'empfehlungVon'); ?>: + empfehlung_von ?> +  |  + p->t('anrechnung', 'empfehlungdatum'); ?>: + empfehlung_am ?> +
+
+ +
+ +
+ p->t('anrechnung', 'keineEmpfehlungAngefordert'); ?> +
+ +
+ p->t('anrechnung', 'empfehlungAngefordertNochKeineEmpfehlung'); ?> + empfehlung_angefordert_am ?>. +
+ +
+ p->t('anrechnung', 'empfehlungPositiv'); ?> +
+ +
+
p->t('anrechnung', 'empfehlungNegativ'); ?>
+
p->t('global', 'begruendung'); ?>: + notiz ?> +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ Status: + + status; ?> + +
+
+ load->view('lehre/anrechnung/reviewAnrechnungInfo'); ?> +
+
+ +
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/lehre/anrechnung/reviewAnrechnungDetail.php b/application/views/lehre/anrechnung/reviewAnrechnungDetail.php index 7b8d29d4c..497fbe635 100644 --- a/application/views/lehre/anrechnung/reviewAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/reviewAnrechnungDetail.php @@ -121,7 +121,7 @@ $this->load->view( - +
diff --git a/public/js/lehre/anrechnung/approveAnrechnungDetail.js b/public/js/lehre/anrechnung/approveAnrechnungDetail.js new file mode 100644 index 000000000..b9b7de9fb --- /dev/null +++ b/public/js/lehre/anrechnung/approveAnrechnungDetail.js @@ -0,0 +1,301 @@ +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'; + + + +$(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; + } + + // Set status alert color + approveAnrechnungDetail.setStatusAlertColor(); + + // Approve Anrechnungen + $("#approve-anrechnungen").click(function(){ + let genehmigung_panel = $('#approveAnrechnungUebersicht-empfehlung-panel'); + let begruendung_panel = $('#approveAnrechnungUebersicht-begruendung-panel'); + + begruendung_panel.css('display', 'none'); + + if (genehmigung_panel.is(":hidden")) + { + // Show begruendung panel if is hidden + genehmigung_panel.slideDown('slow'); + return; + } + + // 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('Bitte wählen Sie erst zumindest einen Antrag auf Anrechnung'); + 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 (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(data.retval.length + " Anrechnungsanträge wurden genehmigt."); + } + }, + errorCallback: function (jqXHR, textStatus, errorThrown) + { + FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator."); + } + } + ); + }); + + // Reject Anrechnungen + $("#reject-anrechnungen").click(function(){ + let begruendung_panel = $('#approveAnrechnungUebersicht-begruendung-panel'); + let begruendung = $('#approveAnrechnungUebersicht-begruendung').val(); + let genehmigung_panel = $('#approveAnrechnungUebersicht-empfehlung-panel'); + + genehmigung_panel.css('display', 'none'); + + if (begruendung_panel.is(":hidden")) + { + // Show begruendung panel if is hidden + begruendung_panel.slideDown('slow'); + return; + } + else + { + // Check if begruendung is given + if (!begruendung.trim()) // empty or white spaces only + { + FHC_DialogLib.alertInfo('Bitte tragen Sie eine Begründung ein.'); + 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('Bitte wählen Sie erst zumindest einen Antrag auf Anrechnung'); + return; + } + + // Confirm before rejecting + if(!confirm('Wollen Sie wirklich die gewählten Anträge ablehnen?')) + { + 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 (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(data.retval.length + " Anrechnungsanträge wurden abgelehnt."); + } + }, + errorCallback: function (jqXHR, textStatus, errorThrown) + { + FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator."); + } + } + ); + }); + + // Request Recommendation for Anrechnungen + $("#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; + } + } + + selected_data.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('Bitte wählen Sie erst zumindest einen Antrag auf Anrechnung'); + return; + } + + // Prepare data object for ajax call + let data = { + 'data': selected_data + }; + + FHC_AjaxClient.ajaxCallPost( + FHC_JS_DATA_STORAGE_OBJECT.called_path + "/requestRecommendation", + 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 'genehmigt' + $('#tableWidgetTabulator').tabulator('updateData', data.retval); + + // Print success message + FHC_DialogLib.alertSuccess("Empfehlungen wurden angefordert."); + } + }, + errorCallback: function (jqXHR, textStatus, errorThrown) + { + FHC_DialogLib.alertError("Systemfehler
Bitte kontaktieren Sie Ihren Administrator."); + } + } + ); + }); + + // Copy Begruendung into textarea + $(".btn-copyIntoTextarea").click(function(){ + approveAnrechnungDetail.copyIntoTextarea(this); + }) + + // Break Empfehlung abgeben + $('#approveAnrechnungDetail-empfehlung-abbrechen').click(function(){ + $('#approveAnrechnungDetail-empfehlung-panel').slideUp('slow'); + + }) + + // Break Begruendung abgeben + $('#approveAnrechnungDetail-begruendung-abbrechen').click(function(){ + $('#approveAnrechnungDetail-begruendung').val(''); + $('#approveAnrechnungDetail-begruendung-panel').slideUp('slow'); + + }) + + +}); + +var approveAnrechnungDetail = { + setStatusAlertColor: function () { + let status_kurzbz = $('#approveAnrechnung-status_kurzbz').data('status_kurzbz'); + + switch (status_kurzbz) { + case ANRECHNUNGSTATUS_APPROVED: + $('#approveAnrechnung-status_kurzbz').closest('div').addClass('alert-success'); + break; + case ANRECHNUNGSTATUS_REJECTED: + $('#approveAnrechnung-status_kurzbz').closest('div').addClass('alert-danger'); + break; + case '': + $('#approveAnrechnung-status_kurzbz').closest('div').addClass('alert-info'); + break; + default: + $('#approveAnrechnung-status_kurzbz').closest('div').addClass('alert-warning'); + } + }, + copyIntoTextarea: function(elem){ + + // Find closest textarea + let textarea = $(elem).closest('div').find('textarea'); + + // Copy begruendung into textarea + textarea.val($.trim($(elem).parent().text())); + }, + formatEmpfehlungIsTrue: function(empfehlungAm, emfehlungVon){ + $('#approveAnrechnungDetail-empfehlungDetail').children().addClass('hidden'); + $('#approveAnrechnungDetail-empfehlungDetail-empfehlungIsTrue').removeClass('hidden'); + $('#recommend-anrechnung').prop('disabled', true); + $('#dont-recommend-anrechnung').prop('disabled', true); + $('#approveAnrechnungDetail-empfehlungAm').text(empfehlungAm); + $('#approveAnrechnungDetail-empfehlungVon').text(emfehlungVon); + }, + formatEmpfehlungIsFalse: function(empfehlungAm, emfehlungVon, begruendung){ + $('#approveAnrechnungDetail-empfehlungDetail').children().addClass('hidden'); + $('#approveAnrechnungDetail-empfehlungDetail-empfehlungIsFalse').removeClass('hidden'); + $('#recommend-anrechnung').prop('disabled', true); + $('#dont-recommend-anrechnung').prop('disabled', true); + $('#approveAnrechnungDetail-empfehlungAm').text(empfehlungAm); + $('#approveAnrechnungDetail-empfehlungVon').text(emfehlungVon); + $('#approveAnrechnungDetail-empfehlungDetail-begruendung').text(begruendung); + } +} \ No newline at end of file diff --git a/public/js/lehre/anrechnung/reviewAnrechnungDetail.js b/public/js/lehre/anrechnung/reviewAnrechnungDetail.js index 22d22f26c..b753d3f64 100644 --- a/public/js/lehre/anrechnung/reviewAnrechnungDetail.js +++ b/public/js/lehre/anrechnung/reviewAnrechnungDetail.js @@ -21,13 +21,6 @@ $(function(){ // Set status alert color reviewAnrechnung.setStatusAlertColor(); - // Break Begruendung abgeben - $('#reviewAnrechnungUebersicht-begruendung-abbrechen').click(function(){ - $('#reviewAnrechnungUebersicht-begruendung').val(''); - $('#reviewAnrechnungUebersicht-begruendung-panel').slideUp('slow'); - - }) - // Copy Begruendung into textarea $(".btn-copyIntoTextarea").click(function(){ reviewAnrechnung.copyIntoTextarea(this); diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index febf31dfd..34680ad95 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -9188,6 +9188,46 @@ Any unusual occurrences 'insertvon' => 'system' ) ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'keineEmpfehlungAngefordert', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Es wurde noch keine Empfehlung angefordert.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'You have not requested a recommendation yet.', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'anrechnung', + 'phrase' => 'empfehlungAngefordertNochKeineEmpfehlung', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Empfehlung wurde angefordert am ', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Recommendation was requested on ', + 'description' => '', + 'insertvon' => 'system' + ) + ) ) );