167 lines
8.2 KiB
PHP
167 lines
8.2 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();
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
|
|
$myStartups = [];
|
|
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 {
|
|
// Investors see all public startups and their active round if any
|
|
$stmt = db()->prepare("
|
|
SELECT s.*, u.full_name as founder_name, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status
|
|
FROM startups s
|
|
LEFT JOIN users u ON s.founder_id = u.id
|
|
LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active'
|
|
WHERE s.status = 'public'
|
|
ORDER BY s.created_at DESC
|
|
");
|
|
$stmt->execute();
|
|
$myStartups = $stmt->fetchAll();
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= $user['role'] === 'founder' ? 'My Startups' : 'Browse Startups' ?> — <?= htmlspecialchars($platformName) ?></title>
|
|
<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(); ?>">
|
|
<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%;">
|
|
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
|
|
<nav class="nav-links">
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="startups.php" class="active">My Startups</a>
|
|
<a href="discover.php">Find Partners</a>
|
|
<?php else: ?>
|
|
<a href="discover.php">Discovery</a>
|
|
<a href="startups.php" class="active">Browse Startups</a>
|
|
<a href="portfolio.php">Portfolio</a>
|
|
<?php endif; ?>
|
|
<a href="messages.php">Messages</a>
|
|
<a href="notifications.php">Notifications</a>
|
|
</nav>
|
|
<div style="display: flex; align-items: center; gap: 15px;">
|
|
<a href="dashboard.php" style="color: var(--text-secondary);"><i class="fas fa-th-large"></i></a>
|
|
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px;">Log Out</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container" style="padding-top: 50px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px;">
|
|
<div>
|
|
<h1><?= $user['role'] === 'founder' ? 'My Startups' : 'Student Startups' ?></h1>
|
|
<p style="color: var(--text-secondary);"><?= $user['role'] === 'founder' ? 'Manage and track your ventures.' : 'Discover the next generation of student-led innovation.' ?></p>
|
|
</div>
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="start_funding.php" class="btn btn-primary">List New Startup</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 25px;">
|
|
<?php if (empty($myStartups)): ?>
|
|
<div class="card" style="grid-column: 1 / -1; text-align: center; padding: 60px 20px;">
|
|
<i class="fas fa-rocket" style="font-size: 64px; color: var(--accent-blue); opacity: 0.2; margin-bottom: 30px;"></i>
|
|
<h3>No startups found</h3>
|
|
<p style="color: var(--text-secondary);">Start your journey by listing your first startup or idea.</p>
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="start_funding.php" class="btn btn-primary" style="margin-top: 25px;">Start Funding Round</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($myStartups as $startup):
|
|
$goal = $startup['active_goal'] ?? $startup['funding_target'];
|
|
$raised = $startup['active_raised'] ?? $startup['funding_raised'];
|
|
$progress = round(($raised / ($goal ?: 1)) * 100);
|
|
?>
|
|
<div class="card">
|
|
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px;">
|
|
<div>
|
|
<h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3>
|
|
<?php if ($user['role'] === 'investor'): ?>
|
|
<div style="font-size: 12px; color: var(--text-secondary); margin-top: 4px;">by <?= $startup['founder_name'] ? htmlspecialchars($startup['founder_name']) : 'Account Deleted' ?></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<span style="font-size: 10px; text-transform: uppercase; padding: 4px 8px; background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); border-radius: 4px; border: 1px solid rgba(0, 242, 255, 0.3);">
|
|
<?= $startup['round_status'] === 'Active' ? 'Active Round' : 'No Active Round' ?>
|
|
</span>
|
|
</div>
|
|
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 25px; line-height: 1.6;">
|
|
<?= htmlspecialchars(substr($startup['description'], 0, 120)) ?>...
|
|
</p>
|
|
<div style="margin-bottom: 20px;">
|
|
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px;">
|
|
<span>Progress</span>
|
|
<span><?= $progress ?>%</span>
|
|
</div>
|
|
<div style="width: 100%; height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden;">
|
|
<div style="width: <?= min(100, $progress) ?>%; height: 100%; background: var(--gradient-primary);"></div>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-color); padding-top: 20px;">
|
|
<div>
|
|
<div style="font-size: 10px; color: var(--text-secondary); text-transform: uppercase;">Raised</div>
|
|
<div style="font-weight: 700; color: #fff;">£<?= number_format($raised, 0) ?></div>
|
|
</div>
|
|
<div>
|
|
<div style="font-size: 10px; color: var(--text-secondary); text-transform: uppercase;">Goal</div>
|
|
<div style="font-weight: 700; color: #fff;">£<?= number_format($goal, 0) ?></div>
|
|
</div>
|
|
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px;"><?= $user['role'] === 'founder' ? 'Manage' : 'View' ?></a>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<style>
|
|
header {
|
|
background: rgba(10, 10, 10, 0.8);
|
|
backdrop-filter: blur(20px);
|
|
border-bottom: 1px solid var(--border-color);
|
|
padding: 15px 0;
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 1000;
|
|
}
|
|
.nav-links a {
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
margin: 0 15px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
transition: color 0.2s;
|
|
}
|
|
.nav-links a:hover, .nav-links a.active {
|
|
color: #fff;
|
|
}
|
|
</style>
|
|
|
|
</body>
|
|
</html>
|