Skip to content
Snippets Groups Projects
Commit 7623db7a authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'feat/indicator-admin' into 'dev'

feat(card) : add indicator claim to help admin

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client!98
parents 2ada145e 70f03336
No related branches found
No related tags found
3 merge requests!103Recette,!102Dev,!98feat(card) : add indicator claim to help admin
<div class="structure" fxLayout="column" (click)="cardClicked()" (mouseenter)="cardHover()"> <div class="structure" fxLayout="column" (click)="cardClicked()" (mouseenter)="cardHover()">
<div class="headerStructure" fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="16px"> <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 <div
*ngIf="structure.distance" *ngIf="structure.distance"
class="distanceStructure" class="distanceStructure"
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
font-style: italic; font-style: italic;
} }
.structure-name { .structure-name {
&.notClaimed {
color: $red-info;
}
color: $grey-1; color: $grey-1;
@include cn-bold-18; @include cn-bold-18;
padding-bottom: 5px; padding-bottom: 5px;
......
import { Component, Input, Output, OnInit, EventEmitter } from '@angular/core'; import { Component, Input, Output, OnInit, EventEmitter } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { Structure } from '../../../models/structure.model'; import { Structure } from '../../../models/structure.model';
import { ProfileService } from '../../../profile/services/profile.service';
import { GeojsonService } from '../../../services/geojson.service'; import { GeojsonService } from '../../../services/geojson.service';
import { StructureService } from '../../../services/structure.service';
@Component({ @Component({
selector: 'app-card', selector: 'app-card',
...@@ -12,9 +14,24 @@ export class CardComponent implements OnInit { ...@@ -12,9 +14,24 @@ export class CardComponent implements OnInit {
@Input() public structure: Structure; @Input() public structure: Structure;
@Output() public showDetails: EventEmitter<Structure> = new EventEmitter<Structure>(); @Output() public showDetails: EventEmitter<Structure> = new EventEmitter<Structure>();
@Output() public hover: EventEmitter<Structure> = new EventEmitter<Structure>(); @Output() public hover: EventEmitter<Structure> = new EventEmitter<Structure>();
public isClaimed = true;
constructor(private route: ActivatedRoute, private router: Router) {} constructor(
ngOnInit(): void {} 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 * Display distance in m or km according to value
......
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