changes the data format from the studierendenEmail api call and displays the mailto on the modal

This commit is contained in:
SimonGschnell
2024-06-28 11:06:44 +02:00
parent c34144a4e8
commit d0f457d8ed
2 changed files with 21 additions and 7 deletions
@@ -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);
}
+16 -7
View File
@@ -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*/`
<bs-modal @showBsModal="showModal" ref="modalContainer" dialogClass="modal-lg">
<template #title>
<p>{{JSON.stringify(event,null,2)}}</p>
<p>{{JSON.stringify(emailAnStudierende,null,2)}}</p>
<p>{{JSON.stringify(event,null,2)}}</p>
<!--<span v-if="lv ">
{{lv + (stg?' / ' + stg:'')}}
</span>
@@ -51,8 +54,14 @@ export default {
<template #default>
<div :style="{'display':'grid', 'row-gap':'10px', 'column-gap':'10px', 'grid-template-columns':'repeat(3,minmax(100px,1fr))', 'grid-template-rows':'repeat('+Math.ceil(items.length / 3)+',minmax(100px,1fr))'} ">
<div class="d-flex flex-column align-items-center justify-content-center" v-for="item in items" :key="item">
<span>{{item}}</span>
<i class="fa fa-file"></i>
<a v-if="item=='E-mail'" :href="emailAnStudierende">
<span>{{item}}</span>
<i class="fa fa-file"></i>
</a>
<a v-else :href="#">
<span>{{item}}</span>
<i class="fa fa-file"></i>
</a>
</div>
</div>
</template>