This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorders.php
108 lines (99 loc) · 5.4 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
<?php
require('config.php');
include("session.php");
?>
<?php include_once "views/partials/header.html"; ?>
<body>
<section class="bg-theme">
<?php include_once "views/partials/admin-navbar.php"; ?>
<div class="container">
<?php /*
$search = $_GET['search-order'] ?? '';
if ($search) {
$sql = "SELECT * FROM orderdetails WHERE OrderID LIKE '%$search%' || OrderDate LIKE '%$search%' || Username LIKE '%$search%' || Total LIKE '%$search%'";
} else {
$sql = "SELECT * FROM orderdetails";
}
$orders = $con->query($sql) or die($con->error);
$row = $orders->fetch_assoc(); */
?>
<!-- <div class="d-flex justify-content-between search-orders border mt-2 mb-5">
<form class="d-inline-flex">
<input class="ms-2" type="search" placeholder="Search..." name="search-order" id="search-order" value="<?php //echo $search
?>">
<label class="form-label d-flex ms-4 mb-0" for="search-order">
<button class="btn btn-primary btn-search-prod rounded-pill" id="search-icon" type="submit" onclick="searchDropDown()">
<i class="fa fa-search icon-color"></i>
</button>
</label>
</form>
</div> -->
<h4>Requests</h4>
<div class="table-responsive">
<table class="table orders-table mb-5">
<thead class="orders-header">
<tr>
<th class="text-center">Request ID</th>
<th class="text-center">Request Date</th>
<th class="text-center">Name</th>
<th class="text-center">Department</th>
<th class="text-center">Product Name</th>
<th class="text-center">Quantity</th>
<th class="text-center">Category</th>
<th class="text-center">Status</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT request.RequestID, request.RequestDateTime, CONCAT(user.FirstName, ' ', user.LastName) as Name, department.DepartmentName, product.ProductName, request.Quantity, category.CategoryName, request.Status FROM `request` INNER JOIN `user` ON request.UserID = user.UserID INNER JOIN `product` ON request.ProductID = product.ProductID INNER JOIN `department` ON user.DepartmentID = department.DepartmentID INNER JOIN `category` ON product.CategoryID = category.CategoryID; ";
$orders = $con->query($sql) or die($con->error);
while ($row = $orders->fetch_assoc()) { ?>
<tr>
<td class="text-center"><?php echo $row['RequestID'] ?></td>
<td class="text-center"><?php echo $row['RequestDateTime'] ?></td>
<td class="text-center"><?php echo $row['Name'] ?></td>
<td class="text-center"><?php echo $row['DepartmentName'] ?></td>
<td class="text-center"><?php echo $row['ProductName'] ?></td>
<td class="text-center"><?php echo $row['Quantity'] ?></td>
<td class="text-center"><?php echo $row['CategoryName'] ?></td>
<td class="text-center"><?php
$id = $row['RequestID'];
if ($row['Status'] == 0) {
echo "<a href='deliver.php?id=$id' >Click to Deliver</a>";
} else {
echo 'Delivered';
} ?></td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>
</section>
<!-- <script>
function searchDropDown() {
const btn = document.querySelector('#search-icon');
btn.addEventListener('click', (e) => {
e.preventDefault();
let category = document.querySelector('#filter-orders').value;
if (category == 'order-id') {
<?php
/* $sql = "SELECT * FROM orderdetails WHERE OrderID = '$search'";
echo $sql; */
?>
} else if (category == 'username') {
<?php
/* $sql = "SELECT * FROM orderdetails WHERE Username = '$search'";
echo $sql; */
?>
} else {
<?php
/* $sql = "SELECT * FROM orderdetails WHERE Total = '$search'";
echo $sql; */
?>
}
})
}
</script> -->
<?php include_once "views/partials/footer.html"; ?>