-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeliver.php
More file actions
131 lines (114 loc) · 3.73 KB
/
Deliver.php
File metadata and controls
131 lines (114 loc) · 3.73 KB
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
<?php
ob_start();
include'Adminheader.php';
include 'connection.php';
if (isset($_GET['Action']) && $_GET['Action'] === "Delivered") {
// $action = $_GET['Action'];
echo "<script>";
echo "alert('Delivered !!');";
echo "</script>";
$update_id = $_GET['Status'];
// if ($action === 'Delivered') {
$update_quantity_query = mysqli_query($conn, "UPDATE `orders` SET `status` = 'Delivered' WHERE id = '$update_id'");
// }
// if ($update_quantity_query) {
// header('location: pending_orders.php');
// }
// $update_id=$_POST['Status'];
// $update_quantity_query = mysqli_query($conn, "UPDATE `orders` SET `status` = 'Delivered' WHERE id = '$update_id'");
// if($update_quantity_query){
// header('location:Deliver.php');
// }
}
if (isset($_GET['Action']) && $_GET['Action'] === "Canceled") {
// $action = $_GET['Action'];
echo "<script>";
echo "alert('Canceled!!');";
echo "</script>";
$update_id = $_GET['Status'];
// if ($action === 'Delivered') {
$update_quantity_query = mysqli_query($conn, "UPDATE `orders` SET `status` = 'Canceled BY CUSTOMER' WHERE id = '$update_id'");
// }
}
if (isset($_GET['Action']) && $_GET['Action'] === "Unreacheable") {
// $action = $_GET['Action'];
echo "<script>";
echo "alert('Customer is unreacheable!!');";
echo "</script>";
$update_id = $_GET['Status'];
// if ($action === 'Delivered') {
$update_quantity_query = mysqli_query($conn, "UPDATE `orders` SET `status` = 'Customer is unreacheable' WHERE id = '$update_id'");
// }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Delivered Orders</title>
<style>
/* Add your CSS styles here */
table {
border-collapse: collapse;
width: 80%;
margin: 20px auto;
}
th, td {
border: 1px solid skyblue;
padding: 10px;
text-align: left;
}
th {
background-color: skyblue;
color: white;
}
</style>
</head>
<body>
<?php
session_start();
include 'connection.php';
$sql = "SELECT * FROM orders WHERE status='Your Product Will Be Delivered Soon'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
?>
<table>
<title>Products To Be Delivered</title>
<thead>
<tr>
<th>Customer Name</th>
<th>Delivery Address</th>
<th>Order Date</th>
<th>Phone Number</th>
<th> </th>
<th>Action</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php
while ($row = $result->fetch_assoc()) {
?>
<tr>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['created_at']; ?></td>
<td><?php echo $row['phone']; ?></td>
<td><a href="Deliver.php?Action=Delivered&Status=<?php echo $row['id']; ?>">Delivered</a></td>
<td><a href="Deliver.php?Action=Canceled&Status=<?php echo $row['id']; ?>">Canceled</a></td>
<td><a href="Deliver.php?Action=Unreacheable&Status=<?php echo $row['id']; ?>">Unreacheable</a></td>
<!-- <td><a href="Deliver.php?Status=<?php echo $row['id']; ?>">Rejected</a></td> -->
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
echo "No delivered orders found.";
}
?>
</body>
</html>