forked from Paradox2102/roborecon-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rate.html
359 lines (315 loc) · 19.1 KB
/
rate.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
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
---
layout: page
title: Rate a Team
permalink: /rate/
---
<div class="container">
<div class="row">
<div class="col-md-12">
<form id="reportForm" class="form-horizontal">
<fieldset>
<div class="scouting-report">Scouting Report</div>
<div class="row">
<div class="col-md-5">
<div class="form-group">
<label class="col-md-4 control-label" for="teams">Team to Rate:</label>
<div class="col-md-8">
<select id="teams" name="team_id" class="form-control">
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-12 panel panel-default">Autonomous:</div>
<!--<div class="form-group">-->
<!-- <table style="width:100%;">-->
<!-- <tr>-->
<!-- <th>Action</th>-->
<!-- <th>Made</th>-->
<!-- <th>Missed</th>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label class="control-label" for="rating_scoring_high_goal">High Goal:</label></td>-->
<!-- <td>-->
<!-- <button type="button" class="btn btn-default btn-circle-green btn-lg js-counter-btn" data-counter-for="rating_scoring_high_goals_made"><i class="fa fa-plus"></i></button>-->
<!-- <input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_high_goals_made" value="0" />-->
<!-- </td>-->
<!-- <td>-->
<!-- <button type="button" class="btn btn-primary btn-circle-red btn-lg js-counter-btn" data-counter-for="rating_scoring_high_goals_missed"><i class="fa fa-times"></i></button>-->
<!-- <input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_high_goals_missed" value="0"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label class="control-label" for="rating_scoring_low_goal">Low Goal:</label></td>-->
<!-- <td>-->
<!-- <button type="button" class="btn btn-default btn-circle-green btn-lg js-counter-btn" data-counter-for="rating_scoring_low_goals_made"><i class="fa fa-plus"></i></button>-->
<!-- <input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_low_goals_made" value="0" />-->
<!-- </td>-->
<!-- <td>-->
<!-- <button type="button" class="btn btn-primary btn-circle-red btn-lg js-counter-btn" data-counter-for="rating_scoring_low_goals_missed"><i class="fa fa-times"></i></button>-->
<!-- <input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_low_goals_missed" value="0"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<div class="form-group" >
<label class="col-md-4 control-label">Cubes on Switch:</label>
<div class="col-md-8" style="text-align: right;right:50px">
<button type="button" class="btn btn-default btn-circle green btn-lg js-counter-btn-1" data-counter-for="rating_scoring_Cubes_on_switch_auto"><i class="fa fa-plus"></i></button>
<input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_Cubes_on_switch_auto" value="0" />
</div>
</div>
<!--</div>-->
<div class="form-group">
<label class="col-md-4 control-label">Cubes on Scale:</label>
<div class="col-md-8" style="text-align: right;right:50px">
<button type="button" class="btn btn-default btn-circle green btn-lg js-counter-btn-1" data-counter-for="rating_scoring_Cubes_on_scale_auto"><i class="fa fa-plus"></i></button>
<input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_Cubes_on_scale_auto" value="0" />
</div>
</div>
<hr class="divider-hor" style="width:500px">
<div class="form-group">
<label class="col-md-4 control-label" for="rating_scoring_base_line_made_auto">Cross Base Line:</label>
<div class="col-md-8" style="text-align: right;right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_scoring_base_line_made_auto" id="rating_scoring_base_line_made_auto_1"
value="1" autocomplete="off">Yes</label>
<label class="btn btn-primary active">
<input type="radio" name="rating_scoring_base_line_made_auto" id="rating_scoring_base_line_made_auto_0"
value="0" autocomplete="off" checked="checked">No</label>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="col-md-12 panel panel-default">Teleoperated:</div>
<div class="form-group">
<label class="col-md-4 control-label">Cubes on Switch:</label>
<div class="col-md-8" style="text-align:right; right:50px">
<button type="button" class="btn btn-default btn-circle green btn-lg js-counter-btn-1" data-counter-for="rating_scoring_Cubes_on_switch"><i class="fa fa-plus"></i></button>
<input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_Cubes_on_switch" value="0" />
</div>
</div>
<!--</div>-->
<div class="form-group">
<label class="col-md-4 control-label">Cubes on Scale:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<button type="button" class="btn btn-default btn-circle green btn-lg js-counter-btn-1" data-counter-for="rating_scoring_Cubes_on_scale"><i class="fa fa-plus"></i></button>
<input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_Cubes_on_scale" value="0" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Cubes Exchanged:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<button type="button" class="btn btn-default btn-circle green btn-lg js-counter-btn-1" data-counter-for="rating_scoring_Cubes_exchanged"><i class="fa fa-plus"></i></button>
<input class="form-control js-counter-textbox" style="display:inline-block;width:60px;" type="number" name="rating_scoring_Cubes_exchanged" value="0"/>
</div>
</div>
<hr class="divider-hor" style="width:500px">
<div class="form-group">
<label class="col-md-4 control-label" for="rating_overall_gear_efficiency">Switch Efficiency:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_overall_switch_efficiency" id="rating_overall_switch_efficiency_1" value="1"
autocomplete="off">1</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_switch_efficiency" id="rating_overall_switch_efficiency_2" value="2"
autocomplete="off">2</label>
<label class="btn btn-primary active">
<input type="radio" name="rating_overall_switch_efficiency" id="rating_overall_switch_efficiency_3" value="3"
autocomplete="off" checked="checked">3</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_switch_efficiency" id="rating_overall_switch_efficiency_4" value="4"
autocomplete="off">4</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_switch_efficiency" id="rating_overall_switch_efficiency_5" value="5"
autocomplete="off">5</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="rating_overall_gear_efficiency">Scale Efficiency:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_overall_scale_efficiency" id="rating_overall_scale_efficiency_1" value="1"
autocomplete="off">1</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_scale_efficiency" id="rating_overall_scale_efficiency_2" value="2"
autocomplete="off">2</label>
<label class="btn btn-primary active" >
<input type="radio" name="rating_overall_scale_efficiency" id="rating_overall_scale_efficiency_3" value="3"
autocomplete="off" checked="checked">3</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_scale_efficiency" id="rating_overall_scale_efficiency_4" value="4"
autocomplete="off">4</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_scale_efficiency" id="rating_overall_scale_efficiency_5" value="5"
autocomplete="off">5</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="rating_overall_exchange_efficiency">Exchange Efficiency:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_overall_exchange_efficiency" id="rating_overall_exchange_efficiency_1"
value="1" autocomplete="off">1</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_exchange_efficiency" id="rating_overall_exchange_efficiency_2"
value="2" autocomplete="off">2</label>
<label class="btn btn-primary active">
<input type="radio" name="rating_overall_exchange_efficiency" id="rating_overall_exchange_efficiency_3"
value="3" autocomplete="off" checked="checked">3</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_exchange_efficiency" id="rating_overall_exchange_efficiency_4"
value="4" autocomplete="off">4</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_exchange_efficiency" id="rating_overall_exchange_efficiency_5"
value="5" autocomplete="off">5</label>
</div>
</div>
</div>
<hr class="divider-hor" style="width:500px">
<div class="form-group">
<label class="col-md-4 control-label" for="rating_scoring_park">Parking:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_scoring_park" id="rating_overall_park_1" value="1" autocomplete="off">Yes</label>
<label class="btn btn-primary active">
<input type="radio" name="rating_scoring_park" id="rating_overall_park_0" value="0" autocomplete="off" checked="checked">No</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="rating_scoring_climb">Climbing:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_scoring_climb" id="rating_overall_climb_1" value="1" autocomplete="off">Yes</label>
<label class="btn btn-primary active">
<input type="radio" name="rating_scoring_climb" id="rating_overall_climb_0" value="0" autocomplete="off" checked="checked">No</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="rating_scoring_number_of_robots_lifted"># of Robots Lifted:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="radio" name="rating_scoring_number_of_robots_lifted" id="rating_scoring_number_of_robots_lifted_0"
value="0" autocomplete="off" checked="checked">0</label>
<label class="btn btn-primary">
<input type="radio" name="rating_scoring_number_of_robots_lifted" id="rating_scoring_number_of_robots_lifted_1"
value="1" autocomplete="off">1</label>
<label class="btn btn-primary">
<input type="radio" name="rating_scoring_number_of_robots_lifted" id="rating_scoring_number_of_robots_lifted_2"
value="2" autocomplete="off">2</label>
<label class="btn btn-primary">
<input type="radio" name="rating_scoring_number_of_robots_lifted" id="rating_scoring_number_of_robots_lifted_3"
value="3" autocomplete="off">3</label>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="col-md-12 panel panel-default">Overall:</div>
<div class="form-group">
<label class="col-md-4 control-label" for="rating_overall_robot_stability">Robot Stability:</label>
<div class="col-md-8" style="text-align: right; right:50px">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="rating_overall_robot_stability" id="rating_overall_robot_stability_1" value="1"
autocomplete="off">1</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_robot_stability" id="rating_overall_robot_stability_2" value="2"
autocomplete="off">2</label>
<label class="btn btn-primary active">
<input type="radio" name="rating_overall_robot_stability" id="rating_overall_robot_stability_3" value="3"
autocomplete="off" checked="checked">3</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_robot_stability" id="rating_overall_robot_stability_4" value="4"
autocomplete="off">4</label>
<label class="btn btn-primary">
<input type="radio" name="rating_overall_robot_stability" id="rating_overall_robot_stability_5" value="5"
autocomplete="off">5</label>
</div>
</div>
</div>
</div>
</div>
</fieldset>
<div class="col-md-6">
<button id="submit" type="button" class="btn btn-primary btn-lg">Submit Scouting Report</button>
<span id="error" class="help-block" style="color:red;font-weight:bold;"></span>
</div>
</form>
</div>
</div>
</div>
<script>
$(function () {
// add new user scouting report
$("#submit").on("click", function (ev) {
ev.preventDefault();
$('.loaderImage').show();
// map from data into json object
var data = {};
$.each($('#reportForm').serializeArray(), function (k, v) {
data[v.name] = v.value;
});
var match_key = AppUtility.getUrlParameter('match_key');
if (match_key) data['match_key'] = match_key;
//console.log(data);
// add scouting report
ParadoxScout.addScoutingReport(data, function (error) {
$('.loaderImage').hide();
if (error) {
AppUtility.showErrorMsg("An error occurred!", error);
}
else {
AppUtility.showSuccessMsg("Scouting Report Saved!", '', function () {
setTimeout("location.href = '" + siteUrl + "/matches'", 3000);
});
}
});
});
// *** onload ***
// 1. build teams dropdown
$('.loaderImage').show();
ParadoxScout.buildTeamsDropdown($('#teams'), null, function (error) {
$('.loaderImage').hide();
if (error) {
AppUtility.showErrorMsg("An error occurred!", error);
}
else {
// if a team key is included in querystring, select that team
var selectedTeamKey = AppUtility.getUrlParameter('team_id');
if (selectedTeamKey && $("#teams option[value='" + selectedTeamKey + "']").length > 0) {
$('#teams').val(selectedTeamKey);
}
}
});
// 3. ensure counters are >= 0
$('.js-counter-textbox').on('change', function (ev) {
$(this).val(Math.max(parseFloat($(this).val()), 0) || 0)
});
// 2. add in increments of 5
$(".js-counter-btn").on("click", function (ev) {
var input = $("input[name=" + $(this).data('counter-for') + "]");
var currentVal = parseFloat(input.val());
input.val(Math.max((currentVal + 5), 0) || 0);
});
// 3. add in increments of 1
$(".js-counter-btn-1").on("click", function (ev) {
var input = $("input[name=" + $(this).data('counter-for') + "]");
var currentVal = parseFloat(input.val());
input.val(Math.max((currentVal + 1), 0) || 0);
});
});
</script>