From 92319b9b291af5b362a01f1d0b342efd758d1441 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 3 Jun 2024 10:27:03 +0200 Subject: [PATCH 01/22] quick fix for overlapping dashboard elements on mobile phones --- public/css/components/dashboard.css | 2 +- public/js/components/Dashboard/Section.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/css/components/dashboard.css b/public/css/components/dashboard.css index b6ad81d2d..9da199442 100755 --- a/public/css/components/dashboard.css +++ b/public/css/components/dashboard.css @@ -19,7 +19,7 @@ } @media(max-width: 577px) { :root { - --fhc-dashboard-grid-size: 2; + --fhc-dashboard-grid-size: 1; } } diff --git a/public/js/components/Dashboard/Section.js b/public/js/components/Dashboard/Section.js index e48b580ed..4aa7c823f 100755 --- a/public/js/components/Dashboard/Section.js +++ b/public/js/components/Dashboard/Section.js @@ -32,7 +32,7 @@ export default { computed: { items() { return this.widgets.map(item => { - return {...item, ...(item.place[this.gridWidth] || {})}; + return {...item, ...(item.place[this.gridWidth] || {h: 1, w:1, x:0, y:0})}; }); } }, From 204de3045916793bbf2949ef5c369f91b47d1583 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 3 Jun 2024 10:46:26 +0200 Subject: [PATCH 02/22] make news modal more responsive --- public/js/components/DashboardWidget/News.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/components/DashboardWidget/News.js b/public/js/components/DashboardWidget/News.js index 830af955e..6f862d085 100755 --- a/public/js/components/DashboardWidget/News.js +++ b/public/js/components/DashboardWidget/News.js @@ -101,7 +101,7 @@ export default { - - - -
- -
-
{{$p.t('person','ort')}}*
- - -
-
-
-
-
{{$p.t('person','plz')}}*
- - - -
-
-
- -
-
{{$p.t('person','gemeinde')}}*
- -
-
-
-
-
{{$p.t('person','nation')}}*
- - -
-
- + +
+
+
+ {{$p.t('profilUpdate','zustelladresseWarning')}} +
+
+ + + +
+
+ + +
+
+ + +
+
+
{{$p.t('person','nation')}}*
+ +
+
+ + +
+
+
{{$p.t('person','plz')}}*
+ +
+
+ + +
+
+
{{$p.t('person','gemeinde')}}*
+ +
+
+ + +
+
+
{{$p.t('person','ort')}}*
+ +
+
+ + +
+
+
{{$p.t('person','strasse')}}*
+ +
+
+ + +
+
+
{{$p.t('profilUpdate','kontaktTyp')}}*
+ +
+
+ + + + + + `, }; diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js index 059742c69..ffb0d0fd3 100755 --- a/public/js/components/Cis/Profil/StudentProfil.js +++ b/public/js/components/Cis/Profil/StudentProfil.js @@ -85,6 +85,7 @@ export default { editData: Object, }, methods: { + betriebsmittelTableBuilt: function () { this.$refs.betriebsmittelTable.tabulator.setData(this.data.mittel); }, @@ -181,6 +182,7 @@ export default { created() { //? sorts the profil Updates: pending -> accepted -> rejected this.data.profilUpdates?.sort(this.sortProfilUpdates); + }, @@ -205,6 +207,7 @@ export default {
+ - `:'' + ` + : + `` }
`; @@ -302,7 +304,7 @@ export default { }, methods: { denyProfilUpdate: function (data) { - Vue.$fhcapi.ProfilUpdate.denyProfilRequest(data) + this.$fhcApi.factory.profilUpdate.denyProfilRequest(data) .then((res) => { // block when the request was successful }) @@ -314,7 +316,7 @@ export default { }); }, acceptProfilUpdate: function (data) { - Vue.$fhcapi.ProfilUpdate.acceptProfilRequest(data) + this.$fhcApi.factory.profilUpdate.acceptProfilRequest(data) .then((res) => { // block when the request was successful }) From a06f9b581fe0677f74768c892b6a353f0384f7b5 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 19 Jul 2024 13:11:58 +0200 Subject: [PATCH 15/22] adds selectProfilRequest to the new ProfilUpdate FhcAPIController --- .../api/frontend/v1/ProfilUpdate.php | 19 +++++++++++++++++++ public/js/api/profilUpdate.js | 13 +++++-------- .../Cis/Profil/MitarbeiterProfil.js | 14 ++++++-------- .../js/components/Cis/Profil/StudentProfil.js | 12 ++++++------ 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index 706f2bf29..75e3bf9f0 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -43,6 +43,7 @@ class ProfilUpdate extends FHCAPI_Controller 'getProfilRequestFiles' => self::PERM_LOGGED, 'denyProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'], 'acceptProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'], + 'selectProfilRequest' => self::PERM_LOGGED, ]); @@ -115,6 +116,24 @@ class ProfilUpdate extends FHCAPI_Controller $this->terminateWithSuccess(self::$TOPICS); } + public function selectProfilRequest() + { + + $uid = $this->input->get('uid',true); + $id = $this->input->get('id',true); + $whereClause = ['uid' => $this->uid]; + + if (isset($uid)) + $whereClause['uid'] = $uid; + if (isset($id)) + $whereClause['id'] = $id; + + $res = $this->ProfilUpdateModel->getProfilUpdatesWhere($whereClause); + $res = $this->getDataOrTerminateWithError($res); + $this->terminateWithSuccess($res); + + } + public function getProfilRequestFiles($id) { if(!$id){ diff --git a/public/js/api/profilUpdate.js b/public/js/api/profilUpdate.js index 8d121fa65..ccef2f0b2 100644 --- a/public/js/api/profilUpdate.js +++ b/public/js/api/profilUpdate.js @@ -43,7 +43,7 @@ export default { }, //TODO post request - //? new reuquests + //? new requests insertFile: function (dms, replace = null) { const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + @@ -61,19 +61,16 @@ export default { FHC_JS_DATA_STORAGE_OBJECT.ci_router + `/api/frontend/v1/ProfilUpdate/getProfilRequestFiles/${requestID}`,{}); }, - - search(searchsettings) { - const url = '/api/frontend/v1/searchbar/search'; - return this.$fhcApi.post(url, searchsettings); - }, - selectProfilRequest: function (uid = null, id = null) { return this.$fhcApi.get( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/selectProfilRequest`,{ uid: uid, id: id }); + `/api/frontend/v1/ProfilUpdate/selectProfilRequest`, + {...(uid?{uid}:{}), + ...(id?{id}:{}) + }); }, //TODO post request diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js index 6653c8253..94ae0078f 100755 --- a/public/js/components/Cis/Profil/MitarbeiterProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js @@ -151,17 +151,17 @@ export default { hideEditProfilModal: function () { //? checks the editModal component property result, if the user made a successful request or not if (this.$refs.editModal.result) { - Vue.$fhcapi.ProfilUpdate.selectProfilRequest() + this.$fhcApi.factory.profilUpdate.selectProfilRequest() .then((request) => { - if (!request.error) { + if (!request.error && request) { this.data.profilUpdates = request.data; this.data.profilUpdates.sort(this.sortProfilUpdates); } else { - console.log("Error when fetching profile updates: " + res.data); + console.error("Error when fetching profile updates: " + res.data); } }) .catch((err) => { - console.log(err); + console.error(err); }); } else { // when modal was closed without submitting request @@ -184,8 +184,8 @@ export default { }, fetchProfilUpdates: function () { - Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res) => { - if (!res.error) { + this.$fhcApi.factory.profilUpdate.selectProfilRequest().then((res) => { + if (!res.error && res) { this.data.profilUpdates = res.data?.length ? res.data.sort(this.sortProfilUpdates) : null; @@ -451,8 +451,6 @@ export default {
- - diff --git a/public/js/components/Cis/Profil/StudentProfil.js b/public/js/components/Cis/Profil/StudentProfil.js index ffb0d0fd3..5cf92fd9f 100755 --- a/public/js/components/Cis/Profil/StudentProfil.js +++ b/public/js/components/Cis/Profil/StudentProfil.js @@ -95,8 +95,8 @@ export default { ); }, fetchProfilUpdates: function () { - Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res) => { - if (!res.error) { + this.$fhcApi.factory.profilUpdate.selectProfilRequest().then((res) => { + if (!res.error && res) { this.data.profilUpdates = res.data?.length ? res.data.sort(this.sortProfilUpdates) : null; @@ -107,17 +107,17 @@ export default { hideEditProfilModal: function () { //? checks the editModal component property result, if the user made a successful request or not if (this.$refs.editModal.result) { - Vue.$fhcapi.ProfilUpdate.selectProfilRequest() + this.$fhcApi.factory.profilUpdate.selectProfilRequest() .then((request) => { - if (!request.error) { + if (!request.error && res) { this.data.profilUpdates = request.data; this.data.profilUpdates.sort(this.sortProfilUpdates); } else { - console.log("Error when fetching profile updates: " + res.data); + console.error("Error when fetching profile updates: " + res.data); } }) .catch((err) => { - console.log(err); + console.error(err); }); } else { // when modal was closed without submitting request From 12626511e93da3cd60cc521a0a1501d76cc84b4e Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 19 Jul 2024 14:00:40 +0200 Subject: [PATCH 16/22] adds insertProfilRequest to the new ProfilUpdate FhcAPIController --- .../api/frontend/v1/ProfilUpdate.php | 146 +++++++++++++++++- public/js/api/profilUpdate.js | 16 +- .../js/components/Calendar/CalendarModal.js | 2 +- .../Cis/Profil/ProfilModal/EditProfil.js | 20 ++- 4 files changed, 166 insertions(+), 18 deletions(-) diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index 75e3bf9f0..27bc10349 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -44,7 +44,7 @@ class ProfilUpdate extends FHCAPI_Controller 'denyProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'], 'acceptProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'], 'selectProfilRequest' => self::PERM_LOGGED, - + 'insertProfilRequest' => self::PERM_LOGGED, ]); // Load language phrases @@ -134,6 +134,81 @@ class ProfilUpdate extends FHCAPI_Controller } + public function insertProfilRequest() + { + + $payload = $this->input->post('payload',true); + $topic = $this->input->post('topic',true); + $fileID = $this->input->post('fileID',true); + + if(!isset($payload) || !isset($topic)){ + $this->terminateWithError("required parameters are missing"); + } + + $identifier = array_key_exists("kontakt_id", $payload) ? "kontakt_id" : (array_key_exists("adresse_id", $payload) ? "adresse_id" : null); + + $data = ["topic" => $topic, "uid" => $this->uid, "requested_change" => json_encode($payload), "insertamum" => "NOW()", "insertvon" => $this->uid, "status" => self::$STATUS_PENDING ?: 'Pending']; + + //? insert fileID in the dataset if sent with post request + if (isset($fileID)) { + $data['attachment_id'] = $fileID; + } + + //? loops over all updateRequests from a user to validate if the new request is valid + $res = $this->ProfilUpdateModel->getProfilUpdatesWhere(["uid" => $this->uid]); + if (isError($res)) { + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loading_error')); + } + $res = $this->getDataOrTerminateWithError($res); + + //? the user cannot delete a zustelladresse/kontakt + if (isset($payload->delete) && $payload->{$identifier == "kontakt_id" ? "zustellung" : "zustelladresse"}) { + $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error'))); + } + + //? if the user tries to delete a adresse, checks whether the adresse is a heimatadresse, if so an error is raised + if (isset($payload->delete) && $identifier == "adresse_id") { + $adr = $this->AdresseModel->load($payload->$identifier); + $adr = $this->getDataOrTerminateWithError($adr)[0]; + if ($adr->heimatadresse) { + $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error'))); + } + } + + if ($res) { + $pending_changes = array_filter($res, function ($element) { + return $element->status == (self::$STATUS_PENDING ?: "Pending"); + }); + + foreach ($pending_changes as $update_request) { + $existing_change = $update_request->requested_change; + + //? the user can add as many new kontakte/adressen as he likes + if (!isset($payload->add) && property_exists($existing_change, $identifier) && property_exists($payload, $identifier) && $existing_change->$identifier == $payload->$identifier) { + //? the kontakt_id / adresse_id of a change has to be unique + $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_changeTwice_error'))); + } + + //? if it is not updating any kontakt/adresse, the topic has to be unique + elseif (!$identifier && $update_request->topic == $topic) { + $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_changeTopicTwice_error', ['0' => $update_request->topic]))); + } + } + } + + $insertID = $this->ProfilUpdateModel->insert($data); + + if (isError($insertID)) { + $this->terminateWithError(error($insertID)); + } else { + + $insertID = hasData($insertID) ? getData($insertID) : null; + //? sends emails to the correspondents of the $uid + $this->sendEmail_onProfilUpdate_insertion($this->uid, $insertID, $topic); + $this->terminateWithSuccess(success($insertID)); + } + } + public function getProfilRequestFiles($id) { if(!$id){ @@ -277,6 +352,75 @@ class ProfilUpdate extends FHCAPI_Controller // Private methods + private function sendEmail_onProfilUpdate_insertion($uid, $profil_update_id, $topic) + { + + $this->load->helper('hlp_sancho_helper'); + $emails = []; + + $is_mitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid); + if (isError($is_mitarbeiter)) { + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_mitarbeiterCheck_error')); + } + $is_mitarbeiter = $this->getDataOrTerminateWithError($is_mitarbeiter); + + //! if the $uid is a mitarbeiter and student, only the hr is notified by email + if ($is_mitarbeiter) { + //? user is not a student therefore he is a mitarbeiter, send email to Personalverwaltung + //? use constant variable MAIL_GST to mail to the personalverwaltung + $this->MitarbeiterModel->addSelect([TRUE]); + $this->MitarbeiterModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_mitarbeiter.mitarbeiter_uid"); + //? check if the the userID is a mitarbeiter and if the benutzer is active + $res = $this->MitarbeiterModel->loadWhere(["public.tbl_mitarbeiter.mitarbeiter_uid" => $uid, "public.tbl_benutzer.aktiv" => TRUE]); + if (isError($res)) { + $this->terminateWithError("was not able to query the mitarbeiter and benutzer by the uid: " . $uid); + } + if (hasData($res)) { + array_push($emails, MAIL_GST); + } else { + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_mitarbeiterCheck_error')); + } + } else { + //? if it is not a mitarbeiter, check whether it is a student and send email to studiengang + $is_student = $this->StudentModel->isStudent($uid); + if (isError($is_student)) { + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_studentCheck_error')); + } + $is_student = $this->getDataOrTerminateWithError($is_student); + if ($is_student) { + //? Send email to the Studiengangsassistentinnen + $this->StudentModel->addSelect(["public.tbl_studiengang.email"]); + $this->StudentModel->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_student.student_uid"); + $this->StudentModel->addJoin("public.tbl_prestudent", "public.tbl_benutzer.person_id = public.tbl_prestudent.person_id"); + $this->StudentModel->addJoin("public.tbl_prestudentstatus", "public.tbl_prestudentstatus.prestudent_id = public.tbl_prestudent.prestudent_id"); + $this->StudentModel->addJoin("public.tbl_studiengang", "public.tbl_studiengang.studiengang_kz = public.tbl_prestudent.studiengang_kz"); + //* check if the benutzer itself is active + //* check if the student status is Student or Diplomand (active students) + $this->StudentModel->db->where_in("public.tbl_prestudentstatus.status_kurzbz", ['Student', 'Diplomand']); + $res = $this->StudentModel->loadWhere(["public.tbl_benutzer.aktiv" => TRUE, "public.tbl_student.student_uid" => $uid]); + if (isError($res)) { + $this->terminateWithError(getData($res)); + } else { + $res = $this->getDataOrTerminateWithError($res); + foreach ($res as $emailObj) { + array_push($emails, $emailObj->email); + } + } + } + } + $mail_res = []; + //? sending email + foreach ($emails as $email) { + array_push($mail_res, sendSanchoMail("profil_update", ['uid' => $uid, 'topic' => $topic, 'href' => APP_ROOT . 'Cis/ProfilUpdate/id/' . $profil_update_id], $email, ("Profil Änderung von " . $uid))); + } + foreach ($mail_res as $m_res) { + if (!$m_res) { + $this->addError($this->p->t('profilUpdate', 'profilUpdate_email_error')); + } + } + + } + private function sendEmail_onProfilUpdate_response($uid, $topic, $status) { $this->load->helper('hlp_sancho_helper'); diff --git a/public/js/api/profilUpdate.js b/public/js/api/profilUpdate.js index ccef2f0b2..ea4ca69c7 100644 --- a/public/js/api/profilUpdate.js +++ b/public/js/api/profilUpdate.js @@ -75,16 +75,16 @@ export default { //TODO post request insertProfilRequest: function (topic, payload, fileID = null) { - const url = + + return this.$fhcApi.post( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/insertProfilRequest`; - - return axios.post(url, { - topic, - payload, - ...(fileID ? { fileID: fileID } : {}), - }); + "/api/frontend/v1/ProfilUpdate/insertProfilRequest", + { + topic, + payload, + ...(fileID ? { fileID } : {}), + }); }, //TODO post request diff --git a/public/js/components/Calendar/CalendarModal.js b/public/js/components/Calendar/CalendarModal.js index 5f6fd9d09..293ca49b8 100644 --- a/public/js/components/Calendar/CalendarModal.js +++ b/public/js/components/Calendar/CalendarModal.js @@ -95,7 +95,7 @@ export default { .catch((err) => { console.error(err); }) - : Vue.$fhcapi.ProfilUpdate.insertProfilRequest( + : this.$fhcApi.factory.profilUpdate.insertProfilRequest( this.topic, this.profilUpdate, this.fileID ? this.fileID[0] : null diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js index 189dd8f5d..e3b2f08f3 100755 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js @@ -55,6 +55,10 @@ export default { }, async submitProfilChange() { + + //todo delete this debugging line + console.log("this is a test") + //? check if data is valid before making a request if (this.topic && this.profilUpdate) { //? if profil update contains any attachment @@ -71,18 +75,18 @@ export default { this.loading = false; this.setLoading(false); - if (res.data.error == 0) { - this.result = true; - this.hide(); - Alert.popup( - "Ihre Anfrage wurde erfolgreich gesendet. Bitte warten Sie, während sich das Team um Ihre Anfrage kümmert." - ); - } else { + if (res.data.error) { this.result = false; this.hide(); Alert.popup( "Ein Fehler ist aufgetreten: " + JSON.stringify(res.data.retval) ); + } else { + this.result = true; + this.hide(); + Alert.popup( + "Ihre Anfrage wurde erfolgreich gesendet. Bitte warten Sie, während sich das Team um Ihre Anfrage kümmert." + ); } }; @@ -104,7 +108,7 @@ export default { .catch((err) => { console.error(err); }) - : Vue.$fhcapi.ProfilUpdate.insertProfilRequest( + : this.$fhcApi.factory.profilUpdate.insertProfilRequest( this.topic, this.profilUpdate, this.fileID ? this.fileID[0] : null From 8700abd0fae34c3592448af282029214ba9184e8 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 19 Jul 2024 14:50:00 +0200 Subject: [PATCH 17/22] adds updateProfilRequest to the new ProfilUpdate FhcAPIController --- .../api/frontend/v1/ProfilUpdate.php | 55 ++++++++++++++----- public/js/api/profilUpdate.js | 20 +++---- .../js/components/Calendar/CalendarModal.js | 2 +- .../Cis/Profil/ProfilModal/EditProfil.js | 2 +- system/phrasesupdate.php | 2 +- 5 files changed, 54 insertions(+), 27 deletions(-) diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index 27bc10349..c9b453c78 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -45,6 +45,8 @@ class ProfilUpdate extends FHCAPI_Controller 'acceptProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'], 'selectProfilRequest' => self::PERM_LOGGED, 'insertProfilRequest' => self::PERM_LOGGED, + 'updateProfilRequest' => self::PERM_LOGGED, + ]); // Load language phrases @@ -163,7 +165,7 @@ class ProfilUpdate extends FHCAPI_Controller //? the user cannot delete a zustelladresse/kontakt if (isset($payload->delete) && $payload->{$identifier == "kontakt_id" ? "zustellung" : "zustelladresse"}) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error'))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error')); } //? if the user tries to delete a adresse, checks whether the adresse is a heimatadresse, if so an error is raised @@ -171,7 +173,7 @@ class ProfilUpdate extends FHCAPI_Controller $adr = $this->AdresseModel->load($payload->$identifier); $adr = $this->getDataOrTerminateWithError($adr)[0]; if ($adr->heimatadresse) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error'))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_deleteZustellung_error')); } } @@ -186,12 +188,12 @@ class ProfilUpdate extends FHCAPI_Controller //? the user can add as many new kontakte/adressen as he likes if (!isset($payload->add) && property_exists($existing_change, $identifier) && property_exists($payload, $identifier) && $existing_change->$identifier == $payload->$identifier) { //? the kontakt_id / adresse_id of a change has to be unique - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_changeTwice_error'))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_changeTwice_error')); } //? if it is not updating any kontakt/adresse, the topic has to be unique elseif (!$identifier && $update_request->topic == $topic) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_changeTopicTwice_error', ['0' => $update_request->topic]))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_changeTopicTwice_error', ['0' => $update_request->topic])); } } } @@ -199,7 +201,7 @@ class ProfilUpdate extends FHCAPI_Controller $insertID = $this->ProfilUpdateModel->insert($data); if (isError($insertID)) { - $this->terminateWithError(error($insertID)); + $this->terminateWithError(getError($insertID)); } else { $insertID = hasData($insertID) ? getData($insertID) : null; @@ -209,6 +211,33 @@ class ProfilUpdate extends FHCAPI_Controller } } + public function updateProfilRequest() + { + $topic = $this->input->post('topic', true); + $payload = $this->input->post('payload', true); + $ID = $this->input->post('ID', true); + $fileID = $this->input->post('fileID', true);//optional + + if(!isset($topic) || !isset($payload) || !isset($ID)){ + $this->terminateWithError("required parameters are missing"); + } + + $updateData = ["requested_change" => json_encode($payload), "updateamum" => "NOW()", "updatevon" => $this->uid]; + if (isset($fileID)) { + $updateData['attachment_id'] = json_decode($fileID); + } + $updateID = $this->ProfilUpdateModel->update([$ID], $updateData); + //? insert fileID in the dataset if sent with post request + + if (isError($updateID)) { + $this->terminateWithError(getError($updateID)); + } + + $updateID = $this->getDataOrTerminateWithError($updateID)[0]; + + $this->terminateWithSuccess(success($updateID)); + } + public function getProfilRequestFiles($id) { if(!$id){ @@ -218,7 +247,7 @@ class ProfilUpdate extends FHCAPI_Controller $this->ProfilUpdateModel->addSelect(["attachment_id"]); $attachmentID = $this->ProfilUpdateModel->load([$id]); if (isError($attachmentID)) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_loading_error')),self::ERROR_TYPE_GENERAL); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loading_error'),self::ERROR_TYPE_GENERAL); } //? get the attachmentID $dms_id = $this->getDataOrTerminateWithError($attachmentID)[0]->attachment_id; @@ -227,7 +256,7 @@ class ProfilUpdate extends FHCAPI_Controller $this->DmsVersionModel->addSelect(["name", "dms_id"]); $attachment = $this->DmsVersionModel->load([$dms_id, 0]); if (isError($attachment)) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_dmsVersion_error')),self::ERROR_TYPE_GENERAL); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_dmsVersion_error'),self::ERROR_TYPE_GENERAL); } $attachment = $this->getDataOrTerminateWithError($attachment); //? returns {name:..., dms_id:...} @@ -276,7 +305,7 @@ class ProfilUpdate extends FHCAPI_Controller //! check for required information if (!isset($id) || !isset($uid) || !isset($personID) || !isset($requested_change) || !isset($topic)) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_requiredInformation_error'))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_requiredInformation_error')); } $is_mitarbeiter = $this->MitarbeiterModel->isMitarbeiter($uid); @@ -299,7 +328,7 @@ class ProfilUpdate extends FHCAPI_Controller $requested_change['adresse_id'] = $insertID; $update_res = $this->updateRequestedChange($id, $requested_change); if (isError($update_res)) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_address_error', [$insertID]))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_address_error', [$insertID])); } } @@ -310,7 +339,7 @@ class ProfilUpdate extends FHCAPI_Controller $requested_change['kontakt_id'] = $insertID; $update_res = $this->updateRequestedChange($id, $requested_change); if (isError($update_res)) { - $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_kontakt_error', [$insertID]))); + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_kontakt_error', [$insertID])); } } @@ -335,7 +364,7 @@ class ProfilUpdate extends FHCAPI_Controller } $result = $this->PersonModel->update($personID, [$topic => $requested_change["value"]]); - if (isError($result)) $this->terminateWithError(error($this->p->t('profilUpdate', 'profilUpdate_insert_error'))); + if (isError($result)) $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_insert_error')); } $this->sendEmail_onProfilUpdate_response($uid, $topic, self::$STATUS_ACCEPTED); @@ -399,7 +428,7 @@ class ProfilUpdate extends FHCAPI_Controller $this->StudentModel->db->where_in("public.tbl_prestudentstatus.status_kurzbz", ['Student', 'Diplomand']); $res = $this->StudentModel->loadWhere(["public.tbl_benutzer.aktiv" => TRUE, "public.tbl_student.student_uid" => $uid]); if (isError($res)) { - $this->terminateWithError(getData($res)); + $this->terminateWithError(getError($res)); } else { $res = $this->getDataOrTerminateWithError($res); foreach ($res as $emailObj) { @@ -498,7 +527,7 @@ class ProfilUpdate extends FHCAPI_Controller elseif (array_key_exists('delete', $requested_change) && $requested_change['delete']) { $result = $this->AdresseModel->delete($adresse_id); if(isError($result)){ - $this->terminateWithError(error($result)); + $this->terminateWithError(getError($result)); } } //! UPDATE diff --git a/public/js/api/profilUpdate.js b/public/js/api/profilUpdate.js index ea4ca69c7..50ced7cdd 100644 --- a/public/js/api/profilUpdate.js +++ b/public/js/api/profilUpdate.js @@ -73,7 +73,6 @@ export default { }); }, - //TODO post request insertProfilRequest: function (topic, payload, fileID = null) { return this.$fhcApi.post( @@ -87,19 +86,18 @@ export default { }); }, - //TODO post request updateProfilRequest: function (topic, payload, ID, fileID = null) { - const url = + + return this.$fhcApi.post( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/updateProfilRequest`; - - return axios.post(url, { - topic, - payload, - ID, - ...(fileID ? { fileID: fileID } : {}), - }); + `/api/frontend/v1/ProfilUpdate/updateProfilRequest`, + { + topic, + payload, + ID, + ...(fileID ? { fileID: fileID } : {}), + }); }, //TODO post request diff --git a/public/js/components/Calendar/CalendarModal.js b/public/js/components/Calendar/CalendarModal.js index 293ca49b8..a9a11f8f7 100644 --- a/public/js/components/Calendar/CalendarModal.js +++ b/public/js/components/Calendar/CalendarModal.js @@ -83,7 +83,7 @@ export default { this.setLoading(true); this.editData.updateID - ? Vue.$fhcapi.ProfilUpdate.updateProfilRequest( + ? this.$fhcApi.factory.profilUpdate.updateProfilRequest( this.topic, this.profilUpdate, this.editData.updateID, diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js index e3b2f08f3..86b704c25 100755 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js @@ -96,7 +96,7 @@ export default { this.setLoading(true); this.editData.updateID - ? Vue.$fhcapi.ProfilUpdate.updateProfilRequest( + ? this.$fhcApi.factory.profilUpdate.updateProfilRequest( this.topic, this.profilUpdate, this.editData.updateID, diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 8c140ea63..8dc1d163f 100755 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -25873,7 +25873,7 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => '!Achtung: Eine deiner Adressen ist bereits als Zustelladresse gespeichert, sind sie sicher, dass sie die aktuelle Adresse stattdessen als Zustelladresse speichern wollen?', + 'text' => '!Achtung: Eine Ihrer Adressen ist bereits als Zustelladresse gespeichert, sind sie sicher, dass sie die aktuelle Adresse stattdessen als Zustelladresse speichern wollen?', 'description' => '', 'insertvon' => 'system' ), From 0cc62221757639ad30f4afe7d1777fa246a65fa8 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 19 Jul 2024 14:57:42 +0200 Subject: [PATCH 18/22] adds deleteProfilRequest to the new ProfilUpdate FhcAPIController --- .../controllers/api/frontend/v1/ProfilUpdate.php | 15 +++++++++++++-- public/js/api/profilUpdate.js | 11 ++++++----- .../Profil/ProfilComponents/FetchProfilUpdates.js | 5 +++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index c9b453c78..44d70afb4 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -46,8 +46,8 @@ class ProfilUpdate extends FHCAPI_Controller 'selectProfilRequest' => self::PERM_LOGGED, 'insertProfilRequest' => self::PERM_LOGGED, 'updateProfilRequest' => self::PERM_LOGGED, - - ]); + 'deleteProfilRequest' => self::PERM_LOGGED, + ]); // Load language phrases $this->loadPhrases( @@ -238,6 +238,17 @@ class ProfilUpdate extends FHCAPI_Controller $this->terminateWithSuccess(success($updateID)); } + public function deleteProfilRequest() + { + + $requestID = $this->input->post('requestID', true); + $result = $this->ProfilUpdateModel->delete([$requestID]); + if (isError($result)) { + $this->terminateWithError(getError($result)); + } + $this->terminateWithSuccess($result); + } + public function getProfilRequestFiles($id) { if(!$id){ diff --git a/public/js/api/profilUpdate.js b/public/js/api/profilUpdate.js index 50ced7cdd..742e4a1b1 100644 --- a/public/js/api/profilUpdate.js +++ b/public/js/api/profilUpdate.js @@ -100,14 +100,15 @@ export default { }); }, - //TODO post request deleteProfilRequest: function (requestID) { - const url = + + return this.$fhcApi.post( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/deleteProfilRequest`; - - return axios.post(url, requestID); + `/api/frontend/v1/ProfilUpdate/deleteProfilRequest`, + { + requestID, + }); }, }; \ No newline at end of file diff --git a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js index 368b5e111..9caee9468 100755 --- a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js +++ b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js @@ -107,17 +107,18 @@ export default { }, deleteRequest: function (item) { - Vue.$fhcapi.ProfilUpdate.deleteProfilRequest(item.profil_update_id).then( + this.$fhcApi.factory.profilUpdate.deleteProfilRequest(item.profil_update_id).then( (res) => { if (res.data.error) { //? open alert - console.log(res.data); + console.error("error happened",res.data); } else { this.$emit("fetchUpdates"); } } ); }, + getView: function (topic, status) { if (!(status === this.profilUpdateStates["Pending"])) { return "Status"; From a0871657cafc401cc4f71b60b8da8dabde896ddd Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Mon, 22 Jul 2024 11:24:47 +0200 Subject: [PATCH 19/22] adds insertFile to the new ProfilUpdate FhcAPIController and starts a transaction when deleting the foreign key from the profil update and deleting the old file --- .../api/frontend/v1/ProfilUpdate.php | 115 ++++++++++++++++++ .../models/person/Profil_update_model.php | 15 +++ public/js/api/profilUpdate.js | 11 +- .../js/components/Calendar/CalendarModal.js | 4 +- .../Cis/Profil/ProfilModal/EditProfil.js | 4 +- 5 files changed, 139 insertions(+), 10 deletions(-) diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index 44d70afb4..4b9dedb48 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -47,6 +47,7 @@ class ProfilUpdate extends FHCAPI_Controller 'insertProfilRequest' => self::PERM_LOGGED, 'updateProfilRequest' => self::PERM_LOGGED, 'deleteProfilRequest' => self::PERM_LOGGED, + 'insertFile' => self::PERM_LOGGED, ]); // Load language phrases @@ -388,6 +389,68 @@ class ProfilUpdate extends FHCAPI_Controller } + public function insertFile($replace) + { + $replace = json_decode($replace); + + if (!count($_FILES)) { + $this->terminateWithError("No file available for upload"); + } + + //? if replace is set it contains the profil_update_id in which the attachment_id has to be replaced + if (isset($replace)) { + + $this->ProfilUpdateModel->addSelect(["attachment_id"]); + $profilUpdate = $this->ProfilUpdateModel->load([$replace]); + if (isError($profilUpdate)) { + $this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loading_error')); + } + //? get the attachmentID + $dms_id = $this->getDataOrTerminateWithError($profilUpdate)[0]->attachment_id; + + //? delete old dms_file of Profil Update + $deleteOldFile_result = $this->deleteOldVersionFile($dms_id); + if(!$deleteOldFile_result){ + $this->terminateWithError("error while deleting the old file"); + } + } + + + $files = $_FILES['files']; + $file_count = count($files['name']); + + $res = []; + + for ($i = 0; $i < $file_count; $i++) { + $_FILES['files']['name'] = $files['name'][$i]; + $_FILES['files']['type'] = $files['type'][$i]; + $_FILES['files']['tmp_name'] = $files['tmp_name'][$i]; + $_FILES['files']['error'] = $files['error'][$i]; + $_FILES['files']['size'] = $files['size'][$i]; + + $dms = [ + "kategorie_kurzbz" => "profil_aenderung", + "version" => 0, + "name" => $_FILES['files']['name'], + "mimetype" => $_FILES['files']['type'], + "beschreibung" => $this->uid . " Profil Änderung", + "insertvon" => $this->uid, + "insertamum" => "NOW()", + ]; + + $tmp_res = $this->dmslib->upload($dms, 'files', array("jpg", "png", "pdf")); + + if(isError($tmp_res)){ + $this->addError(getError($tmp_res)); + } + + $tmp_res = $this->getDataOrTerminateWithError($tmp_res); + array_push($res, $tmp_res); + } + + $this->terminateWithSuccess($res); + } + //------------------------------------------------------------------------------------------------------------------ // Private methods @@ -584,6 +647,58 @@ class ProfilUpdate extends FHCAPI_Controller } } + private function deleteOldVersionFile($dms_id) + { + // starting the transaction + $this->db->trans_start(); + + + if (!isset($dms_id)) { + return; + } + + //? delete the file from the profilUpdate first + $profilUpdateFileDelete = $this->ProfilUpdateModel->removeFileFromProfilUpdate($dms_id); + if(isError($profilUpdateFileDelete)){ + $this->terminateWithError(getError($profilUpdateFileDelete)); + } + + //? delete all the different versions of the dms_file + $dmsVersions = $this->DmsVersionModel->loadWhere(["dms_id" => $dms_id]); + $dmsVersions = $this->getDataOrTerminateWithError($dmsVersions); + + + + $dms_versions = array_map(function ($item) { + return $item->version; + }, $dmsVersions); + + + $test_array = array(); + foreach ($dms_versions as $version) { + + $delete_result = $this->dmslib->removeVersion($dms_id, $version); + array_push($test_array, $delete_result); + + if(isError($delete_result)){ + $this->addError(getError($delete_result)); + } + } + + // transaction complete + $this->db->trans_complete(); + + if ($this->db->trans_status() === FALSE) + { + return false; + } + else + { + return true; + } + + } + } diff --git a/application/models/person/Profil_update_model.php b/application/models/person/Profil_update_model.php index 68394dd9a..ffb04b7e7 100755 --- a/application/models/person/Profil_update_model.php +++ b/application/models/person/Profil_update_model.php @@ -77,6 +77,21 @@ class Profil_update_model extends DB_Model } + //? remove File from the Profil Update + public function removeFileFromProfilUpdate($dms_id) + { + + if(!is_int($dms_id) || $dms_id < 0){ + return error("not valid dms_id"); + } + + return $this->execReadOnlyQuery(" + UPDATE public.tbl_profil_update + SET attachment_id = NULL + WHERE attachment_id = ?", [$dms_id]); + + } + /** * getProfilUpdateWithPermission diff --git a/public/js/api/profilUpdate.js b/public/js/api/profilUpdate.js index 742e4a1b1..acfe99813 100644 --- a/public/js/api/profilUpdate.js +++ b/public/js/api/profilUpdate.js @@ -45,14 +45,13 @@ export default { //TODO post request //? new requests insertFile: function (dms, replace = null) { - const url = + + return this.$fhcApi.post( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/insertFile/${replace}`; - - return axios.post(url, dms, { - headers: { "Content-Type": "multipart/form-data" }, - }); + `/api/frontend/v1/ProfilUpdate/insertFile/${replace}`, + dms); + }, getProfilRequestFiles: function (requestID) { diff --git a/public/js/components/Calendar/CalendarModal.js b/public/js/components/Calendar/CalendarModal.js index a9a11f8f7..1d143986a 100644 --- a/public/js/components/Calendar/CalendarModal.js +++ b/public/js/components/Calendar/CalendarModal.js @@ -116,14 +116,14 @@ export default { const result = this.editData.updateID ? //? updating old attachment by replacing //* second parameter of api request insertFile checks if the file has to be replaced or not - await Vue.$fhcapi.ProfilUpdate.insertFile( + await this.$fhcApi.factory.profilUpdate.insertFile( formData, this.editData.updateID ).then((res) => { return res.data?.map((file) => file.dms_id); }) : //? fresh insert of new attachment - await Vue.$fhcapi.ProfilUpdate.insertFile(formData).then((res) => { + await this.$fhcApi.factory.profilUpdate.insertFile(formData).then((res) => { return res.data?.map((file) => file.dms_id); }); return result; diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js index 86b704c25..1b54fe7f6 100755 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js @@ -129,14 +129,14 @@ export default { const result = this.editData.updateID ? //? updating old attachment by replacing //* second parameter of api request insertFile checks if the file has to be replaced or not - await Vue.$fhcapi.ProfilUpdate.insertFile( + await this.$fhcApi.factory.profilUpdate.insertFile( formData, this.editData.updateID ).then((res) => { return res.data?.map((file) => file.dms_id); }) : //? fresh insert of new attachment - await Vue.$fhcapi.ProfilUpdate.insertFile(formData).then((res) => { + await this.$fhcApi.factory.profilUpdate.insertFile(formData).then((res) => { return res.data?.map((file) => file.dms_id); }); return result; From 82417a7f6f62b74e2d6f712fd47a99bc48e66405 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Mon, 22 Jul 2024 11:36:12 +0200 Subject: [PATCH 20/22] removes old api files and removes the use(fhcApi) because it is already imported in the Phrasen plugin --- public/js/api/profilUpdate.js | 14 --- public/js/apps/Cis/Profil.js | 5 +- public/js/apps/Cis/ProfilUpdateRequests.js | 2 - public/js/apps/api/profilUpdate.js | 120 --------------------- public/js/apps/api/userdata.js | 58 ---------- 5 files changed, 1 insertion(+), 198 deletions(-) delete mode 100755 public/js/apps/api/profilUpdate.js delete mode 100755 public/js/apps/api/userdata.js diff --git a/public/js/api/profilUpdate.js b/public/js/api/profilUpdate.js index acfe99813..fe15a295e 100644 --- a/public/js/api/profilUpdate.js +++ b/public/js/api/profilUpdate.js @@ -30,20 +30,6 @@ export default { "/api/frontend/v1/ProfilUpdate/denyProfilRequest",{profil_update_id,uid,topic,status_message}); }, - //TODO post request - replaceProfilUpdateAttachment: function (dms) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/replaceProfilUpdateAttachment`; - - return axios.post(url, dms, { - headers: { "Content-Type": "multipart/form-data" }, - }); - }, - - //TODO post request - //? new requests insertFile: function (dms, replace = null) { return this.$fhcApi.post( diff --git a/public/js/apps/Cis/Profil.js b/public/js/apps/Cis/Profil.js index 1fa2e404b..7a084744a 100755 --- a/public/js/apps/Cis/Profil.js +++ b/public/js/apps/Cis/Profil.js @@ -2,12 +2,10 @@ import StudentProfil from "../../components/Cis/Profil/StudentProfil.js"; import MitarbeiterProfil from "../../components/Cis/Profil/MitarbeiterProfil.js"; import ViewStudentProfil from "../../components/Cis/Profil/StudentViewProfil.js"; import ViewMitarbeiterProfil from "../../components/Cis/Profil/MitarbeiterViewProfil.js"; -import fhcapifactory from "../api/fhcapifactory.js"; import Loading from "../../components/Loader.js"; import Phrasen from "../../plugin/Phrasen.js"; -import fhcapi from "../../plugin/FhcApi.js"; -Vue.$fhcapi = fhcapifactory; + Vue.$collapseFormatter = function (data) { //data - an array of objects containing the column title and value for each cell var container = document.createElement("div"); @@ -405,5 +403,4 @@ const profilApp = Vue.createApp({ profilApp .use(primevue.config.default, { zIndex: { overlay: 9999 } }) .use(Phrasen) - .use(fhcapi) .mount("#content"); diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index 42e5bd576..b2c761b6e 100755 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -1,7 +1,5 @@ -import fhcapifactory from "../api/fhcapifactory.js"; import ProfilUpdateView from "../../components/Cis/ProfilUpdate/ProfilUpdateView.js"; import Phrasen from "../../plugin/Phrasen.js"; -Vue.$fhcapi = fhcapifactory; const app = Vue.createApp({ components: { diff --git a/public/js/apps/api/profilUpdate.js b/public/js/apps/api/profilUpdate.js deleted file mode 100755 index 9a63dc4d6..000000000 --- a/public/js/apps/api/profilUpdate.js +++ /dev/null @@ -1,120 +0,0 @@ -export default { - //! API calls for profil update requests - - getStatus: function () { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - "/Cis/ProfilUpdate/getStatus"; - return axios.get(url); - }, - - getTopic: function () { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - "/Cis/ProfilUpdate/getTopic"; - return axios.get(url); - }, - - getProfilUpdateRequest: function () { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - "/Cis/ProfilUpdate/getAllRequests"; - return axios.get(url); - }, - - acceptProfilRequest: function (payload) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - "/Cis/ProfilUpdate/acceptProfilRequest"; - return axios.post(url, payload); - }, - - denyProfilRequest: function (payload) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - "/Cis/ProfilUpdate/denyProfilRequest"; - return axios.post(url, payload); - }, - - replaceProfilUpdateAttachment: function (dms) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/replaceProfilUpdateAttachment`; - - return axios.post(url, dms, { - headers: { "Content-Type": "multipart/form-data" }, - }); - }, - - //? new reuquests - insertFile: function (dms, replace = null) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/insertFile/${replace}`; - - return axios.post(url, dms, { - headers: { "Content-Type": "multipart/form-data" }, - }); - }, - - getProfilRequestFiles: function (requestID) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/getProfilRequestFiles`; - - return axios.post(url, requestID); - }, - - selectProfilRequest: function (uid = null, id = null) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/selectProfilRequest`; - - return axios.get(url, { uid: uid, id: id }); - }, - - insertProfilRequest: function (topic, payload, fileID = null) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/insertProfilRequest`; - - return axios.post(url, { - topic, - payload, - ...(fileID ? { fileID: fileID } : {}), - }); - }, - - updateProfilRequest: function (topic, payload, ID, fileID = null) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/updateProfilRequest`; - - return axios.post(url, { - topic, - payload, - ID, - ...(fileID ? { fileID: fileID } : {}), - }); - }, - - deleteProfilRequest: function (requestID) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - FHC_JS_DATA_STORAGE_OBJECT.ci_router + - `/Cis/ProfilUpdate/deleteProfilRequest`; - - return axios.post(url, requestID); - }, -}; diff --git a/public/js/apps/api/userdata.js b/public/js/apps/api/userdata.js deleted file mode 100755 index defea2cbb..000000000 --- a/public/js/apps/api/userdata.js +++ /dev/null @@ -1,58 +0,0 @@ -export default { - //! API Calls for Profil Views - - getGemeinden: function(nation,zip=null){ - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/getGemeinden`; - return axios.get(url,{params:{nation:nation,zip:zip}}); - }, - - getAllNationen:function(){ - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/getAllNationen`; - return axios.get(url); - }, - - getView: function (uid) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + `cis.php/Cis/Profil/getView/${uid}`; - return axios.get(url); - }, - - sperre_foto_function: function (value) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/foto_sperre_function/${value}`; - return axios.get(url); - }, - - isStudent: function (uid) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/isStudent/${uid}`; - return axios.get(url); - }, - - isMitarbeiter: function (uid) { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/isMitarbeiter/${uid}`; - return axios.get(url); - }, - - getZustellAdresse: function () { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/getZustellAdresse`; - return axios.get(url); - }, - - getZustellKontakt: function () { - const url = - FHC_JS_DATA_STORAGE_OBJECT.app_root + - `cis.php/Cis/Profil/getZustellKontakt`; - return axios.get(url); - }, -}; From f2074198593764d8d71e6a2633d6708dd09f1c92 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 23 Jul 2024 08:58:52 +0200 Subject: [PATCH 21/22] removes the import for userdata and profilUpdate from the old fhcapi which should be replaced by the new fhcapi --- application/views/Cis/Documents.php | 7 ++++--- public/js/apps/api/fhcapifactory.js | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/application/views/Cis/Documents.php b/application/views/Cis/Documents.php index 191558d86..9ca3bc961 100755 --- a/application/views/Cis/Documents.php +++ b/application/views/Cis/Documents.php @@ -12,9 +12,10 @@ $this->load->view('templates/CISHTML-Header', $includesArray);

p->t('tools', 'dokumente'); ?>p->t('tools', 'bestaetigungenZeugnisse'); ?>

- +
-
+ +

p->t('tools', 'inskriptionsbestaetigung'); ?>p->t('tools', 'studienbuchblatt') : ''; ?>

@@ -199,7 +200,7 @@ $this->load->view('templates/CISHTML-Header', $includesArray);
-
+
diff --git a/public/js/apps/api/fhcapifactory.js b/public/js/apps/api/fhcapifactory.js index 9d4e3609a..35120779f 100755 --- a/public/js/apps/api/fhcapifactory.js +++ b/public/js/apps/api/fhcapifactory.js @@ -1,11 +1,7 @@ import Search from "./search.js"; import Cms from "./cms.js"; -import UserData from "./userdata.js"; -import ProfilUpdate from "./profilUpdate.js" export default { "Search": Search, - "UserData": UserData, - "ProfilUpdate": ProfilUpdate, "Cms": Cms, }; From 2083e95f8cf724ef7a57ee2099bd59813282818d Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 23 Jul 2024 09:14:38 +0200 Subject: [PATCH 22/22] adds vertical layout for the documents view when the viewport is less than lg --- application/views/Cis/Documents.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/application/views/Cis/Documents.php b/application/views/Cis/Documents.php index 9ca3bc961..74d7b1349 100755 --- a/application/views/Cis/Documents.php +++ b/application/views/Cis/Documents.php @@ -14,8 +14,8 @@ $this->load->view('templates/CISHTML-Header', $includesArray);
- -
+ +

p->t('tools', 'inskriptionsbestaetigung'); ?>p->t('tools', 'studienbuchblatt') : ''; ?>

@@ -200,12 +200,13 @@ $this->load->view('templates/CISHTML-Header', $includesArray);
-
+
+