More progress on the elevator creation tool

This commit is contained in:
TheGreyDiamond
2021-06-03 00:23:28 +02:00
parent da4b13627f
commit 9dcf927ae9
2 changed files with 178 additions and 136 deletions

View File

@@ -497,3 +497,8 @@ header {
border: 1px red solid; border: 1px red solid;
} }
*/ */
TODO {
border: dotted 1px red;
background-color: rgba(127, 255, 212, 0.493);
}

View File

@@ -1,10 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<!-- Basic Page Needs <!-- Basic Page Needs
--> -->
<meta charset="utf-8" /> <meta charset="utf-8" />
<title><%= it.siteTitel %></title> <title>
<%= it.siteTitel %>
</title>
<meta name="description" content="<%= it.desc %>" /> <meta name="description" content="<%= it.desc %>" />
<meta name="author" content="<%= it.author %>" /> <meta name="author" content="<%= it.author %>" />
@@ -24,33 +27,23 @@
<link rel="icon" type="image/png" href="images/favicon-16.png" /> <link rel="icon" type="image/png" href="images/favicon-16.png" />
<script async defer src="/js/site.js"></script> <script async defer src="/js/site.js"></script>
<script <script src="https://kit.fontawesome.com/<%= it.fontawesomeKey %>.js" crossorigin="anonymous"></script>
src="https://kit.fontawesome.com/<%= it.fontawesomeKey %>.js"
crossorigin="anonymous"
></script>
<link <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
rel="stylesheet"
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin="" crossorigin="" />
/>
<!-- Make sure you put this AFTER Leaflet's CSS --> <!-- Make sure you put this AFTER Leaflet's CSS -->
<script <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin="" crossorigin=""></script>
></script>
<link rel="stylesheet" href="./leafletCluster/dist/MarkerCluster.css" /> <link rel="stylesheet" href="./leafletCluster/dist/MarkerCluster.css" />
<link <link rel="stylesheet" href="./leafletCluster/dist/MarkerCluster.Default.css" />
rel="stylesheet"
href="./leafletCluster/dist/MarkerCluster.Default.css"
/>
<script src="./leafletCluster/dist/leaflet.markercluster.js"></script> <script src="./leafletCluster/dist/leaflet.markercluster.js"></script>
</head> </head>
<body> <body>
<!-- Primary Page Layout <!-- Primary Page Layout
--> -->
@@ -63,19 +56,49 @@
<h3>Create a new elevator</h3> <h3>Create a new elevator</h3>
</center> </center>
<step id="step1">
<h5>1. Add a location</h5> <h5>1. Add a location</h5>
<p>Click anywhere on the map to create a pin. You can also use direct input to add cordinates.</p> <p>Click anywhere on the map to create a pin. You can also use direct input to add cordinates.</p>
<!-- TODO: LatLng fields--> <!-- TODO: LatLng fields-->
<label for="lat">Latlitude: </label><input type="number" name="lat" id="lat">
<label for="lng">Longlitude: </label><input type="number" name="lng" id="lng">
<TODO>TODO: Display data of fields on map</TODO>
<button onclick="nextDialogePage()">Next step <i class="fas fa-arrow-right"></i></button>
</step>
<step id="step2" style="display: none;">
<h5>2. Add general information about the elevator</h5>
<p>You may add images in the last step. Now please enter general information about the elevator.</p>
<TODO>TODO: Add fields for input of user data</TODO>
<button onclick="prevPage()">Go back one step <i class="fas fa-arrow-left"></i></button>
<button onclick="nextDialogePage()">Next step <i class="fas fa-arrow-right"></i></button>
</step>
</div> </div>
</div> </div>
<aside> <aside>
<i <i style="color: black; cursor: pointer" class="fas fa-map-marker-alt" onclick="home()"></i>
style="color: black; cursor: pointer"
class="fas fa-map-marker-alt"
onclick="home()"
></i>
</aside> </aside>
<script>
var currentPage = 0;
function updateDialog() {
if (currentPage == 0) {
document.getElementById("step1").style.display= 'block';
document.getElementById("step2").style.display= 'none';
}
if (currentPage == 1) {
document.getElementById("step1").style.display= 'none';
document.getElementById("step2").style.display= 'block';
}
}
function nextDialogePage() {
currentPage++;
updateDialog();
}
function prevPage() {
currentPage--;
updateDialog();
}
</script>
<!-- End Document <!-- End Document
--> -->
@@ -115,6 +138,17 @@
// mymap.setView(new L.LatLng(10.737, -73.923), 8); // mymap.setView(new L.LatLng(10.737, -73.923), 8);
} }
function home() {
if (navigator.geolocation) {
setTimeout(function () {
navigator.geolocation.getCurrentPosition(showPosition);
}, 200);
} else {
console.warn("Geolocation of user could not be fetched");
}
}
home()
mymap.on('click', function (e) { mymap.on('click', function (e) {
markers.clearLayers(); markers.clearLayers();
var coord = e.latlng; var coord = e.latlng;
@@ -124,6 +158,8 @@
//marker.addTo(mymap) //marker.addTo(mymap)
markers.addLayer(marker); markers.addLayer(marker);
markers.addTo(mymap); markers.addTo(mymap);
document.getElementById("lat").value = lat
document.getElementById("lng").value = lng
console.log("You clicked the map at latitude: " + lat + " and longitude: " + lng); console.log("You clicked the map at latitude: " + lat + " and longitude: " + lng);
}); });
@@ -161,4 +197,5 @@
</script> </script>
</body> </body>
</html> </html>