Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
8.3 kB
1
Indexable
Never
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
  <title>Document</title>
  <style>
    #map {
      height: 500px;
      width: 100%;
    }
  </style>

</head>

<body style="background-color:rgb(141, 179, 179);">


  <h3 style="color:darkblue; margin-right: 10%;margin-left: 10%;margin-top: 2%;">WELCOME</h3>

  <form id="form" action="/search" enctype="form-data" method="post" ion="/search"
    style=" margin-right: 10%;margin-left: 10%;margin-top: 2%;">
    <label for="user">Choose Car Id </label>&emsp;
    <select name="id" id="id">
      <option value="1">1</option>
      <option value="2">2</option>
    </select>&emsp;
    <label for="user">Choose Time </label>
    &emsp;
    <select name="time" id="time">
    
      <option value="0:30">00:30</option>
      <option value="1:00">01:00</option>
      <option value="1:30">01:30</option>
      <option value="2:00">02:00</option>
      <option value="2:30">02:30</option>
      <option value="3:00">03:00</option>
      <option value="3:30">03:30</option>
      <option value="4:00">04:00</option>
      <option value="4:30">04:30</option>
      <option value="5:00">05:00</option>
      <option value="5:30">05:30</option>
      <option value="6:00">06:00</option>
      <option value="6:30">06:30</option>
      <option value="7:00">07:00</option>
      <option value="7:30">07:30</option>
      <option value="8:00">08:00</option>
      <option value="8:30">08:30</option>
      <option value="9:00">09:00</option>
      <option value="9:30">09:30</option>
      <option value="10:00">10:00</option>
      <option value="10:30">10:30</option>
      <option value="11:00">11:00</option>
      <option value="11:30">11:30</option>
      <option value="12:00">12:00</option>
      <option value="12:30">12:30</option>
      <option value="13:00">13:00</option>
      <option value="13:30">13:30</option>
      <option value="14:00">14:00</option>
      <option value="14:30">14:30</option>
      <option value="15:00">15:00</option>
      <option value="15:30">15:30</option>
      <option value="16:00">16:00</option>
      <option value="16:30">16:30</option>
      <option value="17:00">17:00</option>
      <option value="17:30">17:30</option>
      <option value="18:00">18:00</option>
      <option value="18:30">18:30</option>
      <option value="19:00">19:00</option>
      <option value="19:30">19:30</option>
      <option value="20:00">20:00</option>
      <option value="20:30">20:30</option>
      <option value="21:00">21:00</option>
      <option value="21:30">21:30</option>
      <option value="22:00">22:00</option>
      <option value="22:30">22:30</option>
      <option value="23:00">23:00</option>
      <option value="23:30">23:30</option>

    </select> &emsp;
  
    <button id="search" onclick="myFunction()">Search</button>
    <br>
    <label for="user">Choose Car Id </label>&emsp;
    <select name="id1" id="id1">
      <option value="1">1</option>
      <option value="2">2</option>

    </select>&emsp;
    <label for="user">Choose Time </label>
    &emsp;
    <select name="time1" id="time1"> 
      <option value="12:00">12:00</option>
      <option value="12:30">12:30</option>
      <option value="13:00">13:00</option>
      <option value="13:30">13:30</option>
      <option value="14:00">14:00</option>
      <option value="14:30">14:30</option>
      <option value="15:00">15:00</option>
      <option value="15:30">15:30</option>
      <option value="16:00">16:00</option>
      <option value="16:30">16:30</option>
      <option value="17:00">17:00</option>
      <option value="17:30">17:30</option>




    </select> &emsp;
    
    <button id="search" onclick="myFunction1()">Search</button>
    <br>
    <br>
    <div id='map'>
      <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB5BI6-6K96G5EKZNSGPR7B-3qV5HdLJgY&callback=initMap"
        async></script>



      <script>
        var map,marker,poly;
        var coord = [];

        function initMap() {
          var options = {
            zoom: 10,
            center: { lat: 59.334591, lng: 18.063240 },
          }
          map = new google.maps.Map(document.getElementById("map"), options);
        }
        function myFunction1() {
          let url = "http://localhost:3000/files1";
          fetch(url).then(response => response.json())
            .then((result) => {
              console.log(result[0].lat)
              console.log(typeof result[0].lat)
              var options = {
            zoom: 14,
            center: { lat: result[result.length-1].lat, lng: result[result.length-1].long },
          }
          map = new google.maps.Map(document.getElementById("map"), options);
              for (let i = 0; i < result.length; i++) {
                  marker = new google.maps.Marker({
                  position: new google.maps.LatLng(result[i].lat, result[i].long),
                  map: map
                  });
                coord.push({lat:result[i].lat,lng: result[i].long}) };
                  
 poly = new google.maps.Polyline({
  path:coord,
  strokeColor:"#0000FF",
  strokeOpacity:0.8,
  strokeWeight:2
}); poly.setMap(map);
              alert("test")})
            .catch(error => console.log('error:', error));
        }

        function myFunction() {
          let url = "http://localhost:3000/files";
          fetch(url).then(response => response.json())
            .then((result) => {
              console.log(result[0].lat)
              console.log(typeof result[0].lat)
              var options = {
            zoom: 14,
            center: { lat: result[result.length-1].lat, lng: result[result.length-1].long },
          }
          map = new google.maps.Map(document.getElementById("map"), options);
              for (let i = 0; i < result.length; i++) {
                  marker = new google.maps.Marker({
                  position: new google.maps.LatLng(result[i].lat, result[i].long),
                  map: map
                  });
                coord.push({lat:result[i].lat,lng: result[i].long}) };
                  
 poly = new google.maps.Polyline({
  path:coord,
  strokeColor:"#FF0000",
  strokeOpacity:0.8,
  strokeWeight:2
}); poly.setMap(map);
              alert("test")})
            .catch(error => console.log('error:', error));
        }


      </script>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
      crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"
      integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB"
      crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"
      integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13"
      crossorigin="anonymous"></script>


  </form>



</body>


</html>
 
       
   

 
 
   
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>


</form>



</body>


</html>