140 lines
8.3 KiB
PHP
140 lines
8.3 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
session_start();
|
|
|
|
$user_id = $_SESSION['user_id'] ?? null;
|
|
if (!$user_id) { header('Location: login.php'); exit; }
|
|
|
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$user_id]);
|
|
$user = $stmt->fetch();
|
|
if (!$user) { header('Location: login.php'); exit; }
|
|
|
|
if ($user['role'] !== 'investor') {
|
|
header('Location: dashboard.php');
|
|
exit;
|
|
}
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
|
|
// Fetch ONLY active funding rounds
|
|
$stmt = db()->prepare("
|
|
SELECT s.*, fr.id as round_id, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status, u.full_name as founder_name
|
|
FROM funding_rounds fr
|
|
JOIN startups s ON fr.startup_id = s.id
|
|
LEFT JOIN users u ON s.founder_id = u.id
|
|
WHERE fr.status = 'Active'
|
|
ORDER BY fr.created_at DESC
|
|
");
|
|
$stmt->execute();
|
|
$activeRounds = $stmt->fetchAll();
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Founding Rounds — <?= htmlspecialchars($platformName) ?></title>
|
|
<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;800;900&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
|
<a href="dashboard.php" class="logo-container">
|
|
<img src="assets/images/logo.svg?v=<?php echo time(); ?>" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
|
|
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
|
|
</a>
|
|
<nav class="nav-links">
|
|
<a href="funding_rounds.php" class="active">Founding Rounds</a>
|
|
<a href="portfolio.php">Portfolio</a>
|
|
<a href="discover.php">Discovery Hub</a>
|
|
<a href="messages.php">Messages</a>
|
|
</nav>
|
|
<div style="display: flex; align-items: center; gap: 15px;">
|
|
<div style="display: flex; align-items: center; gap: 10px; padding: 6px 14px; background: var(--surface-color); border-radius: 50px; border: 1px solid var(--border-color);">
|
|
<div style="width: 24px; height: 24px; background: var(--accent-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #000; font-weight: 800;">
|
|
<?= substr($user['full_name'], 0, 1) ?>
|
|
</div>
|
|
<span style="font-size: 13px; font-weight: 600;"><?= htmlspecialchars(explode(' ', $user['full_name'])[0]) ?></span>
|
|
</div>
|
|
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px;">Log Out</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container" style="padding-top: 50px; padding-bottom: 50px;">
|
|
<div style="margin-bottom: 40px;">
|
|
<h1 style="font-size: 48px; font-weight: 900; color: var(--text-primary);">Active Founding <span style="color: var(--accent-primary);">Rounds.</span></h1>
|
|
<p style="color: var(--text-secondary); font-size: 18px;">Direct access to the most promising student startups seeking capital right now.</p>
|
|
</div>
|
|
|
|
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 25px;">
|
|
<?php if (empty($activeRounds)): ?>
|
|
<div class="card" style="grid-column: 1 / -1; text-align: center; padding: 80px 20px;">
|
|
<i class="fas fa-coins" style="font-size: 64px; color: var(--accent-primary); opacity: 0.2; margin-bottom: 30px;"></i>
|
|
<h3>No active rounds at the moment</h3>
|
|
<p style="color: var(--text-secondary);">Check back soon for new opportunities.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($activeRounds as $round):
|
|
$goal = $round['active_goal'];
|
|
$raised = $round['active_raised'];
|
|
$progress = ($raised > 0 && ($raised / ($goal ?: 1)) * 100 < 1) ? 1 : round(($raised / ($goal ?: 1)) * 100);
|
|
?>
|
|
<div class="card" style="position: relative; padding: 35px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px;">
|
|
<div>
|
|
<div style="font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-primary); font-weight: 800; margin-bottom: 5px;"><?= htmlspecialchars($round['industry']) ?></div>
|
|
<h3 style="margin: 0; font-size: 22px; font-weight: 800;"><?= htmlspecialchars($round['name']) ?></h3>
|
|
<div style="font-size: 13px; color: var(--text-secondary); margin-top: 4px;">by <?= htmlspecialchars($round['founder_name']) ?></div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<div style="font-size: 11px; color: var(--text-secondary); text-transform: uppercase;">Goal</div>
|
|
<div style="font-size: 18px; font-weight: 900; color: var(--text-primary);">£<?= number_format($goal) ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="margin-bottom: 12px; font-weight: 700; display: flex; justify-content: space-between; font-size: 14px;">
|
|
<span style="color: var(--accent-primary);">£<?= number_format($raised) ?> Secured</span>
|
|
<span style="color: var(--text-secondary);"><?= $progress ?>%</span>
|
|
</div>
|
|
<div style="width: 100%; height: 8px; background: var(--bg-color); border-radius: 100px; overflow: hidden; margin-bottom: 30px; border: 1px solid var(--border-color);">
|
|
<div style="width: <?= min(100, $progress) ?>%; height: 100%; background: var(--accent-primary);"></div>
|
|
</div>
|
|
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 30px;">
|
|
<div style="background: var(--bg-color); padding: 12px; border-radius: 12px; border: 1px solid var(--border-color);">
|
|
<div style="font-size: 10px; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 4px;">Platform Yield</div>
|
|
<div style="font-weight: 800; color: #fff;"><?= number_format($round['recommended_return_rate'] ?? 5.0, 1) ?>%</div>
|
|
</div>
|
|
<div style="background: var(--bg-color); padding: 12px; border-radius: 12px; border: 1px solid var(--border-color);">
|
|
<div style="font-size: 10px; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 4px;">Founder Yield</div>
|
|
<div style="font-weight: 800; color: #fff;"><?= $round['founder_return_rate'] ? number_format($round['founder_return_rate'], 1) . '%' : 'N/A' ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="display: flex; gap: 12px;">
|
|
<a href="startup_details.php?id=<?= $round['id'] ?>" class="btn btn-secondary" style="flex: 1; text-align: center; padding: 14px; font-size: 13px;">View Profile</a>
|
|
<a href="invest.php?id=<?= $round['id'] ?>" class="btn btn-primary" style="flex: 1.2; text-align: center; padding: 14px; font-size: 13px;">Invest Now</a>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<footer style="margin-top: 80px; padding: 60px 0; border-top: 1px solid var(--border-color);">
|
|
<div class="container" style="text-align: center;">
|
|
<p style="color: var(--text-secondary); font-size: 14px;">© <?= date('Y') ?> <?= htmlspecialchars($platformName) ?> Capitalist Platform. All rights reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<script src="assets/js/main.js"></script>
|
|
</body>
|
|
</html>
|