From f85d2c4e938941eef70ce6a36f12b8c507b2524b Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 11 Feb 2021 16:08:25 +0100 Subject: [PATCH] feat: add user delete structure --- .../structure-details/structure-details.component.html | 2 +- .../structure-details/structure-details.component.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 5f2d23285..2cbb04476 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 @@ -136,7 +136,7 @@ > Modifier cette structure </a> --> - <a *ngIf="profileService.isAdmin()" (click)="toggleDeleteModal()" class="primary" tabindex="0"> + <a *ngIf="canDelete()" (click)="toggleDeleteModal()" class="primary" tabindex="0"> Supprimer cette structure </a> </div> 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 bff893ebc..df9de7418 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 @@ -220,4 +220,11 @@ export class StructureDetailsComponent implements OnInit { this.tclStopPoints = res; }); } + + public canDelete(): boolean { + if (this.profileService.isAdmin() || this.profileService.isLinkedToStructure(this.structure._id)) { + return true; + } + return false; + } } -- GitLab