-
Notifications
You must be signed in to change notification settings - Fork 0
/
orders.php
170 lines (139 loc) · 4.72 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
<?php
include 'config.php';
session_start();
if(isset($_SESSION['user_id'])){
$id=$_SESSION['user_id'];
} else {
header('location: login.php');
}
// order cancelled
if(isset($_REQUEST['cancel'])) {
$cancel_id = $_REQUEST['cancel'];
$cancelled = mysqli_query($conn, "UPDATE orders SET status = 'Cancelled' WHERE oId = '$cancel_id'");
header('location: orders.php');
}
// order successfull
if(isset($_REQUEST['success'])) {
$success_id = $_REQUEST['success'];
$successfull = mysqli_query($conn, "UPDATE orders SET status = 'Successfull' WHERE oId = '$success_id'");
header('location: orders.php');
}
?>
<!-- ////////////////////////////// -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel</title>
<!-- linking fontawsome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
<!-- linking style sheets -->
<link rel="stylesheet" href="styles.css">
<!-- linking style sheets -->
<link rel="stylesheet" href="style.css">
<!-- linking swiper -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css"/>
</head>
<body>
<!-- ------------------HEADER----------------------- -->
<?php include 'header.php'; ?>
<!-- Orders table -->
<section id="orders" class="display-product-table" style="margin-bottom: 40px;">
<h1 class="heading"><span>My Orders</span></h1>
<?php
if(isset($_REQUEST['provider_session_id'])) {
echo "<div class='empty'>Checkout Successful</div>";
}
?>
<table>
<thead>
<th>Order Id</th>
<th>Order Placed On</th>
<th>Address Line 1</th>
<th>Address Line 2</th>
<th>City</th>
<th>Quantity</th>
<th>Total</th>
<th>Status</th>
</thead>
<tbody>
<?php
$ord = mysqli_query($conn, "SELECT * FROM orders WHERE uId = '$id' ORDER BY oId DESC");
if(mysqli_num_rows($ord) > 0){
while($row = mysqli_fetch_assoc($ord)){
?>
<tr>
<td><?php echo $row['oId']; ?></td>
<td><?php echo $row['datetime']; ?></td>
<td><?php echo $row['addline1']; ?></td>
<td><?php echo $row['addline2']; ?></td>
<td><?php echo $row['city']; ?></td>
<td><?php echo $row['quantity']; ?></td>
<td>$<?php echo $row['total']; ?>/-</td>
<td>
<?php echo $row['status']; ?>
<?php
if($row['status'] == "Processing") {
echo '<a href="orders.php?cancel='.$row['oId'].'" class="option-btn"> <i class="fas fa-x"></i>Cancel</a>';
}
?>
<?php
if($row['status'] == "Shipped") {
echo '<a href="orders.php?success='.$row['oId'].'" class="option-btn"> <i class="fas fa-check"></i>Deliverd</a>';
}
?>
</td>
<!--
<td>
<a href="admin.php?edit=<?php echo $row['oId']; ?>" class="option-btn"> <i class="fas fa-edit"></i> Shipped </a>
</td>
-->
</tr>
<?php
};
}
else{
echo "<div class='empty'>No Orders Have Been Placed</div>";
};
?>
</tbody>
</table>
</section>
<!-- infinite text loop start -->
<div class="scrolling_text">
<div class="text">
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
</div>
<div class="text">
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
<span> ✪ FREEDOM OVER ANYTHING ✪ </span>
<span>MENVERSE</span>
</div>
</div>
<!-- infinite text loop ends -->
<!-- -----------------------------footer---------------------- -->
<?php include 'footer.php'; ?>
<!-- footer section ends -->
<!-- swiper linking -->
<script src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js"></script>
<!-- linking the javascript -->
<script src="script.js"></script>
</body>
</html>