-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.html
200 lines (180 loc) · 6.16 KB
/
header.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="js/jquery-1.12.4.js"></script>
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/bootstrap-theme.css" rel="stylesheet" />
<script src="js/bootstrap.min.js"></script>
<link href="css/jquery-ui.css" rel="stylesheet" />
<script src="js/jquery-ui.js"></script>
<script src="js/morris.min.js"></script>
<link href="css/morris.css" rel="stylesheet" />
<script>
$(function () {
var days = 7;
var date = new Date();
var start = date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
var res = date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
$("#predictdate").datepicker({ minDate: new Date(start), maxDate: new Date(res), dateFormat: 'yy-mm-dd', });
$("#pastdate").datepicker({ maxDate: new Date() });
$('#predict').click(function () {
var cluster = $('.chooseClusterActive').text();
if (cluster == '') {
alert("Choose cluster");
return;
}
var d2 = $("#predictdate").datepicker('getDate');
if (d2 == '') {
alert("Pick Date");
return;
}
var d1 = new Date();
var diff = 1;
if (d2) {
diff = diff + Math.floor((d2.getTime() - d1.getTime()) / 86400000); // ms per day
}
$('#overlay').show();
$.get("server.php?a=predict&d=" + diff + "&c=" + cluster, function (data) {
$('#overlay').hide();
var data = $.parseJSON(data);
console.log(data);
if (cluster != "All Location") {
$('#predictionGraph').html("");
$('#prediction').html("Predicted no of calls for <b>" + cluster + "</b> on <b>" + $("#predictdate").val() + "</b> is <br><span class='presult'>" + data[0]['value'] + "</span> <b></b>");
}
else {
$('#prediction').html("");
$('#predictionTitle').html("Prediction for <b>" + $("#predictdate").val() + "</b>");
Morris.Donut({
element: 'predictionGraph',
data: data,
colors: [
'#009788',
'#8bc24a',
'#e65100',
'#c2175b'
],
labelColor: '#000059',
formatter: function (x) { return x + " calls" }
}).on('click', function (i, row) {
console.log(i, row);
});
}
});
});
$('.chooseCluster').click(function () {
$('.chooseClusterActive').removeClass('chooseClusterActive');
$(this).addClass('chooseClusterActive');
});
});
</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
<style>
h2 {
margin:0}
#overlay {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1;
display: none;
background: url(loading.gif) no-repeat rgba(0,0,0,0.7) center;
background-size: 200px;
}
}
#loading{
}
body {
margin-top: -18px;
}
#predictionGraph {
width:300px;}
.navbar {
background:#000059;
border:none;
border-radius:0;
}
.tab-content {
padding-top: 30px;
height: 530px;
}
#history {
padding-top: 50px;
}
.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
border-radius: 0;
}
.colorpatch {
width: 25px;
height: 25px;
display: inline-block;
}
.chooseCluster {
padding-top:40px;
padding-bottom:40px;
font-size:24px;
text-align:center;
cursor:pointer;
color:#fff;
font-weight:bold;
opacity:0.6;
}
.chooseCluster:hover {
opacity:1;
}
.chooseClusterActive {
opacity:1;
color:#000;
}
#detroit {
position:absolute;
}
#prediction,#predictionTitle {
text-align:center;
color:#000059;
font-size:20px;
padding-top:20px;
}
.presult {
font-size:40px;
font-weight:bold;
}
#predictdate {
margin:10px;margin-top:30px;
padding:15px;
}
#predict {
margin:0px;
border-radius:0;
padding:15px;
width:200px;
font-size:16px;
text-transform:uppercase;
background:#000059;
}
</style>
</head>
<body>
<div id="overlay">
</div>
<div class="container-fluid">
<div class="row">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="col-lg-offset-2 col-lg-8">
<div class="navbar-header">
<img src="Flag_map_of_Detroit.png" width=250 id="detroit">
</div>
<ul class="nav navbar-nav pull-right">
<li class="active"><a href="index.php">Call Prediction</a></li>
<li class="active"><a href="history.php">History</a></li>
<li class="active"><a href="update.php">Update Call Log</a></li>
</ul>
</div>
</div>
</nav>
</div>
<div class="row">