-
Notifications
You must be signed in to change notification settings - Fork 0
/
ordersAdmin.php
108 lines (75 loc) · 4.15 KB
/
ordersAdmin.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
include 'incs/header.php';
include 'classes/dbh.php';
if (isset($_SESSION['userId']) && $userRole == "user") {
header("Location: 404.php");
} elseif (!isset($_SESSION['userId'])) {
header("Location: 404.php");
}
$dbh = new Dbh();
?>
<body>
<?php
include 'incs/navBar.php';
?>
<div id="admin-products-nav">
<a href="ordersAdmin.php" id="admin-nav-producten" class="admin-products-nav-title" style="border-bottom: 3px solid #253d84">Ontvangen</a>
<a href="ordersProcessedAdmin.php" id="admin-nav-categorieen" class="admin-products-nav-title" style="opacity: 0.3">Verwerkt</a>
</div>
<form class="search-bar" methode="post" action="">
<input id="searchOrderAdmin" class="input-search" type="text" name="searchOrderAdmin" placeholder="Zoek een bestelling">
<button type="submit" name="submit-search"><i class="fas fa-search"></i></button>
</form>
<div id="search-results-orders"></div>
<div id="all-orders">
<?php
$stmtCategory = $dbh->connection()->prepare("SELECT * FROM orders WHERE orders_processed = 0 ORDER BY orders_timestamp DESC");
$stmtCategory->execute();
$resultCategory = $stmtCategory->fetchAll();
foreach ($resultCategory as $category) {
$orderTimestamp = date("d-m-Y H:i", strtotime($category['orders_timestamp']));
$orderTimestamp = date("l j F Y H:i", strtotime($orderTimestamp));
$orderTimestamp = str_replace("January", "Januari", $orderTimestamp);
$orderTimestamp = str_replace("February", "Februari", $orderTimestamp);
$orderTimestamp = str_replace("March", "Maart", $orderTimestamp);
$orderTimestamp = str_replace("April", "April", $orderTimestamp);
$orderTimestamp = str_replace("May", "Mei", $orderTimestamp);
$orderTimestamp = str_replace("June", "Juni", $orderTimestamp);
$orderTimestamp = str_replace("July", "Juli", $orderTimestamp);
$orderTimestamp = str_replace("August", "Augustus", $orderTimestamp);
$orderTimestamp = str_replace("September", "September", $orderTimestamp);
$orderTimestamp = str_replace("October", "Oktober", $orderTimestamp);
$orderTimestamp = str_replace("November", "November", $orderTimestamp);
$orderTimestamp = str_replace("December", "December", $orderTimestamp);
$orderTimestamp = str_replace("Monday", "Maandag", $orderTimestamp);
$orderTimestamp = str_replace("Tuesday", "Dinsdag", $orderTimestamp);
$orderTimestamp = str_replace("Wednesday", "Woensdag", $orderTimestamp);
$orderTimestamp = str_replace("Thursday", "Donderdag", $orderTimestamp);
$orderTimestamp = str_replace("Friday", "Vrijdag", $orderTimestamp);
$orderTimestamp = str_replace("Saturday", "Zaterdag", $orderTimestamp);
$orderTimestamp = str_replace("Sunday", "Zondag", $orderTimestamp);
echo "<div class=\"products-wrapper-category\">";
echo "
<h2 class=\"category-title\"> $orderTimestamp</h2>
<h3 style=\"font-size:20px\" class=\"category-title\">Bestelnmr. #$category[orders_id]</h3>
";
$stmt = $dbh->connection()->prepare("SELECT * FROM order_product INNER JOIN product ON product.product_id = order_product.product_id INNER JOIN product_image ON product_image.product_id = product.product_id INNER JOIN orders ON orders.orders_id = order_product.orders_id WHERE orders.orders_id = $category[orders_id] and orders_processed = 0 ORDER BY orders.orders_timestamp;");
$stmt->execute();
$result = $stmt->fetchAll();
foreach ($result as $product) {
echo "
<div class=\"user-card\" onclick=\"window.location.href='viewOrderAdmin.php?id=$category[orders_id]';\" >
<img src=\"imgs/$product[image_name]\" alt=\"product image\">
<h2>$product[product_name]</h2>
<p style=\"font-size:20px\">€$product[product_price]</p>
</div>
<br>
";
}
echo "</div>";
}
?>
</div>
<?php
include 'incs/footer.php';
?>