Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client
1 result
Show changes
Commits on Source (3)
......@@ -29,7 +29,7 @@
<app-card
*ngFor="let structure of ref.structureList"
[structure]="structure"
[isClaimed]="((structureClaims | async) ?? [])[structure._id]"
[isClaimed]="isAdmin ? structure.isClaimed : true"
(showDetails)="ref.showDetails($event)"
(hover)="ref.handleCardHover($event)"
class="structure-card"
......
......@@ -5,6 +5,7 @@ import { Filter, GeoJson, Structure } from '@gouvfr-anct/mediation-numerique';
import { ButtonType } from '@gouvfr-anct/mediation-numerique/shared';
import * as _ from 'lodash';
import { Observable } from 'rxjs';
import { ProfileService } from '../profile/services/profile.service';
import { AuthService } from '../services/auth.service';
import { GeojsonService } from '../services/geojson.service';
import { StructureService } from '../services/structure.service';
......@@ -29,11 +30,11 @@ export class CartoComponent implements OnInit {
public searchedValue = null;
public buttonTypeEnum = ButtonType;
constructor(
private structureService: StructureService,
private geoJsonService: GeojsonService,
private activatedRoute: ActivatedRoute,
private profileService: ProfileService,
private meta: Meta,
private router: Router,
private authService: AuthService
......@@ -112,9 +113,10 @@ export class CartoComponent implements OnInit {
sortByDistance: boolean = true
): void {
Promise.all(
structures.map((structure) => {
structures.map(async (structure) => {
if (this.geolocation) {
structure = this.getStructurePosition(structure, lon, lat);
structure.isClaimed = await this.isClaimed(structure).toPromise();
}
return structure;
})
......@@ -123,7 +125,6 @@ export class CartoComponent implements OnInit {
structureList = _.sortBy(structureList, ['distance']);
}
this.structures = structureList;
// await this.setClaimIndicators(this.profilService.isAdmin());
});
}
......@@ -221,7 +222,11 @@ export class CartoComponent implements OnInit {
}
}
public isClaimed(structure): Observable<boolean> {
public get isAdmin(): boolean {
return this.profileService.isAdmin();
}
public isClaimed(structure: Structure): Observable<boolean> {
return this.structureService.isClaimed(structure._id, null);
}
}
This diff is collapsed.
This diff is collapsed.