Skip to content

Commit

Permalink
Merge 591ba37 into 258505e
Browse files Browse the repository at this point in the history
  • Loading branch information
kimhaak committed Sep 10, 2021
2 parents 258505e + 591ba37 commit 2aa11fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions includes/html/dev-overview-data.inc.php
Expand Up @@ -147,16 +147,21 @@
<script>
var device_marker, device_location, device_map;
$("#toggle-map").on("shown.bs.collapse", function () {
if (device_marker == null) {
if (device_marker == null) {
device_location = new L.LatLng(' . (float) $location->lat . ', ' . (float) $location->lng . ');
config = {"tile_url": "' . Config::get('leaflet.tile_url', '{s}.tile.openstreetmap.org') . '"};
device_map = init_map("location-map", "' . $maps_engine . '", "' . $maps_api . '", config);
device_marker = init_map_marker(device_map, device_location);
device_marker = L.marker(device_location).addTo(device_map);
device_map.setView(device_location);
device_map.setZoom(18);
device_marker.dragging.enable();
';

if (Auth::user()->isAdmin()) {
echo ' device_map.on("dragend", function () {
echo ' device_marker.on("dragend", function () {
var new_location = device_marker.getLatLng();
if (confirm("Update location to " + new_location + "? This will update this location for all devices!")) {
update_location(' . $location->id . ', new_location, function(success) {
Expand Down

0 comments on commit 2aa11fb

Please sign in to comment.