diff --git a/application/controllers/api/frontend/v1/OtherLvPlan.php b/application/controllers/api/frontend/v1/OtherLvPlan.php index af075fbc3..1807f0a4a 100644 --- a/application/controllers/api/frontend/v1/OtherLvPlan.php +++ b/application/controllers/api/frontend/v1/OtherLvPlan.php @@ -62,6 +62,8 @@ class OtherLvPlan extends FHCAPI_Controller "foto" => $profileData->data->foto, "vorname" => $profileData->data->vorname, "nachname" => $profileData->data->nachname, + "titel" => $profileData->data->titel, + "postnomen" => $profileData->data->postnomen, ], ]; diff --git a/public/js/components/Cis/LvPlan/OtherLvPlan.js b/public/js/components/Cis/LvPlan/OtherLvPlan.js index d1caebc90..6c70e1c93 100644 --- a/public/js/components/Cis/LvPlan/OtherLvPlan.js +++ b/public/js/components/Cis/LvPlan/OtherLvPlan.js @@ -32,7 +32,7 @@ export default { listGroup: [], rangeIntervalFirst: null, otherPersonData: { - fullName: "", + fullNameWithTitle: "", photo: "", }, timezone: FHC_JS_DATA_STORAGE_OBJECT.timezone, @@ -210,10 +210,17 @@ export default { this.isOtherPersonMitarbeiter = !!viewData?.user_data?.is_mitarbeiter; this.isOtherPersonStudent = !!viewData?.user_data?.is_student; - this.otherPersonData.fullName = - viewData?.user_data?.vorname + - " " + - viewData?.user_data?.nachname; + let fullNameWithTitleFragments = [ + viewData?.user_data?.titel, + viewData?.user_data?.vorname, + viewData?.user_data?.nachname, + viewData?.user_data?.postnomen, + ]; + fullNameWithTitleFragments = fullNameWithTitleFragments.filter( + (fragment) => !!fragment, + ); + this.otherPersonData.fullNameWithTitle = + fullNameWithTitleFragments.join(" "); this.otherPersonData.photo = viewData?.user_data?.foto; }, async redirectToMyLvPlanIfAuthUid() { @@ -225,12 +232,21 @@ export default { this.$router.push({ name: "MyLvPlan" }); } }, + copyFullNameWithTitleToClipboard() { + navigator.clipboard.writeText( + this.otherPersonData.fullNameWithTitle, + ); + this.$fhcAlert.alertSuccess( + this.$p.t("profil/name_title_clipboard_copy_confirmation"), + ); + }, }, async created() { await this.redirectToMyLvPlanIfAuthUid(); await this.fetchViewData(); + await this.$p.loadCategory(["profil"]); }, - template: ` + template: /*html*/ `