-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_consignments.php
More file actions
146 lines (134 loc) · 9.64 KB
/
Copy pathadmin_consignments.php
File metadata and controls
146 lines (134 loc) · 9.64 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
session_start();
include 'DBConn.php';
// --- SECURITY GATE ---
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
header("Location: admin_login.php");
exit();
}
// Fetch all users who have uploaded items (Sellers) - Updated to match your exact column 'seller_id'
$sellers_query = mysqli_query($conn, "SELECT DISTINCT u.id, u.full_name, u.email
FROM users u
JOIN products p ON p.seller_id = u.id
ORDER BY u.full_name ASC");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Consignment Logs | Pastimes®</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>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;700;900&display=swap');
:root {
--sidebar-width: 260px;
--accent-blue: #0678eb;
--bg-pure: #000000;
--card-bg: #0c0c0c;
--border-dim: #222;
--nav-text-muted: #666;
--nav-text-hover: #fff;
}
body { background-color: var(--bg-pure); color: #fff; font-family: 'Inter', sans-serif; margin: 0; }
.sidebar { width: var(--sidebar-width); height: 100vh; background: #000; border-right: 1px solid var(--border-dim); position: fixed; top: 0; left: 0; padding: 20px 0; display: flex; flex-direction: column; justify-content: space-between; }
.brand-section { padding: 20px 30px; }
.brand-logo { font-weight: 900; letter-spacing: 4px; font-size: 20px; color: #fff; text-decoration: none; display: block; text-transform: uppercase; }
.admin-unit-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: #444; display: block; margin-top: 5px; }
.nav-menu { display: flex; flex-direction: column; width: 100%; margin-top: 50px; flex-grow: 1; }
.nav-item-pastimes { width: 100%; padding-left: 30px; }
.nav-link-pastimes { color: var(--nav-text-muted); text-transform: uppercase; font-size: 11px; font-weight: 800; letter-spacing: 2px; padding: 18px 0; transition: 0.3s; display: flex; align-items: center; text-decoration: none; width: 100%; }
.nav-link-pastimes:hover { color: var(--nav-text-hover); }
.nav-link-pastimes.active { color: var(--nav-text-hover); }
.nav-link-pastimes i { margin-right: 15px; width: 20px; text-align: center; }
.main-content { margin-left: var(--sidebar-width); padding: 60px; }
.welcome-header { text-transform: uppercase; font-size: 26px; font-weight: 900; letter-spacing: 1px; margin-bottom: 5px; color: #fff; }
.section-title { font-size: 11px; text-transform: uppercase; font-weight: 900; letter-spacing: 3px; margin-bottom: 30px; color: var(--accent-blue); }
.seller-block { background: #050505; border: 1px solid var(--border-dim); padding: 25px; margin-bottom: 30px; }
.seller-info-header { border-bottom: 1px solid #111; padding-bottom: 15px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.seller-title { font-size: 16px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.inner-item-table { width: 100%; margin-top: 10px; }
.inner-item-table th { font-size: 9px; color: #555; text-transform: uppercase; letter-spacing: 1px; padding: 8px; border-bottom: 1px solid #222; }
.inner-item-table td { padding: 12px 8px; font-size: 12px; color: #ccc; border-bottom: 1px solid #111; vertical-align: middle; }
.thumb-preview { width: 40px; height: 40px; object-fit: cover; border: 1px solid #222; }
</style>
</head>
<body>
<div class="sidebar">
<div class="brand-section">
<a href="admin_dashboard.php" class="brand-logo">PASTIMES®</a>
<span class="admin-unit-label">Admin Control Unit</span>
</div>
<nav class="nav-menu">
<div class="nav-item-pastimes"><a href="admin_dashboard.php" class="nav-link-pastimes"><i class="fa-solid fa-chart-line"></i> Overview</a></div>
<div class="nav-item-pastimes"><a href="admin_products.php" class="nav-link-pastimes"><i class="fa-solid fa-tags"></i> Inventory</a></div>
<div class="nav-item-pastimes"><a href="admin_orders.php" class="nav-link-pastimes"><i class="fa-solid fa-receipt"></i> Orders</a></div>
<div class="nav-item-pastimes"><a href="admin_users.php" class="nav-link-pastimes"><i class="fa-solid fa-users"></i> Customers</a></div>
<div class="nav-item-pastimes"><a href="admin_consignments.php" class="nav-link-pastimes active"><i class="fa-solid fa-handshake"></i> Consignments</a></div>
</nav>
<div class="terminate-section" style="width: 100%; padding-left: 30px; margin-bottom: 20px; border-top: 1px solid var(--border-dim);">
<a href="logout.php" class="btn-terminate-pastimes" style="color: #ff3e3e; font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: 2px; padding: 18px 0; display: flex; align-items: center; text-decoration: none;"><i class="fa-solid fa-power-off me-3"></i> Terminate Session</a>
</div>
</div>
<div class="main-content">
<h1 class="welcome-header">Consignment Catalogue Control</h1>
<div class="text-muted small text-uppercase mb-5" style="letter-spacing:1px;">Active Third-Party Merchant Portfolio Manifest</div>
<h3 class="section-title">Merchant Inventory Records</h3>
<?php if ($sellers_query && mysqli_num_rows($sellers_query) > 0): ?>
<?php while ($seller = mysqli_fetch_assoc($sellers_query)): ?>
<div class="seller-block">
<div class="seller-info-header">
<div>
<span class="seller-title text-white"><?php echo htmlspecialchars($seller['full_name']); ?></span>
<span class="text-muted small ms-3" style="font-size: 11px;"><i class="fa-regular fa-envelope me-1"></i> <?php echo htmlspecialchars($seller['email']); ?></span>
</div>
<span class="badge bg-dark border border-secondary rounded-0 text-uppercase tracking-wider" style="font-size:9px;">ID: #<?php echo $seller['id']; ?></span>
</div>
<table class="inner-item-table">
<thead>
<tr>
<th style="width: 60px;">Asset</th>
<th>Item Name</th>
<th>Brand</th>
<th>Price</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$seller_id = $seller['id'];
// Updated to use your exact schema layout: seller_id
$products_query = mysqli_query($conn, "SELECT * FROM products WHERE seller_id = '$seller_id' ORDER BY id DESC");
if ($products_query && mysqli_num_rows($products_query) > 0):
while ($item = mysqli_fetch_assoc($products_query)):
// Map to your exact database names 'image_path' and 'product_name'
$img = htmlspecialchars($item['image_path'] ?? '');
$path = (stripos($img, "images/") === 0) ? $img : "images/" . $img;
$status = strtolower($item['listing_status'] ?? ($item['status'] ?? 'pending'));
$color = '#ffcc00';
if ($status === 'approved') { $color = '#00ff88'; }
elseif ($status === 'rejected') { $color = '#ff3e3e'; }
?>
<tr>
<td><img src="<?php echo $path; ?>" class="thumb-preview" alt="Asset"></td>
<td class="fw-bold text-white"><?php echo htmlspecialchars($item['product_name'] ?? 'Unnamed Asset'); ?></td>
<td class="text-uppercase text-info" style="font-size:11px; font-weight:700;"><?php echo htmlspecialchars($item['brand'] ?? 'Generic'); ?></td>
<td class="fw-bold">R <?php echo number_format($item['price'] ?? 0, 2); ?></td>
<td class="text-uppercase fw-bold" style="font-size: 10px; color: <?php echo $color; ?>;"><?php echo $status; ?></td>
</tr>
<?php
endwhile;
else:
?>
<tr><td colspan="5" class="text-muted text-center py-2">No individual product lines linked to this merchant.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="text-muted text-center py-5 border border-secondary" style="background:#0c0c0c;">No verified seller accounts with active product inventory found.</div>
<?php endif; ?>
</div>
</body>
</html>