38873-vm/startups.php
Flatlogic Bot 21f3fc7eab v2
2026-02-28 15:08:46 +00:00

122 lines
6.3 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 * FROM startups WHERE founder_id = ? ORDER BY created_at DESC");
$stmt->execute([$_SESSION['user_id']]);
$myStartups = $stmt->fetchAll();
} else {
// Investors see all public startups
$stmt = db()->prepare("SELECT * FROM startups WHERE status = 'public' ORDER BY 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>My 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="partners.php">Find Partners</a>
<?php else: ?>
<a href="discover.php">Discover</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);">Manage and track your ventures.</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): ?>
<div class="card">
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px;">
<h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3>
<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);">
<?= htmlspecialchars($startup['status']) ?>
</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><?= round(($startup['funding_raised'] / $startup['funding_target']) * 100) ?>%</span>
</div>
<div style="width: 100%; height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden;">
<div style="width: <?= min(100, ($startup['funding_raised'] / $startup['funding_target']) * 100) ?>%; 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($startup['funding_raised'], 0) ?></div>
</div>
<div>
<div style="font-size: 10px; color: var(--text-secondary); text-transform: uppercase;">Target</div>
<div style="font-weight: 700; color: #fff;">£<?= number_format($startup['funding_target'], 0) ?></div>
</div>
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px;">Manage</a>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</main>
</body>
</html>