test/apps/gto/templates/gto_map.html

135 lines
5.5 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-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Горнотранспортное оборудование</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="/">Главная</a></li>
<li class="breadcrumb-item active">Горнотранспортное оборудование</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<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: 75vh; 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: 75vh; padding-left: 0;">
<div id="map"></div>
</div> <!-- /.card-body -->
</div> <!-- /.card -->
</div> <!-- /.row -->
</div><!-- /.container-fluid -->
</div>
</section>
{% endblock %}
{% block script_footer %}
<script>
/**
* Moves the map to display over Berlin
*
* @param {H.Map} map A HERE Map instance within the application
*/
function moveMapToBerlin(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 () {
moveMapToBerlin(map);
}
</script>
{% endblock script_footer %}