forked from Vimall03/Alimento
-
Notifications
You must be signed in to change notification settings - Fork 0
/
orders.php
123 lines (120 loc) · 4.93 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
<?php
session_start();
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
header("location: user_login.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Orders</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href=".css">
<link rel="stylesheet" href="main.css">
<style>
.order-card {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
}
.order-card .card-title {
font-weight: bold;
font-size: 18px;
}
.order-card .card-text {
font-size: 16px;
}
</style>
</head>
<body>
<nav class="nav">
<div class="nav__wrapper grid">
<div class="grid__span2 nav__logo-wrap">
<a href="home.php">
<img class="nav__logo-img" src="images/logo/Logo.png">
</a>
</div>
<div class="grid__span10 nav__links-wrap">
<ul class="nav__links">
<li class="nav__link">
<form action="pin_search.php" method="post">
<input type="text" class="form-control " id="searchBar" name="pincode" placeholder="Search by Pincode" required>
</li>
<li class="nav__link">
<input type="submit" class="btn-dark form-control " value="Search">
</form>
</li>
<li class="nav__link dropdown">
<a class="nav__link-item dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="nav__link-icon" style="width: 1.9rem" src="images/favicons/user_male_circle_32px.png">
<span class="nav__link-item"><?php echo $_SESSION['name']; ?></span>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="profile.php">Profile</a>
<a class="dropdown-item" href="orders.php">Orders</a>
<a class="dropdown-item" href="change_password.php">Change Password</a>
<a class="dropdown-item" href="user_logout.php">Logout</a>
</div>
</li>
<li class="nav__link">
<a href="track_order.php">
<img class="nav__link-icon" style="width: 1.8rem" src="images/favicons/tableware_50px.png">
<span class="nav__link-item">Orders</span>
</a>
</li>
<li class="nav__link">
<a href="#contact">
<img class="nav__link-icon" src="images/favicons/phone_32px.png">
<span class="nav__link-item">Contact </span>
</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<br>
<br>
<br>
<div class="container mt-5">
<h1 class="card-title">Your Orders</h1>
<br>
<div class="container">
<div class="row">
<?php
include 'partials/_dbconnect.php';
$query = "SELECT * FROM `orders` WHERE `user_id` = '".$_SESSION['user_id']."' ORDER BY `dt` DESC";
$result = mysqli_query($conn, $query);
$num = mysqli_num_rows($result);
if ($num >= 1) {
while ($row = mysqli_fetch_array($result)) {
echo '<div class="col-md-4 mb-4">
<div class="order-card">
<div class="card-body">
<h5 class="card-title">Item: '.$row['order'].'</h5>
<p class="card-text">Order ID: '.$row['order_id'].'</p>
<p class="card-text">Date & Time: '.$row['dt'].'</p>
<p class="card-text">Order Status: '.$row['order_status'].'</p>
<p class="card-text">Total: ₹'.$row['amount'].'</p>
</div>
</div>
</div>';
}
} else {
echo '<div class="col">
<p>No orders found.</p>
</div>';
}
?>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src ="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>