From d0f457d8ed290fc6b94b27433cf9f831f21647f1 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Fri, 28 Jun 2024 11:06:44 +0200 Subject: [PATCH] changes the data format from the studierendenEmail api call and displays the mailto on the modal --- .../controllers/api/frontend/v1/Lehre.php | 5 ++++ public/js/components/Cis/Mylv/LvUebersicht.js | 23 +++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/application/controllers/api/frontend/v1/Lehre.php b/application/controllers/api/frontend/v1/Lehre.php index 95422142d..a36b673b4 100644 --- a/application/controllers/api/frontend/v1/Lehre.php +++ b/application/controllers/api/frontend/v1/Lehre.php @@ -57,6 +57,11 @@ class Lehre extends FHCAPI_Controller $studentenMails = $this->getDataOrTerminateWithError($studentenMails); + //convert array of objects into array of strings + $studentenMails = array_map(function($element){ + return $element->mail; + }, $studentenMails); + $this->terminateWithSuccess($studentenMails); } diff --git a/public/js/components/Cis/Mylv/LvUebersicht.js b/public/js/components/Cis/Mylv/LvUebersicht.js index 1a5a3525d..503791404 100644 --- a/public/js/components/Cis/Mylv/LvUebersicht.js +++ b/public/js/components/Cis/Mylv/LvUebersicht.js @@ -15,6 +15,7 @@ export default { lehreinheit:null, stg:null, lv:null, + emailAnStudierende:null, result: false, } @@ -26,11 +27,11 @@ export default { }, methods:{ showModal: function(){ - this.$fhcApi.factory.lehre.getStudentenMail(this.event.lehreinheit_id).then(res => - { - console.log(res.data,"API response"); - }); + { + // prepare the mailto link with all the emails from the students of the lv + this.emailAnStudierende = "mailto:"+res.data.join(","); + }); }, }, mounted(){ @@ -40,7 +41,9 @@ export default { template:/*html*/`