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

feat: add address on strucutre details

parent 8b3bd921
No related branches found
No related tags found
2 merge requests!14Recette,!13Dev
...@@ -52,6 +52,7 @@ export class HomeComponent implements OnInit { ...@@ -52,6 +52,7 @@ export class HomeComponent implements OnInit {
private getStructurePosition(structure: Structure): Promise<Structure> { private getStructurePosition(structure: Structure): Promise<Structure> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.getCoord(structure.voie).subscribe((coord: GeoJson) => { this.getCoord(structure.voie).subscribe((coord: GeoJson) => {
structure.address = coord.properties.name + ' - ' + coord.properties.postcode + ' ' + coord.properties.city;
structure.distance = this.geoJsonService.getDistance( structure.distance = this.geoJsonService.getDistance(
coord.geometry.getLon(), coord.geometry.getLon(),
coord.geometry.getLat(), coord.geometry.getLat(),
......
export class GeoJsonProperties {
public city: string;
public country: string;
public name: string;
public postcode: string;
public state: string;
}
import { AddressGeometry } from './addressGeometry.model'; import { AddressGeometry } from './addressGeometry.model';
import { GeoJsonProperties } from './geoJsonProperties.model';
export class GeoJson { export class GeoJson {
public geometry: AddressGeometry; public geometry: AddressGeometry;
public type: string; public type: string;
public properties: object; public properties: GeoJsonProperties;
constructor(obj?: any) { constructor(obj?: any) {
Object.assign(this, obj, { Object.assign(this, obj, {
......
...@@ -36,6 +36,7 @@ export class Structure { ...@@ -36,6 +36,7 @@ export class Structure {
public isOpen: boolean; public isOpen: boolean;
public openedOn: OpeningDay; public openedOn: OpeningDay;
public distance?: string; public distance?: string;
public address?: string;
constructor(obj?: any) { constructor(obj?: any) {
Object.assign(this, obj, { Object.assign(this, obj, {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div fxLayout="column" fxFlex="60%"> <div fxLayout="column" fxFlex="60%">
<div *ngIf="structure.voie" fxLayout="row" fxLayoutAlign="none center"> <div *ngIf="structure.voie" fxLayout="row" fxLayoutAlign="none center">
<em class="ico-marker-pin-sm absolute"></em> <em class="ico-marker-pin-sm absolute"></em>
<p>{{ structure.voie }}</p> <p>{{ structure.n }} {{ structure.address }}</p>
</div> </div>
<div *ngIf="structure.siteWeb" fxLayout="row" fxLayoutAlign="none center"> <div *ngIf="structure.siteWeb" fxLayout="row" fxLayoutAlign="none center">
<em class="ic-globe-alt"></em> <em class="ic-globe-alt"></em>
......
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