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 08b0db06cc9ff66654168d07c206899adf7a7d16..a22713344fc53967dc4f95df962861f17b397451 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 @@ -130,7 +130,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 dc84ff30b68137212e00865c6980ec67642eb45f..48522178f89d05dde0e54214695d55ee38643c6e 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 @@ -203,6 +203,12 @@ 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; + } public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { return equipmentsAndServices.filter((eqpt) => ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners', 'wifiEnAccesLibre'].includes(eqpt)