diff --git a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js index 06454736c..4eabf82c6 100644 --- a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js +++ b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangInformation.js @@ -1,4 +1,5 @@ import StudiengangPerson from "./StudiengangPerson"; +import StudiengangVertretung from "./StudiengangVertretung"; export default { data(){ @@ -15,36 +16,40 @@ data(){ } }, components:{ - StudiengangPerson + StudiengangPerson, + StudiengangVertretung, }, template:/*html*/` -
`, @@ -52,73 +57,6 @@ computed:{ collection_array: function(){ return [{ title: "Studiengangsleitung", collection: this.stg_ltg }, { title: "geschäftsführende Leitung", collection: this.gf_ltg },{ title: "stellvertretende Leitung", collection: this.stv_ltg },{ title: "Sekretariat", collection: this.ass} ]; }, - - studiengangs_assistenz_array: function () { - // early return if the reactive data is not yet loaded or not present - if (!this.ass) - return null; - - return this.ass.map((assistenz) => { - return { - fullname: this.studiengangs_person_fullname(assistenz.titelpre, assistenz.vorname, assistenz.nachname), - telefone: this.studiengangs_person_phone(assistenz.kontakt, assistenz.telefonklappe), - ort: assistenz.planbezeichnung ?? null, - email: this.studiengangs_person_email(assistenz.email), - } - }) - }, -}, -methods:{ - vertretungFormatedName: function(vertretung,bezeichnung=true){ - if(!vertretung) return null; - return `${vertretung.vorname ?? ''} ${vertretung.nachname ?? ''} ${vertretung.bezeichnung && bezeichnung ? '('.concat(vertretung.bezeichnung.replace("(","").replace(")","")).concat(")") : ''}` - }, - studiengangs_person_data: function (collection) { - // early return if the reactive data is not yet loaded or not present - if (!collection || !Array.isArray(collection) || collection.length === 0) - return null; - - return collection.map((item) => { - return { - fullname: this.studiengangs_person_fullname(item.titelpre, item.vorname, item.nachname), - telefone: this.studiengangs_person_phone(item.kontakt, item.telefonklappe), - ort: item.planbezeichnung ?? null, - email: this.studiengangs_person_email(item.email), - foto: item.foto ? 'data:image/png;base64,'.concat(item.foto) : null, - } - }) - }, - studiengangs_person_fullname: function(titelpre, vorname, nachname){ - if (titelpre && vorname && nachname) - { - return `${titelpre} ${vorname} ${nachname}`; - } - else if (vorname && nachname) - { - return `${vorname} ${nachname}`; - } - else if (nachname) - { - return vorname; - } - else - { - return null; - } - }, - studiengangs_person_phone: function (telefone,telefoneklappe) { - if(telefone && telefoneklappe) - { - return "tel:".concat(telefone).concat(" "+telefoneklappe); - } - else - { - return telefon ? "tel:".concat(telefone): null; - } - }, - studiengangs_person_email: function (email) { - return email? "mailto:".concat(email): null; - }, }, mounted(){ this.$fhcApi.factory.studiengang.studiengangInformation() diff --git a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangPerson.js b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangPerson.js index 294f41cdf..9a077ef82 100644 --- a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangPerson.js +++ b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangPerson.js @@ -1,31 +1,12 @@ export default { - data(){ - - }, - props:{ - person_data: - { - type: Object, - required: true - } - }, - computed:{ - formattedEmail: function(){ - if(!this.person_data ) return null; - let emailString= this.person_data.email.replace("mailto:", ""); - // when splitting a string, the letter that is used to split the string will be removed from the result - let emailArray = emailString.split('@'); - // returns both parts of the splitted string in combination with the removed letter and a word break - return emailArray[0] + '@' + emailArray[1]; - }, - }, + props:["uid","vorname","nachname","titelpre","kontakt","telefonklappe","email","planbezeichnung","foto"], template:/*html*/`
- person_dataFoto + mitarbeiter_foto
-
{{person_data.fullname}}
+
{{fullname}}

@@ -34,52 +15,75 @@ export default {
- {{person_data.ort}} + {{ort}}
- +
- `, + `, + computed:{ + formattedEmail: function(){ + if(!this.email ) return null; + let emailString= this.email.replace("mailto:", ""); + // when splitting a string, the letter that is used to split the string will be removed from the result + let emailArray = emailString.split('@'); + // returns both parts of the splitted string in combination with the removed letter and a word break + return emailArray[0] + '@' + emailArray[1]; + }, + fullname: function () { + if (this.titelpre && this.vorname && this.nachname) { + return `${this.titelpre} ${this.vorname} ${this.nachname}`; + } + else if (this.vorname && this.nachname) { + return `${this.vorname} ${this.nachname}`; + } + else if (this.nachname) { + return this.vorname; + } + else { + return null; + } + }, + phone: function () { + if (this.kontakt && this.telefoneklappe) { + return { + link: "tel:".concat(this.kontakt).concat(" " + this.telefoneklappe), + number: this.kontakt.concat(" " + this.telefoneklappe), + } + } + else { + return this.kontakt ? { + link: "tel:".concat(this.kontakt), + number: this.kontakt, + } : null; + } + }, + email_link: function () { + return this.email ? "mailto:".concat(this.email) : null; + }, + base64Image:function(){ + return this.foto ? 'data:image/png;base64,'.concat(this.foto) : null; + }, + ort:function(){ + return this.planbezeichnung ?? null; + }, + profilViewLink: function(){ + return this.uid ? FHC_JS_DATA_STORAGE_OBJECT.app_root.concat(FHC_JS_DATA_STORAGE_OBJECT.ci_router).concat("/Cis/Profil/View/").concat(this.uid): null; + }, + }, + } \ No newline at end of file diff --git a/public/js/components/Cis/Cms/StudiengangInformation/StudiengangVertretung.js b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangVertretung.js new file mode 100644 index 000000000..abb476c19 --- /dev/null +++ b/public/js/components/Cis/Cms/StudiengangInformation/StudiengangVertretung.js @@ -0,0 +1,32 @@ +export default { + props: { + title:String, + vertretungsList:Array, + showBezeichnung:Boolean, + }, + template:/*html*/` +
+
+ {{title}} +
+
+

+ + + + {{vertretungFormatedName(vertretung,false)}} +

+
+
+ `, + methods: { + profilViewLink: function (uid) { + return uid ? FHC_JS_DATA_STORAGE_OBJECT.app_root.concat(FHC_JS_DATA_STORAGE_OBJECT.ci_router).concat("/Cis/Profil/View/").concat(uid) : null; + }, + vertretungFormatedName: function (vertretung) { + if (!vertretung) return null; + return `${vertretung.vorname ?? ''} ${vertretung.nachname ?? ''} ${vertretung.bezeichnung && this.showBezeichnung ? '('.concat(vertretung.bezeichnung.replace("(", "").replace(")", "")).concat(")") : ''}` + }, + }, + +} \ No newline at end of file