-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewAllItems.php
138 lines (127 loc) · 6.08 KB
/
ViewAllItems.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
<?php
session_start();
if($_SESSION["accountType"] != 'user' && $_SESSION["accountType"] != 'admin')
{
header('Location: index.php');
}
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/tether.min.js"></script>
<script src ="js/bootstrap.min.js"></script>
<script src="DataTables/datatables.min.js"></script>
<script src="js/customItemFilter.js"></script>
<script type="text/javascript">
var interval;
var table;
$( document ).ready(function() {
table = $('#myDataTable').DataTable( {
"ajax": "PhpScripts/ViewItemTable.php",
"bPaginate":true,
"bProcessing": true,
"columns": [
{ mData: 'auction_id', "searchable": true } ,
{ mData: 'description', "searchable": true },
{ mData: 'donated_by', "searchable": false },
{ mData: 'value', "searchable": false},
{ mData: 'winning_bidder_id', "searchable": false},
{ mData: 'winning_bid', "searchable": false},
{ mData: 'sold', visible: false}
],
columnDefs: [
{
"render": function(data,type,row) {
return data == -1 ? "Priceless" : data;
},
"targets":3
},
{
"render": function(data,type,row) {
var id = row.sold == 1 ? data + "\tSOLD!" : data;
return data == null ? "Unassigned" : id;
},
"targets":0
}
],
order: [[0, "asc"]]
}); // end data table
setInterval( function () {
table.ajax.reload(null, false);
}, 10000 );
$('.idFilter').click( function() {
table.draw();
} );
$('select').on('change', function() {
if (table.page.info().pages == 1) document.getElementById("start").style.display = "none";
else document.getElementById("start").style.display = "block";
});
}); // end on ready
function changePagesAutomatically()
{
var table = $('#myDataTable').DataTable();
if(interval)
{
document.getElementById("start").value = "Start Rotating Pages";
clearInterval(interval);
interval = null;
}
else
{
document.getElementById("start").value = "Stop Rotating Pages";
interval = setInterval( function () {
var info = table.page.info();
var pageNum = (info.page < info.pages) ? info.page + 1 : 1;
table.page(pageNum).draw(false);
}, 10000);
}
}
function openCheckBoxDropdown() {
if (!document.getElementsByClassName("dropper")[0].classList.contains("auto-height")) document.getElementsByClassName("dropper")[0].classList.add("auto-height");
else document.getElementsByClassName("dropper")[0].classList.remove("auto-height");
}
function clickInput(id) {
document.getElementById(id).click();
}
</script>
<link href="css/bootstrap.min.css" text="text/css" rel="stylesheet">
<link href="css/customStyles.css" text="text/css" rel="stylesheet">
<link href="DataTables/datatables.min.css" text="text/css" rel="stylesheet">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php include "PhpScripts/Templates/Nav.php";?>
<div class="container body-content top">
<div onclick="openCheckBoxDropdown()" class="groups" data-toggle="dropdown">Select Groups ↓</div>
<div class="dropper">
<div onclick="clickInput('one')" class="dropdown">100's <input id="one" class="idFilter check-boxes" checked type="checkbox"></div>
<div onclick="clickInput('two')" class="dropdown">200's <input id="two" class="idFilter check-boxes" checked type="checkbox"></div>
<div onclick="clickInput('three')" class="dropdown">300's <input id="three" class="idFilter check-boxes" checked type="checkbox"></div>
<div onclick="clickInput('six')" class="dropdown">600's <input id="six" class="idFilter check-boxes" checked type="checkbox"></div>
<div onclick="clickInput('unassigned')" class="dropdown">Not Numbered<input id="unassigned" class="idFilter check-boxes" checked type="checkbox"></div>
</div>
</div>
<table id="myDataTable" class="stripe" cellspacing="0" width="100%">
<thead>
<tr>
<td class="first head">Auction Id</td>
<td class="head">Description</td>
<td class="head">Donated By</td>
<td class="head">Value</td>
<td class="head bidder">Winning Bidder</td>
<td class="last head">Winning Bid</td>
<td></td>
</tr>
</thead>
</table>
<input id="start" type="button" class="btn-info center" value="Start Rotating Pages" onclick="changePagesAutomatically();" />
</div>
</body>
</html>