forked from asoltys/avadepth
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pwl_detail.html
241 lines (228 loc) · 7.04 KB
/
pwl_detail.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="x-ua-compatible" content="IE=edge">
<title>Predicted Water Levels</title>
<script src="/wet-boew/js/jquery/1.11.1/jquery.min.js"></script>
<script src="/scripts/jquery/jquery.ui.core.js"></script>
<script src="/scripts/moment.min.js"></script>
<script src="/wet-boew/js/deps/jquery.flot.min.js"></script>
<script src="/scripts/flot/jquery.flot.time.js"></script>
<script src="/scripts/flot/jquery.flot.axislabels.js"></script>
<script src="/scripts/avadepth_util.js"></script>
<noscript><link rel="stylesheet" href="/wet-boew/css/noscript.min.css" /></noscript>
<link href="/GCWeb/assets/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="stylesheet" href="/GCWeb/css/theme.min.css" />
<!-- CustomCSSStart -->
<link rel="stylesheet" href="/css/custom.css" />
<link rel="stylesheet" media="print" href="/css/print.css" />
<link rel="stylesheet" href="/css/smoothness/jquery-ui-1.7.1.custom.css" />
<!-- CustomCSSEnd -->
<style type="text/css" media="screen">
.span-8 {
width: 98%;
}
#verify_wrapper {
display: table;
margin: 0 auto;
}
.print_holder {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
height: 50px;
}
.btn {
height: 26px;
margin: auto;
}
#det_placeholder {
display: block;
margin-left: auto;
margin-right: auto;
}
</style>
<style type="text/css" media="print">
.btn {
display: none;
}
</style>
<script>
$(document).ready(function() {
$('button[name="print"]').click(function() {
window.print()
});
$('#det_placeholder').empty();
var typCode = avadepth.util.getUrlParameter("code");
var typValue = avadepth.util.getUrlParameter("value");
var waterway = avadepth.util.getUrlParameter("waterway");
var date = avadepth.util.getUrlParameter("date");
var intervalMin = avadepth.util.getUrlParameter("intervalMin");
var flowRate = avadepth.util.getUrlParameter("flowRate");
var flowType = avadepth.util.getUrlParameter("flowType");
var waterway = avadepth.util.getUrlParameter("waterway");
var static_arm = "South Arm";
var static_interval = "1 Hour";
var plotId = "#det_placeholder";
var flow = "";
if (window.location.href.indexOf("fra") > -1) {
switch(flowType) {
case "Predicted":
flow = "Prévu";
break;
case "Actual":
flow = "Réel";
break;
case "Selected":
flow = "Choisi";
break;
case "UserDefined":
flow = "Défini par l'utilisateur";
break;
default:
flow = "N/A"
break;
}
} else if (flowType === "UserDefined"){
flow = "User-defined";
} else {
flow = flowType;
}
switch (waterway) {
case '0':
$('#det_river-section').text("South Arm");
break;
case '1':
$('#det_river-section').text("North Arm");
break;
case '2':
$('#det_river-section').text("Main Arm");
break;
}
$('#det_km_time').text(typValue);
$('#det_static-date').text(moment(date).format("MMM D, YYYY"));
$('#det_static-interval').text(static_interval);
$('#det_static-arm').text(static_arm);
$('#det_static-discharge').text(flowRate);
$('#det_static-discharge-eval').text(flow);
var step = (function() {
var t;
switch (waterway) {
case '0':
t = [(typValue / 2), 2];
break;
case '1':
t = [(typValue / 2), 2];
break;
case '2':
t = [((typValue - 40) / 4), 4];
break;
}
return t[typCode];
})();
$(plotId).css('font-size', 'inherit');
if (typCode == 0) {
$('#det_km_time-suff').text(' km ');
$.getJSON(("/api/waterlevel?date=" + (date) + "&") +
("intervalMin=" + (intervalMin) + "&") +
("flowRate=" + (flowRate) + "&") +
("flowType=" + (flowType) + "&") +
("waterway=" + (waterway) + "&") +
"displayType=0", function(data) {
var points = [];
$.each(data.times, function() {
var date;
if (this.predictTime !== '24:00') {
date = new Date("January 1, 2000 " + this.predictTime);
} else {
date = new Date("January 2, 2000 00:00");
}
return points.push([date.getTime(), this.waterLevels[step]]);
});
console.log("Points processed...");
return $.plot($(plotId), [points], {
xaxis: {
color: 'black',
tickColor: '#ddd',
mode: 'time',
tickSize: [4, "hour"],
timezone: "browser",
axisLabel: 'Pacific Standard Time (PST)'
},
yaxis: {
color: 'black',
tickColor: '#ddd',
position: 'left',
axisLabel: 'Water Level (metres) relative to LWD'
}
});
});
} else {
$('#det_km_time-suff').text('');
$.getJSON(("/api/waterlevel?date=" + (date) + "&") +
("intervalMin=" + (intervalMin) + "&") +
("flowRate=" + (flowRate) + "&") +
("flowType=" + (flowType) + "&") +
("waterway=" + (waterway) + "&") +
"displayType=0", function(data) {
var points = [];
$.each(data.times, function() {
var start;
if (this.predictTime === typValue) {
start = 0;
if (step === 4) {
start = 40;
}
return $.each(this.waterLevels, function(i) {
return points.push([i * step + start, this]);
});
}
});
return $.plot($(plotId), [points], {
xaxis: {
color: 'black',
tickColor: '#ddd',
tickSize: step,
axisLabel: 'Location (km)'
},
yaxis: {
color: 'black',
tickColor: '#ddd',
position: 'left',
axisLabel: 'Water Level (metres) relative to LWD'
}
});
});
}
});
</script>
</head>
<body>
<div id="detail_content">
<div class="print_holder">
<button name="print" class="btn btn-primary print_button print_hide">
<span class="glyphicon glyphicon-print"></span> Print
</button>
<input class="btn btn-primary print_hide" onclick="window.close()" type="button" value="Close">
</div>
<div>
<div class="grid-12">
<div class="align-center">
<h2>Predicted Water Levels<br/>Fraser River - <span id="det_river-section"></span> at <span id="det_km_time-suff"></span><span id="det_km_time"></span></h2>
<p><span id="det_static-date"></span> at <span id="det_static-interval"></span> Intervals<br/>River Discharge @ Hope <span id="det_static-discharge"></span>³/s (<span id="det_static-discharge-eval"></span>)</p>
<div id="det_placeholder" class="demo-placeholder" style="height:450px;width:800px;"></div>
</div>
<div class="page-break"></div>
<div class="print_holder">
<button name="print" class="btn btn-primary print_button print_hide">
<span class="glyphicon glyphicon-print"></span> Print
</button>
<input class="btn btn-primary print_hide" onclick="window.close()" type="button" value="Close">
</div>
</div>
</div>
</div>
</body>
</html>