From dcb001e0d9b510d2c25bcd702c600b093d988c5f Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 19 Jul 2024 07:52:52 +0200 Subject: [PATCH] rename addNewStatus to changeStatus --- .../api/frontend/v1/stv/Status.php | 6 +- .../Details/Prestudent/MultiStatus.js | 57 ++++++++++--------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index a55b3f19d..8d7a9df20 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -12,7 +12,7 @@ class Status extends FHCAPI_Controller parent::__construct([ 'getHistoryPrestudent' => ['admin:r', 'assistenz:r'], 'insert' => ['admin:rw', 'assistenz:rw'], - 'addNewStatus' => ['admin:r', 'assistenz:r', 'student/keine_studstatuspruefung'], + 'changeStatus' => ['admin:r', 'assistenz:r', 'student/keine_studstatuspruefung'], //'turnIntoStudent' => ['admin:r', 'assistenz:r', 'student/keine_studstatuspruefung'], 'addStudent' => ['admin:r', 'assistenz:r', 'student/keine_studstatuspruefung'], 'getStatusgruende' => self::PERM_LOGGED, @@ -201,7 +201,7 @@ class Status extends FHCAPI_Controller return $this->terminateWithSuccess($result); } - public function addNewStatus($prestudent_id) + public function changeStatus($prestudent_id) { //get Studiengang von prestudent_id $this->load->model('crm/Prestudent_model', 'PrestudentModel'); @@ -780,7 +780,7 @@ class Status extends FHCAPI_Controller // } // else - // return $this->terminateWithError("addNewStatus(student)", self::ERROR_TYPE_GENERAL); + // return $this->terminateWithError("changeStatus(student)", self::ERROR_TYPE_GENERAL); // } public function addStudent($prestudent_id) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js index 09a132809..0b44431a5 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/MultiStatus.js @@ -413,51 +413,55 @@ export default{ }, changeStatusToAbbrecherStgl(prestudentIds){ this.hideModal('confirmStatusAction'); + let def_date = this.getDefaultDate(); let abbruchData = { status_kurzbz: 'Abbrecher', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate(), + datum: def_date, + bestaetigtam: def_date, statusgrund_id: 17 }; console.log(this.updateData); this.newArray = this.updateData.map(objekt => ({ ...objekt, ...abbruchData })); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToAbbrecherStud(prestudentIds){ this.hideModal('confirmStatusAction'); + let def_date = this.getDefaultDate(); let deltaData = { status_kurzbz: 'Abbrecher', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate(), + datum: def_date, + bestaetigtam: def_date, statusgrund_id: 18 }; this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData })); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToUnterbrecher(prestudentIds){ this.hideModal('confirmStatusAction'); + let def_date = this.getDefaultDate(); let deltaData = { status_kurzbz: 'Unterbrecher', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate() + datum: def_date, + bestaetigtam: def_date }; this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData })); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToStudent(prestudentIds){ + let def_date = this.getDefaultDate(); //TODO Manu validation if Bewerber already before asking for ausbildungssemester //this.checkIfBewerber(); this.hideModal('askForAusbildungssemester'); let deltaData = { status_kurzbz: 'Student', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate() + datum: def_date, + bestaetigtam: def_date }; this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData, ausbildungssemester: this.actionSem})); @@ -466,40 +470,41 @@ export default{ }, changeStatusToWiederholer(prestudentIds){ this.hideModal('askForAusbildungssemester'); + let def_date = this.getDefaultDate(); let deltaData = { status_kurzbz: 'Student', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate(), + datum: def_date, + bestaetigtam: def_date, statusgrund_id: 16 }; this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData, ausbildungssemester: this.actionSem})); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToDiplomand(prestudentIds){ - + let def_date = this.getDefaultDate(); let deltaData = { status_kurzbz: 'Diplomand', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate(), + datum: def_date, + bestaetigtam: def_date, }; this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData})); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToAbsolvent(prestudentIds){ - + let def_date = this.getDefaultDate(); let deltaData = { status_kurzbz: 'Absolvent', - datum: this.getDefaultDate(), - bestaetigtam: this.getDefaultDate(), + datum: def_date, + bestaetigtam: def_date, }; this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData})); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToBewerber(prestudentIds){ let def_date = this.getDefaultDate(); @@ -514,7 +519,7 @@ export default{ this.newArray = this.updateData.map(objekt => ({ ...objekt, ...deltaData})); - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeStatusToAufgenommener(prestudentIds){ this.hideModal('confirmStatusAction'); @@ -533,7 +538,7 @@ export default{ //TODO(Manu) change studiensemester_kurzbz in backend //studiensemester_kurzbz: this.getStudiensemesterOfBewerber(objekt.prestudent_id) - this.addNewStatus(prestudentIds); + this.changeStatus(prestudentIds); }, changeInteressentToStudent(prestudentIds){ @@ -631,7 +636,7 @@ export default{ }) .catch(this.$fhcAlert.handleSystemError); }, - addNewStatus(prestudentIds){ + changeStatus(prestudentIds){ //Array.isArray(prestudentIds) ? this.modelValue.prestudent_id : [prestudentIds]; let changeData = {}; @@ -646,7 +651,7 @@ export default{ //TODO(manu) besserer check changeData = this.statusData.status_kurzbz ? this.statusData : this.newArray.find(item => item.prestudent_id === prestudentId); - return this.$fhcApi.post('api/frontend/v1/stv/status/addNewStatus/' + prestudentId, + return this.$fhcApi.post('api/frontend/v1/stv/status/changeStatus/' + prestudentId, changeData ).then(response => { countSuccess++;