Browse Source

Merge branch 'develop'

develop
Guillaume Bourgeois 2 years ago
parent
commit
68f2a5ee70
4 changed files with 33 additions and 21 deletions
  1. +11
    -10
      Component/CitiesComponent.php
  2. +1
    -1
      Definition/Field/AbstractFieldDefinition.php
  3. +9
    -0
      Resources/assets/functions/tools.js
  4. +12
    -10
      Resources/assets/functions/widgets.js

+ 11
- 10
Component/CitiesComponent.php View File

@@ -85,19 +85,20 @@ class CitiesComponent

public function callAddressApi($query)
{
if(is_null($query)) {
$query = '';
}
$resultsToReturn = [];

if(!is_null($query)) {
$provider = $this->getGeocoderProvider() ;
$query = GeocodeQuery::create($query)->withData('type', 'housenumber');
$results = $provider->geocodeQuery($query);

$provider = $this->getGeocoderProvider() ;
$query = GeocodeQuery::create($query)->withData('type', 'housenumber');
$results = $provider->geocodeQuery($query);
$resultsToReturn = array();
foreach($results as $result) {
if ($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) {
$resultsToReturn[] = $result;
foreach($results as $result) {
if ($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) {
$resultsToReturn[] = $result;
}
}
}

return $resultsToReturn;
}


+ 1
- 1
Definition/Field/AbstractFieldDefinition.php View File

@@ -146,7 +146,7 @@ abstract class AbstractFieldDefinition
$fieldArray = [];
foreach($configureFieldArray as $fieldName) {
if(isset($allFieldArray[$fieldName])) {
$fieldArray[] = $allFieldArray[$fieldName];
$fieldArray[$fieldName] = $allFieldArray[$fieldName];
}
else {
throw new \ErrorException('Le field "'.$fieldName.'" n\'est pas défini dans configureFields()');

+ 9
- 0
Resources/assets/functions/tools.js View File

@@ -65,6 +65,15 @@ export class SovTools {
else return null;
}

static formatNumberWithoutRounding(number, toFixed) {
if (number){
let factor = Math.pow(10, toFixed);
return Math.floor(number * factor) / factor
}else{
return null
}
}

static formatNumberWithoutFixed(number) {
if (typeof number == 'string') number = number.replace(',', '.');
if (number) return Number(number);

+ 12
- 10
Resources/assets/functions/widgets.js View File

@@ -100,16 +100,18 @@ export class SovWidgets {
static setAutoCompleteField() {
var autocompleteFields = $('[data-lc-autocomplete-url]');
autocompleteFields.each(function () {
var $this = $(this),
url = $this.data('lc-autocomplete-url');

$this.autoComplete({
//bootstrapVersion: 4,
//noResultsText: 'Aucun résultat n\'a été trouvé.',
resolverSettings: {
url: url
}
});
if(!$(this).hasClass('autocomplete-disabled')) {
var $this = $(this),
url = $this.data('lc-autocomplete-url');

$this.autoComplete({
//bootstrapVersion: 4,
//noResultsText: 'Aucun résultat n\'a été trouvé.',
resolverSettings: {
url: url
}
});
}
});
}


Loading…
Cancel
Save