forked from Ash1nSky/ProjectEx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
orders.php
304 lines (269 loc) · 12.3 KB
/
orders.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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<?php
include 'includes/connect.php';
if($_SESSION['customer_sid']==session_id())
{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=Arvo" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css2?family=Splash&display=swap');
</style>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Aboreto&family=Montserrat+Subrayada:wght@700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous"
referrerpolicy="no-referrer" />
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css'>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="msapplication-tap-highlight" content="no">
<title>Past Orders</title>
<!-- Favicons-->
<link rel="icon" href="images/favicon/favicon-32x32.png" sizes="32x32">
<!-- Favicons-->
<link rel="apple-touch-icon-precomposed" href="images/favicon/apple-touch-icon-152x152.png">
<!-- For iPhone -->
<meta name="msapplication-TileColor" content="#00bcd4">
<meta name="msapplication-TileImage" content="images/favicon/mstile-144x144.png">
<!-- For Windows Phone -->
<!-- CORE CSS-->
<link href="css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="css/style.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<!-- Custome CSS-->
<link href="css/custom/custom.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
<link href="js/plugins/perfect-scrollbar/perfect-scrollbar.css" type="text/css" rel="stylesheet" media="screen,projection">
</head>
<body>
<!-- Start Page Loading -->
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
</div>
<!-- End Page Loading -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START HEADER -->
<header id="header" class="page-topbar">
<!-- start header nav-->
<div class="navbar-fixed">
<nav class="navbar-color">
<div class="nav-wrapper">
<ul class="left">
</ul>
<ul class="right hide-on-med-and-down">
<li><a href="#" class="waves-effect waves-block waves-light"><h1 class="drop-shop animate-character">DROPSHOP <i class="fa-solid fa-cart-shopping"></i></h1></a>
</li>
</ul>
</div>
</nav>
</div>
<!-- end header nav-->
</header>
<!-- END HEADER -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START MAIN -->
<div id="main">
<!-- START WRAPPER -->
<div class="wrapper">
<!-- START LEFT SIDEBAR NAV-->
<aside id="left-sidebar-nav">
<ul id="slide-out" class="side-nav fixed leftside-navigation">
<li class="user-details cyan darken-2">
<div class="row">
<div class="col col s4 m4 l4">
<img src="images/avatar.jpg" style="margin-left:-67px ;" class="circle responsive-img valign profile-image">
</div>
<div class="col col s8 m8 l8">
<ul id="profile-dropdown" class="dropdown-content">
<li><a href="routers/logout.php"><i class="mdi-hardware-keyboard-tab"></i> Logout</a>
</li>
</ul>
</div>
<div class="col col s8 m8 l8">
<a class="btn-flat dropdown-button waves-effect waves-light white-text profile-btn" href="#" data-activates="profile-dropdown"><?php echo $name;?>
<i class="mdi-navigation-arrow-drop-down right"></i></a>
</div>
</div>
</li>
<li class="bold"><a href="index.php" class="waves-effect waves-cyan"><i class="mdi-editor-border-color"></i> Order Food</a>
</li>
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold"><a class="collapsible-header waves-effect waves-cyan active"><i class="mdi-editor-insert-invitation"></i> Orders</a>
<div class="collapsible-body">
<ul>
<li class="<?php
if(!isset($_GET['status'])){
echo 'active';
}?>
"><a href="orders.php">All Orders</a>
</li>
<?php
$sql = mysqli_query($con, "SELECT DISTINCT status FROM orders ;;");
while($row = mysqli_fetch_array($sql)){
if(isset($_GET['status'])){
$status = $row['status'];
}
echo '<li class='.(isset($_GET['status'])?($status == $_GET['status'] ? 'active' : ''): '').'><a href="orders.php?status='.$row['status'].'">'.$row['status'].'</a>
</li>';
}
?>
</ul>
</div>
</li>
</ul>
<li class="bold"><a href="details.php" class="waves-effect waves-cyan"><i class="mdi-social-person"></i> Edit Details</a>
</li>
</ul>
<a href="#" data-activates="slide-out" class="sidebar-collapse btn-floating btn-medium waves-effect waves-light hide-on-large-only cyan"><i class="mdi-navigation-menu"></i></a>
</aside>
<!-- END LEFT SIDEBAR NAV-->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START CONTENT -->
<section id="content">
<!--breadcrumbs start-->
<div id="breadcrumbs-wrapper">
<div class="container">
<div class="row">
<div class="col s12 m12 l12">
<h5 class="breadcrumbs-title">Past Orders</h5>
</div>
</div>
</div>
</div>
<!--breadcrumbs end-->
<!--start container-->
<div class="container">
<p class="caption">List of your past orders with details</p>
<div class="divider"></div>
<!--editableTable-->
<div id="work-collections" class="seaction">
<?php
if(isset($_GET['status'])){
$status = $_GET['status'];
}
else{
$status = '%';
}
$sql = mysqli_query($con, "SELECT * FROM orders WHERE STATUS LIKE '$status';;");
echo ' <div class="row">
<div>
<h4 class="header">List</h4>
<ul id="issues-collection" class="collection">';
while($row = mysqli_fetch_array($sql))
{
$status = $row['status'];
echo '<li class="collection-item avatar">
<i class="mdi-content-content-paste red circle"></i>
<span class="collection-header">Order No. '.$row['id'].'</span>
<p><strong>Date:</strong> '.$row['date'].'</p>
<p><strong>Payment Type:</strong> '.$row['payment_type'].'</p>
<p><strong>Address: </strong>'.$row['address'].'</p>
<p><strong>Status:</strong> '.($status=='Paused' ? 'Paused <a data-position="bottom" data-delay="50" data-tooltip="Please contact administrator for further details." class="btn-floating waves-effect waves-light tooltipped cyan"> ?</a>' : $status).'</p>
'.(!empty($row['description']) ? '<p><strong>Note: </strong>'.$row['description'].'</p>' : '').'
<a href="#" class="secondary-content"><i class="mdi-action-grade"></i></a>
</li>';
$order_id = $row['id'];
$sql1 = mysqli_query($con, "SELECT * FROM order_details WHERE order_id = $order_id;");
while($row1 = mysqli_fetch_array($sql1))
{
$item_id = $row1['item_id'];
$sql2 = mysqli_query($con, "SELECT * FROM items WHERE id = $item_id;");
while($row2 = mysqli_fetch_array($sql2)){
$item_name = $row2['name'];
}
echo '<li class="collection-item">
<div class="row">
<div class="col s7">
<p class="collections-title"><strong>#'.$row1['item_id'].'</strong> '.$item_name.'</p>
</div>
<div class="col s2">
<span>'.$row1['quantity'].' Pieces</span>
</div>
<div class="col s3">
<span>Rs. '.$row1['price'].'</span>
</div>
</div>
</li>';
$id = $row1['order_id'];
}
echo'<li class="collection-item">
<div class="row">
<div class="col s7">
<p class="collections-title"> Total</p>
</div>
<div class="col s2">
<span> </span>
</div>
<div class="col s3">
<span><strong>Rs. '.$row['total'].'</strong></span>
</div>';
if(!preg_match('/^Cancelled/', $status)){
if($status != 'Delivered'){
echo '<form action="routers/cancel-order.php" method="post">
<input type="hidden" value="'.$id.'" name="id">
<input type="hidden" value="Cancelled by Customer" name="status">
<input type="hidden" value="'.$row['payment_type'].'" name="payment_type">
<button class="btn waves-effect waves-light right submit" type="submit" name="action">Cancel Order
<i class="mdi-content-clear right"></i>
</button>
</form>';
}
}
echo'</div></li>';
}
?>
</ul>
</div>
</div>
</div>
</div>
<!--end container-->
</section>
<!-- END CONTENT -->
</div>
<!-- END WRAPPER -->
</div>
<!-- END MAIN -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START FOOTER -->
<footer class="page-footer">
<div class="footer-copyright">
</div>
</footer>
<!-- END FOOTER -->
<!-- ================================================
Scripts
================================================ -->
<!-- jQuery Library -->
<script type="text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
<!--angularjs-->
<script type="text/javascript" src="js/plugins/angular.min.js"></script>
<!--materialize js-->
<script type="text/javascript" src="js/materialize.min.js"></script>
<!--scrollbar-->
<script type="text/javascript" src="js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script type="text/javascript" src="js/plugins.min.js"></script>
<!--custom-script.js - Add your own theme custom JS-->
<script type="text/javascript" src="js/custom-script.js"></script>
</body>
</html>
<?php
}
else
{
if($_SESSION['admin_sid']==session_id())
{
header("location:all-orders.php");
}
else{
header("location:login.php");
}
}
?>