-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.php
286 lines (266 loc) · 14 KB
/
log.php
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
<!doctype html>
<html lang="en">
<head>
<title>Amstore Machine Cycle Time</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.4/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="./bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/moment-with-locales.min.js"></script>
<script src="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="./js/events.js"></script>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="./bootstrap/css/bootstrap-theme.css" rel="stylesheet" media="screen">
<link rel="icon" type="image/png" href="./favicon.png" />
<style>
body, fieldset {
background: url(./img/cork-wallet.png) repeat 0 0;
}
.datepicker, .table-condensed {
cursor: pointer;
}
#timeMenu {
padding: 7px;
border-radius: 3px;
border-width: thin;
border-style: solid;
}
#timeMenu:hover {
background-color: lightgrey;
text-decoration: none;
}
fieldset {
padding: 10px;
}
.chart {
width: 1090px;
height: auto;
margin: 0 auto;
padding: 5px;
position: relative;
opacity: 0.8;
}
.google-visualization-table-table td {
font-size: 0.7em;
border: solid #eee;
border-width: 0 1px 1px 0;
padding: 2px .35em;
}
</style>
<!-- <script type="text/javascript" src="./js/efficiency.js"> </script> -->
<script type="text/javascript">
$(document).ready(
function() {
$.backstretch("./img/stolen-bg.jpg");
$('#start').datetimepicker({
format: 'YYYY/MM/DD h:mm A'
});
$('#end').datetimepicker({
format: 'YYYY/MM/DD h:mm A'
});
$('button#load').on('click', makeTable);
makeTable();
});
</script>
</head>
<body>
<header>
<nav role="navigation" class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">Machines</a>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li id="LinkHome" class="inactive"><a href="/machine/">Home</a></li>
</ul>
<!-- <ul class="nav navbar-nav">
<li id="allMachines" class="active"><a href="#">All</a></li>
</ul> -->
<!-- <ul class="nav navbar-nav nav-right">
</ul> -->
</div>
</nav>
</header>
<div class="container">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">Amstore Machine Cycle Time</div>
<div class="panel-body">
<script type="text/javascript" >
var formatDate = function(d) {
var day = d.getDate();
if (day < 10) {
day = "0" + day;
}
var month = d.getMonth() + 1;
if (month < 10) {
month = "0" + month;
}
var year = d.getFullYear();
var hours = d.getHours();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12;
/* if (hours < 10) {
* hours = "0" + hours;
* }*/
var minutes = d.getMinutes();
if (minutes < 10) {
minutes = "0" + minutes;
}
return year + "/" + month + "/" + day + " " + hours + ":" + minutes + " " + ampm;
};
var sixTillNow = function() {
var start = new Date();
var end = new Date();
if (start.getHours() <= 6)
start.setHours(start.getHours() - 1);
else
start.setHours(6);
start.setMinutes(0);
start.setSeconds(0);
end.setHours(end.getHours() + 1);
end.setMinutes(0);
end.setSeconds(0);
$('#start').val(formatDate(start));
$('#end').val(formatDate(end));
$('#timeMenu').html('Today <b class="caret"></b>');
};
var today = function() {
var start = new Date();
var end = new Date();
start.setHours(6);
start.setMinutes(0);
start.setSeconds(0);
end.setHours(14);
end.setMinutes(30);
end.setSeconds(0);
$('#start').val(formatDate(start));
$('#end').val(formatDate(end));
$('#timeMenu').html('Today <b class="caret"></b>');
};
var yesterday = function() {
var start = new Date();
var end = new Date();
start.setHours(6);
start.setMinutes(0);
start.setSeconds(0);
start.setDate(start.getDate() - 1);
end.setHours(14);
end.setMinutes(30);
end.setSeconds(0);
end.setDate(end.getDate() - 1);
$('#start').val(formatDate(start));
$('#end').val(formatDate(end));
$('#timeMenu').html('Yesterday <b class="caret"></b>');
};
var thisHour = function() {
var start = new Date();
var end = new Date();
// start.setHours(start.getHours() - 1);
start.setMinutes(0);
start.setSeconds(0);
end.setMinutes(59);
end.setSeconds(0);
$('#start').val(formatDate(start));
$('#end').val(formatDate(end));
$('#timeMenu').html('This Hour <b class="caret"></b>');
};
var thisWeek = function() {
var start = new Date();
var end = new Date();
start.setDate(start.getDate() - (start.getDay() - 2));
start.setHours(6);
start.setMinutes(0);
start.setSeconds(0);
start.setDate(start.getDate() - 1);
/* end.setDate(end.getDate() + (6 - end.getDay()));*/
end.setHours(14);
end.setMinutes(30);
end.setSeconds(0);
end.setDate(end.getDate() - 1);
$('#start').val(formatDate(start));
$('#end').val(formatDate(end));
$('#timeMenu').html('This Week <b class="caret"></b>');
};
var lastWeek = function() {
var start = new Date();
var end = new Date();
start.setDate(start.getDate() - (start.getDay() - 2) - 7);
start.setHours(6);
start.setMinutes(0);
start.setSeconds(0);
start.setDate(start.getDate() - 1);
end.setDate(end.getDate() + (6 - end.getDay()) - 7);
end.setHours(14);
end.setMinutes(30);
end.setSeconds(0);
end.setDate(end.getDate() - 1);
$('#start').val(formatDate(start));
$('#end').val(formatDate(end));
$('#timeMenu').html('Last Week <b class="caret"></b>');
};
var userSpec = function() {
$('#timeMenu').html('User Specified <b class="caret"></b>');
};
</script>
<div id="timeButtons" class="dropdown" style="padding-bottom: 20px;">
<a href="#" id="timeMenu" data-toggle="dropdown" class="dropdown-toggle" >Time Presets <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#" onclick="today();">Today</a></li>
<li><a href="#" onclick="yesterday();">Yesterday</a></li>
<li><a href="#" onclick="thisHour();">This Hour</a></li>
<li><a href="#" onclick="thisWeek();">This Week</a></li>
<li><a href="#" onclick="lastWeek();">Last Week</a></li>
</ul>
</div>
<fieldset class="row">
<div class="form-group">
<label for="start"><span class="glyphicon glyphicon-time"></span> Start time</label>
<input type="datetime" id="start" class="form-control" name="start" onclick="userSpec();" value="<?php
if (!isset($_COOKIE["start"])) {
echo date('Y-m-d H:i T', time() - (60 * 60));
} else {
$hm = date('H:i T', $_COOKIE["start"]);
echo date('Y-m-d H:i T', strtotime("$hm now"));
}
?>">
</div>
<div class="form-group">
<label for="end"><span class="glyphicon glyphicon-time"></span> End time</label>
<input type="datetime" id="end" class="form-control" name="end" onclick="userSpec();" value="<?php
if (!isset($_COOKIE["end"])) {
echo date('Y-m-d H:i T', time());
} else {
$hm = date('H:i T', $_COOKIE["end"]);
echo date('Y-m-d H:i T', strtotime("$hm now"));
}
?>"></input>
</div>
<button id="load" class="btn btn-primary" action="submit"><span class="glyphicon glyphicon-search"></span> <i>Load</i></button>
<input style="opacity: 0;" type="text" value= "" id="machineClicked"></input>
</fieldset>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Log</div>
<div id="panel-body" style="padding: 20px;">
<div id="logtbl" class="chart">
</div>
</div>
</div>
</div>
</div>
</body>
</html>