From 2d8766384176f6b736607cc95e2b66924b39961d Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 22 Apr 2025 13:35:31 +0200 Subject: [PATCH 1/4] basic structure for Tab Admission Dates --- .../api/frontend/v1/stv/Aufnahmetermine.php | 506 ++++++++++++++++++ .../api/frontend/v1/stv/Config.php | 5 + public/js/api/factory/stv.js | 4 +- public/js/api/factory/stv/admissionDates.js | 25 + public/js/api/stv/admissionDates.js | 0 .../Details/Aufnahmetermine.js | 26 + .../Aufnahmetermine/Aufnahmetermine.js | 58 ++ .../Aufnahmetermine/HeaderReihungstest.js | 14 + system/phrasesupdate.php | 25 +- 9 files changed, 661 insertions(+), 2 deletions(-) create mode 100644 application/controllers/api/frontend/v1/stv/Aufnahmetermine.php create mode 100644 public/js/api/factory/stv/admissionDates.js create mode 100644 public/js/api/stv/admissionDates.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/HeaderReihungstest.js diff --git a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php new file mode 100644 index 000000000..519e8125d --- /dev/null +++ b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php @@ -0,0 +1,506 @@ + ['admin:r', 'assistenz:r'], + 'loadAufnahmetermin' => ['admin:r', 'assistenz:r'], + 'insertAufnahmetermin' => ['admin:rw', 'assistenz:rw'], + 'updateAufnahmetermin' => ['admin:rw', 'assistenz:rw'], + 'deleteAufnahmetermin' => ['admin:rw', 'assistenz:rw'], + ]); + + // Load Libraries + $this->load->library('VariableLib', ['uid' => getAuthUID()]); + $this->load->library('form_validation'); + + // Load language phrases + $this->loadPhrases([ + 'ui', + 'mobility' + ]); + + // Load models + $this->load->model('codex/Bisio_model', 'BisioModel'); + } + + public function getAufnahmetermine($student_uid) + { + $this->BisioModel->addSelect("*"); + $this->BisioModel->addJoin('bis.tbl_mobilitaetsprogramm mp', 'ON (mp.mobilitaetsprogramm_code = bis.tbl_bisio.mobilitaetsprogramm_code)', 'LEFT'); + $this->BisioModel->addJoin('lehre.tbl_lehreinheit le', 'ON (le.lehreinheit_id = bis.tbl_bisio.lehreinheit_id)','LEFT'); + $this->BisioModel->addOrder('von', 'DESC'); + $this->BisioModel->addOrder('bis', 'DESC'); + $this->BisioModel->addOrder('aufnahmetermin_id', 'DESC'); + $result = $this->BisioModel->loadWhere( + array('student_uid' => $student_uid) + ); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function insertAufnahmetermin() + { + $this->load->library('form_validation'); + $authUID = getAuthUID(); + + $student_uid = $this->input->post('uid'); + + if(!$student_uid) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL); + } + + $formData = $this->input->post('formData'); + + $_POST['von'] = (isset($formData['von']) && !empty($formData['von'])) ? $formData['von'] : null; + $_POST['bis'] = (isset($formData['bis']) && !empty($formData['bis'])) ? $formData['bis'] : null; + $_POST['nation_code'] = (isset($formData['nation_code']) && !empty($formData['nation_code'])) ? $formData['nation_code'] : 'A'; + $_POST['mobilitaetsprogramm_code'] = (isset($formData['mobilitaetsprogramm_code']) && !empty($formData['mobilitaetsprogramm_code'])) ? $formData['mobilitaetsprogramm_code'] : null; + $_POST['herkunftsland_code'] = (isset($formData['herkunftsland_code']) && !empty($formData['herkunftsland_code'])) ? $formData['herkunftsland_code'] : 'A'; + $_POST['ects_erworben'] = (isset($formData['ects_erworben']) && !empty($formData['ects_erworben'])) ? $formData['ects_erworben'] : null; + $_POST['ects_angerechnet'] = (isset($formData['ects_angerechnet']) && !empty($formData['ects_angerechnet'])) ? $formData['ects_angerechnet'] : null; + $_POST['lehreinheit_id'] = (isset($formData['lehreinheit_id']) && !empty($formData['lehreinheit_id'])) ? $formData['lehreinheit_id'] : null; + + $this->form_validation->set_rules('nation_code', 'Nation_code', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Nation_code']) + ]); + $this->form_validation->set_rules('herkunftsland_code', 'Herkunftsland_code', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Herkunftsland_code']) + ]); + $this->form_validation->set_rules('mobilitaetsprogramm_code', 'Mobilitaetsprogramm_code', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Mobilitaetsprogramm_code']) + ]); + $this->form_validation->set_rules('von', 'VonDatum', 'is_valid_date', [ + 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum']) + ]); + + $this->form_validation->set_rules('bis', 'VBisDatum', 'is_valid_date', [ + 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VBisDatum']) + ]); + + $this->form_validation->set_rules('ects_erworben', 'Ects_erworben', 'numeric', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_erworben']) + ]); + + $this->form_validation->set_rules('ects_angerechnet', 'Ects_angerechnet', 'numeric', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_angerechnet']) + ]); + + $this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'numeric', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Lehreinheit']) + ]); + + if ($this->form_validation->run() == false) + { + $this->terminateWithValidationErrors($this->form_validation->error_array()); + } + + $ort = (isset($formData['ort']) && !empty($formData['ort'])) ? $formData['ort'] : null; + $universitaet = (isset($formData['universitaet']) && !empty($formData['universitaet'])) ? $formData['universitaet'] : null; + $localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPurposes'])) ? $formData['localPurposes'] : null; + $localSupports = (isset($formData['localSupports']) && !empty($formData['localSupports'])) ? $formData['localSupports'] : null; + + $result = $this->BisioModel->insert([ + 'student_uid' => $student_uid, + 'von' => $_POST['von'], + 'bis' => $_POST['bis'], + 'mobilitaetsprogramm_code' => $_POST['mobilitaetsprogramm_code'], + 'nation_code' => $_POST['nation_code'], + 'herkunftsland_code' => $_POST['herkunftsland_code'], + 'lehreinheit_id' => $_POST['lehreinheit_id'], + 'ort' => $ort, + 'universitaet' => $universitaet, + 'ects_erworben' => $_POST['ects_erworben'] , + 'ects_angerechnet' => $_POST['ects_angerechnet'], + 'insertamum' => date('c'), + 'insertvon' => $authUID, + ]); + + $aufnahmetermin_id = $this->getDataOrTerminateWithError($result); + + //check if localData (purposes) + if(count($localPurposes) > 0){ + foreach ($localPurposes as $zweck){ + $zweck = (int)$zweck; + $this->addAufnahmeterminPurpose($aufnahmetermin_id, $zweck); + } + } + + //check if localData (supports) + if(count($localSupports) > 0){ + foreach ($localSupports as $support){ + $this->addAufnahmeterminSupport($aufnahmetermin_id, $support); + } + } + + $this->terminateWithSuccess($aufnahmetermin_id); + } + + public function loadAufnahmetermin($aufnahmetermin_id) + { + $this->BisioModel->addSelect("*"); + $this->BisioModel->addJoin('bis.tbl_mobilitaetsprogramm mp', 'ON (mp.mobilitaetsprogramm_code = bis.tbl_bisio.mobilitaetsprogramm_code)', 'LEFT'); + $this->BisioModel->addJoin('lehre.tbl_lehreinheit le', 'ON (le.lehreinheit_id = bis.tbl_bisio.lehreinheit_id)','LEFT'); + $result = $this->BisioModel->loadWhere( + array('aufnahmetermin_id' => $aufnahmetermin_id) + ); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(current($data)); + } + + public function updateAufnahmetermin() + { + + $this->load->library('form_validation'); + $authUID = getAuthUID(); + + $student_uid = $this->input->post('uid'); + + if(!$student_uid) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL); + } + $formData = $this->input->post('formData'); + + $_POST['von'] = (isset($formData['von']) && !empty($formData['von'])) ? $formData['von'] : null; + $_POST['bis'] = (isset($formData['bis']) && !empty($formData['bis'])) ? $formData['bis'] : null; + $_POST['nation_code'] = (isset($formData['nation_code']) && !empty($formData['nation_code'])) ? $formData['nation_code'] : 'A'; + $_POST['mobilitaetsprogramm_code'] = (isset($formData['mobilitaetsprogramm_code']) && !empty($formData['mobilitaetsprogramm_code'])) ? $formData['mobilitaetsprogramm_code'] : null; + $_POST['herkunftsland_code'] = (isset($formData['herkunftsland_code']) && !empty($formData['herkunftsland_code'])) ? $formData['herkunftsland_code'] : 'A'; + $_POST['ects_erworben'] = (isset($formData['ects_erworben']) && !empty($formData['ects_erworben'])) ? $formData['ects_erworben'] : null; + $_POST['ects_angerechnet'] = (isset($formData['ects_angerechnet']) && !empty($formData['ects_angerechnet'])) ? $formData['ects_angerechnet'] : null; + $_POST['lehreinheit_id'] = (isset($formData['lehreinheit_id']) && !empty($formData['lehreinheit_id'])) ? $formData['lehreinheit_id'] : null; + + $this->form_validation->set_rules('nation_code', 'Nation_code', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Nation_code']) + ]); + $this->form_validation->set_rules('herkunftsland_code', 'Herkunftsland_code', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Herkunftsland_code']) + ]); + $this->form_validation->set_rules('mobilitaetsprogramm_code', 'Mobilitaetsprogramm_code', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Mobilitaetsprogramm_code']) + ]); + $this->form_validation->set_rules('von', 'VonDatum', 'is_valid_date', [ + 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum']) + ]); + + $this->form_validation->set_rules('bis', 'VBisDatum', 'is_valid_date', [ + 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VBisDatum']) + ]); + + $this->form_validation->set_rules('ects_erworben', 'Ects_erworben', 'numeric', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_erworben']) + ]); + + $this->form_validation->set_rules('ects_angerechnet', 'Ects_angerechnet', 'numeric', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_angerechnet']) + ]); + + $this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'numeric', [ + 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Lehreinheit']) + ]); + + if ($this->form_validation->run() == false) + { + $this->terminateWithValidationErrors($this->form_validation->error_array()); + } + + $result = $this->BisioModel->update( + [ + 'aufnahmetermin_id' => $formData['aufnahmetermin_id'] + ], + [ + 'student_uid' => $student_uid, + 'von' => $_POST['von'], + 'bis' => $_POST['bis'], + 'mobilitaetsprogramm_code' => $_POST['mobilitaetsprogramm_code'], + 'nation_code' => $_POST['nation_code'], + 'herkunftsland_code' => $_POST['herkunftsland_code'], + 'lehreinheit_id' => $_POST['lehreinheit_id'], + 'ort' => $formData['ort'], + 'universitaet' => $formData['universitaet'], + 'ects_erworben' => $_POST['ects_erworben'] , + 'ects_angerechnet' => $_POST['ects_angerechnet'], + 'updateamum' => date('c'), + 'updatevon' => $authUID, + ] + ); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(current($data)); + } + + public function deleteAufnahmetermin($aufnahmetermin_id) + { + //check if extension table exists + $result = $this->BisioModel->tableExists('extension', 'tbl_mo_bisioidzuordnung'); + $data = $this->getDataOrTerminateWithError($result); + + //if table exists check if existing entry + if(!empty($data)) + { + $this->BisioModel->addSelect("count(*)"); + $this->BisioModel->addJoin('extension.tbl_mo_bisioidzuordnung mo', 'ON (mo.aufnahmetermin_id = bis.tbl_bisio.aufnahmetermin_id)', 'LEFT'); + + $resultCheckMo = $this->BisioModel->loadWhere( + array('mo.aufnahmetermin_id' => $aufnahmetermin_id) + ); + + $resultCheckMo = $this->getDataOrTerminateWithError($resultCheckMo); + $count = current($resultCheckMo)->count; + + $existsInExtension = $count > 0 ? true : false; + + if($existsInExtension) + $this->terminateWithError($this->p->t('mobility', 'error_existingEntryInExtension'), self::ERROR_TYPE_GENERAL); + } + + $result = $this->BisioModel->delete( + array('aufnahmetermin_id' => $aufnahmetermin_id) + ); + + $data = $this->getDataOrTerminateWithError($result); + $this->terminateWithSuccess($data); + } + + public function getLVList($studiengang_kz) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudiengangkz($studiengang_kz); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getAllLehreinheiten() + { + $lv_id = $this->input->post('lv_id'); + $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz'); + + $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); + + $result = $this->LehreinheitModel->getLesFromLvIds($lv_id, $studiensemester_kurzbz); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getLvsandLesByStudent($student_uid) + { + $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); + + $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); + + $data = $this->getDataOrTerminateWithError($result); + + $lv_ids = array(); + $allData = array(); + + foreach ($data as $lehrveranstaltung) { + $lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id; + } + + $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); + + foreach ($lv_ids as $id) + { + $result = $this->LehreinheitModel->getLesFromLvIds($id); + $data = $this->getDataOrTerminateWithError($result); + + if (is_array($data)) { + $allData = array_merge($allData, $data); + } + } + + return $this->terminateWithSuccess($allData); + } + + public function getPurposes($aufnahmetermin_id) + { + $aufnahmetermin_id = (int)$aufnahmetermin_id; + + $this->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + $this->BisiozweckModel->addSelect("*"); + $this->BisiozweckModel->addJoin('bis.tbl_zweck zw', 'ON (zw.zweck_code = bis.tbl_bisio_zweck.zweck_code)'); + + $result = $this->BisiozweckModel->loadWhere( + array('aufnahmetermin_id' => $aufnahmetermin_id) + ); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getSupports($aufnahmetermin_id) + { + $aufnahmetermin_id = (int)$aufnahmetermin_id; + + $this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel'); + + $this->BisioaufenthaltfoerderungModel->addSelect("*"); + $this->BisioaufenthaltfoerderungModel->addJoin('bis.tbl_aufenthaltfoerderung af', 'ON (af.aufenthaltfoerderung_code = bis.tbl_bisio_aufenthaltfoerderung.aufenthaltfoerderung_code)'); + + $result = $this->BisioaufenthaltfoerderungModel->loadWhere( + array('aufnahmetermin_id' => $aufnahmetermin_id) + ); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getListPurposes() + { + $this->load->model('codex/Zweck_model', 'ZweckModel'); + + $result = $this->ZweckModel->load(); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getListSupports() + { + $this->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); + + $result = $this->AufenthaltfoerderungModel->load(); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function addAufnahmeterminPurpose($aufnahmetermin_id, $local_purpose = null) + { + $zweck_code = $this->input->post('zweck_code'); + + if($local_purpose){ + $zweck_code = $local_purpose; + } + + $this->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + if(!$local_purpose) + { + $check = $this->BisiozweckModel->loadWhere( + [ + 'aufnahmetermin_id' => $aufnahmetermin_id, + 'zweck_code' => $zweck_code, + ] + ); + if (hasData($check)) + { + $this->terminateWithError($this->p->t('ui', 'error_entryExisting'), self::ERROR_TYPE_GENERAL); + } + } + + $result = $this->BisiozweckModel->insert( + array( + 'aufnahmetermin_id' => $aufnahmetermin_id, + 'zweck_code' => $zweck_code + ) + ); + + $data = $this->getDataOrTerminateWithError($result); + + if($local_purpose) + { + return $data; + } + + return $this->terminateWithSuccess(current($data)); + } + + public function deleteAufnahmeterminPurpose($aufnahmetermin_id) + { + $zweck_code = $this->input->post('zweck_code'); + + $this->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); + + + $result = $this->BisiozweckModel->delete( + array( + 'aufnahmetermin_id' => $aufnahmetermin_id, + 'zweck_code' => $zweck_code + ) + ); + + $data = $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess(current($data)); + } + + public function addAufnahmeterminSupport($aufnahmetermin_id, $local_support = null) + { + $aufenthaltfoerderung_code = $this->input->post('aufenthaltfoerderung_code'); + + if($local_support){ + $aufenthaltfoerderung_code = $local_support; + } + + $this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel'); + + if(!$local_support) + { + $check = $this->BisioaufenthaltfoerderungModel->loadWhere( + [ + 'aufnahmetermin_id' => $aufnahmetermin_id, + 'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code, + ] + ); + if (hasData($check)) + { + $this->terminateWithError($this->p->t('ui', 'error_entryExisting'), self::ERROR_TYPE_GENERAL); + } + } + + $result = $this->BisioaufenthaltfoerderungModel->insert( + array( + 'aufnahmetermin_id' => $aufnahmetermin_id, + 'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code + ) + ); + + $data = $this->getDataOrTerminateWithError($result); + + if($local_support) + { + return $data; + } + + return $this->terminateWithSuccess(current($data)); + } + + public function deleteAufnahmeterminSupport($aufnahmetermin_id) + { + $aufenthaltfoerderung_code = $this->input->post('aufenthaltfoerderung_code'); + + $this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel'); + + $result = $this->BisioaufenthaltfoerderungModel->delete( + array( + 'aufnahmetermin_id' => $aufnahmetermin_id, + 'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code + ) + ); + $data = $this->getDataOrTerminateWithError($result); + + return $this->terminateWithSuccess(current($data)); + } +} diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 42de1b02f..f65daf627 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -128,6 +128,11 @@ class Config extends FHCAPI_Controller 'component' => './Stv/Studentenverwaltung/Details/Mobility.js' ]; + $result['admissionDates'] = [ + 'title' => $this->p->t('stv', 'tab_admissionDates'), + 'component' => './Stv/Studentenverwaltung/Details/Aufnahmetermine.js' + ]; + Events::trigger('stv_conf_student', function & () use (&$result) { return $result; }); diff --git a/public/js/api/factory/stv.js b/public/js/api/factory/stv.js index 7ea387263..95bc227f5 100644 --- a/public/js/api/factory/stv.js +++ b/public/js/api/factory/stv.js @@ -29,6 +29,7 @@ import exam from './stv/exam.js'; import abschlusspruefung from './stv/abschlusspruefung.js'; import grades from './stv/grades.js'; import mobility from './stv/mobility.js'; +import admissionDates from './stv/admissionDates.js'; export default { app, @@ -44,5 +45,6 @@ export default { exam, abschlusspruefung, grades, - mobility + mobility, + admissionDates }; \ No newline at end of file diff --git a/public/js/api/factory/stv/admissionDates.js b/public/js/api/factory/stv/admissionDates.js new file mode 100644 index 000000000..fc96f47be --- /dev/null +++ b/public/js/api/factory/stv/admissionDates.js @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2025 fhcomplete.org + * + * 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 . + */ + +export default { + getAufnahmetermine(prestudent_id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/' + prestudent_id + }; + }, +} \ No newline at end of file diff --git a/public/js/api/stv/admissionDates.js b/public/js/api/stv/admissionDates.js new file mode 100644 index 000000000..e69de29bb diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js new file mode 100644 index 000000000..4ad8c6002 --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js @@ -0,0 +1,26 @@ +import AdmissionDates from "./Aufnahmetermine/Aufnahmetermine.js"; +import HeaderPlacement from "./Aufnahmetermine/HeaderReihungstest.js"; + +export default { + name: "TabAdmissionDates", + components: { + AdmissionDates, + HeaderPlacement + }, + provide() { + return { + config: this.config + }; + }, + props: { + modelValue: Object, + }, + data(){ + return {} + }, + template: ` +
+ + +
` +}; \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js new file mode 100644 index 000000000..58f440836 --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js @@ -0,0 +1,58 @@ +import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import BsModal from "../../../../Bootstrap/Modal.js"; +import FormForm from '../../../../Form/Form.js'; +import FormInput from '../../../../Form/Input.js'; + +import ApiStvAdmissionDates from '../../../../../api/factory/stv/admissionDates'; + +export default { + name: 'ListAdmissionDates', + components: { + CoreFilterCmpt, + BsModal, + FormForm, + FormInput + }, + inject: { + $reloadList: { + from: '$reloadList', + required: true + }, + }, + props: { + student: Object + }, + data() { + return { + tabulatorOptions: { + ajaxURL: 'dummy', + ajaxRequestFunc: () => this.$api.call( + ApiStvAdmissionDates.getAufnahmetermin(this.student.prestudent_id) + ), + ajaxResponse: (url, params, response) => response.data, + columns: [ + {title: "aufnahmetermin_id", field: "aufnahmetermin_id"}, + {title: "prestudent_id", field: "prestudent_id"}, + ], + layout: 'fitDataFill', + layoutColumnsOnNewData: false, + height: 'auto', + minHeight: 200, + index: 'aufnahmetermin_id', + persistenceID: 'stv-details-table_admission-dates' + }, + tabulatorEvents: [], + formData: {}, + statusNew: true, + } + }, + methods: {}, + created() { + }, + template: ` +
+

Allgemein

+ +
+ ` +} diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/HeaderReihungstest.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/HeaderReihungstest.js new file mode 100644 index 000000000..529979b3c --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/HeaderReihungstest.js @@ -0,0 +1,14 @@ +export default { + name: 'HeaderPlacement', + data(){ + return { + statusNew: true, + } + }, + template: ` +
+

Studiengang

+ +
+ ` +} \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index cd17215ee..fd54d9f66 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -41393,8 +41393,31 @@ and represent the current state of research on the topic. The prescribed citatio 'insertvon' => 'system' ) ) - ) + ), // PROJEKTARBEITSBEURTEILUNG SS2025 ENDE --------------------------------------------------------------------------- + // FHC4 STUDIERENDENVERWALTUNG AUFNAHMETERMINE START --------------------------------------------------------------- + array( + 'app' => 'core', + 'category' => 'stv', + 'phrase' => 'tab_admissionDates', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Aufnahmetermine', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Admission Dates', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + // FHC4 STUDIERENDENVERWALTUNG AUFNAHMETERMINE ENDE --------------------------------------------------------------- + ); From 2ab01132b1a069390abc360bb359fc4dc12bf89f Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 24 Apr 2025 16:30:50 +0200 Subject: [PATCH 2/4] show List Admission Dates --- .../api/frontend/v1/stv/Aufnahmetermine.php | 243 +----------------- application/models/crm/Reihungstest_model.php | 39 +++ public/js/api/factory/stv/admissionDates.js | 4 +- public/js/api/stv/admissionDates.js | 0 .../Aufnahmetermine/Aufnahmetermine.js | 31 ++- system/phrasesupdate.php | 20 ++ 6 files changed, 92 insertions(+), 245 deletions(-) delete mode 100644 public/js/api/stv/admissionDates.js diff --git a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php index 519e8125d..3a0be3d40 100644 --- a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php +++ b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php @@ -27,20 +27,12 @@ class Aufnahmetermine extends FHCAPI_Controller ]); // Load models - $this->load->model('codex/Bisio_model', 'BisioModel'); + $this->load->model('crm/Reihungstest_model', 'ReihungstestModel'); } - public function getAufnahmetermine($student_uid) + public function getAufnahmetermine($person_id) { - $this->BisioModel->addSelect("*"); - $this->BisioModel->addJoin('bis.tbl_mobilitaetsprogramm mp', 'ON (mp.mobilitaetsprogramm_code = bis.tbl_bisio.mobilitaetsprogramm_code)', 'LEFT'); - $this->BisioModel->addJoin('lehre.tbl_lehreinheit le', 'ON (le.lehreinheit_id = bis.tbl_bisio.lehreinheit_id)','LEFT'); - $this->BisioModel->addOrder('von', 'DESC'); - $this->BisioModel->addOrder('bis', 'DESC'); - $this->BisioModel->addOrder('aufnahmetermin_id', 'DESC'); - $result = $this->BisioModel->loadWhere( - array('student_uid' => $student_uid) - ); + $result = $this->ReihungstestModel->getReihungstestPerson($person_id); $data = $this->getDataOrTerminateWithError($result); @@ -274,233 +266,4 @@ class Aufnahmetermine extends FHCAPI_Controller $this->terminateWithSuccess($data); } - public function getLVList($studiengang_kz) - { - $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); - - $result = $this->LehrveranstaltungModel->getLvsByStudiengangkz($studiengang_kz); - - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess($data); - } - - public function getAllLehreinheiten() - { - $lv_id = $this->input->post('lv_id'); - $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz'); - - $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); - - $result = $this->LehreinheitModel->getLesFromLvIds($lv_id, $studiensemester_kurzbz); - - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess($data); - } - - public function getLvsandLesByStudent($student_uid) - { - $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); - - $result = $this->LehrveranstaltungModel->getLvsByStudent($student_uid); - - $data = $this->getDataOrTerminateWithError($result); - - $lv_ids = array(); - $allData = array(); - - foreach ($data as $lehrveranstaltung) { - $lv_ids[] = $lehrveranstaltung->lehrveranstaltung_id; - } - - $this->load->model('education/Lehreinheit_model', 'LehreinheitModel'); - - foreach ($lv_ids as $id) - { - $result = $this->LehreinheitModel->getLesFromLvIds($id); - $data = $this->getDataOrTerminateWithError($result); - - if (is_array($data)) { - $allData = array_merge($allData, $data); - } - } - - return $this->terminateWithSuccess($allData); - } - - public function getPurposes($aufnahmetermin_id) - { - $aufnahmetermin_id = (int)$aufnahmetermin_id; - - $this->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); - - $this->BisiozweckModel->addSelect("*"); - $this->BisiozweckModel->addJoin('bis.tbl_zweck zw', 'ON (zw.zweck_code = bis.tbl_bisio_zweck.zweck_code)'); - - $result = $this->BisiozweckModel->loadWhere( - array('aufnahmetermin_id' => $aufnahmetermin_id) - ); - - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess($data); - } - - public function getSupports($aufnahmetermin_id) - { - $aufnahmetermin_id = (int)$aufnahmetermin_id; - - $this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel'); - - $this->BisioaufenthaltfoerderungModel->addSelect("*"); - $this->BisioaufenthaltfoerderungModel->addJoin('bis.tbl_aufenthaltfoerderung af', 'ON (af.aufenthaltfoerderung_code = bis.tbl_bisio_aufenthaltfoerderung.aufenthaltfoerderung_code)'); - - $result = $this->BisioaufenthaltfoerderungModel->loadWhere( - array('aufnahmetermin_id' => $aufnahmetermin_id) - ); - - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess($data); - } - - public function getListPurposes() - { - $this->load->model('codex/Zweck_model', 'ZweckModel'); - - $result = $this->ZweckModel->load(); - - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess($data); - } - - public function getListSupports() - { - $this->load->model('codex/Aufenthaltfoerderung_model', 'AufenthaltfoerderungModel'); - - $result = $this->AufenthaltfoerderungModel->load(); - - $data = $this->getDataOrTerminateWithError($result); - - $this->terminateWithSuccess($data); - } - - public function addAufnahmeterminPurpose($aufnahmetermin_id, $local_purpose = null) - { - $zweck_code = $this->input->post('zweck_code'); - - if($local_purpose){ - $zweck_code = $local_purpose; - } - - $this->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); - if(!$local_purpose) - { - $check = $this->BisiozweckModel->loadWhere( - [ - 'aufnahmetermin_id' => $aufnahmetermin_id, - 'zweck_code' => $zweck_code, - ] - ); - if (hasData($check)) - { - $this->terminateWithError($this->p->t('ui', 'error_entryExisting'), self::ERROR_TYPE_GENERAL); - } - } - - $result = $this->BisiozweckModel->insert( - array( - 'aufnahmetermin_id' => $aufnahmetermin_id, - 'zweck_code' => $zweck_code - ) - ); - - $data = $this->getDataOrTerminateWithError($result); - - if($local_purpose) - { - return $data; - } - - return $this->terminateWithSuccess(current($data)); - } - - public function deleteAufnahmeterminPurpose($aufnahmetermin_id) - { - $zweck_code = $this->input->post('zweck_code'); - - $this->load->model('codex/Bisiozweck_model', 'BisiozweckModel'); - - - $result = $this->BisiozweckModel->delete( - array( - 'aufnahmetermin_id' => $aufnahmetermin_id, - 'zweck_code' => $zweck_code - ) - ); - - $data = $this->getDataOrTerminateWithError($result); - - return $this->terminateWithSuccess(current($data)); - } - - public function addAufnahmeterminSupport($aufnahmetermin_id, $local_support = null) - { - $aufenthaltfoerderung_code = $this->input->post('aufenthaltfoerderung_code'); - - if($local_support){ - $aufenthaltfoerderung_code = $local_support; - } - - $this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel'); - - if(!$local_support) - { - $check = $this->BisioaufenthaltfoerderungModel->loadWhere( - [ - 'aufnahmetermin_id' => $aufnahmetermin_id, - 'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code, - ] - ); - if (hasData($check)) - { - $this->terminateWithError($this->p->t('ui', 'error_entryExisting'), self::ERROR_TYPE_GENERAL); - } - } - - $result = $this->BisioaufenthaltfoerderungModel->insert( - array( - 'aufnahmetermin_id' => $aufnahmetermin_id, - 'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code - ) - ); - - $data = $this->getDataOrTerminateWithError($result); - - if($local_support) - { - return $data; - } - - return $this->terminateWithSuccess(current($data)); - } - - public function deleteAufnahmeterminSupport($aufnahmetermin_id) - { - $aufenthaltfoerderung_code = $this->input->post('aufenthaltfoerderung_code'); - - $this->load->model('codex/Bisioaufenthaltfoerderung_model', 'BisioaufenthaltfoerderungModel'); - - $result = $this->BisioaufenthaltfoerderungModel->delete( - array( - 'aufnahmetermin_id' => $aufnahmetermin_id, - 'aufenthaltfoerderung_code' => $aufenthaltfoerderung_code - ) - ); - $data = $this->getDataOrTerminateWithError($result); - - return $this->terminateWithSuccess(current($data)); - } } diff --git a/application/models/crm/Reihungstest_model.php b/application/models/crm/Reihungstest_model.php index 86ebfd0af..f2732b636 100644 --- a/application/models/crm/Reihungstest_model.php +++ b/application/models/crm/Reihungstest_model.php @@ -511,4 +511,43 @@ class Reihungstest_model extends DB_Model return $this->execQuery($query, array($date, $studiengang_kz)); } + + /** + * Loads all placement tests of a given person + * @param integer $person_id + * @return array Returns object array with data of placement tests + */ + public function getReihungstestPerson($person_id) + { + $query = ' + SELECT + tbl_rt_person.*, + tbl_reihungstest.studiengang_kz, + tbl_reihungstest.anmerkung, + tbl_reihungstest.datum, + tbl_reihungstest.uhrzeit, + tbl_reihungstest.ext_id, + tbl_reihungstest.max_teilnehmer, + tbl_reihungstest.oeffentlich, + tbl_reihungstest.freigeschaltet, + tbl_reihungstest.studiensemester_kurzbz, + tbl_reihungstest.stufe, + tbl_reihungstest.anmeldefrist, + tbl_reihungstest.aufnahmegruppe_kurzbz, + tbl_studiengang.typ, + UPPER(typ::varchar(1) || kurzbz) AS stg_kuerzel, + so.studiengangbezeichnung, + so.studiengangbezeichnung_englisch + FROM + public.tbl_rt_person + JOIN public.tbl_reihungstest ON (rt_id=reihungstest_id) + JOIN public.tbl_studiengang ON tbl_reihungstest.studiengang_kz = tbl_studiengang.studiengang_kz + JOIN lehre.tbl_studienplan sp USING(studienplan_id) + JOIN lehre.tbl_studienordnung so USING(studienordnung_id) + WHERE + tbl_rt_person.person_id = ? + ORDER BY datum, uhrzeit ASC'; + + return $this->execQuery($query, array($person_id)); + } } \ No newline at end of file diff --git a/public/js/api/factory/stv/admissionDates.js b/public/js/api/factory/stv/admissionDates.js index fc96f47be..51a92c331 100644 --- a/public/js/api/factory/stv/admissionDates.js +++ b/public/js/api/factory/stv/admissionDates.js @@ -16,10 +16,10 @@ */ export default { - getAufnahmetermine(prestudent_id) { + getAufnahmetermine(person_id) { return { method: 'get', - url: 'api/frontend/v1/stv/aufnahmetermine/' + prestudent_id + url: 'api/frontend/v1/stv/aufnahmetermine/getAufnahmetermine/' + person_id, }; }, } \ No newline at end of file diff --git a/public/js/api/stv/admissionDates.js b/public/js/api/stv/admissionDates.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js index 58f440836..7e7e2ae97 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js @@ -27,12 +27,24 @@ export default { tabulatorOptions: { ajaxURL: 'dummy', ajaxRequestFunc: () => this.$api.call( - ApiStvAdmissionDates.getAufnahmetermin(this.student.prestudent_id) + ApiStvAdmissionDates.getAufnahmetermine(this.student.person_id) ), ajaxResponse: (url, params, response) => response.data, columns: [ - {title: "aufnahmetermin_id", field: "aufnahmetermin_id"}, - {title: "prestudent_id", field: "prestudent_id"}, + {title: "rt_id", field: "rt_id"}, + {title: "rt_person_id", field: "rt_person_id"}, + {title: "person_id", field: "person_id"}, + {title: "datum", field: "datum"}, + {title: "stufe", field: "stufe"}, + {title: "studiensemester", field: "studiensemester_kurzbz"}, + {title: "anmerkung", field: "anmerkung", visible: false}, + {title: "anmeldedatum", field: "anmeldedatum", visible: false}, + {title: "punkte", field: "punkte"}, + {title: "teilgenommen", field: "teilgenommen"}, + {title: "ort", field: "ort", visible: false}, + {title: "studienplan", field: "studienplan", visible: false}, + {title: "studienplan_id", field: "studienplan_id", visible: false}, + {title: "stg_kuerzel", field: "stg_kuerzel"}, ], layout: 'fitDataFill', layoutColumnsOnNewData: false, @@ -53,6 +65,19 @@ export default {

Allgemein

+ + +
` } diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index fd54d9f66..bf18f50c8 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -41416,6 +41416,26 @@ and represent the current state of research on the topic. The prescribed citatio ) ) ), + array( + 'app' => 'core', + 'category' => 'lehre', + 'phrase' => 'reihungstest', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Reihungstest', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Placement Test', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), // FHC4 STUDIERENDENVERWALTUNG AUFNAHMETERMINE ENDE --------------------------------------------------------------- ); From bf0cd8e8e3341138a2e7f74cc1927989ef14732e Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 25 Apr 2025 16:15:27 +0200 Subject: [PATCH 3/4] actions new, update and delete aufnahmetermine --- .../api/frontend/v1/stv/Aufnahmetermine.php | 250 ++++++---------- application/models/crm/Reihungstest_model.php | 33 ++ .../models/organisation/Studienplan_model.php | 13 + public/js/api/factory/stv/admissionDates.js | 39 +++ .../Aufnahmetermine/Aufnahmetermine.js | 282 +++++++++++++++++- system/phrasesupdate.php | 100 +++++++ 6 files changed, 556 insertions(+), 161 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php index 3a0be3d40..6b0356bc3 100644 --- a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php +++ b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php @@ -14,6 +14,9 @@ class Aufnahmetermine extends FHCAPI_Controller 'insertAufnahmetermin' => ['admin:rw', 'assistenz:rw'], 'updateAufnahmetermin' => ['admin:rw', 'assistenz:rw'], 'deleteAufnahmetermin' => ['admin:rw', 'assistenz:rw'], + 'getListPlacementTests' => ['admin:rw', 'assistenz:rw'], + 'getListStudyPlans' => ['admin:rw', 'assistenz:rw'], + ]); // Load Libraries @@ -23,11 +26,12 @@ class Aufnahmetermine extends FHCAPI_Controller // Load language phrases $this->loadPhrases([ 'ui', - 'mobility' + 'admission' ]); // Load models $this->load->model('crm/Reihungstest_model', 'ReihungstestModel'); + $this->load->model('crm/RtPerson_model', 'RtPersonModel'); } public function getAufnahmetermine($person_id) @@ -44,106 +48,62 @@ class Aufnahmetermine extends FHCAPI_Controller $this->load->library('form_validation'); $authUID = getAuthUID(); - $student_uid = $this->input->post('uid'); + $formData = $this->input->post('formData'); + $person_id = $this->input->post('person_id'); - if(!$student_uid) + if(!$person_id) { - return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL); + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL); } - $formData = $this->input->post('formData'); - $_POST['von'] = (isset($formData['von']) && !empty($formData['von'])) ? $formData['von'] : null; - $_POST['bis'] = (isset($formData['bis']) && !empty($formData['bis'])) ? $formData['bis'] : null; - $_POST['nation_code'] = (isset($formData['nation_code']) && !empty($formData['nation_code'])) ? $formData['nation_code'] : 'A'; - $_POST['mobilitaetsprogramm_code'] = (isset($formData['mobilitaetsprogramm_code']) && !empty($formData['mobilitaetsprogramm_code'])) ? $formData['mobilitaetsprogramm_code'] : null; - $_POST['herkunftsland_code'] = (isset($formData['herkunftsland_code']) && !empty($formData['herkunftsland_code'])) ? $formData['herkunftsland_code'] : 'A'; - $_POST['ects_erworben'] = (isset($formData['ects_erworben']) && !empty($formData['ects_erworben'])) ? $formData['ects_erworben'] : null; - $_POST['ects_angerechnet'] = (isset($formData['ects_angerechnet']) && !empty($formData['ects_angerechnet'])) ? $formData['ects_angerechnet'] : null; - $_POST['lehreinheit_id'] = (isset($formData['lehreinheit_id']) && !empty($formData['lehreinheit_id'])) ? $formData['lehreinheit_id'] : null; - $this->form_validation->set_rules('nation_code', 'Nation_code', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Nation_code']) + $_POST['rt_id'] = (isset($formData['rt_id']) && !empty($formData['rt_id'])) ? $formData['rt_id'] : null; + $_POST['anmeldedatum'] = (isset($formData['anmeldedatum']) && !empty($formData['anmeldedatum'])) ? $formData['anmeldedatum'] : null; + $_POST['teilgenommen'] = (isset($formData['teilgenommen']) && !empty($formData['teilgenommen'])) ? $formData['teilgenommen'] : false; + $_POST['studienplan_id'] = (isset($formData['studienplan_id']) && !empty($formData['studienplan_id'])) ? $formData['studienplan_id'] : null; + $_POST['punkte'] = (isset($formData['punkte']) && !empty($formData['punkte'])) ? $formData['punkte'] : null; + + $this->form_validation->set_rules('punkte', 'Punkte', 'numeric', [ + 'required' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Punkte']) ]); - $this->form_validation->set_rules('herkunftsland_code', 'Herkunftsland_code', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Herkunftsland_code']) + $this->form_validation->set_rules('studienplan_id', 'studienplan_id', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Studienplan']) ]); - $this->form_validation->set_rules('mobilitaetsprogramm_code', 'Mobilitaetsprogramm_code', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Mobilitaetsprogramm_code']) - ]); - $this->form_validation->set_rules('von', 'VonDatum', 'is_valid_date', [ - 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum']) + $this->form_validation->set_rules('rt_id', 'Reihungstest_id', 'required', [ + 'is_valid_date' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Reihungstest']) ]); - $this->form_validation->set_rules('bis', 'VBisDatum', 'is_valid_date', [ - 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VBisDatum']) + $this->form_validation->set_rules('anmeldedatum', 'AnmeldeDatum', 'is_valid_date', [ + 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'Anmeldedatum']) ]); - $this->form_validation->set_rules('ects_erworben', 'Ects_erworben', 'numeric', [ - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_erworben']) - ]); - - $this->form_validation->set_rules('ects_angerechnet', 'Ects_angerechnet', 'numeric', [ - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_angerechnet']) - ]); - - $this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'numeric', [ - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Lehreinheit']) - ]); if ($this->form_validation->run() == false) { $this->terminateWithValidationErrors($this->form_validation->error_array()); } - $ort = (isset($formData['ort']) && !empty($formData['ort'])) ? $formData['ort'] : null; - $universitaet = (isset($formData['universitaet']) && !empty($formData['universitaet'])) ? $formData['universitaet'] : null; - $localPurposes = (isset($formData['localPurposes']) && !empty($formData['localPurposes'])) ? $formData['localPurposes'] : null; - $localSupports = (isset($formData['localSupports']) && !empty($formData['localSupports'])) ? $formData['localSupports'] : null; - - $result = $this->BisioModel->insert([ - 'student_uid' => $student_uid, - 'von' => $_POST['von'], - 'bis' => $_POST['bis'], - 'mobilitaetsprogramm_code' => $_POST['mobilitaetsprogramm_code'], - 'nation_code' => $_POST['nation_code'], - 'herkunftsland_code' => $_POST['herkunftsland_code'], - 'lehreinheit_id' => $_POST['lehreinheit_id'], - 'ort' => $ort, - 'universitaet' => $universitaet, - 'ects_erworben' => $_POST['ects_erworben'] , - 'ects_angerechnet' => $_POST['ects_angerechnet'], + $result = $this->RtPersonModel->insert([ + 'person_id' => $person_id, + 'rt_id' => $_POST['rt_id'], + 'anmeldedatum' => $_POST['anmeldedatum'], + 'teilgenommen' => $_POST['teilgenommen'], + 'studienplan_id' => $_POST['studienplan_id'], + 'punkte' => $_POST['punkte'], 'insertamum' => date('c'), 'insertvon' => $authUID, ]); - $aufnahmetermin_id = $this->getDataOrTerminateWithError($result); + $data = $this->getDataOrTerminateWithError($result); - //check if localData (purposes) - if(count($localPurposes) > 0){ - foreach ($localPurposes as $zweck){ - $zweck = (int)$zweck; - $this->addAufnahmeterminPurpose($aufnahmetermin_id, $zweck); - } - } - - //check if localData (supports) - if(count($localSupports) > 0){ - foreach ($localSupports as $support){ - $this->addAufnahmeterminSupport($aufnahmetermin_id, $support); - } - } - - $this->terminateWithSuccess($aufnahmetermin_id); + $this->terminateWithSuccess($data); } - public function loadAufnahmetermin($aufnahmetermin_id) + public function loadAufnahmetermin($rt_person_id) { - $this->BisioModel->addSelect("*"); - $this->BisioModel->addJoin('bis.tbl_mobilitaetsprogramm mp', 'ON (mp.mobilitaetsprogramm_code = bis.tbl_bisio.mobilitaetsprogramm_code)', 'LEFT'); - $this->BisioModel->addJoin('lehre.tbl_lehreinheit le', 'ON (le.lehreinheit_id = bis.tbl_bisio.lehreinheit_id)','LEFT'); - $result = $this->BisioModel->loadWhere( - array('aufnahmetermin_id' => $aufnahmetermin_id) + $result = $this->RtPersonModel->loadWhere( + array('rt_person_id' => $rt_person_id) ); $data = $this->getDataOrTerminateWithError($result); @@ -152,118 +112,96 @@ class Aufnahmetermine extends FHCAPI_Controller public function updateAufnahmetermin() { - $this->load->library('form_validation'); $authUID = getAuthUID(); - $student_uid = $this->input->post('uid'); - - if(!$student_uid) - { - return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Student UID']), self::ERROR_TYPE_GENERAL); - } $formData = $this->input->post('formData'); + $rt_person_id = $this->input->post('rt_person_id'); + $person_id = (isset($formData['person_id']) && !empty($formData['person_id'])) ? $formData['person_id'] : null; - $_POST['von'] = (isset($formData['von']) && !empty($formData['von'])) ? $formData['von'] : null; - $_POST['bis'] = (isset($formData['bis']) && !empty($formData['bis'])) ? $formData['bis'] : null; - $_POST['nation_code'] = (isset($formData['nation_code']) && !empty($formData['nation_code'])) ? $formData['nation_code'] : 'A'; - $_POST['mobilitaetsprogramm_code'] = (isset($formData['mobilitaetsprogramm_code']) && !empty($formData['mobilitaetsprogramm_code'])) ? $formData['mobilitaetsprogramm_code'] : null; - $_POST['herkunftsland_code'] = (isset($formData['herkunftsland_code']) && !empty($formData['herkunftsland_code'])) ? $formData['herkunftsland_code'] : 'A'; - $_POST['ects_erworben'] = (isset($formData['ects_erworben']) && !empty($formData['ects_erworben'])) ? $formData['ects_erworben'] : null; - $_POST['ects_angerechnet'] = (isset($formData['ects_angerechnet']) && !empty($formData['ects_angerechnet'])) ? $formData['ects_angerechnet'] : null; - $_POST['lehreinheit_id'] = (isset($formData['lehreinheit_id']) && !empty($formData['lehreinheit_id'])) ? $formData['lehreinheit_id'] : null; - $this->form_validation->set_rules('nation_code', 'Nation_code', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Nation_code']) + if(!$person_id) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Person ID']), self::ERROR_TYPE_GENERAL); + } + if(!$rt_person_id) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'RT_Person ID']), self::ERROR_TYPE_GENERAL); + } + + + $_POST['rt_id'] = (isset($formData['rt_id']) && !empty($formData['rt_id'])) ? $formData['rt_id'] : null; + $_POST['anmeldedatum'] = (isset($formData['anmeldedatum']) && !empty($formData['anmeldedatum'])) ? $formData['anmeldedatum'] : null; + $_POST['teilgenommen'] = (isset($formData['teilgenommen']) && !empty($formData['teilgenommen'])) ? $formData['teilgenommen'] : false; + $_POST['studienplan_id'] = (isset($formData['studienplan_id']) && !empty($formData['studienplan_id'])) ? $formData['studienplan_id'] : null; + $_POST['punkte'] = (isset($formData['punkte']) && !empty($formData['punkte'])) ? $formData['punkte'] : null; + + $this->form_validation->set_rules('punkte', 'Punkte', 'numeric', [ + 'required' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Punkte']) ]); - $this->form_validation->set_rules('herkunftsland_code', 'Herkunftsland_code', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Herkunftsland_code']) + $this->form_validation->set_rules('studienplan_id', 'studienplan_id', 'required', [ + 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Studienplan']) ]); - $this->form_validation->set_rules('mobilitaetsprogramm_code', 'Mobilitaetsprogramm_code', 'required', [ - 'required' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Mobilitaetsprogramm_code']) - ]); - $this->form_validation->set_rules('von', 'VonDatum', 'is_valid_date', [ - 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VonDatum']) + $this->form_validation->set_rules('rt_id', 'Reihungstest_id', 'required', [ + 'is_valid_date' => $this->p->t('ui', 'error_fieldRequired', ['field' => 'Reihungstest']) ]); - $this->form_validation->set_rules('bis', 'VBisDatum', 'is_valid_date', [ - 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'VBisDatum']) + $this->form_validation->set_rules('anmeldedatum', 'AnmeldeDatum', 'is_valid_date', [ + 'is_valid_date' => $this->p->t('ui', 'error_notValidDate', ['field' => 'Anmeldedatum']) ]); - $this->form_validation->set_rules('ects_erworben', 'Ects_erworben', 'numeric', [ - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_erworben']) - ]); - - $this->form_validation->set_rules('ects_angerechnet', 'Ects_angerechnet', 'numeric', [ - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Ects_angerechnet']) - ]); - - $this->form_validation->set_rules('lehreinheit_id', 'Lehreinheit', 'numeric', [ - 'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Lehreinheit']) - ]); if ($this->form_validation->run() == false) { $this->terminateWithValidationErrors($this->form_validation->error_array()); } - $result = $this->BisioModel->update( + $result = $this->RtPersonModel->update( [ - 'aufnahmetermin_id' => $formData['aufnahmetermin_id'] + 'rt_person_id' => $rt_person_id, + 'person_id' => $person_id, ], [ - 'student_uid' => $student_uid, - 'von' => $_POST['von'], - 'bis' => $_POST['bis'], - 'mobilitaetsprogramm_code' => $_POST['mobilitaetsprogramm_code'], - 'nation_code' => $_POST['nation_code'], - 'herkunftsland_code' => $_POST['herkunftsland_code'], - 'lehreinheit_id' => $_POST['lehreinheit_id'], - 'ort' => $formData['ort'], - 'universitaet' => $formData['universitaet'], - 'ects_erworben' => $_POST['ects_erworben'] , - 'ects_angerechnet' => $_POST['ects_angerechnet'], - 'updateamum' => date('c'), - 'updatevon' => $authUID, - ] - ); + 'rt_id' => $_POST['rt_id'], + 'anmeldedatum' => $_POST['anmeldedatum'], + 'teilgenommen' => $_POST['teilgenommen'], + 'studienplan_id' => $_POST['studienplan_id'], + 'punkte' => $_POST['punkte'], + 'insertamum' => date('c'), + 'insertvon' => $authUID, + ]); $data = $this->getDataOrTerminateWithError($result); - $this->terminateWithSuccess(current($data)); + $this->terminateWithSuccess($data); } - public function deleteAufnahmetermin($aufnahmetermin_id) + public function deleteAufnahmetermin($rt_person_id) { - //check if extension table exists - $result = $this->BisioModel->tableExists('extension', 'tbl_mo_bisioidzuordnung'); - $data = $this->getDataOrTerminateWithError($result); - - //if table exists check if existing entry - if(!empty($data)) - { - $this->BisioModel->addSelect("count(*)"); - $this->BisioModel->addJoin('extension.tbl_mo_bisioidzuordnung mo', 'ON (mo.aufnahmetermin_id = bis.tbl_bisio.aufnahmetermin_id)', 'LEFT'); - - $resultCheckMo = $this->BisioModel->loadWhere( - array('mo.aufnahmetermin_id' => $aufnahmetermin_id) - ); - - $resultCheckMo = $this->getDataOrTerminateWithError($resultCheckMo); - $count = current($resultCheckMo)->count; - - $existsInExtension = $count > 0 ? true : false; - - if($existsInExtension) - $this->terminateWithError($this->p->t('mobility', 'error_existingEntryInExtension'), self::ERROR_TYPE_GENERAL); - } - - $result = $this->BisioModel->delete( - array('aufnahmetermin_id' => $aufnahmetermin_id) + $result = $this->RtPersonModel->delete( + array('rt_person_id' => $rt_person_id) ); $data = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($data); } + public function getListPlacementTests() + { + $result = $this->ReihungstestModel->getAllReihungstests(); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function getListStudyPlans($person_id) + { + $this->load->model('organisation/Studienplan_model','StudienplanModel'); + + $result = $this->StudienplanModel->getStudienplaeneForPerson($person_id);; + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + } diff --git a/application/models/crm/Reihungstest_model.php b/application/models/crm/Reihungstest_model.php index f2732b636..2eb08ee86 100644 --- a/application/models/crm/Reihungstest_model.php +++ b/application/models/crm/Reihungstest_model.php @@ -550,4 +550,37 @@ class Reihungstest_model extends DB_Model return $this->execQuery($query, array($person_id)); } + + /** + * Loads all placement tests + * @return array Returns object array with data of placement tests + */ + //TODO(Manu) finish Details + public function getAllReihungstests() + { + $query = ' + SELECT * FROM public.tbl_reihungstest + JOIN public.tbl_studiengang ON tbl_reihungstest.studiengang_kz = tbl_studiengang.studiengang_kz + -- JOIN lehre.tbl_studienplan sp USING(studienplan_id) + -- JOIN lehre.tbl_studienordnung so USING(studienordnung_id) + ORDER BY datum DESC NULLS LAST, uhrzeit + '; + + return $this->execQuery($query); + } + + public function getReihungstestsPs($prestudent_id) + { + $query = ' + SELECT * FROM public.tbl_reihungstest + JOIN public.tbl_studiengang ON tbl_reihungstest.studiengang_kz = tbl_studiengang.studiengang_kz + JOIN lehre.tbl_studienplan sp USING(studienplan_id) + JOIN lehre.tbl_studienordnung so USING(studienordnung_id) + ORDER BY datum DESC, uhrzeit + '; + + return $this->execQuery($query); + } + + } \ No newline at end of file diff --git a/application/models/organisation/Studienplan_model.php b/application/models/organisation/Studienplan_model.php index e35ba52fb..569aebd0b 100644 --- a/application/models/organisation/Studienplan_model.php +++ b/application/models/organisation/Studienplan_model.php @@ -134,4 +134,17 @@ class Studienplan_model extends DB_Model 'prestudent_id' => $prestudent_id ]); } + + public function getStudienplaeneForPerson($person_id) + { + $this->addDistinct(); + $this->addSelect($this->dbTable . '.*'); + $this->addSelect('ps.*'); + $this->addJoin('public.tbl_prestudentstatus pss', 'studienplan_id'); + $this->addJoin('public.tbl_prestudent ps', 'prestudent_id'); + + return $this->loadWhere([ + 'person_id' => $person_id + ]); + } } diff --git a/public/js/api/factory/stv/admissionDates.js b/public/js/api/factory/stv/admissionDates.js index 51a92c331..a5b0697da 100644 --- a/public/js/api/factory/stv/admissionDates.js +++ b/public/js/api/factory/stv/admissionDates.js @@ -22,4 +22,43 @@ export default { url: 'api/frontend/v1/stv/aufnahmetermine/getAufnahmetermine/' + person_id, }; }, + getListPlacementTests(){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/getListPlacementTests/', + }; + }, + getListStudyPlans(person_id){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/getListStudyPlans/' + person_id, + }; + }, + addNewPlacementTest(params){ + return { + method: 'post', + url: 'api/frontend/v1/stv/aufnahmetermine/insertAufnahmetermin/', + params + }; + }, + loadPlacementTest(rt_person_id){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/loadAufnahmetermin/' + rt_person_id, + }; + }, + updatePlacementTest(params){ + return { + method: 'post', + url: 'api/frontend/v1/stv/aufnahmetermine/updateAufnahmetermin/', + params + }; + }, + deletePlacementTest(rt_person_id){ + return { + method: 'post', + url: 'api/frontend/v1/stv/aufnahmetermine/deleteAufnahmetermin/' + rt_person_id + }; + } + } \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js index 7e7e2ae97..5fe32e885 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js @@ -34,17 +34,70 @@ export default { {title: "rt_id", field: "rt_id"}, {title: "rt_person_id", field: "rt_person_id"}, {title: "person_id", field: "person_id"}, - {title: "datum", field: "datum"}, + {title: "datum", field: "datum", + formatter: function (cell) { + const dateStr = cell.getValue(); + if (!dateStr) return ""; + + const date = new Date(dateStr); + return date.toLocaleString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }); + } + }, {title: "stufe", field: "stufe"}, {title: "studiensemester", field: "studiensemester_kurzbz"}, {title: "anmerkung", field: "anmerkung", visible: false}, - {title: "anmeldedatum", field: "anmeldedatum", visible: false}, + {title: "anmeldedatum", field: "anmeldedatum", visible: false, + formatter: function (cell) { + const dateStr = cell.getValue(); + if (!dateStr) return ""; + + const date = new Date(dateStr); + return date.toLocaleString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }); + } + }, {title: "punkte", field: "punkte"}, {title: "teilgenommen", field: "teilgenommen"}, {title: "ort", field: "ort", visible: false}, {title: "studienplan", field: "studienplan", visible: false}, {title: "studienplan_id", field: "studienplan_id", visible: false}, {title: "stg_kuerzel", field: "stg_kuerzel"}, + { + title: 'Aktionen', field: 'actions', + minWidth: 150, // Ensures Action-buttons will be always fully displayed + formatter: (cell, formatterParams, onRendered) => { + let container = document.createElement('div'); + container.className = "d-flex gap-2"; + + let button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = this.$p.t('ui', 'bearbeiten'); + button.addEventListener('click', (event) => + this.actionEditPlacementTest(cell.getData().rt_person_id) + ); + container.append(button); + + button = document.createElement('button'); + button.className = 'btn btn-outline-secondary btn-action'; + button.innerHTML = ''; + button.title = this.$p.t('ui', 'loeschen'); + button.addEventListener('click', () => + this.actionDeletePlacementTest(cell.getData().rt_person_id) + ); + container.append(button); + + return container; + }, + frozen: true + } ], layout: 'fitDataFill', layoutColumnsOnNewData: false, @@ -56,13 +109,129 @@ export default { tabulatorEvents: [], formData: {}, statusNew: true, + listPlacementTests: [], + listStudyPlans: [] } }, - methods: {}, + methods: { + actionNewPlacementTest() { + this.resetForm(); + this.statusNew = true; + this.$refs.placementTestModal.show(); + }, + actionEditPlacementTest(rt_person_id) { + console.log("edit Test " + rt_person_id); + this.resetForm(); + this.statusNew = false; + this.loadPlacementTest(rt_person_id); + this.$refs.placementTestModal.show(); + }, + actionDeletePlacementTest(rt_person_id) { + this.$fhcAlert + .confirmDelete() + .then(result => result + ? rt_person_id + : Promise.reject({handled: true})) + .then(this.deletePlacementTest) + .catch(this.$fhcAlert.handleSystemError); + }, + addNewPlacementTest() { + const dataToSend = { + person_id: this.student.person_id, + formData: this.formData + }; + return this.$refs.formPlacementTest + .call(ApiStvAdmissionDates.addNewPlacementTest(dataToSend)) + .then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal("placementTestModal"); + this.resetForm(); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { + this.reload(); + }); + }, + hideModal(modalRef){ + this.$refs[modalRef].hide(); + }, + reload() { + this.$refs.table.reloadTable(); + }, + loadPlacementTest(rt_person_id) { + console.log("load Test " + rt_person_id); + return this.$api + .call(ApiStvAdmissionDates.loadPlacementTest(rt_person_id)) + .then(result => { + this.formData = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + }, + updatePlacementTest(rt_person_id) { + const dataToSend = { + formData: this.formData, + rt_person_id: rt_person_id, + }; + this.$refs.formPlacementTest + .call(ApiStvAdmissionDates.updatePlacementTest(dataToSend)) + .then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); + this.hideModal("placementTestModal"); + this.resetForm(); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { + this.reload(); + }); + }, + deletePlacementTest(rt_person_id) { + console.log("delete Test" + rt_person_id); + return this.$api + .call(ApiStvAdmissionDates.deletePlacementTest(rt_person_id)) + .then(response => { + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { + this.reload(); + }); + }, + resetForm() { + console.log("resetForm"); + this.formData = {}; + /* + + this.formData.von = new Date(); + this.formData.bis = new Date(); + this.formData.mobilitaetsprogramm_code = 7; + this.formData.nation_code = 'A'; + this.formData.herkunftsland_code = 'A'; + this.formData.rt_id = null; + this.formData.localPurposes = []; + this.formData.localSupports = []; + this.formData.lehrveranstaltung_id = '', + this.formData.lehreinheit_id = '', + this.statusNew = true; + this.listLes = [];*/ + }, + }, created() { + this.$api + .call(ApiStvAdmissionDates.getListPlacementTests()) + .then(result => { + this.listPlacementTests = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); + + this.$api + .call(ApiStvAdmissionDates.getListStudyPlans(this.student.person_id)) + .then(result => { + this.listStudyPlans = result.data; + }) + .catch(this.$fhcAlert.handleSystemError); }, template: ` -
+

Allgemein

+ {{formData}} + + + + + + + + + + + + +
+ + + + +
+ +
+ + +
+ +
+ + +
+ +
+ + + + +
+ +
+ + +
+ + + + +
+ + +
` } diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index bf18f50c8..66fd48a8b 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -41436,6 +41436,106 @@ and represent the current state of research on the topic. The prescribed citatio ) ) ), + array( + 'app' => 'core', + 'category' => 'admission', + 'phrase' => 'admission_edit', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Aufnahmetermin bearbeiten', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Edit appointment for participation placement test', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'admission', + 'phrase' => 'admission_delete', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Aufnahmetermin Löschen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Delete Admission Date', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'admission', + 'phrase' => 'admission_new', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Termin für Teilnahme am Reihungstest anlegen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Create appointment for participation placement test', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'admission', + 'phrase' => 'anmeldundRtAm', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Anmeldung zum Reihungstest am', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Registration for the ranking test on', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'admission', + 'phrase' => 'rtAngetreten', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Zum Reihungstest angetreten', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Participated in the ranking test', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), // FHC4 STUDIERENDENVERWALTUNG AUFNAHMETERMINE ENDE --------------------------------------------------------------- ); From 9d4568e15eea009573960a8edb56bc2c79f57f4f Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 8 May 2025 09:58:08 +0200 Subject: [PATCH 4/4] client side placementtest handling, filtering Dropdowns placementtests, Phrases, show future Placementtests, open Reihungstestverwaltung --- .../api/frontend/v1/stv/Aufnahmetermine.php | 209 ++++++++++- application/models/crm/Reihungstest_model.php | 222 ++++++++++-- .../models/person/Benutzergruppe_model.php | 12 + application/models/testtool/Ablauf_model.php | 27 ++ application/views/Studentenverwaltung.php | 5 +- public/js/api/factory/stv/admissionDates.js | 41 ++- .../js/components/Stv/Studentenverwaltung.js | 5 +- .../Details/Aufnahmetermine.js | 2 +- .../Aufnahmetermine/Aufnahmetermine.js | 338 +++++++++++++----- .../Aufnahmetermine/HeaderReihungstest.js | 145 +++++++- rdf/reihungstest.rdf.php | 5 + system/phrasesupdate.php | 280 +++++++++++++++ 12 files changed, 1157 insertions(+), 134 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php index 6b0356bc3..538626789 100644 --- a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php +++ b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php @@ -14,9 +14,13 @@ class Aufnahmetermine extends FHCAPI_Controller 'insertAufnahmetermin' => ['admin:rw', 'assistenz:rw'], 'updateAufnahmetermin' => ['admin:rw', 'assistenz:rw'], 'deleteAufnahmetermin' => ['admin:rw', 'assistenz:rw'], - 'getListPlacementTests' => ['admin:rw', 'assistenz:rw'], - 'getListStudyPlans' => ['admin:rw', 'assistenz:rw'], - + 'getListPlacementTests' => ['admin:r', 'assistenz:r'], + 'getListStudyPlans' => ['admin:r', 'assistenz:r'], + 'loadDataRtPrestudent' => ['admin:r', 'assistenz:r'], + 'insertOrUpdateDataRtPrestudent' => ['admin:r', 'assistenz:r'], + 'loadAufnahmegruppen' => ['admin:r', 'assistenz:r'], + 'getResultReihungstest' => ['admin:r', 'assistenz:r'], + 'getZukuenftigeReihungstestStg' => ['admin:r', 'assistenz:r'], ]); // Load Libraries @@ -169,7 +173,8 @@ class Aufnahmetermine extends FHCAPI_Controller 'punkte' => $_POST['punkte'], 'insertamum' => date('c'), 'insertvon' => $authUID, - ]); + ] + ); $data = $this->getDataOrTerminateWithError($result); @@ -186,9 +191,53 @@ class Aufnahmetermine extends FHCAPI_Controller $this->terminateWithSuccess($data); } - public function getListPlacementTests() + public function getListPlacementTests($prestudent_id) { - $result = $this->ReihungstestModel->getAllReihungstests(); + if(!$prestudent_id) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Prestudent ID']), self::ERROR_TYPE_GENERAL); + } + + //get studienplan array + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + + $this->PrestudentstatusModel->addSelect('*'); + $this->PrestudentstatusModel->addSelect('sp.studienplan_id'); + + $this->PrestudentstatusModel->addJoin('lehre.tbl_studienplan sp', 'studienplan_id', 'LEFT'); + + $result = $this->PrestudentstatusModel->loadWhere( + array( + 'prestudent_id' => $prestudent_id, + 'status_kurzbz' => 'Interessent' + ) + ); + + $data = $this->getDataOrTerminateWithError($result); + + $studienplan_arr = []; + $include_ids = []; + foreach ($data as $item) + { + if($item->studienplan_id != null) + $studienplan_arr[] = $item->studienplan_id; + } + + //get Placementtests Person + $person_id = $this->_getPersonId($prestudent_id); + $resultRt = $this->ReihungstestModel->getReihungstestPerson($person_id); + + $dataRt = $this->getDataOrTerminateWithError($resultRt); + + foreach ($dataRt as $item) + { + if(!in_array($item->studienplan_id, $studienplan_arr)) + $studienplan_arr[] = $item->studienplan_id; + if(!in_array($item->rt_id, $include_ids) && ($item->rt_id != null)) + $include_ids[] = $item->rt_id; + } + + $result = $this->ReihungstestModel->getReihungstestByStudyPlanAndIds($studienplan_arr, $include_ids); $data = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($data); @@ -196,12 +245,156 @@ class Aufnahmetermine extends FHCAPI_Controller public function getListStudyPlans($person_id) { - $this->load->model('organisation/Studienplan_model','StudienplanModel'); + $this->load->model('organisation/Studienplan_model', 'StudienplanModel'); - $result = $this->StudienplanModel->getStudienplaeneForPerson($person_id);; + $result = $this->StudienplanModel->getStudienplaeneForPerson($person_id); $data = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($data); } + public function loadDataRtPrestudent($prestudent_id) + { + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $this->PrestudentModel->addSelect(["reihungstestangetreten"]); + $this->PrestudentModel->addSelect(["rt_gesamtpunkte"]); + $this->PrestudentModel->addSelect(["aufnahmegruppe_kurzbz"]); + $result = $this->PrestudentModel->loadWhere( + array('prestudent_id' => $prestudent_id) + ); + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(current($data)); + } + + public function insertOrUpdateDataRtPrestudent() + { + $this->load->library('form_validation'); + $authUID = getAuthUID(); + + $formData = $this->input->post('formData'); + $prestudent_id = $this->input->post('prestudent_id'); + + if(!$prestudent_id) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Prestudent ID']), self::ERROR_TYPE_GENERAL); + } + $_POST['rt_gesamtpunkte'] = + (isset($formData['rt_gesamtpunkte']) && !empty($formData['rt_gesamtpunkte'])) + ? $formData['rt_gesamtpunkte'] + : null; + $_POST['reihungstestangetreten'] = + (isset($formData['reihungstestangetreten']) && !empty($formData['reihungstestangetreten'])) + ? $formData['reihungstestangetreten'] + : null; + $_POST['aufnahmegruppe_kurzbz'] = + (isset($formData['aufnahmegruppe_kurzbz']) && !empty($formData['aufnahmegruppe_kurzbz'])) + ? $formData['aufnahmegruppe_kurzbz'] + : null; + + $this->form_validation->set_rules('rt_gesamtpunkte', 'Rt_gesamtpunkte', 'numeric', [ + 'required' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Rt_gesamtpunkte']) + ]); + + if ($this->form_validation->run() == false) + { + $this->terminateWithValidationErrors($this->form_validation->error_array()); + } + + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $result = $this->PrestudentModel->update( + [ + 'prestudent_id' => $prestudent_id, + ], + [ + 'reihungstestangetreten' => $_POST['reihungstestangetreten'], + 'rt_gesamtpunkte' => $_POST['rt_gesamtpunkte'], + 'aufnahmegruppe_kurzbz' => $_POST['aufnahmegruppe_kurzbz'], + 'updateamum' => date('c'), + 'updatevon' => $authUID, + ] + ); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + public function loadAufnahmegruppen() + { + $uid = $this->input->get('uid'); + $studiensemester_kurzbz = $this->input->get('studiensemester_kurzbz'); + + $this->load->model('person/Benutzergruppe_model', 'BenutzergruppeModel'); + + $result = $this->BenutzergruppeModel->loadAufnahmegruppen($uid, $studiensemester_kurzbz); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess(($data)); + } + + public function getResultReihungstest() + { + $person_id = $this->input->get('person_id'); + $punkte = $this->input->get('punkte'); + $reihungstest_id = $this->input->get('reihungstest_id'); + + if(!$reihungstest_id) + { + $this->terminateWithSuccess(null); + } + + //for gewichtung + $studiengang_kz = $this->input->get('studiengang_kz'); + + $this->load->model('testtool/Ablauf_model', 'AblaufModel'); + $result = $this->AblaufModel->getAblaufGebieteAndGewichte($studiengang_kz); + $data = $this->getDataOrTerminateWithError($result); + + $weightedArray = []; + foreach ($data as $abl) + { + $weightedArray[$abl->gebiet_id] = $abl->gewicht; + } + + $result = $this->ReihungstestModel->getReihungstestErgebnisPerson($person_id, $punkte, $reihungstest_id, $weightedArray); + +/* if (isError($result)) + { + $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); + }*/ + + $this->terminateWithSuccess($result); + } + + public function getZukuenftigeReihungstestStg() + { + $studiengang_kz = $this->input->get('studiengang_kz'); + if(!$studiengang_kz) + { + return $this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Studiengang_kz']), self::ERROR_TYPE_GENERAL); + } + + $result = $this->ReihungstestModel->getZukuenftigeReihungstestStg($studiengang_kz); + + $data = $this->getDataOrTerminateWithError($result); + + $this->terminateWithSuccess($data); + } + + private function _getPersonId($prestudent_id) + { + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + $result = $this->PrestudentModel->loadWhere( + ['prestudent_id' => $prestudent_id] + ); + + $data = $this->getDataOrTerminateWithError($result); + $person = current($data); + + return $person->person_id; + } } diff --git a/application/models/crm/Reihungstest_model.php b/application/models/crm/Reihungstest_model.php index 2eb08ee86..a685b01cd 100644 --- a/application/models/crm/Reihungstest_model.php +++ b/application/models/crm/Reihungstest_model.php @@ -530,14 +530,15 @@ class Reihungstest_model extends DB_Model tbl_reihungstest.max_teilnehmer, tbl_reihungstest.oeffentlich, tbl_reihungstest.freigeschaltet, - tbl_reihungstest.studiensemester_kurzbz, + tbl_reihungstest.studiensemester_kurzbz as studiensemester, tbl_reihungstest.stufe, tbl_reihungstest.anmeldefrist, tbl_reihungstest.aufnahmegruppe_kurzbz, tbl_studiengang.typ, UPPER(typ::varchar(1) || kurzbz) AS stg_kuerzel, so.studiengangbezeichnung, - so.studiengangbezeichnung_englisch + so.studiengangbezeichnung_englisch, + so.studiengangkurzbzlang FROM public.tbl_rt_person JOIN public.tbl_reihungstest ON (rt_id=reihungstest_id) @@ -552,35 +553,208 @@ class Reihungstest_model extends DB_Model } /** - * Loads all placement tests - * @return array Returns object array with data of placement tests + * Calculates Result of Placement Test for a given Person and given placementtest + * and with taking account of weighting per area + * + * @param $person_id ID of Person + * @param $punkte if true result is points else result is percentage of sum + * @param $reihungstest_id ID of Placementtest + * @param $weightedArray array of weighting per area (gewicht per gebiet_id) + * @return float result */ - //TODO(Manu) finish Details - public function getAllReihungstests() + public function getReihungstestErgebnisPerson($person_id, $punkte, $reihungstest_id, $weightedArray = null) { - $query = ' - SELECT * FROM public.tbl_reihungstest - JOIN public.tbl_studiengang ON tbl_reihungstest.studiengang_kz = tbl_studiengang.studiengang_kz - -- JOIN lehre.tbl_studienplan sp USING(studienplan_id) - -- JOIN lehre.tbl_studienordnung so USING(studienordnung_id) - ORDER BY datum DESC NULLS LAST, uhrzeit - '; + $parametersArray = array($reihungstest_id); - return $this->execQuery($query); + $qry = " + SELECT DISTINCT ON (vw_auswertung_ablauf.gebiet_id) gebiet_id, + vw_auswertung_ablauf.*, + tbl_studiengang.typ + FROM + testtool.vw_auswertung_ablauf + JOIN + public.tbl_studiengang USING (studiengang_kz) + WHERE + reihungstest_id = ? "; + + //using prestudent Status to avoid to get the sum of more than 1 placement tests + $qry .= " + AND prestudent_id = ( + SELECT + prestudent_id + FROM + public.tbl_rt_person + JOIN + public.tbl_prestudent USING(person_id) + JOIN + public.tbl_prestudentstatus USING (prestudent_id, studienplan_id) + JOIN + tbl_reihungstest ON ( + tbl_rt_person.rt_id = tbl_reihungstest.reihungstest_id + ) + WHERE + tbl_rt_person.person_id = ? + AND + tbl_rt_person.rt_id = ? + AND + tbl_prestudentstatus.status_kurzbz = 'Interessent' + AND + tbl_prestudentstatus.studiensemester_kurzbz = tbl_reihungstest.studiensemester_kurzbz + ORDER BY tbl_reihungstest.datum DESC, tbl_prestudent.priorisierung ASC LIMIT 1 + ) + "; + array_push($parametersArray, $person_id); + array_push($parametersArray, $reihungstest_id); + + $resultRtPerson = $this->execQuery($qry, $parametersArray); + + $ergebnis = 0; + $summeGewicht = 0; + + foreach ($resultRtPerson->retval as $row) + { + $prozent = 0; + if($row->punkte>=$row->maxpunkte) + { + $prozent = 100; + $row->punkte = $row->maxpunkte; + } + else + $prozent = (($row->punkte + $row->offsetpunkte)/($row->maxpunkte + $row->offsetpunkte))*100; + + if($punkte == 'true') + { + if($row->punkte) + { + $ergebnis += $row->punkte; + } + } + else + { + if ($row->punkte) + { + $gew = isset($weightedArray[$row->gebiet_id]) ? $weightedArray[$row->gebiet_id] : 1; + $ergebnis += $prozent * $gew; + $summeGewicht += $gew; + } + } + } + $return = $summeGewicht > 0 + ? number_format($ergebnis/$summeGewicht, 4, '.', '') + : number_format($ergebnis, 4, '.', ''); + + return $return; } - public function getReihungstestsPs($prestudent_id) + /** + * returns Reihungstests for given studyplans and include_ids + * + * @param Array $studienplan_arr array of studienplaene + * @param Array $include_ids array of include_ids + * @return Array List of Reihungstests + */ + public function getReihungstestByStudyPlanAndIds($studienplan_arr, $include_ids = null) { - $query = ' - SELECT * FROM public.tbl_reihungstest - JOIN public.tbl_studiengang ON tbl_reihungstest.studiengang_kz = tbl_studiengang.studiengang_kz - JOIN lehre.tbl_studienplan sp USING(studienplan_id) - JOIN lehre.tbl_studienordnung so USING(studienordnung_id) - ORDER BY datum DESC, uhrzeit - '; + $studienplan_ids_string = implode(',', $studienplan_arr); + $studienplan_arr = explode(',', $studienplan_ids_string); - return $this->execQuery($query); + $parametersArray = array($studienplan_arr); + + $qry = " + SELECT + distinct a.*, + CASE EXTRACT(DOW FROM a.datum) + WHEN 0 THEN 'So' + WHEN 1 THEN 'Mo' + WHEN 2 THEN 'Di' + WHEN 3 THEN 'Mi' + WHEN 4 THEN 'Do' + WHEN 5 THEN 'Fr' + WHEN 6 THEN 'Sa' + END AS wochentag, + sg.kurzbzlang as stg, + ( + SELECT count(*) FROM public.tbl_rt_person + WHERE rt_id = a.reihungstest_id + ) as angemeldete_teilnehmer + FROM + public.tbl_reihungstest a + JOIN public.tbl_rt_studienplan USING(reihungstest_id) + JOIN public.tbl_studiengang sg USING(studiengang_kz) + WHERE studienplan_id IN ?"; + + if($include_ids && is_array($include_ids) && count($include_ids) > 0) + { + $include_ids_string = implode(',', $include_ids); + $include_ids = explode(',', $include_ids_string); + + array_push($parametersArray, $include_ids); + + $qry .= "OR reihungstest_id in ?"; + } + $qry .= "ORDER BY a.datum DESC"; + + return $this->execQuery($qry, $parametersArray); } + /** + * returns Reihungstests for given studyplans and include_ids + * + * @param Integer $studiengang_kz + * @param $include_id optional (here null) + * @return Array List of Reihungstests + */ + public function getZukuenftigeReihungstestStg($studiengang_kz, $include_id = null) + { + $parametersArray = array($studiengang_kz, $studiengang_kz, $include_id); + $qry = " + SELECT *, + CASE EXTRACT(DOW FROM a.datum) + WHEN 0 THEN 'So' + WHEN 1 THEN 'Mo' + WHEN 2 THEN 'Di' + WHEN 3 THEN 'Mi' + WHEN 4 THEN 'Do' + WHEN 5 THEN 'Fr' + WHEN 6 THEN 'Sa' + END AS wochentag, + ( + SELECT count(*) FROM public.tbl_prestudent + WHERE reihungstest_id=a.reihungstest_id + ) as angemeldete_teilnehmer + FROM + ( + SELECT *, '1' as sortierung, + ( + SELECT upper(typ || kurzbz) FROM public.tbl_studiengang + WHERE studiengang_kz=tbl_reihungstest.studiengang_kz + ) as stg + FROM + public.tbl_reihungstest + WHERE + datum>=now()-'1 days'::interval AND studiengang_kz=? + UNION + SELECT *, '2' as sortierung, + ( + SELECT upper(typ || kurzbz) FROM public.tbl_studiengang + WHERE studiengang_kz=tbl_reihungstest.studiengang_kz + ) as stg + FROM + public.tbl_reihungstest + WHERE datum>=now()-'1 days'::interval AND studiengang_kz!=? + UNION + SELECT *, '0' as sortierung, + ( + SELECT upper(typ || kurzbz) FROM public.tbl_studiengang + WHERE studiengang_kz=tbl_reihungstest.studiengang_kz + ) as stg + FROM + public.tbl_reihungstest + WHERE reihungstest_id=? + ORDER BY sortierung, stg, datum + ) a + "; -} \ No newline at end of file + return $this->execQuery($qry, $parametersArray); + } +} diff --git a/application/models/person/Benutzergruppe_model.php b/application/models/person/Benutzergruppe_model.php index fba797641..271402ffe 100644 --- a/application/models/person/Benutzergruppe_model.php +++ b/application/models/person/Benutzergruppe_model.php @@ -33,4 +33,16 @@ class Benutzergruppe_model extends DB_Model $uids = (hasData($res)) ? getData($res) : array(); return $uids; } + + /** + * Laedt die Aufnahmegruppe(n) in Abhängigkeit von User und Studiensemester + * @param uid, gruppe_kurzbz, studiensemester_kurzbz + * @return array + */ + public function loadAufnahmegruppen($uid, $stsem) + { + $query = " + SELECT * FROM tbl_gruppe WHERE aufnahmegruppe=true;"; + return $this->execReadOnlyQuery($query); + } } diff --git a/application/models/testtool/Ablauf_model.php b/application/models/testtool/Ablauf_model.php index 748926658..d6d6ebe74 100644 --- a/application/models/testtool/Ablauf_model.php +++ b/application/models/testtool/Ablauf_model.php @@ -11,4 +11,31 @@ class Ablauf_model extends DB_Model $this->dbTable = 'testtool.tbl_ablauf'; $this->pk = 'ablauf_id'; } + + /** + * Returns Weighting of the respective ranking test areas + * @param $studiengang_kz Studiengang_kz + * @param $semester Integer optional + * @return array of weightings per ranking test areas of given studiengang + */ + public function getAblaufGebieteAndGewichte($studiengang_kz, $semester = null) + { + $parametersArray = array($studiengang_kz); + + $qry = " + SELECT + tbl_ablauf.gebiet_id, tbl_ablauf.gewicht + FROM + testtool.tbl_ablauf + WHERE + tbl_ablauf.studiengang_kz= ?"; + + if($semester) + { + $qry .= " AND semester = ?"; + array_push($parametersArray, $semester); + + } + return $this->execQuery($qry, $parametersArray); + } } diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index c10dc475a..8e4c523d6 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -37,7 +37,10 @@ $configArray = [ //replaced by possibility to hide each formular field via config stv.php #'showZgvDoktor' => !defined('ZGV_DOKTOR_ANZEIGEN') ? false : ZGV_DOKTOR_ANZEIGEN, #'showZgvErfuellt' => !defined('ZGV_ERFUELLT_ANZEIGEN') ? false : ZGV_ERFUELLT_ANZEIGEN - 'showHintKommPrfg' => !defined('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT') ? false : FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT + 'showHintKommPrfg' => !defined('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT') ? false : FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT, + 'showAufnahmegruppen' => !defined('FAS_REIHUNGSTEST_AUFNAHMEGRUPPEN') ? false : FAS_REIHUNGSTEST_AUFNAHMEGRUPPEN, + 'allowUebernahmePunkte' => !defined('FAS_REIHUNGSTEST_PUNKTEUEBERNAHME') ? true : FAS_REIHUNGSTEST_PUNKTEUEBERNAHME, + 'useReihungstestPunkte' => !defined('FAS_REIHUNGSTEST_PUNKTE') ? true : FAS_REIHUNGSTEST_PUNKTE, ]; ?> diff --git a/public/js/api/factory/stv/admissionDates.js b/public/js/api/factory/stv/admissionDates.js index a5b0697da..a6d743276 100644 --- a/public/js/api/factory/stv/admissionDates.js +++ b/public/js/api/factory/stv/admissionDates.js @@ -22,10 +22,10 @@ export default { url: 'api/frontend/v1/stv/aufnahmetermine/getAufnahmetermine/' + person_id, }; }, - getListPlacementTests(){ + getListPlacementTests(prestudent_id){ return { method: 'get', - url: 'api/frontend/v1/stv/aufnahmetermine/getListPlacementTests/', + url: 'api/frontend/v1/stv/aufnahmetermine/getListPlacementTests/' + prestudent_id, }; }, getListStudyPlans(person_id){ @@ -59,6 +59,41 @@ export default { method: 'post', url: 'api/frontend/v1/stv/aufnahmetermine/deleteAufnahmetermin/' + rt_person_id }; - } + }, + loadDataRtPrestudent(prestudent_id){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/loadDataRtPrestudent/' + prestudent_id, + }; + }, + saveDataRtPrestudent(params){ + return { + method: 'post', + url: 'api/frontend/v1/stv/aufnahmetermine/insertOrUpdateDataRtPrestudent/', + params + }; + }, + loadAufnahmegruppen(params){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/loadAufnahmegruppen/', + params + }; + }, + getResultReihungstest(params){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/getResultReihungstest/', + params + }; + }, + loadFutureReihungstests(params){ + return { + method: 'get', + url: 'api/frontend/v1/stv/aufnahmetermine/getZukuenftigeReihungstestStg/', + params + }; + }, + } \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js index 248cfd55c..36340a767 100644 --- a/public/js/components/Stv/Studentenverwaltung.js +++ b/public/js/components/Stv/Studentenverwaltung.js @@ -65,7 +65,10 @@ export default { defaultSemester: this.defaultSemester, $reloadList: () => { this.$refs.stvList.reload(); - } + }, + configShowAufnahmegruppen: this.config.showAufnahmegruppen, + configAllowUebernahmePunkte: this.config.allowUebernahmePunkte, + configUseReihungstestPunkte: this.config.useReihungstestPunkte } }, data() { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js index 4ad8c6002..53ae524e0 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine.js @@ -20,7 +20,7 @@ export default { }, template: `
- +
` }; \ No newline at end of file diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js index 5fe32e885..cf8a47dd3 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Aufnahmetermine/Aufnahmetermine.js @@ -14,10 +14,22 @@ export default { FormInput }, inject: { + allowUebernahmePunkte: { + from: 'configAllowUebernahmePunkte', + default: true + }, + //if true use punkte, false: use percentage + useReihungstestPunkte: { + from: 'configUseReihungstestPunkte', + default: true + }, $reloadList: { from: '$reloadList', required: true }, + cisRoot: { + from: 'cisRoot' + }, }, props: { student: Object @@ -31,9 +43,9 @@ export default { ), ajaxResponse: (url, params, response) => response.data, columns: [ - {title: "rt_id", field: "rt_id"}, - {title: "rt_person_id", field: "rt_person_id"}, - {title: "person_id", field: "person_id"}, + {title: "rt_id", field: "rt_id", visible: false}, + {title: "rt_person_id", field: "rt_person_id", visible: false}, + {title: "person_id", field: "person_id", visible: false}, {title: "datum", field: "datum", formatter: function (cell) { const dateStr = cell.getValue(); @@ -48,7 +60,7 @@ export default { } }, {title: "stufe", field: "stufe"}, - {title: "studiensemester", field: "studiensemester_kurzbz"}, + {title: "studiensemester", field: "studiensemester"}, {title: "anmerkung", field: "anmerkung", visible: false}, {title: "anmeldedatum", field: "anmeldedatum", visible: false, formatter: function (cell) { @@ -64,11 +76,20 @@ export default { } }, {title: "punkte", field: "punkte"}, - {title: "teilgenommen", field: "teilgenommen"}, + { + title: "teilgenommen", field: "teilgenommen", + formatter: "tickCross", + hozAlign: "center", + formatterParams: { + tickElement: '', + crossElement: '' + } + }, {title: "ort", field: "ort", visible: false}, {title: "studienplan", field: "studienplan", visible: false}, {title: "studienplan_id", field: "studienplan_id", visible: false}, - {title: "stg_kuerzel", field: "stg_kuerzel"}, + {title: "stg", field: "studiengangkurzbzlang"}, + {title: "Stg", field: "stg_kuerzel"}, { title: 'Aktionen', field: 'actions', minWidth: 150, // Ensures Action-buttons will be always fully displayed @@ -106,21 +127,77 @@ export default { index: 'aufnahmetermin_id', persistenceID: 'stv-details-table_admission-dates' }, - tabulatorEvents: [], + tabulatorEvents: [ + { + event: 'tableBuilt', + handler: async () => { + await this.$p.loadCategory(['admission', 'global', 'person', 'ui', 'projektarbeitsbeurteilung']); + let cm = this.$refs.table.tabulator.columnManager; + + cm.getColumnByField('rt_id').component.updateDefinition({ + title: this.$p.t('ui', 'reihungstest_id') + }); + cm.getColumnByField('rt_person_id').component.updateDefinition({ + title: this.$p.t('ui', 'reihungstest_person_id') + }); + cm.getColumnByField('person_id').component.updateDefinition({ + title: this.$p.t('person', 'person_id') + }); + cm.getColumnByField('datum').component.updateDefinition({ + title: this.$p.t('global', 'datum') + }); + cm.getColumnByField('stufe').component.updateDefinition({ + title: this.$p.t('admission', 'stufe') + }); + cm.getColumnByField('studiensemester').component.updateDefinition({ + title: this.$p.t('lehre', 'studiensemester') + }); + cm.getColumnByField('anmerkung').component.updateDefinition({ + title: this.$p.t('global', 'anmerkung') + }); + cm.getColumnByField('anmeldedatum').component.updateDefinition({ + title: this.$p.t('admission', 'anmeldedatum') + }); + cm.getColumnByField('punkte').component.updateDefinition({ + title: this.$p.t('exam', 'punkte') + }); + cm.getColumnByField('teilgenommen').component.updateDefinition({ + title: this.$p.t('admission', 'teilgenommen') + }); + cm.getColumnByField('ort').component.updateDefinition({ + title: this.$p.t('person', 'ort') + }); + cm.getColumnByField('studienplan').component.updateDefinition({ + title: this.$p.t('lehre', 'studienplan') + }); + cm.getColumnByField('studienplan_id').component.updateDefinition({ + title: this.$p.t('ui', 'studienplan_id') + }); + cm.getColumnByField('studiengangkurzbzlang').component.updateDefinition({ + title: this.$p.t('projektarbeitsbeurteilung', 'studiengang') + }); + cm.getColumnByField('stg_kuerzel').component.updateDefinition({ + title: this.$p.t('admission', 'stg_kurz') + }); + } + } + ], formData: {}, statusNew: true, listPlacementTests: [], - listStudyPlans: [] + listStudyPlans: [], + filterOnlyFutureTestsSet: false, + filteredPlacementTests: [] } }, methods: { actionNewPlacementTest() { this.resetForm(); this.statusNew = true; + this.formData.anmeldedatum = new Date(); this.$refs.placementTestModal.show(); }, actionEditPlacementTest(rt_person_id) { - console.log("edit Test " + rt_person_id); this.resetForm(); this.statusNew = false; this.loadPlacementTest(rt_person_id); @@ -159,7 +236,6 @@ export default { this.$refs.table.reloadTable(); }, loadPlacementTest(rt_person_id) { - console.log("load Test " + rt_person_id); return this.$api .call(ApiStvAdmissionDates.loadPlacementTest(rt_person_id)) .then(result => { @@ -185,7 +261,6 @@ export default { }); }, deletePlacementTest(rt_person_id) { - console.log("delete Test" + rt_person_id); return this.$api .call(ApiStvAdmissionDates.deletePlacementTest(rt_person_id)) .then(response => { @@ -196,30 +271,72 @@ export default { this.reload(); }); }, - resetForm() { - console.log("resetForm"); - this.formData = {}; - /* + getResultReihungstest(reihungstest_id){ + const paramsRt = { + reihungstest_id: reihungstest_id, + person_id: this.student.person_id, + punkte: this.useReihungstestPunkte, + studiengang_kz: this.student.studiengang_kz + }; - this.formData.von = new Date(); - this.formData.bis = new Date(); - this.formData.mobilitaetsprogramm_code = 7; - this.formData.nation_code = 'A'; - this.formData.herkunftsland_code = 'A'; - this.formData.rt_id = null; - this.formData.localPurposes = []; - this.formData.localSupports = []; - this.formData.lehrveranstaltung_id = '', - this.formData.lehreinheit_id = '', - this.statusNew = true; - this.listLes = [];*/ + return this.$api + .call(ApiStvAdmissionDates.getResultReihungstest(paramsRt)) + .then(response => { + this.formData.punkte = response.data; + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { + this.reload(); + }); + }, + loadFutureReihungstests(){ + const arrayReihungstestIds = this.listPlacementTests.map(item => item.reihungstest_id); + const paramsRt = { + studiengang_kz: this.student.studiengang_kz, + arrayReihungstestIds : arrayReihungstestIds + }; + + return this.$api + .call(ApiStvAdmissionDates.loadFutureReihungstests(paramsRt)) + .then(response => { + this.filteredPlacementTests = response.data; + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'filterOnlyFutureActive')); + this.$refs.filterButton.className = 'btn btn-secondary w-100'; + this.$refs.filterButton.title = this.$p.t('ui', 'alleAnzeigen'); + }) + .catch(this.$fhcAlert.handleSystemError) + .finally(() => { + this.reload(); + }); + }, + toggleFilter(){ + this.filterOnlyFutureTestsSet = !this.filterOnlyFutureTestsSet; + + if(this.filterOnlyFutureTestsSet) { + this.loadFutureReihungstests(); + } + else + { + this.filteredPlacementTests = this.listPlacementTests; + this.$refs.filterButton.className = 'btn btn-outline-secondary w-100'; + this.$refs.filterButton.title = this.$p.t('admission', 'loadZukuenftigeRT');} + }, + openAdministrationPlacementTest(reihungstest_id){ + let link = this.cisRoot + 'vilesci/stammdaten/reihungstestverwaltung.php'; + if(reihungstest_id){ + link += '?reihungstest_id=' + reihungstest_id; + } + window.open(link, '_blank'); + }, + resetForm() { + this.formData = {}; }, }, created() { this.$api - .call(ApiStvAdmissionDates.getListPlacementTests()) + .call(ApiStvAdmissionDates.getListPlacementTests(this.student.prestudent_id)) .then(result => { - this.listPlacementTests = result.data; + this.listPlacementTests = this.filteredPlacementTests = result.data; }) .catch(this.$fhcAlert.handleSystemError); @@ -232,7 +349,7 @@ export default { }, template: `
-

Allgemein

+

{{$p.t('admission', 'allgemein')}}

- {{formData}} - - - - - - +