-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_order.php
More file actions
121 lines (111 loc) · 5.88 KB
/
Copy pathview_order.php
File metadata and controls
121 lines (111 loc) · 5.88 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
<?php
session_start();
$conn = mysqli_connect("localhost", "root", "", "clothingstore_db");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Safely pull down order tracking variables from the GET pipeline
if (!isset($_GET['orderID'])) {
die("Error Exception: Target Order ID tracker reference context is missing.");
}
$order_id = intval($_GET['orderID']);
// 1. Fetch Core Order Metadata
$order_query = mysqli_query($conn, "SELECT * FROM orders WHERE id = $order_id");
$order = $order_query ? mysqli_fetch_assoc($order_query) : null;
if (!$order) {
die("Data Exception: Selected manifest record does not exist inside repository.");
}
// 2. Fetch Itemized Products Associated with the Manifest (Fixed p.name -> p.product_name)
$items_query = "SELECT oi.*, p.product_name as item_name, p.price, p.image_path, p.brand
FROM order_items oi
JOIN products p ON oi.product_id = p.id
WHERE oi.order_id = $order_id";
$items = mysqli_query($conn, $items_query);
if (!$items) {
die("Database Query Execution Failure: " . mysqli_error($conn));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shipping Manifest Reference #PT-<?php echo $order_id; ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
body { background-color: #000000; color: #ffffff; font-family: 'Inter', sans-serif; padding: 50px 0; }
.manifest-wrapper { background-color: #0c0c0c; border: 1px solid #222; padding: 40px; }
.meta-header-label { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: #555; font-weight: 800; }
.meta-value { font-size: 15px; font-weight: 600; color: #fff; margin-top: 5px; }
.item-row { border-bottom: 1px solid #111; padding: 15px 0; align-items: center; }
</style>
</head>
<body>
<div class="container">
<div class="mb-4 d-flex justify-content-between align-items-center">
<a href="admin_dashboard.php" class="text-decoration-none text-muted small fw-bold text-uppercase">
<i class="fa-solid fa-chevron-left me-2"></i> Return to Console Panel
</a>
<button onclick="window.print();" class="btn btn-outline-light btn-sm rounded-0 fw-bold text-uppercase" style="font-size:11px;">
<i class="fa-solid fa-print me-2"></i> Print Document
</button>
</div>
<div class="manifest-wrapper">
<div class="border-bottom border-secondary pb-4 mb-4">
<h1 class="fw-black text-uppercase tracking-wider m-0" style="font-size: 28px;">Shipping Manifest</h1>
<p class="text-muted small m-0 mt-1">Reference Allocation Tracking Unit Log ID: #PT-<?php echo $order_id; ?></p>
</div>
<div class="row mb-5 text-uppercase">
<div class="col-md-4">
<div class="meta-header-label">Workflow Status</div>
<div class="meta-value text-warning">
<i class="fa-solid fa-circle-dot me-2" style="font-size:10px;"></i><?php echo htmlspecialchars($order['status'] ?? 'N/A'); ?>
</div>
</div>
<div class="col-md-4">
<div class="meta-header-label">Order Date Time</div>
<div class="meta-value">
<?php
$date_log = $order['order_date'] ?? null;
echo ($date_log) ? date("d F Y - H:i", strtotime($date_log)) : "Timestamp unrecorded";
?>
</div>
</div>
<div class="col-md-4">
<div class="meta-header-label">Total Document Value</div>
<div class="meta-value text-primary">R <?php echo number_format($order['total_amount'] ?? 0, 2); ?></div>
</div>
</div>
<h5 class="fw-bold text-uppercase mb-3" style="font-size:12px; letter-spacing:1px; color:#666;">Itemized Contents Allocation</h5>
<div class="border-top border-secondary pt-2">
<?php
if ($items && mysqli_num_rows($items) > 0):
while($item_row = mysqli_fetch_assoc($items)):
?>
<div class="row item-row g-3">
<div class="col-2 col-md-1">
<img src="<?php echo htmlspecialchars($item_row['image_path'] ?? ''); ?>" class="img-fluid" style="height:50px; object-fit:cover; border:1px solid #222;" onerror="this.src='https://via.placeholder.com/100'">
</div>
<div class="col-6 col-md-6">
<span class="d-block text-white fw-bold text-uppercase" style="font-size:14px;"><?php echo htmlspecialchars($item_row['item_name'] ?? 'Clothing Asset Item'); ?></span>
<span class="text-muted small text-uppercase" style="font-size:10px;"><?php echo htmlspecialchars($item_row['brand'] ?? 'Pastimes Collective'); ?></span>
</div>
<div class="col-2 col-md-2 text-center text-muted small">
QTY: <?php echo $item_row['quantity'] ?? 1; ?>
</div>
<div class="col-2 col-md-3 text-end fw-bold text-white">
R <?php echo number_format($item_row['price'] ?? 0, 2); ?>
</div>
</div>
<?php
endwhile;
else:
?>
<div class="text-center py-4 text-muted small">No structural inventory lines attached to this invoice document.</div>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>