240 lines
9.2 KiB
HTML
240 lines
9.2 KiB
HTML
{% extends "default.html" %}
|
|
{% load static %}
|
|
{% load mysettings %}
|
|
|
|
{% block header_link %}
|
|
<!-- Select2 -->
|
|
<link rel="stylesheet" href="{% static 'lte/plugins/select2/css/select2.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
|
<link rel="stylesheet" href="{% static 'lte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
|
|
|
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-core.js"></script>
|
|
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-service.js"></script>
|
|
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-ui.js"></script>
|
|
<script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-mapevents.js"></script>
|
|
|
|
{% endblock header_link %}
|
|
|
|
{% block content %}
|
|
<section class="content">
|
|
<div class="container-fluid ">
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="card">
|
|
<div class="card-body table-responsive p-0" style="height: 85vh; padding-left: 0;">
|
|
<table class="table table-bordered table-hover table-head-fixed text-nowrap text-sm">
|
|
<thead>
|
|
<tr role="row">
|
|
<th>Сотрудники ({{objects_count}})</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
{% for catalog in catalog_list %}
|
|
<tr style="padding-left:0;">
|
|
<td>
|
|
<form action="/ogr/edit/?id={{catalog.id}}" id="frm_name_{{catalog.id}}" method="POST" class="floatLeft butDelUser">
|
|
{% csrf_token %}
|
|
<a href="#" onclick="document.getElementById('frm_name_{{catalog.id}}').submit(); return false;">
|
|
{{ catalog.name }}
|
|
</a>
|
|
<input type="hidden" value="{{catalog.id}}" name="id">
|
|
</form>
|
|
|
|
</td>
|
|
<td>
|
|
<a href="#" class="text-muted">
|
|
<i class="fas fa-bars"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div> <!-- /.card-body -->
|
|
</div> <!-- /.card -->
|
|
</div> <!-- /.row -->
|
|
<div class="col-md-9">
|
|
<div class="card">
|
|
<div class="card-body table-responsive p-0" style="height: 85vh; padding-left: 0;">
|
|
<div id="map"></div>
|
|
</div> <!-- /.card-body -->
|
|
</div> <!-- /.card -->
|
|
</div> <!-- /.row -->
|
|
</div><!-- /.container-fluid -->
|
|
</div>
|
|
</section>
|
|
|
|
{% endblock %}
|
|
|
|
{% block script_footer %}
|
|
<script>
|
|
|
|
function createMarkers() {
|
|
// create SVG Dom Icon
|
|
var svg = `<svg xmlns="http://www.w3.org/2000/svg" class="svg-icon" width="10px" height="10px">
|
|
<circle cx="5" cy="5" r="4" fill="rgb(250, 127, 0)" stroke-width="1" stroke="black" opacity="1"/>
|
|
</svg>`,
|
|
domIcon = new H.map.DomIcon(svg),
|
|
markers = [],
|
|
// array of initial positions of 40 markers
|
|
initialPositions = [
|
|
[53.9919212108278, 86.6710607860535],
|
|
/*[50.98194, 12.50638],
|
|
[51.83169, 12.19096],
|
|
[52.19585, 14.58753],
|
|
[51.30805, 13.55555],
|
|
[51.36305, 11.94083],
|
|
[51.55222, 12.05388],
|
|
[51.29360, 13.35611],
|
|
[53.30638, 12.75222],
|
|
[52.58055, 13.91666],
|
|
[52.20360, 13.15638],
|
|
[54.03825, 12.71051],
|
|
[50.91527, 11.71444],
|
|
[52.91888, 12.42527],
|
|
[52.07361, 11.62638],
|
|
[51.36333, 14.94999],
|
|
[53.83277, 13.66861],
|
|
[51.88944, 14.53194],
|
|
[51.29694, 14.12749],
|
|
[52.38000, 13.52250],
|
|
[51.13280, 13.76720],
|
|
[50.97980, 10.95810],
|
|
[50.02233, 8.57055],
|
|
[52.13460, 7.68482],
|
|
[53.63040, 9.98822],
|
|
[52.47259, 13.40390],
|
|
[50.86589, 7.14273],
|
|
[51.22701, 6.76677],
|
|
[48.35380, 11.7861],
|
|
[49.49869, 11.07805],
|
|
[51.42388, 12.23308],
|
|
[49.21459, 7.10950],
|
|
[48.68989, 9.22196],
|
|
[52.35970, 13.28769],
|
|
[52.46110, 9.68479],
|
|
[53.04750, 8.78665],
|
|
[49.69999, 8.64583],
|
|
[49.94869, 7.26388],
|
|
[49.47305, 8.51416],
|
|
[51.03499, 8.68083]*/
|
|
];
|
|
|
|
// create markers
|
|
initialPositions.forEach(function(pos) {
|
|
markers.push(new H.map.DomMarker({lat: pos[0], lng: pos[1]}, {
|
|
icon: domIcon
|
|
}));
|
|
});
|
|
|
|
// add markers to map
|
|
map.addObjects(markers);
|
|
|
|
// randomly update all markers positions in intervals
|
|
setTimeout(updateMarkerPositions, 500);
|
|
setInterval(updateMarkerPositions, 5000);
|
|
|
|
/**
|
|
* update all markers' positions with animation using the ease function
|
|
*/
|
|
function updateMarkerPositions() {
|
|
markers.forEach(function(marker) {
|
|
// get random position 0 - 450km from map's center in random direction
|
|
let randomPoint = map.getCenter().walk(Math.random() * 3, Math.random() * 4);
|
|
|
|
// update marker's position within ease function callback
|
|
ease(
|
|
marker.getGeometry(),
|
|
randomPoint,
|
|
4000,
|
|
function(coord) {
|
|
marker.setGeometry(coord);
|
|
}
|
|
)
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
function ease(
|
|
startCoord = {lat: 0, lng: 0},
|
|
endCoord = {lat: 1, lng: 1},
|
|
durationMs = 200,
|
|
onStep = console.log,
|
|
onComplete = function() {},
|
|
) {
|
|
var raf = window.requestAnimationFrame || function(f) {window.setTimeout(f, 16)},
|
|
stepCount = durationMs / 16,
|
|
valueIncrementLat = (endCoord.lat - startCoord.lat) / stepCount,
|
|
valueIncrementLng = (endCoord.lng - startCoord.lng) / stepCount,
|
|
sinValueIncrement = Math.PI / stepCount,
|
|
currentValueLat = startCoord.lat,
|
|
currentValueLng = startCoord.lng,
|
|
currentSinValue = 0;
|
|
|
|
function step() {
|
|
currentSinValue += sinValueIncrement;
|
|
currentValueLat += valueIncrementLat * (Math.sin(currentSinValue) ** 2) * 2;
|
|
currentValueLng += valueIncrementLng * (Math.sin(currentSinValue) ** 2) * 2;
|
|
|
|
if (currentSinValue < Math.PI) {
|
|
onStep({lat: currentValueLat, lng: currentValueLng});
|
|
raf(step);
|
|
} else {
|
|
onStep(endCoord);
|
|
onComplete();
|
|
}
|
|
}
|
|
|
|
raf(step);
|
|
}
|
|
|
|
/**
|
|
* Moves the map to display over Berlin
|
|
*
|
|
* @param {H.Map} map A HERE Map instance within the application
|
|
*/
|
|
function moveMapTolocation(map) {
|
|
map.setCenter({ lat: {{lat}}, lng: {{lon}} });
|
|
map.setZoom(14);
|
|
}
|
|
|
|
/**
|
|
* Boilerplate map initialization code starts below:
|
|
*/
|
|
|
|
//Step 1: initialize communication with the platform
|
|
// In your own code, replace variable window.apikey with your own apikey
|
|
var platform = new H.service.Platform({
|
|
apikey: '8hwYsYjgnywj3aNdHc9dLF7hLD3c2-ydDyY4tiawfNA'
|
|
});
|
|
var defaultLayers = platform.createDefaultLayers();
|
|
|
|
//Step 2: initialize a map - this map is centered over Europe
|
|
var map = new H.Map(document.getElementById('map'),
|
|
defaultLayers.vector.normal.map, {
|
|
center: {
|
|
lat: {{lat}}, lng: {{lon}} },
|
|
zoom: 4,
|
|
pixelRatio: window.devicePixelRatio || 1
|
|
});
|
|
// add a resize listener to make sure that the map occupies the whole container
|
|
window.addEventListener('resize', () => map.getViewPort().resize());
|
|
|
|
//Step 3: make the map interactive
|
|
// MapEvents enables the event system
|
|
// Behavior implements default interactions for pan/zoom (also on mobile touch environments)
|
|
var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));
|
|
|
|
// Create the default UI components
|
|
var ui = H.ui.UI.createDefault(map, defaultLayers);
|
|
|
|
// Now use the map as required...
|
|
window.onload = function () {
|
|
moveMapTolocation(map);
|
|
}
|
|
createMarkers();
|
|
</script>
|
|
{% endblock script_footer %}
|