-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (142 loc) · 5.32 KB
/
index.html
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html>
<head>
<title>Known Places Configuration Assistant</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css" />
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>
<style>
body {
background-color: #005151;
color: white;
}
.map {
height: 475px;
width: 100%;
}
.coordinates {
padding: 10px;
font-weight: bold;
}
#howto {
padding: 10px;
font-style: italic;
}
</style>
</head>
<body>
<!-- changelog
Created By: Brandon Boisclair (brandon.boisclair@ukg.com)
v1.0 - Initial Release
-->
<center>
<h1>Unofficial UKG Pro WFM - Known Places Configuration Assistant</h1>
</center>
<br>
<div id="map" class="map"></div>
<br>
<div id="coordinates" class="coordinates">Latitude: <span id="latitude"></span>, Longitude: <span id="longitude"></span></div>
<div>
<label for="radius">Radius (meters):</label>
<input type="number" id="radius" value="50" />
<button id="minus">-</button>
<button id="plus">+</button>
</div>
<div id="howto">
How To:
<ol>
<li>Enter an address in the search box above and press Enter</li>
<li>Set desired zoom level</li>
<li>Click middle of desired Known Place</li>
<li>Increase / Decrease Radius with + & - buttons</li>
<li>Utilize Latitude, Longitude & Raidus to program Known Place</li>
</ol>
</div>
<div>
<br>
<center>
PLEASE NOTE THIS IS AN UNOFFICIAL UKG PRODUCT AND IS NOT SUPPORTED OR MAINTAINED. PLEASE DO NOT CONTACT GLOBAL SUPPORT ABOUT THIS PRODUCT.
</center>
</br>
</div>
<script>
googleSat = L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 20,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
});
openStreet = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
});
var newMap = L.map('map', {
center: [42.614689, -71.324092],
zoom: 15,
layers: [googleSat, openStreet]
});
var baseMaps = {
"Google Satellite": googleSat,
"Open Street Map": openStreet
};
var circle = null; // Variable to hold the circle layer
L.Control.geocoder({ position: 'topleft', collapsed: false, placeholder: "Enter an address..." }).on('markgeocode', function (e) {
var latlng = e.geocode.center;
var latitudeElement = document.getElementById("latitude");
var longitudeElement = document.getElementById("longitude");
latitudeElement.textContent = latlng.lat.toFixed(6);
longitudeElement.textContent = latlng.lng.toFixed(6);
drawCircle(latlng.lat, latlng.lng);
}).addTo(newMap);
L.control.layers(baseMaps).addTo(newMap);
// Zoom control options
var zoomOptions = {
zoomInText: '+',
zoomOutText: '-',
};
// Creating Zoom control
var zoom = L.control.zoom(zoomOptions);
// Creating scale control
var scale = L.control.scale();
// Adding scale control to the map
scale.addTo(newMap);
newMap.on('click', function (e) {
var latitudeElement = document.getElementById("latitude");
var longitudeElement = document.getElementById("longitude");
latitudeElement.textContent = e.latlng.lat.toFixed(6);
longitudeElement.textContent = e.latlng.lng.toFixed(6);
drawCircle(e.latlng.lat, e.latlng.lng);
});
document.getElementById("minus").addEventListener("click", function () {
adjustRadius(-5);
});
document.getElementById("plus").addEventListener("click", function () {
adjustRadius(5);
});
function drawCircle(lat, lng) {
var radius = document.getElementById("radius").value;
if (!radius) {
return;
}
if (circle) {
newMap.removeLayer(circle); // Remove the previous circle
}
circle = L.circle([lat, lng], {
color: 'blue',
fillColor: 'blue',
fillOpacity: 0.2,
radius: radius
}).addTo(newMap);
}
function adjustRadius(value) {
var radiusInput = document.getElementById("radius");
var newRadius = parseInt(radiusInput.value) + value;
if (newRadius >= 0) {
radiusInput.value = newRadius;
if (circle) {
drawCircle(circle.getLatLng().lat, circle.getLatLng().lng);
}
}
}
</script>
</body>
</html>