311 lines
18 KiB
PHP
311 lines
18 KiB
PHP
<?php
|
|
session_start();
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$_SESSION['user_id']]);
|
|
$user = $stmt->fetch();
|
|
|
|
if (!$user) {
|
|
session_destroy();
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
// Security: Check if verified
|
|
if ($user['verified'] == 0) {
|
|
session_destroy();
|
|
header("Location: login.php?error=not_verified");
|
|
exit;
|
|
}
|
|
|
|
// Check if onboarding is complete
|
|
if ($user['role'] === 'founder' && $user['onboarding_completed'] == 0) {
|
|
header("Location: founder_onboarding.php");
|
|
exit;
|
|
}
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
|
|
// Identify Trending Startups (Top 3 in followers or funding this week)
|
|
$trendingIds = [];
|
|
|
|
// Top 3 Followed
|
|
$stmt = db()->prepare("
|
|
SELECT s.id
|
|
FROM startups s
|
|
JOIN startup_followers sf ON s.id = sf.startup_id
|
|
WHERE sf.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
|
GROUP BY s.id
|
|
ORDER BY COUNT(sf.id) DESC
|
|
LIMIT 3
|
|
");
|
|
$stmt->execute();
|
|
$topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
|
$trendingIds = array_merge($trendingIds, $topFollowed);
|
|
|
|
// Top 3 Funded
|
|
$stmt = db()->prepare("
|
|
SELECT s.id
|
|
FROM startups s
|
|
JOIN investments i ON s.id = i.startup_id
|
|
WHERE i.status = 'approved' AND i.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
|
|
GROUP BY s.id
|
|
ORDER BY SUM(i.amount) DESC
|
|
LIMIT 3
|
|
");
|
|
$stmt->execute();
|
|
$topFunded = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
|
$trendingIds = array_unique(array_merge($trendingIds, $topFunded));
|
|
|
|
// Fetch user's data based on role
|
|
$myStartups = [];
|
|
$myInvestments = [];
|
|
|
|
if ($user['role'] === 'founder') {
|
|
$stmt = db()->prepare("
|
|
SELECT s.*, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status
|
|
FROM startups s
|
|
LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active'
|
|
WHERE s.founder_id = ?
|
|
ORDER BY s.created_at DESC
|
|
");
|
|
$stmt->execute([$_SESSION['user_id']]);
|
|
$myStartups = $stmt->fetchAll();
|
|
} else {
|
|
$stmt = db()->prepare("SELECT i.*, s.name as startup_name FROM investments i JOIN startups s ON i.startup_id = s.id WHERE i.investor_id = ? ORDER BY i.created_at DESC");
|
|
$stmt->execute([$_SESSION['user_id']]);
|
|
$myInvestments = $stmt->fetchAll();
|
|
}
|
|
|
|
function number_get_formatted($num) {
|
|
return number_format((float)$num, 0, '.', ',');
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Dashboard — <?= 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">
|
|
<style>
|
|
.trending-pill {
|
|
background: linear-gradient(45deg, #FFD700, #FFA500);
|
|
color: #000;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-size: 10px;
|
|
font-weight: 800;
|
|
text-transform: uppercase;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 3px;
|
|
margin-left: 8px;
|
|
vertical-align: middle;
|
|
}
|
|
</style>
|
|
</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" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
|
|
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
|
|
</a>
|
|
<nav class="nav-links">
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="startups.php">My Startups</a>
|
|
<a href="partners.php">Find Partners</a>
|
|
<?php else: ?>
|
|
<a href="startups.php">Browse Startups</a>
|
|
<a href="portfolio.php">Portfolio</a>
|
|
<?php endif; ?>
|
|
<a href="discover.php">Discovery Hub</a>
|
|
<a href="messages.php">Messages</a>
|
|
</nav>
|
|
<div style="display: flex; align-items: center; gap: 15px;">
|
|
<a href="notifications.php" style="color: var(--text-secondary); position: relative; font-size: 18px;">
|
|
<i class="fas fa-bell"></i>
|
|
</a>
|
|
<div style="display: flex; align-items: center; gap: 10px; padding: 5px 12px; background: rgba(255,255,255,0.05); border-radius: 50px; border: 1px solid var(--border-color);">
|
|
<div style="width: 24px; height: 24px; background: var(--gradient-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; 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; border-radius: 10px;">Log Out</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container" style="padding-top: 60px; padding-bottom: 80px;">
|
|
<div class="hero-bg">
|
|
<div class="hero-blob" style="top: 5%; left: -15%;"></div>
|
|
<div class="hero-blob" style="bottom: 10%; right: -15%; width: 500px; height: 500px; background: radial-gradient(circle, rgba(138, 43, 226, 0.1) 0%, rgba(0, 242, 255, 0.1) 100%);"></div>
|
|
</div>
|
|
|
|
<div style="margin-bottom: 60px;">
|
|
<div class="match-score-pill" style="margin-bottom: 20px;"><i class="fas fa-rocket"></i> Launchpad Active</div>
|
|
<h1 style="font-size: 56px; font-weight: 900; letter-spacing: -2px; line-height: 1.1;">Welcome back, <span style="background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;"><?= htmlspecialchars(explode(' ', $user['full_name'])[0]) ?>.</span></h1>
|
|
<p style="color: var(--text-secondary); font-size: 20px; margin-top: 10px;">Your command center for the next big thing.</p>
|
|
</div>
|
|
|
|
<div style="display: grid; grid-template-columns: 2fr 1fr; gap: 40px;">
|
|
<div>
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<div class="card" style="margin-bottom: 40px; padding: 35px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
|
|
<h3 style="margin: 0; font-size: 24px; font-weight: 800;">My Ventures</h3>
|
|
<a href="start_funding.php" class="btn btn-primary" style="padding: 12px 24px; font-size: 14px;">+ Launch Startup</a>
|
|
</div>
|
|
|
|
<?php if (empty($myStartups)): ?>
|
|
<div style="text-align: center; padding: 60px 0; background: rgba(255,255,255,0.02); border-radius: 32px; border: 1px dashed var(--border-color);">
|
|
<div class="card-icon" style="margin: 0 auto 20px; background: rgba(0, 242, 255, 0.1);"><i class="fas fa-rocket"></i></div>
|
|
<p style="color: var(--text-secondary); margin-bottom: 25px; font-size: 18px;">Ready to share your vision with the world?</p>
|
|
<a href="start_funding.php" class="btn btn-primary">Start Your First Round</a>
|
|
</div>
|
|
<?php else: ?>
|
|
<div style="display: grid; grid-template-columns: 1fr; gap: 20px;">
|
|
<?php foreach ($myStartups as $startup):
|
|
$goal = $startup['active_goal'] ?? $startup['funding_target'];
|
|
$raised = $startup['active_raised'] ?? $startup['funding_raised'];
|
|
$isTrending = in_array($startup['id'], $trendingIds);
|
|
?>
|
|
<div class="candidate-card" style="padding: 25px; display: flex; justify-content: space-between; align-items: center;" onclick="window.location.href='startup_details.php?id=<?= $startup['id'] ?>'">
|
|
<div style="display: flex; align-items: center; gap: 20px;">
|
|
<div style="width: 60px; height: 60px; background: var(--gradient-primary); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; font-weight: 800;">
|
|
<?= substr($startup['name'], 0, 1) ?>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 800; font-size: 20px; margin-bottom: 6px;">
|
|
<?= htmlspecialchars($startup['name']) ?>
|
|
<?php if ($isTrending): ?>
|
|
<span class="trending-pill"><i class="fas fa-fire"></i> Trending</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div style="font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 12px;">
|
|
<span style="padding: 4px 10px; background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); border-radius: 8px; font-weight: 700; font-size: 12px; letter-spacing: 0.5px;">
|
|
<?= strtoupper($startup['round_status'] ?? 'Draft') ?>
|
|
</span>
|
|
<span style="opacity: 0.7;">Target: £<?= number_get_formatted($goal) ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<div style="font-size: 22px; font-weight: 900; color: #fff;">£<?= number_get_formatted($raised) ?></div>
|
|
<div style="font-size: 13px; color: var(--text-secondary); opacity: 0.6;">Funds Raised</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="card" style="margin-bottom: 40px; padding: 35px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
|
|
<h3 style="margin: 0; font-size: 24px; font-weight: 800;">Portfolio Overview</h3>
|
|
<a href="startups.php" class="btn btn-primary" style="padding: 12px 24px; font-size: 14px;">Find New Deals</a>
|
|
</div>
|
|
|
|
<?php if (empty($myInvestments)): ?>
|
|
<div style="text-align: center; padding: 60px 0; background: rgba(255,255,255,0.02); border-radius: 32px; border: 1px dashed var(--border-color);">
|
|
<div class="card-icon" style="margin: 0 auto 20px; background: rgba(0, 242, 255, 0.1);"><i class="fas fa-chart-line"></i></div>
|
|
<p style="color: var(--text-secondary); margin-bottom: 25px; font-size: 18px;">Start backing the next generation of founders.</p>
|
|
<a href="startups.php" class="btn btn-primary">Start Investing</a>
|
|
</div>
|
|
<?php else: ?>
|
|
<div style="display: grid; grid-template-columns: 1fr; gap: 20px;">
|
|
<?php foreach ($myInvestments as $inv): ?>
|
|
<div class="candidate-card" style="padding: 25px; display: flex; justify-content: space-between; align-items: center;">
|
|
<div style="display: flex; align-items: center; gap: 20px;">
|
|
<div style="width: 60px; height: 60px; background: var(--surface-color); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 24px; border: 1px solid var(--border-color);">
|
|
<i class="fas fa-building" style="opacity: 0.5;"></i>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 800; font-size: 20px; margin-bottom: 6px;"><?= htmlspecialchars($inv['startup_name']) ?></div>
|
|
<div style="font-size: 14px; color: var(--text-secondary);">Committed on <?= date('M d, Y', strtotime($inv['created_at'])) ?></div>
|
|
</div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<div style="font-size: 22px; font-weight: 900; color: var(--accent-blue);">£<?= number_get_formatted($inv['amount']) ?></div>
|
|
<div style="font-size: 13px; font-weight: 800; color: <?= $inv['status'] === 'approved' ? '#4cd964' : ($inv['status'] === 'rejected' ? '#ff3b30' : '#ffcc00') ?>; letter-spacing: 1px;">
|
|
<?= strtoupper($inv['status']) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="card" style="padding: 40px; text-align: center; border-style: dashed;">
|
|
<h3 style="font-size: 22px; font-weight: 800; margin-bottom: 10px;">Ecosystem Activity</h3>
|
|
<p style="color: var(--text-secondary); font-size: 16px;">Insights from your network and trending matches will appear here.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="card" style="margin-bottom: 30px; padding: 30px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
|
|
<h3 style="margin: 0; font-size: 20px; font-weight: 800;">My Profile</h3>
|
|
<a href="edit_profile.php" style="color: var(--accent-blue); font-size: 13px; font-weight: 700; text-decoration: none; padding: 6px 14px; background: rgba(0, 242, 255, 0.1); border-radius: 50px;">Edit</a>
|
|
</div>
|
|
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 25px;">
|
|
<div style="width: 80px; height: 80px; background: var(--gradient-primary); border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 32px; color: #fff; font-weight: 900; box-shadow: 0 15px 30px rgba(0, 122, 255, 0.2);">
|
|
<?= substr($user['full_name'], 0, 1) ?>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 900; font-size: 22px; letter-spacing: -0.5px;"><?= htmlspecialchars($user['full_name']) ?></div>
|
|
<div style="font-size: 14px; color: var(--accent-blue); font-weight: 700; opacity: 0.8;"><?= htmlspecialchars($user['university']) ?></div>
|
|
</div>
|
|
</div>
|
|
<div style="margin-bottom: 25px; font-size: 15px; line-height: 1.6; color: var(--text-secondary);">
|
|
<?= htmlspecialchars($user['bio'] ?: 'No bio provided yet.') ?>
|
|
</div>
|
|
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<div style="display: flex; flex-wrap: wrap; gap: 10px;">
|
|
<?php
|
|
$skills = explode(',', $user['skills'] ?? '');
|
|
foreach (array_slice($skills, 0, 3) as $skill): if(empty(trim($skill))) continue; ?>
|
|
<span style="font-size: 11px; padding: 6px 14px; background: rgba(255,255,255,0.04); border-radius: 50px; border: 1px solid var(--border-color); font-weight: 600; color: var(--text-secondary);"><?= htmlspecialchars(trim($skill)) ?></span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="card" style="background: var(--gradient-primary); color: #fff; border: none; margin-bottom: 30px; padding: 30px; position: relative; overflow: hidden;">
|
|
<div style="position: absolute; top: -50px; right: -50px; width: 150px; height: 150px; background: rgba(255,255,255,0.1); border-radius: 50%; blur: 20px;"></div>
|
|
<h3 style="color: #fff; margin-bottom: 12px; font-size: 22px; font-weight: 800; position: relative;"><?= $user['role'] === 'founder' ? 'Find Your Team' : 'Discover Talent' ?></h3>
|
|
<p style="font-size: 15px; opacity: 0.9; margin-bottom: 25px; font-weight: 400; position: relative;">
|
|
<?= $user['role'] === 'founder' ? 'Start swiping to find co-founders with complementary skills.' : 'Explore the most promising student startups today.' ?>
|
|
</p>
|
|
<a href="<?= $user['role'] === 'founder' ? 'partners.php' : 'discover.php' ?>" class="btn" style="width: 100%; background: #fff; color: #1a1a24; font-weight: 800; text-align: center; border-radius: 16px; position: relative;">
|
|
<?= $user['role'] === 'founder' ? 'Launch Matching' : 'Go to Discovery Hub' ?>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="card" style="background: var(--glass-bg); color: #fff; border: 1px solid var(--glass-border); padding: 30px;">
|
|
<h3 style="color: #fff; margin-bottom: 12px; font-size: 18px; font-weight: 800;">Gatsby Premium</h3>
|
|
<p style="font-size: 14px; opacity: 0.7; margin-bottom: 20px;">Unlock direct access to institutional investors and exclusive demo days.</p>
|
|
<button class="btn btn-secondary" style="width: 100%; border-radius: 12px; font-size: 13px;">Upgrade Now</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
</body>
|
|
</html>
|