added new way to select areas for shipping note
This commit is contained in:
@@ -438,11 +438,10 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
protected function geoAutocompleteAction() {
|
||||
$search = $this->request->q;
|
||||
$search = urlencode($search);
|
||||
$url = "https://nominatim.haid.in/search?q=$search&format=json";
|
||||
$url = "https://nominatim.haid.in/search?q=$search&format=json&addressdetails=1";
|
||||
$data = json_decode(file_get_contents($url), true);
|
||||
$out = [];
|
||||
|
||||
|
||||
foreach ($data as $entry) {
|
||||
$parsedDisplayNameParts = [];
|
||||
foreach (explode(',', $entry['display_name']) as $part) {
|
||||
@@ -460,7 +459,7 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
}
|
||||
}
|
||||
}
|
||||
$out[] = ['value' => $entry['lat'] . "," . $entry['lon'] . (!isset($entry['house_number']) ? ", area" : ""), 'text' => implode(',', $parsedDisplayNameParts)];
|
||||
$out[] = ['value' => $entry['lat'] . "," . $entry['lon'] . (!isset($entry['address']['house_number']) ? ", area" : ""), 'text' => implode(',', $parsedDisplayNameParts)];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user