From 6e303e79e140bbb7eac82fd31f87b36da5efb65e Mon Sep 17 00:00:00 2001 From: Antonin COQUET <ext.sopra.acoquet@grandlyon.com> Date: Mon, 12 Apr 2021 15:05:44 +0200 Subject: [PATCH] feat(structures): add owners list for admin --- .../structure-details/structure-details.component.html | 9 +++++++++ .../structure-details/structure-details.component.ts | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index 4f1daeeda..ec2c3ff77 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -121,6 +121,15 @@ </div> </div> </div> + <div *ngIf="profileService.isAdmin()" class="hide-on-print"> + Administrateur(s) de cette structure: + <div *ngIf="structureAdmins.length === 0">Aucun administrateur</div> + <div *ngIf="structureAdmins.length > 0"> + <div *ngFor="let structureAdmin of structureAdmins"> + {{ structureAdmin.email }} + </div> + </div> + </div> <div fxLayout="row" fxLayoutAlign="center center" class="hide-on-print"> <a *ngIf="!isClaimed" (click)="handleClaim()" class="primary" tabindex="0">Revendiquer cette structure</a> <a *ngIf="displayJoin()" (click)="handleJoin()" class="primary" tabindex="0">Rejoindre cette structure</a> diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 79042b400..0382434a5 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -15,6 +15,7 @@ import { ProfileService } from '../../../profile/services/profile.service'; import { User } from '../../../models/user.model'; import { AuthService } from '../../../services/auth.service'; import { PublicCategorie } from '../../enum/public.enum'; +import { Owner } from '../../../models/owner.model'; @Component({ selector: 'app-structure-details', templateUrl: './structure-details.component.html', @@ -44,6 +45,7 @@ export class StructureDetailsComponent implements OnInit { public claimModalOpenned = false; public structureErrorModalOpenned = false; public joinModalOpenned = false; + public structureAdmins: Owner[] = []; constructor( private printService: PrintService, @@ -67,8 +69,15 @@ export class StructureDetailsComponent implements OnInit { this.isLoading = true; if (this.userIsLoggedIn()) { this.currentProfile = await this.profileService.getProfile(); + + if (this.profileService.isAdmin()) { + this.structureService.getStructureWithOwners(this.structure._id, this.currentProfile).subscribe((res) => { + this.structureAdmins = res.owners; + }); + } } this.isClaimed = await this.structureService.isClaimed(this.structure._id, this.currentProfile).toPromise(); + // GetTclStopPoints this.getTclStopPoints(); this.searchService.getCategoriesTraining().subscribe((referentiels) => { -- GitLab