switched 2 inputs
This commit is contained in:
@@ -15,7 +15,7 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
['key' => 'deliveryAddressLine', 'text' => 'L.-Adr.', 'required' => true],
|
||||
['key' => 'deliveryAddressPLZ', 'text' => 'L.-Adr. PLZ', 'required' => true],
|
||||
['key' => 'deliveryAddressEMail', 'text' => 'L.-Adr. EMail', 'required' => true, 'table' => false],
|
||||
['key' => 'note', 'text' => 'Notiz', 'required' => true, 'table' => false],
|
||||
['key' => 'note', 'text' => 'Art der Arbeit', 'required' => true, 'table' => false],
|
||||
['key' => 'status',
|
||||
'text' => 'Status',
|
||||
'required' => true,
|
||||
@@ -387,6 +387,37 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
die(json_encode(['success' => true, 'status' => 'USER_NO_CAR']));
|
||||
}
|
||||
|
||||
protected function geoAutocompleteAction() {
|
||||
$search = $this->request->q;
|
||||
$search = urlencode($search);
|
||||
$url = "https://nominatim.haid.in/search?q=$search&format=json";
|
||||
$data = json_decode(file_get_contents($url), true);
|
||||
$out = [];
|
||||
|
||||
|
||||
|
||||
foreach ($data as $entry) {
|
||||
$parsedDisplayNameParts = [];
|
||||
foreach(explode(',', $entry['display_name']) as $part) {
|
||||
// if str_includes Bezirk remove it
|
||||
if (strpos($part, 'Bezirk') !== false) {
|
||||
continue;
|
||||
}
|
||||
$parsedDisplayNameParts[] = $part;
|
||||
}
|
||||
$out[] = ['value' => $entry['lat'] . "," . $entry['lon'], 'text' => implode(',', $parsedDisplayNameParts)];
|
||||
}
|
||||
self::returnJson($out);
|
||||
}
|
||||
|
||||
protected function geoReverseAction() {
|
||||
$lat = $this->request->lat;
|
||||
$lon = $this->request->lon;
|
||||
$url = "https://nominatim.haid.in/reverse?lat=$lat&lon=$lon&format=json";
|
||||
$data = json_decode(file_get_contents($url), true);
|
||||
self::returnJson($data);
|
||||
}
|
||||
|
||||
|
||||
//TODO: export this to an api class for openstreetmap
|
||||
protected function getDistanceAction() {
|
||||
@@ -413,7 +444,7 @@ class WarehouseShippingNoteController extends TTCrud {
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://nominatim.openstreetmap.org/search?q=$address&format=json",
|
||||
CURLOPT_URL => "https://nominatim.haid.in/search?q=$address&format=json",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
|
||||
Reference in New Issue
Block a user