-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtaskbrief.js
More file actions
49 lines (48 loc) · 1.4 KB
/
taskbrief.js
File metadata and controls
49 lines (48 loc) · 1.4 KB
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
(function($) {
'use strict';
function showtask(task) {
var i;
var row;
var tpref;
var taskdistance = 0;
var bearing = "";
var leglength = "";
var showlength = "";
var legdata;
for (i = 0; i < task.length; i++) {
switch (i) {
case 0:
tpref = "Start";
break;
case task.length - 1:
tpref = "Finish";
break;
default:
tpref = "TP" + i.toString();
}
row = "<tr><td>" + tpref + "</td><td>" + task[i].trigraph + "</td><td>" + task[i].tpname + "</td><td>" + showpoint(task[i]);
if (i > 0) {
legdata = leginfo(task[i - 1], task[i]);
leglength = legdata.distance;
taskdistance += leglength;
showlength = leglength.toFixed(1) + " Km";
bearing = legdata.bearing + "°";
}
row += "</td><td>" + bearing + "</td><td>" + showlength + "</td><td>" + task[i].detail + "</td></tr>";
$('#tasklist').append(row);
}
$('#tasklength').text("Total distance " + taskdistance.toFixed(1) + " Km");
}
$(document).ready(function() {
$('#datepick').dcalendarpicker({
format: 'w dd mmm yyyy'
});
showtask(window.opener.taskdetail);
$("#printme").click(function() {
window.print();
});
$("#closeme").click(function() {
window.close();
});
});
}(jQuery));