From 77e31f2da6421164c7efd60021b38304e0649079 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 29 Feb 2024 10:58:45 +0100 Subject: [PATCH 01/12] Delete Prestudent --- .../controllers/components/stv/Status.php | 94 ++++++++++++++----- application/models/crm/Prestudent_model.php | 4 +- .../models/crm/Prestudentstatus_model.php | 14 ++- application/models/crm/Student_model.php | 2 +- .../Studentenverwaltung/Details/Prestudent.js | 1 + .../Details/Prestudent/Status.js | 14 +-- 6 files changed, 90 insertions(+), 39 deletions(-) diff --git a/application/controllers/components/stv/Status.php b/application/controllers/components/stv/Status.php index 1618a3d52..fa1ec9295 100644 --- a/application/controllers/components/stv/Status.php +++ b/application/controllers/components/stv/Status.php @@ -111,7 +111,14 @@ class Status extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson(getError($result)); } - $lastStatusData = current(getData($result)); + elseif(!hasData($result)) + { + $lastStatusData = []; +/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson("donn holt nittan");*/ + } + else + $lastStatusData = current(getData($result)); //var_dump($lastStatusData); //Different handling depending on newStatus @@ -214,7 +221,7 @@ class Status extends FHC_Controller } } - //TODO(Manu) permission not working here... + //TODO(Manu) check permission... $hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung'); /* var_dump($hasPermissionToSkipStatusCheck); @@ -309,8 +316,9 @@ class Status extends FHC_Controller $status_kurzbz = $this->input->post('status_kurzbz'); $ausbildungssemester = $this->input->post('ausbildungssemester'); $studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz'); + $deletePrestudent = false; - //TODO(Manu) check: warum sind beim Löschen andere Berechtigungen? + //TODO(Manu) check permissions: warum sind beim Löschen andere Berechtigungen? //ich darf keine Stati anlegen, aber löschen, wenn mehr als einer übrig??? /* $granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz'); $granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin'); @@ -346,22 +354,28 @@ class Status extends FHC_Controller } - if(!$isBerechtigtAdmin && !$isBerechtigtNoStudstatusCheck) + //check if last status + $result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id); + if (isError($result)) { - //check if last status - $result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id); - if (isError($result)) - { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson($result); - } - if($result->retval == "1") + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result); + } + if($result->retval == "1") + { + //Berechtigungen nach Check prüfen! + if(!$isBerechtigtAdmin && !$isBerechtigtNoStudstatusCheck) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson($result->code); } + else + { + $deletePrestudent = true; + } } + //TODO(manu) $this->db->trans_start(false); and rollback? //Delete Status $result = $this->PrestudentstatusModel->delete( array( @@ -376,29 +390,31 @@ class Status extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); $this->outputJson($result); } - elseif(!hasData($result)) { + if(!hasData($result)) { $this->outputJson($result); } - //return $this->outputJsonSuccess(current(getData($result))); - // Delete Studentlehrverband if no Status left + //Delete Studentlehrverband if no Status left $result = $this->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz); - if(isError($result)) - { + if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson(getError($result)); } - if(!hasData($result)) + if (!hasData($result)) { //get student_uid $this->load->model('crm/Student_model', 'StudentModel'); $result = $this->StudentModel->checkIfUid($prestudent_id); - if(isError($result)) + if (isError($result)) { $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson(getError($result)); } + if (!hasData($result)) + { + $this->outputJson($result); + } $student_uid = $result->retval; $this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel'); @@ -413,16 +429,42 @@ class Status extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); $this->outputJson("Fehler beim Löschen der Lehrverbandszuordnung"); } - if(!hasData($result)) { + if (!hasData($result)) + { + $this->outputJson($result); + var_dump("no data2"); + } + $this->outputJsonSuccess(true); + + } + + //Delete Prestudent if no data is left + if($deletePrestudent) + { + //TODO(manu) check all connected tables and delete them + //es wird noch auf prestudent_dokumentprestudent verwiesen + //löschen zuerst von Doks + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + $result = $this->PrestudentModel->delete( + array( + 'prestudent_id' => $prestudent_id + ) + ); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); $this->outputJson($result); } - return $this->outputJsonSuccess(true); + if(!hasData($result)) + { + $this->outputJson($result); + } + $this->outputJson($result); + + } - //TODO(manu) $this->db->trans_start(false); and rollback? - //TODO(manu) ganzen Prestudenten löschen, wenn kein Eintrag mehr + return $this->outputJsonSuccess(true); - - } public function updateStatus($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester) @@ -498,7 +540,7 @@ class Status extends FHC_Controller } } - //TODO(Manu) permission not working here... + //TODO(Manu) check permissions $hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung'); /* var_dump($hasPermissionToSkipStatusCheck); diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 08653c481..1938e661a 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -743,7 +743,7 @@ class Prestudent_model extends DB_Model { return getData($result); } - if($result->retval != "0") + if($result->retval == "0") //wenn kein studentlehrband eingetragen { $query = " SELECT @@ -782,7 +782,7 @@ class Prestudent_model extends DB_Model { $query = " SELECT - ps.status_kurzbz2, + ps.status_kurzbz, ps.studiensemester_kurzbz, ps.ausbildungssemester, CASE WHEN ps.status_kurzbz IN ('Student', 'Diplomand') THEN CONCAT(lv.semester, lv.verband, lv.gruppe) END AS lehrverband, diff --git a/application/models/crm/Prestudentstatus_model.php b/application/models/crm/Prestudentstatus_model.php index e824ebaf3..593a13452 100644 --- a/application/models/crm/Prestudentstatus_model.php +++ b/application/models/crm/Prestudentstatus_model.php @@ -504,13 +504,19 @@ class Prestudentstatus_model extends DB_Model $new_status_semesterstart = $studiensemester->start; //get all prestudentstati + //TODO(manu) errorlogic $resultPs = $this->getAllPrestudentstatiWithStudiensemester($prestudent_id); if (isError($resultPs)) { - $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson(getError($resultPs)); + $resultArr = []; } - $resultArr = $resultPs->retval; + if(!hasData($resultPs)) + { + $resultArr = []; + } + else + $resultArr = $resultPs->retval; + $statusArr = array(); $newStatusInserted = false; @@ -625,7 +631,7 @@ class Prestudentstatus_model extends DB_Model return error($result); } if (!hasData($result)) { - return error('No Statusdata vorhanden'); + return success("0",'No Statusdata vorhanden'); } return $result; diff --git a/application/models/crm/Student_model.php b/application/models/crm/Student_model.php index 9ccaff1a4..364524df9 100644 --- a/application/models/crm/Student_model.php +++ b/application/models/crm/Student_model.php @@ -82,7 +82,7 @@ class Student_model extends DB_Model if(isError($result)) { - return error("0", "Error while checking student_uid"); + return error( "Error while checking student_uid"); } if (!hasData($result)) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index aaab14983..7f3517ee9 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -198,6 +198,7 @@ export default {
+
diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 1d83db1b1..4969d9b55 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -200,11 +200,13 @@ export default{ actionConfirmStatus(status, stdsem, ausbildungssemester){ console.log("Action: Status bestätigen: (" + status + ": " + stdsem + "/" + ausbildungssemester + ")") //this.$refs.deleteStatusModal.show(); - - /* this.loadStatus(status_id).then(() => { - if(this.statusData.bankverbindung_id) - this.$refs.deleteStatusModal.show(); - });*/ + this.statusId = { + 'prestudent_id': this.prestudent_id, + 'status_kurzbz': status, + 'studiensemester_kurzbz': stdsem, + 'ausbildungssemester': ausbildungssemester + }; + console.log(this.statusId); }, addNewStatus(){ CoreRESTClient.post('components/stv/Status/addNewStatus/' + this.prestudent_id, @@ -590,7 +592,7 @@ export default{ type="select" name="studiensemester_kurzbz" v-model="statusData['studiensemester_kurzbz']" - > + >
From b98794a292daa684352d24bd05875c78ab0c55a2 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 4 Mar 2024 08:40:08 +0100 Subject: [PATCH 02/12] fix bug Validierung checkifExistingStudentRolle --- application/controllers/components/stv/Status.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/controllers/components/stv/Status.php b/application/controllers/components/stv/Status.php index fa1ec9295..4c5770779 100644 --- a/application/controllers/components/stv/Status.php +++ b/application/controllers/components/stv/Status.php @@ -219,6 +219,11 @@ class Status extends FHC_Controller $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson(getError($result)); } + if($result->retval == "0") + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result->code); + } } //TODO(Manu) check permission... From a7f1e43225ffc563b18f4dffdc2f9c8b23181334 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 4 Mar 2024 10:10:35 +0100 Subject: [PATCH 03/12] Status als eigener Tab --- .../controllers/components/stv/Config.php | 4 ++++ application/models/crm/Student_model.php | 3 ++- .../Studentenverwaltung/Details/Prestudent.js | 17 +++++------------ .../Details/Prestudent/Status.js | 2 +- .../Stv/Studentenverwaltung/Details/Status.js | 18 ++++++++++++++++++ 5 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 public/js/components/Stv/Studentenverwaltung/Details/Status.js diff --git a/application/controllers/components/stv/Config.php b/application/controllers/components/stv/Config.php index 5c6b52c9c..47842822c 100644 --- a/application/controllers/components/stv/Config.php +++ b/application/controllers/components/stv/Config.php @@ -31,6 +31,10 @@ class Config extends FHC_Controller 'title' => 'PreStudentIn', 'component' => './Stv/Studentenverwaltung/Details/Prestudent.js' ]; + $result['status'] = [ + 'title' => 'Status', + 'component' => './Stv/Studentenverwaltung/Details/Status.js' + ]; $result['noten'] = [ 'title' => 'Noten', 'component' => './Stv/Studentenverwaltung/Details/Noten.js' diff --git a/application/models/crm/Student_model.php b/application/models/crm/Student_model.php index 364524df9..e6df423d4 100644 --- a/application/models/crm/Student_model.php +++ b/application/models/crm/Student_model.php @@ -143,7 +143,8 @@ class Student_model extends DB_Model { return error($result); } - else { + else + { $resultObject = current(getData($result)); if (property_exists($resultObject, 'anzahl')) { diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index 7f3517ee9..6f067795c 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -554,24 +554,17 @@ export default {
- - -
- Status - -
- -
-
Gesamthistorie
+ + - - - ` diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 4969d9b55..97e47dfa1 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -356,7 +356,7 @@ export default{ }) .catch(this.$fhcAlert.handleSystemError); CoreRESTClient - .get('components/stv/Prestudent/getStudienplaene/' + this.prestudent_id) + .get('components/stv/Prestudent/getStudienplaene/' + this.modelValue.prestudent_id) .then(result => CoreRESTClient.getData(result.data) || []) .then(result => { this.listStudienplaene = result; diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Status.js new file mode 100644 index 000000000..b7ecc556d --- /dev/null +++ b/public/js/components/Stv/Studentenverwaltung/Details/Status.js @@ -0,0 +1,18 @@ +import TblStatus from "./Prestudent/Status.js"; + +export default { + components: { + TblStatus + }, + props: { + modelValue: Object, + }, + template: ` +
+
+ Status + +
+
+ ` +} \ No newline at end of file From caac612a0d4247c7ce3155b0c97472dc010f7c6b Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 4 Mar 2024 15:45:54 +0100 Subject: [PATCH 04/12] confirm status and add transactions --- .../controllers/components/stv/Status.php | 145 ++++++++++++++++-- .../Studentenverwaltung/Details/Prestudent.js | 6 +- .../Details/Prestudent/Status.js | 52 ++++--- 3 files changed, 164 insertions(+), 39 deletions(-) diff --git a/application/controllers/components/stv/Status.php b/application/controllers/components/stv/Status.php index 4c5770779..d29c32982 100644 --- a/application/controllers/components/stv/Status.php +++ b/application/controllers/components/stv/Status.php @@ -100,9 +100,6 @@ class Status extends FHC_Controller $rt_stufe = $this->input->post('rt_stufe'); $bestaetigtvon = $uid; - // Start DB transaction - //$this->db->trans_start(false); - //GET lastStatus $result = $this->PrestudentstatusModel->getLastStatus($prestudent_id); @@ -114,12 +111,9 @@ class Status extends FHC_Controller elseif(!hasData($result)) { $lastStatusData = []; -/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson("donn holt nittan");*/ } else $lastStatusData = current(getData($result)); - //var_dump($lastStatusData); //Different handling depending on newStatus if($status_kurzbz == 'Absolvent' || $status_kurzbz == 'Diplomand') @@ -251,6 +245,9 @@ class Status extends FHC_Controller } } + // Start DB transaction + $this->db->trans_start(false); + $result = $this->PrestudentstatusModel->insert( [ 'prestudent_id' => $prestudent_id, @@ -269,13 +266,21 @@ class Status extends FHC_Controller 'rt_stufe' => $rt_stufe ] ); - if (isError($result)) + + // Transaction complete! + $this->db->trans_complete(); + + if ($this->db->trans_status() === false || isError($result)) { + $this->db->trans_rollback(); $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson(getError($result)); } - - return $this->outputJsonSuccess(true); + else + { + $this->db->trans_commit(); + return $this->outputJsonSuccess(true); + } } public function loadStatus() @@ -380,6 +385,9 @@ class Status extends FHC_Controller } } + // Start DB transaction + $this->db->trans_start(false); + //TODO(manu) $this->db->trans_start(false); and rollback? //Delete Status $result = $this->PrestudentstatusModel->delete( @@ -390,15 +398,22 @@ class Status extends FHC_Controller 'studiensemester_kurzbz' => $studiensemester_kurzbz ) ); - if (isError($result)) + + // Transaction complete! + $this->db->trans_complete(); + + if ( $this->db->trans_status() === false || isError($result)) { + $this->db->trans_rollback(); $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $this->outputJson($result); + return $this->outputJson($result); } if(!hasData($result)) { $this->outputJson($result); } + $this->db->trans_commit(); + //Delete Studentlehrverband if no Status left $result = $this->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz); @@ -706,6 +721,9 @@ class Status extends FHC_Controller } } + // Start DB transaction + $this->db->trans_start(false); + //insert prestudentstatus $uid = getAuthUID(); $result = $this->PrestudentstatusModel->insert( @@ -721,14 +739,17 @@ class Status extends FHC_Controller 'studienplan_id' => $statusData->studienplan_id, 'datum' => date('c'), 'anmerkung' => $statusData->anmerkung - ] ); - if (isError($result)) + + // Transaction complete! + $this->db->trans_complete(); + + if ($this->db->trans_status() === false || isError($result)) { + $this->db->trans_rollback(); $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - //return $this->outputJson(getError($result)); - return $this->outputJson("DEBUG: in insert Funktion"); + return $this->outputJson(getError($result)); } //Studentlehrverband anlegen @@ -778,13 +799,105 @@ class Status extends FHC_Controller ]); if (isError($result)) { + $this->db->trans_rollback(); $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); return $this->outputJson("Error in insert Studentlehrverband"); } } + $this->db->trans_commit(); + return $this->outputJsonSuccess(true); + } + + public function confirmStatus($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester) + { + $uid = getAuthUID(); + //TODO(Manu) check: Annahme, dass hier immer suid bei Berechtigung STG vergeben wird! + $granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz') ? $this->permissionlib->getSTG_isEntitledFor('assistenz') : []; + $granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin') ? $this->permissionlib->getSTG_isEntitledFor('admin') : []; + $granted = array_merge($granted_Ass, $granted_Adm); + + //get Studiengang von prestudent_id + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + $result = $this->PrestudentModel->load([ + 'prestudent_id'=> $key_prestudent_id, + ]); + if(isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + $result = current(getData($result)); + + $stg = $result->studiengang_kz; + + if(!in_array($stg, $granted)){ + $result = "Sie haben keine Schreibrechte fuer diesen Studiengang!"; + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result); + } + + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + + $result = $this->PrestudentstatusModel->loadWhere( + array( + 'prestudent_id' => $key_prestudent_id, + 'status_kurzbz' => $key_status_kurzbz, + 'ausbildungssemester' => $key_ausbildungssemester, + 'studiensemester_kurzbz' => $key_studiensemester_kurzbz + ) + ); + + if (isError($result)) { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->outputJson($result); + } + + elseif (!hasData($result)) { + $this->outputJson($result); + } + else + { + $statusData = current(getData($result)); + } + + //check if Status is unconfirmed.. TODO(manu) check further conditions? Status < Student + if($statusData->bestaetigtam != NULL) + { + $result = "Der Status ist bereits bestätigt!"; + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result); + } + + //check if Bewerbung abgeschickt + if($statusData->bewerbung_abgeschicktamum == NULL) + { + $result = "Die Bewerbung wurde noch nicht abgeschickt und kann deshalb nicht bestaetigt werden!"; + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result); + } + + $result = $this->PrestudentstatusModel->update( + [ + 'prestudent_id' => $key_prestudent_id, + 'status_kurzbz' => $key_status_kurzbz, + 'studiensemester_kurzbz' => $key_studiensemester_kurzbz, + 'ausbildungssemester' => $key_ausbildungssemester, + ], + [ + 'bestaetigtam' => date('c'), + 'bestaetigtvon' => $uid + ] + ); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson(getError($result)); + } + if (!hasData($result)) { + return error('No Statusdata vorhanden'); + } return $this->outputJsonSuccess(true); } - } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index 6f067795c..c4015114d 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -111,8 +111,6 @@ export default { } });*/ - - }, detectChanges() { const delta = {}; @@ -537,7 +535,7 @@ export default { -
+ diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 97e47dfa1..03effa24b 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -206,7 +206,10 @@ export default{ 'studiensemester_kurzbz': stdsem, 'ausbildungssemester': ausbildungssemester }; - console.log(this.statusId); + this.loadStatus(this.statusId).then(() => { + if(this.statusData) + this.confirmStatus(this.statusId); + }); }, addNewStatus(){ CoreRESTClient.post('components/stv/Status/addNewStatus/' + this.prestudent_id, @@ -260,6 +263,33 @@ export default{ this.reload(); }); }, + confirmStatus(statusId){ + return CoreRESTClient.post('components/stv/Status/confirmStatus/' + + this.statusId.prestudent_id + '/' + + this.statusId.status_kurzbz + '/' + + this.statusId.studiensemester_kurzbz + '/' + + this.statusId.ausbildungssemester) + .then( + result => { + if(!result.data.error) { + this.$fhcAlert.alertSuccess('Bestätigung Status erfolgreich'); + } + else + { + const errorData = result.data.retval; + this.$fhcAlert.alertError('Kein Status mit Id ' + status_id + ' gefunden'); + } + /* return result;*/ + }).catch(error => { + if (error.response) { + console.log(error.response); + this.$fhcAlert.alertError(error.response.data); + } + }).finally(() => { + window.scrollTo(0, 0); + this.reload(); + }); + }, deleteStatus(status_id){ return CoreRESTClient.post('components/stv/Status/deleteStatus/', status_id) @@ -356,7 +386,7 @@ export default{ }) .catch(this.$fhcAlert.handleSystemError); CoreRESTClient - .get('components/stv/Prestudent/getStudienplaene/' + this.modelValue.prestudent_id) + .get('components/stv/Prestudent/getStudienplaene/' + this.prestudent_id) .then(result => CoreRESTClient.getData(result.data) || []) .then(result => { this.listStudienplaene = result; @@ -388,7 +418,6 @@ export default{ - @@ -428,7 +457,7 @@ export default{
- +
@@ -729,21 +758,6 @@ export default{

Prestudentstatus {{statusData.status_kurzbz}} (id: {{statusData.prestudent_id}} / {{statusData.studiensemester_kurzbz}}) im {{statusData.ausbildungssemester}}. Ausbildungssemester wirklich löschen?

- - From 861f8a728873f4f6124c76d9190663bb7ed19eae Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 5 Mar 2024 08:47:45 +0100 Subject: [PATCH 05/12] Prestudent: Button Save inactive, if there are changes --- .../Studentenverwaltung/Details/Prestudent.js | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index c4015114d..9407355cd 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -56,13 +56,32 @@ export default { listStgTyp: [], listFoerderrelevant: [], initialFormData: {}, - deltaArray: [], - actionUpdate: false, + deltaArray: {}, + actionUpdate: false }; }, computed: { + deltaLength() { + return Object.keys(this.deltaArray).length; + } }, watch: { + data: { + // TODO(chris): use @input instead? + handler(n) { + + const delta = {}; + for (const key in this.data) { + if (this.data[key] !== this.initialFormData[key]) { + delta[key] = this.data[key]; + this.actionUpdate = true; + } + } + //this.deltaArray.push(delta); + this.deltaArray = delta; + }, + deep: true + } }, methods: { @@ -78,13 +97,6 @@ export default { .catch(this.$fhcAlert.handleSystemError); }, updatePrestudent(){ - this.detectChanges(); - -/* this.$nextTick(() => { - - if (this.actionUpdate) { - console.log("Action");*/ - //todo(manu) checken, ob überhaupt eine Änderung vorgenommen wurde CoreRESTClient.post('components/stv/Prestudent/updatePrestudent/' + this.modelValue.prestudent_id, this.deltaArray ).then(response => { @@ -105,14 +117,9 @@ export default { }).finally(() => { window.scrollTo(0, 0); }); - -/* } else { - console.log("no action"); - } - });*/ - }, - detectChanges() { +/* //besser im watch teil, dann wird Änderung immer verfolgt +detectChanges() { const delta = {}; for (const key in this.data) { if (this.data[key] !== this.initialFormData[key]) { @@ -121,7 +128,7 @@ export default { } } this.deltaArray.push(delta); - }, + },*/ }, created() { this.loadPrestudent(); @@ -196,13 +203,11 @@ export default {
- - +
-
Zugangsvoraussetzungen für {{modelValue.nachname}} {{modelValue.vorname}} - +
- -
+ +
Gesamthistorie
From 35bf6a2efd592972dbc1641d5f8830f2933448b4 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 5 Mar 2024 09:31:50 +0100 Subject: [PATCH 06/12] Tab Status: show Dropdown Statusgruende only if exisiting --- .../Details/Prestudent/Status.js | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 03effa24b..450ca6283 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -127,13 +127,26 @@ export default{ listStudienplaene: [], aufnahmestufen: {'': '-- keine Auswahl --', 1: 1, 2: 2, 3: 3}, listStatusgruende: [], - statusId: {} + statusId: {}, + gruendeLength: {} } }, computed: { gruende() { return this.listStatusgruende.filter(grund => grund.status_kurzbz == this.statusData.status_kurzbz); }, +/* gruendeLength() { + //return Object.keys(this.gruende).length; + return 33; + }*/ + }, + watch: { + data: { + handler(n) { + const start = this.status_kurzbz; + }, + deep: true + } }, methods: { actionNewStatus() { @@ -407,6 +420,9 @@ export default{

TestData

{{statusData}}
+ {{gruende}} + {{gruendeLength}} + -
+ +
- @@ -728,8 +742,7 @@ export default{
- -
+
Date: Tue, 5 Mar 2024 10:34:01 +0100 Subject: [PATCH 07/12] css --- public/css/Tabulator5.css | 8 +++++++- .../Details/Prestudent/Status.js | 15 --------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/public/css/Tabulator5.css b/public/css/Tabulator5.css index 2c7fa9117..c5e0b6486 100644 --- a/public/css/Tabulator5.css +++ b/public/css/Tabulator5.css @@ -1,4 +1,4 @@ -@import '../../vendor/olifolkerd/tabulator5/dist/css/tabulator_bootstrap5.min.css'; +@import '../../vendor/olifolkerd/tabulator5/dist/css/tabulator_simple.min.css'; /* Apply borders and background to Cell instead of the Row * otherwise frozen columns won't look good (columns behind @@ -38,6 +38,12 @@ .tabulator .tabulator-col-resize-handle:last-of-type { z-index: 999999; } +.tabulator-cell .btn { + padding: 0 .5rem; + max-height: 22px; + min-width: 30px; +} + .tabulator { font-size: 1rem; } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 450ca6283..3b7c5a341 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -135,18 +135,6 @@ export default{ gruende() { return this.listStatusgruende.filter(grund => grund.status_kurzbz == this.statusData.status_kurzbz); }, -/* gruendeLength() { - //return Object.keys(this.gruende).length; - return 33; - }*/ - }, - watch: { - data: { - handler(n) { - const start = this.status_kurzbz; - }, - deep: true - } }, methods: { actionNewStatus() { @@ -419,9 +407,6 @@ export default{

TestData

{{statusData}} -
- {{gruende}} - {{gruendeLength}}