236 lines
12 KiB
PHP
236 lines
12 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; }
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
|
|
if ($user['role'] !== 'founder') {
|
|
header('Location: funding_rounds.php');
|
|
exit;
|
|
}
|
|
|
|
// Fetch Trending Startups based on total funding raised
|
|
$stmt = db()->prepare("
|
|
SELECT id
|
|
FROM startups
|
|
ORDER BY funding_raised DESC
|
|
LIMIT 10
|
|
");
|
|
$stmt->execute();
|
|
$trendingIds = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
|
|
|
$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
|
|
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([$user_id]);
|
|
$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 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-badge {
|
|
position: absolute;
|
|
top: -10px;
|
|
right: -10px;
|
|
background: var(--warning-color);
|
|
color: #000;
|
|
padding: 5px 12px;
|
|
border-radius: 20px;
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
text-transform: uppercase;
|
|
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
z-index: 10;
|
|
}
|
|
.btn-status {
|
|
padding: 8px 12px;
|
|
font-size: 11px;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
border-radius: 8px;
|
|
border: 1px solid transparent;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 5px;
|
|
background: transparent;
|
|
}
|
|
.btn-cancel {
|
|
border-color: var(--error-color);
|
|
color: var(--error-color);
|
|
}
|
|
.btn-cancel:hover {
|
|
background: var(--error-color);
|
|
color: #fff;
|
|
}
|
|
.btn-finish {
|
|
border-color: var(--success-color);
|
|
color: var(--success-color);
|
|
}
|
|
.btn-finish:hover {
|
|
background: var(--success-color);
|
|
color: #000;
|
|
}
|
|
</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?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="startups.php" class="active">My Startups</a>
|
|
<a href="partners.php">Find Partners</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: 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="display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px;">
|
|
<div>
|
|
<h1>My Startups</h1>
|
|
<p style="color: var(--text-secondary);">Manage and track your ventures.</p>
|
|
</div>
|
|
<a href="create_startup.php" class="btn btn-primary">List New Startup</a>
|
|
</div>
|
|
|
|
<?php if (isset($_GET['success'])): ?>
|
|
<div style="background: rgba(0, 200, 83, 0.1); border: 1px solid var(--success-color); color: var(--success-color); padding: 15px; border-radius: 12px; margin-bottom: 25px; font-size: 14px; text-align: center; font-weight: 600;">
|
|
Round status updated successfully!
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<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-primary); 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>
|
|
<a href="create_startup.php" class="btn btn-primary" style="margin-top: 25px;">List First Startup</a>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($myStartups as $startup):
|
|
$goal = $startup['active_goal'] ?: 0;
|
|
$raised = $startup['active_raised'] ?: 0;
|
|
$progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0;
|
|
$isTrending = in_array($startup['id'], $trendingIds);
|
|
?>
|
|
<div class="card" style="position: relative; display: flex; flex-direction: column;">
|
|
<?php if ($isTrending): ?>
|
|
<div class="trending-badge">
|
|
<i class="fas fa-fire"></i> Trending
|
|
</div>
|
|
<?php endif; ?>
|
|
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px;">
|
|
<div>
|
|
<h3 style="margin: 0; color: var(--text-primary);"><?= htmlspecialchars($startup['name']) ?></h3>
|
|
</div>
|
|
<span style="font-size: 10px; text-transform: uppercase; padding: 4px 8px; background: var(--surface-color); color: <?= $startup['round_status'] === 'Active' ? 'var(--success-color)' : 'var(--text-secondary)' ?>; border-radius: 4px; border: 1px solid var(--border-color);">
|
|
<?= $startup['round_status'] === 'Active' ? 'Active Round' : 'Inactive' ?>
|
|
</span>
|
|
</div>
|
|
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 25px; line-height: 1.6; height: 42px; overflow: hidden;">
|
|
<?= htmlspecialchars(substr($startup['description'], 0, 120)) ?><?= strlen($startup['description']) > 120 ? '...' : '' ?>
|
|
</p>
|
|
|
|
<?php if ($startup['round_status'] === 'Active'): ?>
|
|
<div style="margin-bottom: 10px; font-weight: 600; display: flex; justify-content: space-between; font-size: 13px;">
|
|
<span>£<?= number_format($raised) ?> Raised</span>
|
|
<span style="color: var(--text-secondary);"><?= $progress ?>%</span>
|
|
</div>
|
|
<div style="width: 100%; height: 6px; background: var(--bg-color); border-radius: 3px; overflow: hidden; margin-bottom: 15px; border: 1px solid var(--border-color);">
|
|
<div style="width: <?= min(100, $progress) ?>%; height: 100%; background: var(--accent-primary);"></div>
|
|
</div>
|
|
|
|
<!-- Management Buttons -->
|
|
<div style="display: flex; gap: 10px; margin-bottom: 25px;">
|
|
<form action="update_round_status.php" method="POST" style="flex: 1;" onsubmit="return confirm('Are you sure you want to finish this round early?');">
|
|
<input type="hidden" name="round_id" value="<?= $startup['round_id'] ?>">
|
|
<input type="hidden" name="status" value="Closed">
|
|
<button type="submit" class="btn-status btn-finish">
|
|
<i class="fas fa-check-circle"></i> Finish
|
|
</button>
|
|
</form>
|
|
<form action="update_round_status.php" method="POST" style="flex: 1;" onsubmit="return confirm('Are you sure you want to cancel this round?');">
|
|
<input type="hidden" name="round_id" value="<?= $startup['round_id'] ?>">
|
|
<input type="hidden" name="status" value="Cancelled">
|
|
<button type="submit" class="btn-status btn-cancel">
|
|
<i class="fas fa-times-circle"></i> Cancel
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<?php else: ?>
|
|
<div style="margin-bottom: 25px; padding: 15px; background: var(--surface-color); border-radius: 12px; border: 1px dashed var(--border-color); text-align: center;">
|
|
<a href="start_funding_round.php?id=<?= $startup['id'] ?>" style="color: var(--accent-primary); text-decoration: none; font-size: 13px; font-weight: 700;">
|
|
<i class="fas fa-plus-circle"></i> Launch Funding Round
|
|
</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div style="display: flex; gap: 10px; margin-top: auto;">
|
|
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="flex: 1; padding: 10px; font-size: 13px;">View Profile</a>
|
|
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 10px; font-size: 13px;"><i class="fas fa-edit"></i></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;">
|
|
<div class="logo-container" style="justify-content: center; margin-bottom: 25px;">
|
|
<img src="assets/images/logo.svg?v=<?php echo time(); ?>" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img" style="width: 30px; height: 30px;">
|
|
<span class="logo-text" style="font-size: 20px;"><?= htmlspecialchars($platformName) ?></span>
|
|
</div>
|
|
<p style="color: var(--text-secondary); font-size: 14px;">© <?= date('Y') ?> <?= htmlspecialchars($platformName) ?>. All rights reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<script src="assets/js/main.js"></script>
|
|
</body>
|
|
</html>
|