diff --git a/src/app/structure-list/components/card/card.component.html b/src/app/structure-list/components/card/card.component.html index 1111644351601efa7e80b94c4aed177aa1b68b5d..ca492505150b2e60a136b393172950367583a457 100644 --- a/src/app/structure-list/components/card/card.component.html +++ b/src/app/structure-list/components/card/card.component.html @@ -1,6 +1,6 @@ <div class="structure" fxLayout="column" (click)="cardClicked()" (mouseenter)="cardHover()"> <div class="headerStructure" fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="16px"> - <span class="structure-name">{{ structure.structureName }}</span> + <span class="structure-name" [ngClass]="{ notClaimed: !isClaimed }">{{ structure.structureName }}</span> <div *ngIf="structure.distance" class="distanceStructure" diff --git a/src/app/structure-list/components/card/card.component.scss b/src/app/structure-list/components/card/card.component.scss index 6deabb870aa37f73a9b53c9efa120ca599f370fc..fe17d873498c1c91b65ba030f42843cfd067253b 100644 --- a/src/app/structure-list/components/card/card.component.scss +++ b/src/app/structure-list/components/card/card.component.scss @@ -17,6 +17,9 @@ font-style: italic; } .structure-name { + &.notClaimed { + color: $red-info; + } color: $grey-1; @include cn-bold-18; padding-bottom: 5px; diff --git a/src/app/structure-list/components/card/card.component.ts b/src/app/structure-list/components/card/card.component.ts index 94440ab2d1d22a56d29fd2585b81971ffd13f0a2..b3a414f4a8fd446011c456f9652fe29a26ae8f7a 100644 --- a/src/app/structure-list/components/card/card.component.ts +++ b/src/app/structure-list/components/card/card.component.ts @@ -1,7 +1,9 @@ import { Component, Input, Output, OnInit, EventEmitter } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Structure } from '../../../models/structure.model'; +import { ProfileService } from '../../../profile/services/profile.service'; import { GeojsonService } from '../../../services/geojson.service'; +import { StructureService } from '../../../services/structure.service'; @Component({ selector: 'app-card', @@ -12,9 +14,24 @@ export class CardComponent implements OnInit { @Input() public structure: Structure; @Output() public showDetails: EventEmitter<Structure> = new EventEmitter<Structure>(); @Output() public hover: EventEmitter<Structure> = new EventEmitter<Structure>(); + public isClaimed = true; - constructor(private route: ActivatedRoute, private router: Router) {} - ngOnInit(): void {} + constructor( + private route: ActivatedRoute, + private router: Router, + private profileService: ProfileService, + private structureService: StructureService + ) {} + ngOnInit(): void { + if (this.profileService.isAdmin()) { + this.setClaimIndicator(); + } + } + + // Check if structure haven't owners to help admin vision. + async setClaimIndicator() { + this.isClaimed = await this.structureService.isClaimed(this.structure._id, null).toPromise(); + } /** * Display distance in m or km according to value