-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatch_entry.html
190 lines (154 loc) · 8.48 KB
/
match_entry.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
<html>
<head>
<title>Code Red Scouting</title>
<link rel= "stylesheet" href="css/default.css" type="text/css">
</head>
<body>
<div class= "formb1">
<a href="index.html"><img src="assets/Scouting4.png" alt="Scouting4.png" width="639" height="200"></a>
</br><ul id="header"><li><a href="match_entry.html">Match entry</a></li><li><a href="robot_attributes.html">Robot Data</a></li><li><a href="heatmap.html">Heatmap Enter</a></li></ul><ul id="header"><li><a href="match_view.html">View Matches</a></li><li><a href="php/robot_view.php">View Robots</a></li><li><a href="graph.html">Graphs</a></li><li><a href="analysis.html">Analysis</a></li><li><a href="heatmap_view.html">Heatmap View</a></li></ul>
<h1>Data Entry Form</h1>
<p>
<h3>Enter data here:</h3>
</p>
<!--<form action="php/match_entry.php" method="post" id="form">-->
<form id="form">
Match number:<input type="number" name="match"> </br>
Team number:<input type="number" name="team"> </br>
</br>
<h3>Autonomous:</h3>
Shot high:<input type="radio" name="shot_auton" value="high"></br>
Shot low:<input type="radio" name="shot_auton" value="low"></br>
Missed:<input type="radio" name="shot_auton" value="missed_auton"></br> <!-- TODO:add these fields to the database and to the php script -->
Didn't Take Ball:<input type="radio" name="shot_auton" value="NA"></br>
Hot goal:<input type="checkbox" name="hot" value="hot" id="hot"></br>
Drove forward:<input type="checkbox" name="drove_auton" value="drove" id="drove"></br>
</br>
<h3>Main game:</br></h3>
Passes Over Truss:<input type="number" name="bar_toss">
<button onclick="increment('bar_toss')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('bar_toss')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Catches From Truss:<input type="number" name="bar_catch">
<button onclick="increment('bar_catch')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('bar_catch')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Passes (don't include the bar):<input type="number" name="passes">
<button onclick="increment('passes')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('passes')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Assists:<input type="number" name="received">
<button onclick="increment('received')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('received')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
High goals:<input type="number" name="goal_high">
<button onclick="increment('goal_high')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('goal_high')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Low goals:<input type="number" name="goal_low">
<button onclick="increment('goal_low')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('goal_low')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Missed goals:<input type="number" name="missed">
<button onclick="increment('missed')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('missed')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Estimated points defended:<input type="number" name="defense"></br>
Balls Killed:<input type="number" name="killed">
<button onclick="increment('killed')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('killed')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Fouls:<input type = "number" name = "fouls">
<button onclick="increment('fouls')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('fouls')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
Technical Fouls:<input type = "number" name = "tech_fouls">
<button onclick="increment('tech_fouls')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/plus.png" width="20" height="20"></button>
<button onclick="decrement('tech_fouls')" src="/assets/plus.png" type="button" class="inc"><img src="/assets/minus.png" width="20" height="20"></button></br>
</br>
Won:<input type="radio" name="won" value="won"></br>
Lost:<input type="radio" name="won" value="lost"></br></br>
Tags (separate by #):<input type="text" name="tags" size="60"></br>
Technical Problems:<br><textarea rows = "7" cols = "60" name = "tech_problems">NA</textarea></br>
Notes:<br><textarea rows="10" cols="60" name="notes"></textarea></br>
<select name="comp" id="comp">
<option value="flr">flr</option>
<option value="buckeye">buckeye</option>
<option value="championships">championships</option>
</select></br>
<button type="button" onclick="upload()">submit</button>
</form>
<div id="response"></div>
</div>
<script type="text/javascript">
function increment(field){
var s=document.getElementsByName(field)[0].value;
if(s==""){
document.getElementsByName(field)[0].value=1;
}else{
var v=parseInt(s);
v+=1;
document.getElementsByName(field)[0].value=v;
}
}
function decrement(field){
var s=document.getElementsByName(field)[0].value;
if(s==""){
document.getElementsByName(field)[0].value=1;
}else{
var v=parseInt(s);
if(v>0)
v-=1;
document.getElementsByName(field)[0].value=v;
}
}
//returns a default empty string
function getRadioValue(name){
var rad=document.getElementsByName(name);
for(var i=0;i<rad.length;i++){
if(rad[i].checked){
return rad[i].value;
}
}
return "";
}
function upload(){
if(document.cookie.indexOf("enter_data")==-1){
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("response").innerHTML=xmlhttp.responseText;
var m=parseInt(document.getElementsByName("match")[0].value);
document.getElementById("form").reset();
document.getElementsByName("match")[0].value=m+1;
}
}
var competition=document.getElementById("comp");
//TODO:FIX IF BROKE: probably is
var parameters="match="+document.getElementsByName("match")[0].value+
"&team="+document.getElementsByName("team")[0].value+
"&shot_auton="+getRadioValue("shot_auton")+
"&hot="+document.getElementById("hot").checked+
"&drove_auton="+document.getElementById("drove").checked+
"&bar_toss="+document.getElementsByName("bar_toss")[0].value+
"&bar_catch="+document.getElementsByName("bar_catch")[0].value+
"&passes="+document.getElementsByName("passes")[0].value+
"&receive="+document.getElementsByName("received")[0].value+
"&goal_high="+document.getElementsByName("goal_high")[0].value+
"&goal_low="+document.getElementsByName("goal_low")[0].value+
"&missed="+document.getElementsByName("missed")[0].value+
"&defense="+document.getElementsByName("defense")[0].value+
"&killed="+document.getElementsByName("killed")[0].value+
"&fouls="+document.getElementsByName("fouls")[0].value+
"&tech_fouls="+document.getElementsByName("tech_fouls")[0].value+
"&won="+getRadioValue("won")+
"&tags="+document.getElementsByName("tags")[0].value+
"&tech_problems="+document.getElementsByName("tech_problems")[0].value+
"&competition="+competition.options[competition.selectedIndex].value+
"¬es="+document.getElementsByName("notes")[0].value;
xmlhttp.open("POST","/php/match_entry.php",true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(parameters);
}else{
alert("you do not have permission to submit data");
}
}
</script>
</body>
</html>