-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathweb.html
More file actions
100 lines (94 loc) · 2.47 KB
/
web.html
File metadata and controls
100 lines (94 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.qrcode.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkEwq_DBXFsYc2BzYZ3TNsWHn19kxZ2HM&callback=initMap" async defer></script>
<script>
socket = io();
var marker = null;
var ruta = null;
var markers = [];
var motorizados = {};
var map;
socket.emit('who-i-am');
socket.on('you-are', function (msg){
document.getElementById("web_id").innerHTML = msg;
$("#qr").qrcode({
"size": 100,
"color": "#000",
"text": msg
});
});
socket.on('ionic-qr', function (msg){
document.getElementById("cell_id").value = msg;
});
socket.on('gps', function (msg){
if (motorizados[msg.django_id] == undefined) {
motorizados[msg.django_id] = {markers: [], marker: null};
}
if(motorizados[msg.django_id].marker){
motorizados[msg.django_id].marker.setMap(null);
motorizados[msg.django_id].marker = null;
}
var cityCircle = new google.maps.Circle({
strokeColor: motorizados[msg.django_id].detenido?'#FF0000':'#0B9444',
strokeOpacity: 1,
strokeWeight: 2,
fillColor: motorizados[msg.django_id].detenido? '#FF0000':'#8DC63E',
fillOpacity: 0.8,
map: map,
center: msg,
radius: 10
});
motorizados[msg.django_id].markers.push(cityCircle);
motorizados[msg.django_id].marker = new google.maps.Marker({
position: msg,
map: map,
icon: 'img/pin.svg',
title: 'my ID ' + msg.django_id,
animation: google.maps.Animation.DROP
});
map.setCenter(msg);
});
socket.on('motorizado-detenido', function(message) {
console.log(message);
motorizados[message.identificador].detenido = true;
});
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 10.3970683, lng: -75.4925649},
zoom: 15
});
}
</script>
<style>
html, body {
margin: 0;
padding: 0;
}
#map {
height: 400px;
}
#qr{
width: 100px;
margin: 0 auto;
padding: 5px;
}
</style>
<title>Map</title>
</head>
<body>
<section>
<p id="web_id"></p>
<div id="qr">
</div>
<input type="search" id="cell_id" />
<div id="map"></div>
</section>
</body>
</html>