Skip to content
Snippets Groups Projects
Commit 7627bc32 authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

Merge branch 'fix/display-job-employer-in-profile' into 'V2.0'

Fix/display job employer in profile

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client!270
parents 0f4b5608 bf5db27c
No related branches found
No related tags found
4 merge requests!418V2.1.0,!400V2.0,!270Fix/display job employer in profile,!230V2.0
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
></app-svg-icon> ></app-svg-icon>
<div class="information"> <div class="information">
<div class="name">{{ userProfile.name }} {{ userProfile.surname }}</div> <div class="name">{{ userProfile.name }} {{ userProfile.surname }}</div>
<div class="job">{{ userProfile.job.name }}, {{ userProfile.employer.name }}</div> <div *ngIf="utils.getJobEmployer(userProfile)" class="job">{{ utils.getJobEmployer(userProfile) }}</div>
<div class="phone">{{ userProfile.phone | phone }}</div> <div class="phone">{{ userProfile.phone | phone }}</div>
<a class="email" href="mailto:{{ userProfile.email }}">{{ userProfile.email }}</a> <a class="email" href="mailto:{{ userProfile.email }}">{{ userProfile.email }}</a>
<div class="description" *ngIf="userProfile.description">{{ userProfile.description }}</div> <div class="description" *ngIf="userProfile.description">{{ userProfile.description }}</div>
......
...@@ -5,6 +5,7 @@ import { User } from '../models/user.model'; ...@@ -5,6 +5,7 @@ import { User } from '../models/user.model';
import { StructureService } from '../services/structure.service'; import { StructureService } from '../services/structure.service';
import { ButtonType } from '../shared/components/button/buttonType.enum'; import { ButtonType } from '../shared/components/button/buttonType.enum';
import { ProfileService } from './services/profile.service'; import { ProfileService } from './services/profile.service';
import { Utils } from '../utils/utils';
@Component({ @Component({
selector: 'app-profile', selector: 'app-profile',
...@@ -19,7 +20,8 @@ export class ProfileComponent implements OnInit { ...@@ -19,7 +20,8 @@ export class ProfileComponent implements OnInit {
constructor( constructor(
private profileService: ProfileService, private profileService: ProfileService,
private structureService: StructureService, private structureService: StructureService,
private router: Router private router: Router,
public utils: Utils
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { FormGroup } from '@angular/forms'; import { FormGroup } from '@angular/forms';
import { User } from '../models/user.model';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
...@@ -25,4 +26,13 @@ export class Utils { ...@@ -25,4 +26,13 @@ export class Utils {
} }
return phoneNumber; return phoneNumber;
} }
public getJobEmployer(userProfile: User): string {
const jobName = userProfile.job?.name;
const employerName = userProfile.employer?.name;
if (!jobName && !employerName) return '';
if (!jobName && employerName) return employerName;
if (jobName && !employerName) return jobName;
if (jobName && employerName) return `${jobName}, ${employerName}`;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment