<!DOCTYPE html>
<html>
	<head>
		<title>Welcome to SkyAI</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!--<meta http-equiv="refresh" content="5">-->
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="Cache-Control" CONTENT="no-cache, must-revalidate"> 
		<meta http-equiv="expires" content="365 days">
		<script src="../static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="../static/css/bootstrap.min.css">
		<script src="../static/js/bootstrap.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.2.1/bootstrap-slider.min.js"></script>
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.2.1/css/bootstrap-slider.min.css">
		<link rel="stylesheet" href="../static/css/generalstyle.css?<?php echo rand(0,512);?>">
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		 <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js">
        </script>
        <style >
        html, body, #map-canvas {width:100%;  height: 100%;}
        </style>
        <script>
        {% if params.gps %}
        	var lat = {{params.gps[0].lat}};
        	var lng = {{params.gps[0].lng}};
        {% else %}
        	var lat = 22.707340;
        	var lng = 120.531000;
        {% endif %}

        function initialize() {
        	var a = -1;

        var mapOptions = {
          center: { lat: lat, lng: lng},
          zoom: 19,
          mapTypeId: 'satellite',
        };
        var position1 = {
         lat:  22.707508,
         lng: 120.532132
        };
        var position2 = {
         lat: 22.706996,
         lng: 120.529765
        };
        var position3 = {
         lat:  22.707200,
         lng: 120.532090
        };
        var position4 = {
         lat:  22.706900,
         lng: 120.532040
        };
        var position5 = {
         lat:  22.706684,
         lng: 120.531459
        };
        var position6 = {
         lat:  22.706813,
         lng: 120.530876
        };
        var position7 = {
         lat:  22.707066,
         lng: 120.531099
        };
        var position8 = {
         lat:  22.707340,
         lng: 120.531166
        };
        var position9 = {
         lat:  22.707611,
         lng: 120.531440
        };
        var position10 = {
         lat: 22.707549,
         lng: 120.531845
        };
        var position11 = {
         lat:  22.707300,
         lng: 120.529820
        };
        var position12 = {
         lat:  22.707576,
         lng: 120.529871
        };
        var position13 = {
         lat:  22.707791,
         lng: 120.530245
        };
        var position14 = {
         lat:  22.707726,
         lng: 120.530770
        };
        var position15 = {
         lat:  22.707360,
         lng: 120.531087
        };
        var position16 = {
         lat:  22.707086,
         lng: 120.531013
        };
        var position17 = {
         lat:  22.706867,
         lng: 120.530592
        };
        var position18 = {
         lat:  22.706946,
         lng: 120.530130
        };
        var map = new google.maps.Map(
            document.getElementById('map-canvas'),
            mapOptions);

        var marker1 = new google.maps.Marker({
        position: position1,
        map: map,
        label: '1'
        });

        var contentString ='<div id="content">' +
       "<img src='img/PV.jpg' id='img' style='max-width:100%;height:auto;'/>"+
       "</div>";
        var infowindow = new google.maps.InfoWindow({
        content:contentString});

        marker1.addListener('click',function(){
        a = a * -1;
        if(a > 0){
         infowindow.open(map, marker1);
         }else{
         infowindow.close();
         }
         });
         var marker2 = new google.maps.Marker({
        position: position2,
        map: map,
        label: '2'
        });
        var marker3 = new google.maps.Marker({
        position: position3,
        map: map,
        label: '3'
        });
         var marker4 = new google.maps.Marker({
        position: position4,
        map: map,
        label: '4'
        });
        var marker5 = new google.maps.Marker({
        position: position5,
        map: map,
        label: '5'
        });
         var marker6 = new google.maps.Marker({
        position: position6,
        map: map,
        label: '6'
        });
        var marker7 = new google.maps.Marker({
        position: position7,
        map: map,
        label: '7'
        });
         var marker8 = new google.maps.Marker({
        position: position8,
        map: map,
        label: '8'
        });
        var marker9 = new google.maps.Marker({
        position: position9,
        map: map,
        label: '9'
        });
         var marker10 = new google.maps.Marker({
        position: position10,
        map: map,
        label: '10'
        });
        var marker11 = new google.maps.Marker({
        position: position11,
        map: map,
        label: '11'
        });
         var marker12 = new google.maps.Marker({
        position: position12,
        map: map,
        label: '12'
        });
        var marker13 = new google.maps.Marker({
        position: position13,
        map: map,
        label: '13'
        });
         var marker14 = new google.maps.Marker({
        position: position14,
        map: map,
        label: '14'
        });
        var marker15 = new google.maps.Marker({
        position: position15,
        map: map,
        label: '15'
        });
         var marker16 = new google.maps.Marker({
        position: position16,
        map: map,
        label: '16'
        });
        var marker17 = new google.maps.Marker({
        position: position17,
        map: map,
        label: '17'
        });
         var marker18 = new google.maps.Marker({
        position: position18,
        map: map,
        label: '18'
        });


        var trackPoints = [
        		{% for g in params.gps %}
        			new google.maps.LatLng({{g.lat}},{{g.lng}}),
        		{% endfor %}
            ];  
        var trackPath = new google.maps.Polyline({        
                path: trackPoints,        
                strokeColor: "#FF0000", // 線條顏色        
                strokeOpacity: 1.0, // 線條透明度        
                strokeWeight: 2 // 線條粗細        
            });  
        trackPath.setMap(map);       

        }
        google.maps.event.addDomListener(
          window, 'load', initialize);


          $(function(){
          	{% if params.queryDate %}
          		{% if params.month < 10 %}
          			var month = '0' + {{params.month}};
          		{% else %}
          			var month = {{params.month}};
          		{% endif %}
          		{% if params.day < 10 %}
          			var day = '0' + {{params.day}};
          		{% else %}
          			var day = {{params.day}};
          		{% endif %}
          		$("input[name=date]").val({{params.year}} + '-' + month + '-' + day);
          	{% endif %}
          });
        </script>
		<style>
		.bg{
			position:static;
			width:100%;
			height: 358px;
			display:block;
			margin:auto;
			background-position: 0px 0px;
			background-repeat: no-repeat;
			background-size: 100% 100%;
			}
		.logo {
			 width:35%;
			 height:100px;
			 border: 0px;
			 background-color: #EF7F33;
			 color:#172987;
			 text-align:center;
			 font-size:48px;
			 margin: auto;
			 font-family:DFKai-sb;
			 font-weight:bold;
			 margin-bottom:15px;
			}
		button {
			background-color: white;
			border-radius:10px;
			border: 3px solid lightgray;
			}
		img {
			display: block;
			margin-left: auto;
			margin-right: auto;
			}
		.img1 {
			display: block;
			margin-left: auto;
			margin-right: auto;
			margin: auto;
		}

		.detail{
			font-family: Microsoft JhengHei;
			border-radius: 100px;
			background-color: #008CBA;
			border: none;
			color: white;
			padding: 5px 12px;
			text-align: center;
			text-decoration: none;
			display: inline-block;
			font-size: 1.4em;
			margin: 4px 2px;
			cursor: pointer;
			transition-duration: 0.4s;
			border: 3px solid white;
			}
		.detail:hover {
			background-color: white; 
			color: black; 
			border: 3px solid black;
			}
		.title{
			font-family: Microsoft JhengHei;
			border-radius: 100px;
			background-color: #f2f2f2;
			border: none;
			color: black;
			padding: 10px 32px;
			font-size: 2em;
			}
		.font {
			color: white;
			font-size: 1.4em;
			}
		.font:hover {
			color: black;
			font-size: 1.5em;
			}

		.choosed {
		    width: 40px;
		    font-size: 1.5em;
		    border: 1px;
		    border-radius: 100px;
		    border: 3px solid red;
		    background-color: white;
		}
		.sw_number {
		    width: 40px;
		    font-size: 1.5em;
		    border: 1px;
		    border-radius: 100px;
		    border: 3px solid lightgray;
		}
		 </style>
	</head>
	<body>
		<div class="container">
			<div id="header" class="row" style="background-color:#ffffff;">
	            <div class="col-md-12" style="text-align:center;margin-top:5px;">
		            <div class="col-md-4 col-sm-12" style="">
			        	<img src="../static/img/logo_new.png" width="60%" height="30%">
		            </div>
		            <div class="col-md-4 col-sm-12" style="">
			        	<a href="/cindex/{{params.tid}}"><button class="btn btn-primary btn-lg" style="">車輛軌跡</button></a>
						<a href="/cshoot_setting/{{params.tid}}"><button class="btn btn-danger btn-lg" style="">拍攝設定</button></a>
		             	<a href="/cimg_history/{{params.tid}}"><button class="btn btn-danger btn-lg" style="">歷史資料</button></a>
						<a href="/aindex"><button class="btn btn-danger btn-lg" style="">毛豆田</button></a>
		            </div>
					<div class="col-md-4 col-sm-12" style="">
						<a href="/logout"><button class="btn btn-primary btn-lg" style="">登出</button></a>
					</div>
				</div>
           </div>
            <div class="col-md-12" style="background-color:red;width:100%;height:5px;margin-top:5px;margin-bottom:20px"></div>
			<div class="col-sm-12" style="text-align:center;background-color:#f2f2f2;padding:15px;border:1px;border-radius: 35px;">
				<center>
					<h1>{{params.tid}} 號 車輛軌跡</h1>
					<p style="text-align:center;font-weight:bold;font-size: 1.7em;">請選擇查詢日期:</p>
					<form action="/cindex/{{params.tid}}" method="post">
						<input type="date" name="date">
						<input type="submit" value="查詢">
					</form>
					<a href="/cindex/1"><button class="btn btn-primary btn-lg" style="margin-top:5px;margin-bottom:5px">1</button></a>
					<a href="/cindex/2"><button class="btn btn-primary btn-lg" style="margin-top:5px;margin-bottom:5px">2</button></a>
					<a href="/cindex/3"><button class="btn btn-primary btn-lg" style="margin-top:5px;margin-bottom:5px">3</button></a>
					<br>
					<div id="map-canvas" class="col-sm-12" style="text-align:center;background-color:#f2f2f2;padding:280px;border:1px;border-radius: 35px;"></div>
				</center>
			</div>
		</div>
	</body>
</html>