-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorders.php
209 lines (190 loc) · 7.78 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
<?php
require("./connection/connect.php");
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ayuruveda | About Us</title>
<!-- Common Tags -->
<?php require('includes/head.php') ?>
</head>
<style>
header {
width: 100%;
height: 40px;
background-color: #07660a;
}
header .col-11 {
text-align: end;
}
header .account-bar {
display: flex;
flex-direction: end;
}
header .account-bar a {
color: white;
margin: 4px;
display: flex;
}
header .account-bar a i {
margin-top: 4px;
}
header .account-bar .account {
margin-top: 7px;
}
header .account-bar .account:hover {
text-decoration: none;
cursor: pointer;
}
</style>
<body>
<!-- Header -->
<header>
<div class="container">
<div class="row">
<?php
if(isset($_SESSION['email'])){
echo '<div class="col-lg-3">
<div class="social d-flex pt-2 pb-2">
<i class="fa-brands fa-facebook pr-4" style="font-size:22px; color: white;"></i>
<i class="fa-brands fa-instagram pr-4" style="font-size:22px; color: white;"></i>
<i class="fa-brands fa-twitter pr-4" style="font-size:22px; color: white;"></i>
<i class="fa-brands fa-youtube pr-4" style="font-size:22px; color: white;"></i>
</div></div>
<div class="col-lg-6"></div>
<div class="col-lg-3">
<div class="account-bar">
<a class="account text-light" href="account.php">
<i class="fa-solid fa-circle-user"></i>
My Account
<span class="disabled" style="font-size: 30px; margin-top: -10px;">|</span>
</a>
<form method="post">
<a class="btn btn-outline-light btn-sm" href="logout.php"><i
class="fa-solid fa-arrow-right-from-bracket"></i> Logout</a>
</form>
</div>
</div>';
}else{
echo '<div class="col-lg-3">
<div class="social d-flex pt-2 pb-2">
<i class="fa-brands fa-facebook pr-4" style="font-size:22px; color: white;"></i>
<i class="fa-brands fa-instagram pr-4" style="font-size:22px; color: white;"></i>
<i class="fa-brands fa-twitter pr-4" style="font-size:22px; color: white;"></i>
<i class="fa-brands fa-youtube pr-4" style="font-size:22px; color: white;"></i>
</div></div>
<div class="col-lg-8"></div>
<div class="col-lg-1">
<div class="account-bar">
<a class="btn btn-outline-light btn-sm" href="login.php">
<i class="fa-solid fa-user"></i>
Login
</a>
</div>
</div>';
}
?>
</div>
</div>
</header>
<!-- Navbar and Header -->
<?php require('includes/navbar.php') ?>
<section>
<div class="container mt-4 mb-4">
<?php
if(isset($_SESSION['email'])){
$sql = "SELECT * from orders where email = '".$_SESSION['email']."'";
$result=mysqli_query($con,$sql);
if($result){
while($row=mysqli_fetch_assoc($result)){
$id=$row['id'];
$products=$row['products'];
$amount_paid=$row['amount_paid'];
$mode=$row['mode'];
echo '
<div class="row justify-content-center">
<div class="col-md-8 border mb-4 rounded card">
<div class="row card-body mb-1">
<div class="col-md-6">
<h5 class="text-secondary">Products</h5>
</div>
<div class="col-md-3">
<h5 class="text-secondary">Price</h5>
</div>
<div class="col-md-3">
<a href="action.php?order='.$row['id'].'" type="submit" class="btn btn-danger">Cancel</a>
</div>
</div>
<hr class="pb-2" style="width:60%;margin:0;">
<div class="row">
<div class="col-md-6">
<h5 class="text-success">'.$products.'</h5>
</div>
<div class="col-md-3">
<h5 class="text-danger">Rs. '.$amount_paid.'</h5>
</div>
</div>
</div>
</div>
';
}
}
else{
}
}else{
echo '<div class="row justify-content-center">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 border rounded p-4">
<div class="text-center">
<i class="fa-solid fa-circle-exclamation fa-3x" aria-hidden="true"></i>
<div class="title mt-2">
<h4>You are not logged in.</h4>
</div>
<div class="text mb-2">
<span>Please logged in and try again.</span>
</div>
<a class="btn btn-warning" href="login.php">Login</a>
</div>
</div>
</div>';
}
?>
</div>
</section>
<!-- Footer -->
<?php require('includes/footer.php') ?>
<script type="text/javascript">
$(document).ready(function() {
$(".itemQty").on('change', function(){
var $el = $(this).closest('tr');
var pid = $el.find(".pid").val();
var pprice = $el.find(".pprice").val();
var qty = $el.find(".itemQty").val();
location.reload(true);
$.ajax({
url: 'action.php',
method: 'post',
cache: false,
data: {qty:qty,pid:pid,pprice:pprice},
success: function(response){
console.log(response);
}
})
});
load_cart_item_number();
function load_cart_item_number() {
$.ajax({
url: 'action.php',
method: 'get',
data: {
cartItem: "cart_item"
},
success: function(response) {
$("#cart-item").html(response);
}
});
}
});
</script>
</body>
</html>