Skip to content
Snippets Groups Projects
Commit c386cafd authored by Pierre Ecarlat's avatar Pierre Ecarlat
Browse files

Merge branch '566-carto-oullins-pierre-benite' into 'dev'

feat: Update of photon-bal to handle oullins pierre benite

See merge request !959
parents de0d870e f59a8f97
No related branches found
No related tags found
2 merge requests!975v3.4.0,!959feat: Update of photon-bal to handle oullins pierre benite
......@@ -81,6 +81,9 @@ export class StructureFormComponent implements OnInit, OnChanges {
this.structureForm.get('address').get('numero').setValue(address.numero);
this.structureForm.get('address').get('street').setValue(address.street);
this.structureForm.get('address').get('commune').setValue(address.commune);
this.structureForm.get('address').get('coordinates').setValue(address.coordinates);
this.structureForm.get('address').get('postcode').setValue(address.postcode);
this.structureForm.get('address').get('inseeCode').setValue(address.inseeCode);
} else {
this.structureForm.get('address').reset();
}
......
......@@ -3,5 +3,6 @@ export class Address {
street: string = null;
commune: string = null;
postcode?: number = null;
inseeCode: number = null;
coordinates? = [];
}
......@@ -242,6 +242,7 @@ export class StructureEditionSummaryComponent implements OnInit {
let address = '';
if (this.structure.address.numero) address += `${this.structure.address.numero} `;
if (this.structure.address.street) address += `${this.structure.address.street}, `;
if (this.structure.address.postcode) address += `${this.structure.address.postcode} `;
if (this.structure.address.commune) address += `${this.structure.address.commune}`;
return address;
}
......
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import * as _ from 'lodash';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { GeoJson } from '../map/models/geojson.model';
import * as _ from 'lodash';
@Injectable({
providedIn: 'root',
......@@ -61,7 +61,7 @@ export class GeojsonService {
// ::: :::
// ::: This routine calculates the distance between two points (given the :::
// ::: latitude/longitude of those points). It is being used to calculate :::
// ::: the distance between two locations using GeoDataSource (TM) prodducts :::
// ::: the distance between two locations using GeoDataSource (TM) products :::
// ::: :::
// ::: Definitions: :::
// ::: South latitudes are negative, east longitudes are positive :::
......
......@@ -32,16 +32,10 @@ export class AddressAutocompleteComponent implements OnInit {
constructor(private addressService: AddressService) {}
ngOnInit(): void {
this.launchSearch();
}
public launchSearch(): void {
if (this.address) {
let address_str = null;
let address_str = this.address.street + ', ' + this.address.postcode + ' ' + this.address.commune;
if (this.address.numero) {
address_str = this.address.numero + ' ' + this.address.street + ', ' + this.address.commune;
} else {
address_str = this.address.street + ', ' + this.address.commune;
address_str = this.address.numero + ' ' + address_str;
}
this.searchString = address_str;
}
......@@ -56,7 +50,6 @@ export class AddressAutocompleteComponent implements OnInit {
el.displayedName = this.parseHitToAddress(el);
return el;
});
// Filtering duplicate displayed string. This duplication is caused by the API used for gathering addresses info.
this.data = [...new Map(data.features.map((item) => [item.displayedName, item])).values()];
this.isAlreadySearching = false;
......@@ -75,6 +68,7 @@ export class AddressAutocompleteComponent implements OnInit {
address.commune = hit.properties.city;
address.coordinates = hit.geometry.coordinates;
address.postcode = hit.properties.postcode;
address.inseeCode = hit.properties.extra.insee;
if (hit.properties.street) {
address.street = hit.properties.street;
} else {
......@@ -99,7 +93,7 @@ export class AddressAutocompleteComponent implements OnInit {
} else {
parsedAddress += `${hit.properties.name}, `;
}
parsedAddress += `${hit.properties.city}`;
parsedAddress += `${hit.properties.postcode} ${hit.properties.city}`;
return parsedAddress;
}
}
......@@ -69,6 +69,9 @@ export class FormUtils {
numero: new UntypedFormControl(structure.address.numero),
street: new UntypedFormControl(structure.address.street, Validators.required),
commune: new UntypedFormControl(structure.address.commune, Validators.required),
coordinates: new UntypedFormControl(structure.address.coordinates, Validators.required),
postcode: new UntypedFormControl(structure.address.postcode, Validators.required),
inseeCode: new UntypedFormControl(structure.address.inseeCode, Validators.required),
}),
contactMail: new UntypedFormControl(structure.contactMail === '' ? null : structure.contactMail, [
Validators.pattern(CustomRegExp.EMAIL),
......
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