-
Notifications
You must be signed in to change notification settings - Fork 7
/
place-order.php
475 lines (442 loc) · 17.1 KB
/
place-order.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<?php
include 'includes/connect.php';
include 'includes/wallet.php';
$total = 0;
if($_SESSION['customer_sid']==session_id())
{
$result = mysqli_query($con, "SELECT * FROM users where id = $user_id");
while($row = mysqli_fetch_array($result)){
$name = $row['name'];
$address = $row['address'];
$contact = $row['contact'];
$verified = $row['verified'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<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>Provide Order Details</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">
<style type="text/css">
.input-field div.error{
position: relative;
top: -1rem;
left: 0rem;
font-size: 0.8rem;
color:#FF4081;
-webkit-transform: translateY(0%);
-ms-transform: translateY(0%);
-o-transform: translateY(0%);
transform: translateY(0%);
}
.input-field label.active{
width:100%;
}
.left-alert input[type=text] + label:after,
.left-alert input[type=password] + label:after,
.left-alert input[type=email] + label:after,
.left-alert input[type=url] + label:after,
.left-alert input[type=time] + label:after,
.left-alert input[type=date] + label:after,
.left-alert input[type=datetime-local] + label:after,
.left-alert input[type=tel] + label:after,
.left-alert input[type=number] + label:after,
.left-alert input[type=search] + label:after,
.left-alert textarea.materialize-textarea + label:after{
left:0px;
}
.right-alert input[type=text] + label:after,
.right-alert input[type=password] + label:after,
.right-alert input[type=email] + label:after,
.right-alert input[type=url] + label:after,
.right-alert input[type=time] + label:after,
.right-alert input[type=date] + label:after,
.right-alert input[type=datetime-local] + label:after,
.right-alert input[type=tel] + label:after,
.right-alert input[type=number] + label:after,
.right-alert input[type=search] + label:after,
.right-alert textarea.materialize-textarea + label:after{
right:70px;
}
</style>
</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">
<li><h1 class="logo-wrapper"><a href="index.php" class="brand-logo darken-1"></a> <span class="logo-text">Logo</span></h1></li>
</ul>
<ul class="right hide-on-med-and-down">
<li><a href="#" class="waves-effect waves-block waves-light"><i class="mdi-editor-attach-money"><?php echo $balance;?></i></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" alt="" 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>
<p class="user-roal"><?php echo $role;?></p>
</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"><i class="mdi-editor-insert-invitation"></i> Orders</a>
<div class="collapsible-body">
<ul>
<li><a href="orders.php">All Orders</a>
</li>
<?php
$sql = mysqli_query($con, "SELECT DISTINCT status FROM orders WHERE customer_id = $user_id;");
while($row = mysqli_fetch_array($sql)){
echo '<li><a href="orders.php?status='.$row['status'].'">'.$row['status'].'</a>
</li>';
}
?>
</ul>
</div>
</li>
</ul>
</li>
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold"><a class="collapsible-header waves-effect waves-cyan"><i class="mdi-action-question-answer"></i> Tickets</a>
<div class="collapsible-body">
<ul>
<li><a href="tickets.php">All Tickets</a>
</li>
<?php
$sql = mysqli_query($con, "SELECT DISTINCT status FROM tickets WHERE poster_id = $user_id AND not deleted;");
while($row = mysqli_fetch_array($sql)){
echo '<li><a href="tickets.php?status='.$row['status'].'">'.$row['status'].'</a>
</li>';
}
?>
</ul>
</div>
</li>
</ul>
</li>
<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">Provide Order Details</h5>
</div>
</div>
</div>
</div>
<!--breadcrumbs end-->
<!--start container-->
<div class="container">
<p class="caption">Provide required delivery and payment details.</p>
<div class="divider"></div>
<div class="row">
<div class="col s12 m4 l3">
<h4 class="header">Details</h4>
</div>
<div>
<div class="card-panel">
<div class="row">
<form class="formValidate col s12 m12 l6" id="formValidate" method="post" action="confirm-order.php" novalidate="novalidate">
<div class="row">
<div class="input-field col s12">
<label for="payment_type">Payment Type</label><br><br>
<select id="payment_type" name="payment_type">
<option value="Wallet" selected>Wallet</option>
<option value="Cash On Delivery" <?php if(!$verified) echo 'disabled';?>>Cash on Delivery</option>
</select>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<i class="mdi-action-home prefix"></i>
<textarea name="address" id="address" class="materialize-textarea validate" data-error=".errorTxt1"><?php echo $address;?></textarea>
<label for="address" class="">Address</label>
<div class="errorTxt1"></div>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<i class="mdi-action-credit-card prefix"></i>
<input name="cc_number" id="cc_number" type="text" data-error=".errorTxt2" required>
<label for="cc_number" class="">Card Number</label>
<div class="errorTxt2"></div>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<i class="mdi-communication-vpn-key prefix"></i>
<input name="cvv_number" id="cvv_number" type="text" data-error=".errorTxt3" required>
<label for="cvv_number" class="">CVV Number</label>
<div class="errorTxt3"></div>
</div>
</div>
<div class="row">
<div class="row">
<div class="input-field col s12">
<button class="btn cyan waves-effect waves-light right" type="submit" name="action">Submit
<i class="mdi-content-send right"></i>
</button>
</div>
</div>
</div>
<?php
foreach ($_POST as $key => $value)
{
if($key == 'action' || $value == ''){
break;
}
echo '<input name="'.$key.'" type="hidden" value="'.$value.'">';
}
?>
</form>
</div>
</div>
</div>
<div class="divider"></div>
</div>
<!--end container-->
</div>
<div class="container">
<p class="caption">Estimated Receipt</p>
<div class="divider"></div>
<!--editableTable-->
<div id="work-collections" class="seaction">
<div class="row">
<div>
<ul id="issues-collection" class="collection">
<?php
echo '<li class="collection-item avatar">
<i class="mdi-content-content-paste red circle"></i>
<p><strong>Name:</strong>'.$name.'</p>
<p><strong>Contact Number:</strong> '.$contact.'</p>
<a href="#" class="secondary-content"><i class="mdi-action-grade"></i></a>';
foreach ($_POST as $key => $value)
{
if($value == ''){
break;
}
if(is_numeric($key)){
$result = mysqli_query($con, "SELECT * FROM items WHERE id = $key");
while($row = mysqli_fetch_array($result))
{
$price = $row['price'];
$item_name = $row['name'];
$item_id = $row['id'];
}
$price = $value*$price;
echo '<li class="collection-item">
<div class="row">
<div class="col s7">
<p class="collections-title"><strong>#'.$item_id.' </strong>'.$item_name.'</p>
</div>
<div class="col s2">
<span>'.$value.' Pieces</span>
</div>
<div class="col s3">
<span>Ksh. '.$price.'</span>
</div>
</div>
</li>';
$total = $total + $price;
}
}
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>Ksh. '.$total.'</strong></span>
</div>
</div>
</li>';
if(!empty($_POST['description']))
echo '<li class="collection-item avatar"><p><strong>Note: </strong>'.htmlspecialchars($_POST['description']).'</p></li>';
?>
</ul>
</div>
</div>
</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 class="container">
<span>Copyright © 2017
<span class="right"> Design and Developed by <a class="grey-text text-lighten-4" href="#">Musebe</a></span>
</div>
</div>
</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>
<script type="text/javascript" src="js/plugins/jquery-validation/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery-validation/additional-methods.min.js"></script>
<script type="text/javascript" src="js/plugins/formatter/jquery.formatter.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>
<script type="text/javascript">
$("#formValidate").validate({
rules: {
address: {
required: true,
minlength: 5
},
cc_number: {
required: true,
minlength: 16,
},
cvv_number: {
required: true,
minlength: 3,
},
},
messages: {
address:{
required: "Enter a address",
minlength: "Enter at least 5 characters"
},
cc_number:{
required: "Please provide card number",
minlength: "Enter at least 16 digits",
},
cvv_number:{
required: "Please provide CVV number",
minlength: "Enter at least 3 digits",
},
},
errorElement : 'div',
errorPlacement: function(error, element) {
var placement = $(element).data('error');
if (placement) {
$(placement).append(error)
} else {
error.insertAfter(element);
}
}
});
$('#cc_number').formatter({
'pattern': '{{9999}}-{{9999}}-{{9999}}-{{9999}}',
'persistent': true
});
$('#cvv_number').formatter({
'pattern': '{{9}}-{{9}}-{{9}}',
'persistent': true
});
$('#payment_type').change(function() {
if ($(this).val() === 'Cash On Delivery') {
$("#cc_number").prop('disabled', true);
$("#cvv_number").prop('disabled', true);
}
if ($(this).val() === 'Wallet'){
$("#cc_number").prop('disabled', false);
$("#cvv_number").prop('disabled', false);
}
});
</script>
</body>
</html>
<?php
}
else
{
if($_SESSION['admin_sid']==session_id())
{
header("location:admin-page.php");
}
else{
header("location:login.php");
}
}
?>