Subversion Repository Public Repository

gpstest

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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%  
    String email=session.getAttribute("email").toString();  
    String password=session.getAttribute("password").toString();  
%>
<title>Nrusingh GPS</title>
<link href="css/jquery-ui.min.css" rel="stylesheet" />
<link href="css/main.css" rel="stylesheet" />
<link href="css/topmenu.css" rel="stylesheet" />
<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script type="text/javascript">

function toggle(source) {
    var checkboxes = document.querySelectorAll('input[type="checkbox"]');
    for (var i = 0; i < checkboxes.length; i++) {
        if (checkboxes[i] != source)
            checkboxes[i].checked = source.checked;
    }
}



$(function(){
	var eml = '<%= email%>';
	//alert(eml);
	$('#loader_map').hide();
	var url = '';
	//url = 'http://23.92.61.79:8082/api/devices/';
	var position_url = 'http://23.92.61.79:8082/api/positions/';
	var device_url = 'http://23.92.61.79:8082/api/devices';
	
	var username = "admin";
	var password = "admin";

	$('#loader_left').show();
	$.ajax({
		type: 'get',
		url: device_url,
		headers: {
			"Accept": "application/json",         
			"Content-Type": "application/json",
			"Authorization": "Basic " + btoa(username + ":" + password)
		},
		'dataType': 'json',
		success: function (response) {
			console.log('Success: '+JSON.stringify(response));
			var html =  '';
			html += '<div>';
			html += '<table id="mytable" style="width: 100%;">';
			html += '<tr>';
			html += '<th>Vehicle No</th>';
			html += '<th>Date</th>';
			html += '<th>Distance</th>';
			html += '<th>Commulative Total</th>';
			html += '</tr>';
			$.each(response, function(k,v){
				var vehicleno = null ;
				var date = null;
				var distance = null;
				var commulativetotal =null;
				
				
				
				html += '<tr>';
				html += '<td><div class="report_vehicleno">'+vehicleno+'</div></td>';
				html += '<td><div class="report_location">'+date+'</div></td>';
				html += '<td><div class="report_haltedfrom">'+distance+'</div></td>';
				html += '<td><div class="report_haltedtill">'+commulativetotal+'</div></td>';
				
				html += '</tr>';
				//$("#ul_device_list").append($(" <li class='device_li' id='"+id+"^"+uniqueId+"^"+name+"^"+status+"'> ").html(html));
			});
			html += '</table>';
			html += '</div>';
			$('#div_device_list').html('');
			$('#div_device_list').html(html);
			$('#loader_left').hide();
		},
		error: function(response){
			alert('Error: '+JSON.stringify(response));
			$('#loader_left').hide();
		}
	});
	
	$(document).on("click", "#ul_device_list li", function(event) {
      var li_id = $(this).attr('id');
      var id = li_id.split('^')[0];
      var uniqueId = li_id.split('^')[1];
      var name = li_id.split('^')[2];
      var status = li_id.split('^')[3];
      $('#loader_map').show();
      $.ajax({
			async:false,
			cache:false,
			dataType:"json",
			type: "POST",  
			url: "map.jsp",
			data:{id:id,uniqueId:uniqueId,name:name,status:status},
			success: function (response) {
				$('#loader_map').hide();
				console.log('Success: ');
				$('#div_map').html("");
				$('#div_map').html(response.responseText);
			},
			error: function (response) {
				$('#loader_map').hide();
				console.log('Error: ');
				$('#div_map').html("");
				$('#div_map').html(response.responseText);
			}
		});
    });
	
	//date picker
	$("#dt1").datepicker({
	            dateFormat: "dd-M-yy",
	            minDate: 0,
	            onSelect: function () {
	                var dt2 = $('#dt1');
	                var startDate = $(this).datepicker('getDate');
	                var minDate = $(this).datepicker('getDate');
	                var dt2Date = dt2.datepicker('getDate');
	                //difference in days. 86400 seconds in day, 1000 ms in second
	                var dateDiff = (dt2Date - minDate)/(86400 * 1000);
	                
	                startDate.setDate(startDate.getDate() + 30);
	                if (dt2Date == null || dateDiff < 0) {
	                		dt2.datepicker('setDate', minDate);
	                }
	                else if (dateDiff > 30){
	                		dt2.datepicker('setDate', startDate);
	                }
	                //sets dt2 maxDate to the last day of 30 days window
	                dt2.datepicker('option', 'maxDate', startDate);
	                dt2.datepicker('option', 'minDate', minDate);
	            }
	        });
	        $('#dt2').datepicker({
	            dateFormat: "dd-M-yy",
	            minDate: 0,
	            onSelect: function () {
	                var dt2 = $('#dt2');
	                var startDate = $(this).datepicker('getDate');
	                var minDate = $(this).datepicker('getDate');
	                var dt2Date = dt2.datepicker('getDate');
	                //difference in days. 86400 seconds in day, 1000 ms in second
	                var dateDiff = (dt2Date - minDate)/(86400 * 1000);
	                
	                startDate.setDate(startDate.getDate() + 30);
	                if (dt2Date == null || dateDiff < 0) {
	                		dt2.datepicker('setDate', minDate);
	                }
	                else if (dateDiff > 30){
	                		dt2.datepicker('setDate', startDate);
	                }
	                //sets dt2 maxDate to the last day of 30 days window
	                dt2.datepicker('option', 'maxDate', startDate);
	                dt2.datepicker('option', 'minDate', minDate);
	            }
	        });

	
});





</script>

</head>
<body>





<div class="container">
	<!-- top panel -->
	<header>
	<div><img src="images/logo1.png" style="width: 100px;"></div>
	<div style="margin-top: -95px; margin-left: 180px;"><h1><a href="login" style="text-decoration: none;color: white;">NRUSiNGH GPS TRACKER</a></h1></div>
	
	<div style="float: right; margin-top: -40px;">
		<span style="font-weight: 900; text-transform: uppercase; vertical-align: 7px;"><%=session.getAttribute("email")%></span>
		<a href="logout"><img src="images/logout.png" alt="logout" style="width: 22px; margin-right: 15px;"/></a>
	</div>
	<jsp:include page="menu.jsp" />
	</header>
	

	<!-- top panel ends -->
	
	
<!-- left panel -->
<div>
<input type="checkbox" onclick="toggle(this);" />Select All<br/>
<input type="checkbox" />Bar 1<br />
<input type="checkbox" />Bar 2<br />
<input type="checkbox" />Bar 3<br />
<input type="checkbox" />Bar 4<br />
<input type="checkbox" />Bar 5<br />
<input type="checkbox" />Bar 6<br />
<input type="checkbox" />Bar 7<br />
<input type="checkbox" />Bar 8<br />

</div>	



	
	<nav> 
	
	<span><b>Date Range</b></span><br>
	<table cellpadding="0" cellspacing="0">


     <tbody><tr>
     <td>
     <span>From Date</span>
      </td>
     </tr>
     <tr>
      <td>
     <input  type="text" id="dt1" maxlength="18" size="10" onclick="" readonly="readonly" onfocus="this.blur()" tabindex="1" placeholder="dd-mm-yyyy">
       <a  id="dt1"> 
       <img height="12" src="images/Calendar_Icon.svg.png" width="18" class="ImageColor">
       </a>
          </td>
       </tr>
       
       
     <tr >
       <td >
       <span>To Date</span>
       </td>
       </tr>
        <tr >
      <td >
      <input type="text" id="dt2" maxlength="18" size="10" onclick="" readonly="readonly" onfocus="this.blur()" tabindex="2" placeholder="dd-mm-yyyy">
       <a  id="dt2">
       <img height="12" src="images/Calendar_Icon.svg.png" width="18" class="ImageColor">
       </a>
       </td>
       </tr>
        <tr >
       <td >
      <table border="0">
		<tbody><tr>
			<td><input type="radio" name="a" value="" checked><label >Day Wise</label></td><td><input  type="radio" name="a" value=""><label>Periodic</label></td>
		</tr>
	</tbody></table>
        </td>
        </tr>
 <tr >
      <td >
   <input type="submit"value="Search" onclick="return validate();" tabindex="4" title="Search" >
   <input type="submit" value="Reset" onclick="return uncheckall();" tabindex="5" title="Reset" >

    </td>
   </tr>

  </tbody>
  </table>
	
	
</nav>
	<!-- left panel ends -->

	<!-- right panel -->
	<article> 
		<div id="loader_left">
			<img id="loader_img_left" alt="Loding ..." src="images/loader.gif" />
		</div>
		<!-- <ul id="ul_device_list"></ul> -->
		<div id="div_device_list"></div>
		
	</article>
	<!-- right panel ends -->

	<!-- buttom panel -->
	<footer><div style="text-align: center"> Copyright &copy; Nrusingha nath Nayak</div></footer>
	<!-- buttom panel ends -->
</div>
</body>
</html>

Commits for gpstest/WebContent/_distance_daywise.jsp

Diff revisions: vs.
Revision Author Commited Message
1 lingaraj picture lingaraj Sat 24 Nov, 2018 13:04:59 +0000