mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-18 20:49:27 +00:00
also shows the zustellungs warning when there is more than one kontakt marked as zustellung
This commit is contained in:
@@ -23,6 +23,7 @@ class Profil extends Auth_Controller
|
||||
'isMitarbeiter' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'isStudent' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'getZustellAdresse' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'getZustellKontakt' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
|
||||
]);
|
||||
|
||||
@@ -101,6 +102,16 @@ class Profil extends Auth_Controller
|
||||
echo json_encode($adressen_res);
|
||||
}
|
||||
|
||||
public function getZustellKontakt(){
|
||||
$this->KontaktModel->addSelect(["kontakt_id"]);
|
||||
$kontakt_res = $this->KontaktModel->loadWhere(['person_id'=>$this->pid, 'zustellung'=>true]);
|
||||
$kontakt_res = hasData($kontakt_res) ? getData($kontakt_res): null;
|
||||
$kontakt_res = array_map(function($item){
|
||||
return $item->kontakt_id;
|
||||
},$kontakt_res);
|
||||
echo json_encode($kontakt_res);
|
||||
}
|
||||
|
||||
|
||||
private function viewMitarbeiterProfil($uid)
|
||||
{
|
||||
|
||||
@@ -43,4 +43,11 @@ export default {
|
||||
`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);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ export default {
|
||||
//? if the adresse was already saved
|
||||
return false;
|
||||
}
|
||||
return this.zustellAdressenCount > 0 && this.data.zustelladresse;
|
||||
return this.zustellAdressenCount>0 && this.data.zustelladresse;
|
||||
}
|
||||
//? if this.zustellAdressenCount is still not set by the api call and is still null
|
||||
return false;
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
created(){
|
||||
Vue.$fhcapi.UserData.getZustellAdresse().then(res => {
|
||||
|
||||
this.zustellAdressenCount = res.data;
|
||||
this.zustellAdressenCount = res.data?.length;
|
||||
})
|
||||
this.originalValue = JSON.stringify(this.data);
|
||||
|
||||
@@ -72,6 +72,7 @@ export default {
|
||||
<div class="gy-3 row justify-content-center align-items-center">
|
||||
|
||||
|
||||
<!-- warning message for too many zustellungs Adressen -->
|
||||
<div v-if="showZustellAdressenWarning" class="col-12 ">
|
||||
<div class="card bg-danger mx-2">
|
||||
<div class="card-body text-white ">
|
||||
@@ -79,6 +80,9 @@ export default {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of warning -->
|
||||
|
||||
|
||||
<div class="col-12 ">
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ export default {
|
||||
return{
|
||||
|
||||
originalValue:null,
|
||||
zustellKontaktCount:null,
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
@@ -27,6 +28,20 @@ export default {
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
showZustellKontakteWarning: function(){
|
||||
if(this.zustellKontaktCount){
|
||||
|
||||
if(this.zustellKontaktCount.includes(this.data.kontakt_id)){
|
||||
//? if the adresse was already saved
|
||||
return false;
|
||||
}
|
||||
return this.zustellKontaktCount>0 && this.data.zustellung;
|
||||
}
|
||||
//? if this.zustellAdressenCount is still not set by the api call and is still null
|
||||
return false;
|
||||
|
||||
|
||||
},
|
||||
isChanged: function(){
|
||||
//? returns true if the original passed data object was changed
|
||||
if(!this.data.kontakt || !this.data.kontakttyp) {return false;}
|
||||
@@ -35,14 +50,30 @@ export default {
|
||||
},
|
||||
created(){
|
||||
|
||||
this.originalValue = JSON.stringify(this.data);
|
||||
Vue.$fhcapi.UserData.getZustellKontakt().then(res => {
|
||||
|
||||
this.zustellKontaktCount = res.data?.length;
|
||||
})
|
||||
|
||||
this.originalValue = JSON.stringify(this.data);
|
||||
|
||||
},
|
||||
template:
|
||||
`
|
||||
|
||||
<div class="gy-3 row align-items-center justify-content-center">
|
||||
|
||||
|
||||
<!-- warning message for too many zustellungs Kontakte -->
|
||||
<div v-if="showZustellKontakteWarning" class="col-12 ">
|
||||
<div class="card bg-danger mx-2">
|
||||
<div class="card-body text-white ">
|
||||
<span>!Achtung: Eine deiner Kontakte ist bereits als Zustellungskontakt gespeichert, sind sie sicher, dass sie den aktuellen Kontakt stattdessen als Zustellkontakt speichern wollen?</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of warning -->
|
||||
|
||||
<div v-if="!data.kontakt_id" class="col-12">
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user