-
Notifications
You must be signed in to change notification settings - Fork 11
/
index_laptop.php
272 lines (204 loc) · 7.33 KB
/
index_laptop.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
<?php
include_once 'includes/dbh.inc.php';
session_start();
$current_user="superuser";
if(isset($_SESSION["current_user"])){
$current_user=$_SESSION["current_user"];
}
else{
echo "<script> window.location.replace('authentication/login.php'); </script>";
}
$sql = "SELECT * FROM user_notifications where user_uid='$current_user'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$data[] = $row;
}
} else {
echo "0 results";
}
// echo $data[1]["orderstatus"];
$sql = "SELECT * FROM order_details where user_uid='$current_user'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$data2[] = $row;
}
} else {
echo "0 results";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=PT+Serif" rel="stylesheet">
<!-- <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script> -->
<link rel="stylesheet" type="text/css" media="screen" href="public/css/userdashboard.css"/>
<script>
/* Set the width of the side navigation to 250px */
function openNav() {
document.getElementById("mySidenav").style.width = "2000px";
}
/* Set the width of the side navigation to 0 */
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
function openNav() {
document.getElementById("mySidenav").style.width = "200px";
document.getElementById("main").style.marginLeft = "200px";
}
/* Set the width of the side navigation to 0 and the left margin of the page content to 0 */
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
}
</script>
</head>
<body>
<!-- Use any element to open the sidenav -->
<!-- Add all page content inside this div if you want the side nav to push page content to the right (not used if you only want the sidenav to sit on top of the page -->
<div id="main">
<header>
<div id="header">
<div class="row">
<div class="col-lg-3 heading">
<i class="fa fa-recycle logoimg" aria-hidden="true"></i>
<a href="index.php"> <span>Welcome to Ankur</span> </a>
</div>
<div class="col-lg-9 navlinks">
<ul>
<li>
<form method="POST" action="includes/logout.inc.php">
<button type="submit" class="btn userlogoutbtn" name="submit">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</div>
</header>
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="locatedustbin.php"> Locate Dustbin</a>
<a href="dustbin_on_demand.php"> On-demand Dustbin</a>
<a href="collectrequest.php">Collect Request</a>
<a href="sendcomplaints.php">Send Complaint</a>
</div>
<div class="menu">
<button class="menubutton"><span onclick="openNav()">Menu</span></button>
</div>
<div class="jumbotron text-center">
<h1>This is user Dashboard</h1>
<p>Welcome to our site :) <span id="userinfo"></span></p>
</div>
<div class="row">
<div class="col-lg-9 recentorders">
<h2>Recent Orders</h2>
<table class="table" id="orderTable">
<thead>
<tr>
<th>OrderNo</th>
<th>OrderDate</th>
<th>DeliveryDate</th>
<th>CollectDate</th>
<th>Type_of_Bin</th>
<th>Size_of_Bin</th>
<th>No_of_Bin</th>
<th>Garbage_Amount</th>
<th>Status</th>
<th>Return_Amount</th>
</tr>
</thead>
</table>
</div>
<div class="col-lg-3 vl">
<h2>Notifications</h2>
<table class="table" id="dataTable">
<thead>
<tr>
<th>Orderno</th>
<th>Orderstatus</th>
<th>Notification Date</th>
<th>Message</th>
</tr>
</thead>
</table>
</div><!--col end here-->
</div><!--row end here-->
</div><!--main end here-->
</body>
<script>
var temp = <?php echo json_encode($data) ?>;
var temp2 = <?php echo json_encode($data2) ?>;
var temp3 = <?php echo json_encode($current_user) ?>;
console.log(temp3);
window.onload = function()
{
var userinfospan = document.getElementById("userinfo");
userinfospan.innerHTML=temp3;
for(var i=temp.length-1;i>=temp.length-3;i--)
{
var table = document.getElementById("dataTable");
var row = table.insertRow();
var cell1 = row.insertCell();
var cell2 = row.insertCell();
var cell3 = row.insertCell();
var cell4 = row.insertCell();
cell1.innerHTML = temp[i]["orderno"];
cell2.innerHTML = temp[i]["orderstatus"];
cell3.innerHTML = temp[i]["notifydate"];
cell4.innerHTML = temp[i]["notification"];
// var status=temp[i]["orderstatus"];
// console.log(status);
// if (status=="success"){
// row.classList.add("success");
// }
// elseif(status=="failed"){
// row.classList.add("danger");
// }
// else{
// row.classList.add("warning");
// }
// console.log(row.classList);
}
for(var i=temp2.length-1;i>=temp2.length-5;i--)
{
var table2 = document.getElementById("orderTable");
var row2 = table2.insertRow();
var cell22 = row2.insertCell();
var cell32 = row2.insertCell();
var cell52 = row2.insertCell();
var cell62 = row2.insertCell();
var cell72 = row2.insertCell();
var cell82 = row2.insertCell();
var cell92 = row2.insertCell();
var cell102 = row2.insertCell();
var cell112 = row2.insertCell();
var cell122= row2.insertCell();
cell22.innerHTML = temp2[i]["orderno"];
cell32.innerHTML = temp2[i]["orderdate"];
cell52.innerHTML = temp2[i]["deliverydate"];
cell62.innerHTML = temp2[i]["collectdate"];
cell72.innerHTML = temp2[i]["typeofbin"];
cell82.innerHTML = temp2[i]["sizeofbin"];
cell92.innerHTML = temp2[i]["noofbin"];
cell102.innerHTML = temp2[i]["garbageamount"];
cell112.innerHTML = temp2[i]["orderstatus"];
cell122.innerHTML = temp2[i]["returnamount"];
}
}
</script>
</html>