202 lines
7.7 KiB
PHP
202 lines
7.7 KiB
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
if (!isset($_GET['id'])) {
|
|
header("Location: pooled-requests.php");
|
|
exit;
|
|
}
|
|
|
|
$userId = $_SESSION['user_id'];
|
|
$requestId = $_GET['id'];
|
|
$pdo = db();
|
|
|
|
// Fetch user data
|
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$userId]);
|
|
$user = $stmt->fetch();
|
|
|
|
// Fetch pooled request details
|
|
$stmt = $pdo->prepare("SELECT pr.*, u.name as creator_name FROM pooled_requests pr JOIN users u ON pr.user_id = u.id WHERE pr.id = ?");
|
|
$stmt->execute([$requestId]);
|
|
$request = $stmt->fetch();
|
|
|
|
if (!$request) {
|
|
header("Location: pooled-requests.php");
|
|
exit;
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Join Pool - <?php echo htmlspecialchars($request['medicine_name']); ?> - Kotkakey</title>
|
|
<meta name="description" content="Details for the pooled request for <?php echo htmlspecialchars($request['medicine_name']); ?>.">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<style>
|
|
body {
|
|
background-color: #f7f9fc;
|
|
font-family: 'Inter', sans-serif;
|
|
}
|
|
.sidebar {
|
|
height: 100vh;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 260px;
|
|
background-color: #fff;
|
|
border-right: 1px solid #e9ecef;
|
|
padding: 1.5rem;
|
|
}
|
|
.sidebar .nav-link {
|
|
color: #5a6474;
|
|
font-weight: 500;
|
|
padding: 0.75rem 1rem;
|
|
border-radius: 0.5rem;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
|
color: #0057FF;
|
|
background-color: #f0f6ff;
|
|
}
|
|
.sidebar .nav-link i {
|
|
margin-right: 0.75rem;
|
|
font-size: 1.2rem;
|
|
}
|
|
.main-content {
|
|
margin-left: 260px;
|
|
padding: 2rem;
|
|
padding-top: 80px; /* Space for header */
|
|
}
|
|
.top-header {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 260px;
|
|
right: 0;
|
|
height: 64px;
|
|
background-color: #fff;
|
|
border-bottom: 1px solid #e9ecef;
|
|
padding: 0 2rem;
|
|
z-index: 1000;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
}
|
|
.card-details {
|
|
background-color: #fff;
|
|
border: 1px solid #e9ecef;
|
|
border-radius: 0.75rem;
|
|
padding: 2rem;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="sidebar">
|
|
<a class="navbar-brand mb-4" href="index.php">
|
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
|
</a>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="dashboard.php">
|
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="shortage-alerts.php">
|
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link active" href="pooled-requests.php">
|
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="predictions.php">
|
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
|
</a>
|
|
</li>
|
|
<li class="nav-item mt-auto">
|
|
<a class="nav-link" href="settings.php">
|
|
<i class="bi bi-gear-fill"></i> Settings
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<header class="top-header">
|
|
<div class="dropdown">
|
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
|
</a>
|
|
<ul class="dropdown-menu text-small shadow">
|
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
|
</ul>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="main-content">
|
|
<nav aria-label="breadcrumb">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="pooled-requests.php">Pooled Requests</a></li>
|
|
<li class="breadcrumb-item active" aria-current="page"><?php echo htmlspecialchars($request['medicine_name']); ?></li>
|
|
</ol>
|
|
</nav>
|
|
<h1 class="h2 mb-4 fw-bold">Pooled Request Details</h1>
|
|
|
|
<div class="card-details">
|
|
<h3 class="fw-semibold"><?php echo htmlspecialchars($request['medicine_name']); ?></h3>
|
|
<p class="text-muted">Created by <?php echo htmlspecialchars($request['creator_name']); ?> on <?php echo date("F j, Y", strtotime($request['created_at'])); ?></p>
|
|
|
|
<div class="row mt-4">
|
|
<div class="col-md-4">
|
|
<h5>Status</h5>
|
|
<p><span class="badge bg-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-subtle text-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-emphasis rounded-pill fs-6"><?php echo htmlspecialchars($request['status']); ?></span></p>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<h5>Participants</h5>
|
|
<p class="fs-5 fw-semibold"><?php echo $request['participants']; ?> Pharmacies</p>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<h5>Required Quantity</h5>
|
|
<p class="fs-5 fw-semibold">100 Units</p> <!-- Placeholder -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
<h5>Description</h5>
|
|
<p>This is a placeholder description for the pooled request of <?php echo htmlspecialchars($request['medicine_name']); ?>. Details about the request, required quantity, and other relevant information will be displayed here.</p>
|
|
</div>
|
|
|
|
<div class="mt-5 text-center">
|
|
<a href="#" class="btn btn-primary btn-lg">Join This Pool</a>
|
|
<a href="pooled-requests.php" class="btn btn-secondary btn-lg">Back to List</a>
|
|
</div>
|
|
</div>
|
|
|
|
</main>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|