-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewOrder.php
101 lines (96 loc) · 4.45 KB
/
viewOrder.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
<?php
include_once('core.php');
if (!isset($_SESSION['userEmail'])) {
header('Location: /login.php');
}
if ($_SERVER['REQUEST_METHOD'] =='POST') {
$order = new OrderAdminController;
$order = $order->update($_POST, $_GET['id']);
if ($order ==1) {
$message = message(1,'Order updated successfully!');
}
}
if (!isset($_GET['id']) || empty($_GET['id'])) {
header('Location: /accessControl.php');
} else {
if ($_SESSION['userRole'] =='admin') {
$order = new OrderAdminController;
$order = $order->view($_GET['id']);
} else {
$order = new OrderController;
$order = $order->view($_GET['id']);
}
if (!is_array($order)) {
header('Location: /accessControl.php');
}
$pageTitle = 'Edit Order - '.$order['item_name'];
include 'header.php';
if (isset($message)) {
echo "$message";
}
?>
<div class="contact-form sm-res-mg-t-30 tb-res-mg-t-30 tb-res-mg-t-0">
<div class="contact-hd sm-form-hd">
<h2 class="col-md-10 col-sm-12">Order</h2>
<div class="col-md-2 col-sm-12 text-right">
<a href="order.php?id=<?php echo $order['id']; ?>" class="btn btn-success success-icon-notika waves-effect"><i class="fa fa-pencil"></i> Edit Order</a>
</div>
</div>
<div class="contact-inner">
<div class="contact-hd widget-ctn-hd">
<h2>Order Information</h2>
</div>
<div class="contact-dt">
<ul class="contact-list widget-contact-list">
<li><i class="fa fa-shopping-cart"></i> <?php echo $order['item_name'];?></li>
<li><i class="fa fa-money"></i> <?php echo $order['amount'];?></li>
<li><i class="fa fa-dollar"></i> <?php echo $order['fee'];?></li>
<li><i class="fa fa-shield"></i> <?php echo $order['payment_status'];?></li>
<li><i class="fa fa-truck"></i> <b><?php $status = new StatusController; $status = $status->view($order['status_id']); echo $status['name'];?></b>
<?php if ($_SESSION['userRole'] =='admin') { ?>
<form method="post">
<div class="form-example-int mg-t-15">
<div class="form-group">
<label>Delivery Status</label>
<div class="nk-int-st">
<select name="status_id" class="selectpicker">
<option value="<?php echo $order['status_id'];?>"> <?php
$status = new StatusController;
$status = $status->view($order['status_id']);
echo $status ['name'];
?></option>
<?php
$status = new StatusController;
$status = $status->all();
foreach ($status as $stat) {
?>
<option value="<?php echo $stat['id'];?>"><?php echo $stat['name'];?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="contact-btn">
<button class="button btn waves-effect">Change</button>
</div>
</form>
<?php } ?>
</li>
</ul>
</div>
</div>
<div class="contact-inner">
<div class="contact-hd widget-ctn-hd">
<h2>Recipient Information</h2>
</div>
<div class="contact-dt">
<ul class="contact-list widget-contact-list">
<li><i class="fa fa-user"></i> <?php echo $order['recipient']; ?></li>
<li><i class="fa fa-phone"></i> <?php echo $order['recipient_number']; ?></li>
<li><i class="fa fa-map-marker"></i> <?php echo $order['recipient_address']; ?></li>
</ul>
</div>
</div>
<a href="orders.php" class="btn btn-success success-icon-notika waves-effect"><i class="fa fa-arrow-left"></i> Back</a>
</div>
<?php } include 'footer.php'; ?>