-
Notifications
You must be signed in to change notification settings - Fork 0
/
orders_sent.php
138 lines (109 loc) · 4.86 KB
/
orders_sent.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
<?php
include 'configs/connect.php';
session_start();
if (isset($_SESSION['user_id'])) {
$user_id = $_SESSION['user_id'];
} else {
$user_id = '';
header('location:home.php');
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="templates/uploaded_img/system_img/logo.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Đơn hàng</title>
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<!-- custom css file link -->
<link rel="stylesheet" href="templates/css/style.css">
<link rel="stylesheet" href="templates/css/test.css">
</head>
<body>
<!-- header section starts -->
<?php include 'configs/user_header.php'; ?>
<!-- header section ends -->
<div class="heading">
<h3>Đơn hàng</h3>
<p><a href="html.php">Trang chủ</a> <span> / Đơn hàng</span></p>
</div>
<section class="orders">
<h1 class="title">Đơn hàng của bạn</h1>
<div class="nav-links">
<a href="orders_all.php">Tất cả </a>-
<a href="orders_wait.php"> Chờ xác nhận </a>-
<a href="orders_completed.php"> Đã xác nhận </a>-
<a href="orders_sent.php"> Đơn đang vận chuyển </a>-
<a href="orders_finish.php"> Đơn hoàn thành </a>-
<a href="orders_cancel.php"> Đơn đã hủy </a>
</div>
<table class="orders-table">
<thead>
<tr>
<th>Mã đơn hàng</th>
<th>Ngày đặt</th>
<th>Sản phẩm</th>
<th>Tổng tiền</th>
<th>Trạng thái đơn hàng</th>
<th>Chi tiết</th>
</tr>
</thead>
<tbody>
<?php
if ($user_id == '') {
echo '<tr><td colspan="6"><p class="empty">Please login to see your orders</p></td></tr>';
} else {
$select_orders = $conn->prepare("SELECT * FROM `orders` WHERE user_id = ? AND payment_status='sent' ORDER BY placed_on DESC");
$select_orders->execute([$user_id]);
if ($select_orders->rowCount() > 0) {
while ($fetch_orders = $select_orders->fetch(PDO::FETCH_ASSOC)) {
?>
<tr>
<td><?= $fetch_orders['id']; ?></td>
<td><?= $fetch_orders['placed_on']; ?></td>
<td><?= $fetch_orders['total_products']; ?></td>
<td><?= number_format($fetch_orders['total_price']); ?> đ</td>
<td>
<?php
switch ($fetch_orders['payment_status']) {
case 'wait':
echo 'Chờ xác nhận';
break;
case 'completed':
echo 'Đang chuẩn bị đơn';
break;
case 'sent':
echo 'Đã gửi';
break;
case 'finish':
echo 'Giao hàng thành công';
break;
default:
echo 'Không xác định';
}
?>
</td>
<td>
<a href="order_details.php?id_order=<?= $fetch_orders['id']; ?>" class="delete-bt">Chi tiết đơn hàng</a>
</td>
</tr>
<?php
}
} else {
echo '<tr><td colspan="6"><p class="empty">Không tìm thấy đơn hàng nào!</p></td></tr>';
}
}
?>
</tbody>
</table>
</section>
<!-- footer section starts -->
<?php include 'configs/user_footer.php'; ?>
<!-- footer section ends -->
<!-- custom js file link -->
<script src="templates/js/script.js"></script>
</body>
</html>