455 lines
30 KiB
PHP
455 lines
30 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; }
|
|
|
|
$startup_id = (int)($_GET['id'] ?? 0);
|
|
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
|
|
$stmt->execute([$startup_id]);
|
|
$startup = $stmt->fetch();
|
|
|
|
if (!$startup) { header('Location: startups.php'); exit; }
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
$error = '';
|
|
$success = '';
|
|
|
|
// Check if user is following
|
|
$stmt = db()->prepare("SELECT id FROM startup_followers WHERE user_id = ? AND startup_id = ?");
|
|
$stmt->execute([$user_id, $startup_id]);
|
|
$isFollowing = $stmt->fetch();
|
|
|
|
// Actions: follow/unfollow, invest, post_update, finish_round, cancel_round
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
|
if ($_POST['action'] === 'follow') {
|
|
$stmt = db()->prepare("INSERT IGNORE INTO startup_followers (user_id, startup_id) VALUES (?, ?)");
|
|
$stmt->execute([$user_id, $startup_id]);
|
|
$success = "You are now following " . $startup['name'] . "!";
|
|
} elseif ($_POST['action'] === 'unfollow') {
|
|
$stmt = db()->prepare("DELETE FROM startup_followers WHERE user_id = ? AND startup_id = ?");
|
|
$stmt->execute([$user_id, $startup_id]);
|
|
$success = "You have unfollowed " . $startup['name'] . ".";
|
|
} elseif ($_POST['action'] === 'invest' && $user['role'] === 'investor') {
|
|
$amount = (float)($_POST['amount'] ?? 0);
|
|
if ($amount > 0) {
|
|
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? AND status = 'Active'");
|
|
$stmt->execute([$startup_id]);
|
|
$round = $stmt->fetch();
|
|
if ($round) {
|
|
$stmt = db()->prepare("INSERT INTO investments (investor_id, startup_id, funding_round_id, amount, status) VALUES (?, ?, ?, ?, 'approved')");
|
|
$stmt->execute([$user_id, $startup_id, $round['id'], $amount]);
|
|
|
|
$stmt = db()->prepare("UPDATE funding_rounds SET funding_raised = funding_raised + ? WHERE id = ?");
|
|
$stmt->execute([$amount, $round['id']]);
|
|
|
|
$stmt = db()->prepare("UPDATE startups SET funding_raised = funding_raised + ? WHERE id = ?");
|
|
$stmt->execute([$amount, $startup_id]);
|
|
|
|
// Create notification for founder
|
|
$notif = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
|
|
$notif->execute([$startup['founder_id'], $user['full_name'] . " just invested £" . number_format($amount) . " in " . $startup['name'] . "!"]);
|
|
|
|
$success = "Investment of £" . number_format($amount) . " successfully processed!";
|
|
// Refresh data
|
|
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
|
|
$stmt->execute([$startup_id]);
|
|
$startup = $stmt->fetch();
|
|
}
|
|
}
|
|
} elseif ($_POST['action'] === 'post_update' && $user['role'] === 'founder' && $startup['founder_id'] == $user_id) {
|
|
$title = $_POST['update_title'] ?? '';
|
|
$content = $_POST['update_content'] ?? '';
|
|
if ($title && $content) {
|
|
// FIX: Added founder_id to the query to avoid 500 error
|
|
$stmt = db()->prepare("INSERT INTO startup_updates (startup_id, founder_id, title, content) VALUES (?, ?, ?, ?)");
|
|
$stmt->execute([$startup_id, $user_id, $title, $content]);
|
|
|
|
// Notify followers
|
|
$stmt = db()->prepare("SELECT user_id FROM startup_followers WHERE startup_id = ?");
|
|
$stmt->execute([$startup_id]);
|
|
$followers = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
|
|
|
if (!empty($followers)) {
|
|
$notif = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
|
|
foreach ($followers as $f_id) {
|
|
$notif->execute([$f_id, "New update from " . $startup['name'] . ": " . $title]);
|
|
}
|
|
}
|
|
$success = "Update posted successfully!";
|
|
}
|
|
} elseif ($_POST['action'] === 'finish_round' && $user['role'] === 'founder' && $startup['founder_id'] == $user_id) {
|
|
$stmt = db()->prepare("UPDATE funding_rounds SET status = 'Closed' WHERE startup_id = ? AND status = 'Active'");
|
|
$stmt->execute([$startup_id]);
|
|
$success = "Funding round successfully closed!";
|
|
} elseif ($_POST['action'] === 'cancel_round' && $user['role'] === 'founder' && $startup['founder_id'] == $user_id) {
|
|
db()->beginTransaction();
|
|
try {
|
|
// Find active round
|
|
$stmt = db()->prepare("SELECT id FROM funding_rounds WHERE startup_id = ? AND status = 'Active'");
|
|
$stmt->execute([$startup_id]);
|
|
$round = $stmt->fetch();
|
|
|
|
if ($round) {
|
|
// Cancel round
|
|
$stmt = db()->prepare("UPDATE funding_rounds SET status = 'Cancelled' WHERE id = ?");
|
|
$stmt->execute([$round['id']]);
|
|
|
|
// Refund all investments in this round
|
|
$stmt = db()->prepare("UPDATE investments SET status = 'Refunded' WHERE funding_round_id = ?");
|
|
$stmt->execute([$round['id']]);
|
|
|
|
// Deduct from startup total raised
|
|
$stmt = db()->prepare("SELECT SUM(amount) as total FROM investments WHERE funding_round_id = ? AND status = 'Refunded'");
|
|
$stmt->execute([$round['id']]);
|
|
$totalRefunded = $stmt->fetch()['total'] ?? 0;
|
|
|
|
$stmt = db()->prepare("UPDATE startups SET funding_raised = GREATEST(0, funding_raised - ?) WHERE id = ?");
|
|
$stmt->execute([$totalRefunded, $startup_id]);
|
|
|
|
db()->commit();
|
|
$success = "Funding round cancelled and all investments marked for refund.";
|
|
|
|
// Refresh data
|
|
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
|
|
$stmt->execute([$startup_id]);
|
|
$startup = $stmt->fetch();
|
|
} else {
|
|
db()->rollBack();
|
|
$error = "No active round found to cancel.";
|
|
}
|
|
} catch (Exception $e) {
|
|
db()->rollBack();
|
|
$error = "Error: " . $e->getMessage();
|
|
}
|
|
}
|
|
}
|
|
|
|
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? AND status = 'Active'");
|
|
$stmt->execute([$startup_id]);
|
|
$activeRound = $stmt->fetch();
|
|
|
|
// Permission check for Funding History: Founders see their own, Investors see all.
|
|
$canSeeHistory = ($user['role'] === 'investor' || ($user['role'] === 'founder' && $startup['founder_id'] == $user_id));
|
|
|
|
// Fetch Funding History
|
|
$fundingHistory = [];
|
|
if ($canSeeHistory) {
|
|
$stmt = db()->prepare("
|
|
SELECT i.*, u.full_name as investor_name, u.profile_photo as investor_photo
|
|
FROM investments i
|
|
JOIN users u ON i.investor_id = u.id
|
|
WHERE i.startup_id = ? AND i.status != 'rejected'
|
|
ORDER BY i.created_at DESC
|
|
");
|
|
$stmt->execute([$startup_id]);
|
|
$fundingHistory = $stmt->fetchAll();
|
|
}
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?= htmlspecialchars($startup['name']) ?> — <?= 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" 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>
|
|
<a href="discover.php">Discovery Hub</a>
|
|
<?php endif; ?>
|
|
<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: 50px; padding-bottom: 50px;">
|
|
<?php if ($error): ?>
|
|
<div class="alert alert-danger" style="margin-bottom: 30px; padding: 15px; border-radius: 12px; background: rgba(255,77,77,0.1); border: 1px solid rgba(255,77,77,0.2); color: #ff4d4d;"><?= htmlspecialchars($error) ?></div>
|
|
<?php endif; ?>
|
|
<?php if ($success): ?>
|
|
<div class="alert alert-success" style="margin-bottom: 30px; padding: 15px; border-radius: 12px; background: rgba(0,242,255,0.1); border: 1px solid rgba(0,242,255,0.2); color: var(--accent-blue);"><?= htmlspecialchars($success) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<div style="display: grid; grid-template-columns: 2fr 1.2fr; gap: 40px;">
|
|
<div>
|
|
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 30px;">
|
|
<div style="width: 80px; height: 80px; background: var(--gradient-primary); border-radius: 20px; display: flex; align-items: center; justify-content: center; color: white; font-size: 32px; font-weight: 700;">
|
|
<?= substr($startup['name'], 0, 1) ?>
|
|
</div>
|
|
<div style="flex: 1;">
|
|
<h1 style="margin: 0; font-size: 36px;"><?= htmlspecialchars($startup['name']) ?></h1>
|
|
<div style="color: var(--text-secondary); display: flex; align-items: center; gap: 10px;">
|
|
<span><i class="fas fa-calendar-alt"></i> Founded <?= date('M Y', strtotime($startup['created_at'])) ?></span>
|
|
<span class="badge" style="background: var(--accent-blue); color: #000; padding: 4px 10px; border-radius: 50px; font-size: 11px; font-weight: 700; text-transform: uppercase;"><?= ucfirst($startup['status']) ?></span>
|
|
</div>
|
|
</div>
|
|
<?php if ($startup['founder_id'] != $user_id): ?>
|
|
<form method="POST">
|
|
<?php if ($isFollowing): ?>
|
|
<input type="hidden" name="action" value="unfollow">
|
|
<button type="submit" class="btn btn-secondary" style="border-radius: 50px; padding: 10px 25px;"><i class="fas fa-check"></i> Following</button>
|
|
<?php else: ?>
|
|
<input type="hidden" name="action" value="follow">
|
|
<button type="submit" class="btn btn-primary" style="border-radius: 50px; padding: 10px 25px;"><i class="fas fa-plus"></i> Follow</button>
|
|
<?php endif; ?>
|
|
</form>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<section class="card" style="margin-bottom: 40px;">
|
|
<h2 style="margin-top: 0; margin-bottom: 20px;">About the Venture</h2>
|
|
<p style="font-size: 18px; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap;"><?= htmlspecialchars($startup['description']) ?></p>
|
|
</section>
|
|
|
|
<!-- Funding History Section -->
|
|
<?php if ($canSeeHistory): ?>
|
|
<section class="card" style="margin-bottom: 40px;">
|
|
<h2 style="margin-top: 0; margin-bottom: 25px; display: flex; align-items: center; gap: 12px;">
|
|
<i class="fas fa-history" style="color: var(--accent-blue);"></i> Funding History
|
|
</h2>
|
|
<?php if (empty($fundingHistory)): ?>
|
|
<div style="padding: 40px; text-align: center; background: rgba(255,255,255,0.02); border-radius: 20px; border: 1px dashed var(--border-color);">
|
|
<i class="fas fa-coins" style="font-size: 32px; color: var(--text-secondary); opacity: 0.3; margin-bottom: 15px;"></i>
|
|
<p style="color: var(--text-secondary); margin: 0; font-style: italic;">No investment history available yet.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div style="display: flex; flex-direction: column; gap: 15px;">
|
|
<?php foreach ($fundingHistory as $inv): ?>
|
|
<div style="display: flex; align-items: center; justify-content: space-between; padding: 20px; background: rgba(255,255,255,0.03); border-radius: 18px; border: 1px solid var(--border-color);">
|
|
<div style="display: flex; align-items: center; gap: 15px;">
|
|
<div style="width: 45px; height: 45px; border-radius: 12px; background: var(--surface-color); border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; overflow: hidden;">
|
|
<?php if ($inv['investor_photo']): ?>
|
|
<img src="<?= htmlspecialchars($inv['investor_photo']) ?>" style="width: 100%; height: 100%; object-fit: cover;">
|
|
<?php else: ?>
|
|
<span style="font-weight: 800; color: var(--accent-blue);"><?= substr($inv['investor_name'], 0, 1) ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 700; font-size: 16px;"><?= htmlspecialchars($inv['investor_name']) ?></div>
|
|
<div style="font-size: 12px; color: var(--text-secondary);"><?= date('M d, Y', strtotime($inv['created_at'])) ?></div>
|
|
</div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<div style="font-weight: 800; font-size: 18px; color: <?= $inv['status'] === 'Refunded' ? '#ff5555' : 'var(--accent-blue)' ?>;">
|
|
<?= $inv['status'] === 'Refunded' ? '-' : '' ?>£<?= number_format($inv['amount']) ?>
|
|
</div>
|
|
<div style="font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px;">
|
|
<?= $inv['status'] === 'Refunded' ? 'Refunded' : 'Investment' ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php endif; ?>
|
|
|
|
<section class="card" style="margin-bottom: 40px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
|
|
<h2 style="margin: 0; font-size: 28px; font-weight: 800;">Public Updates</h2>
|
|
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
|
<button class="btn btn-primary" onclick="document.getElementById('postUpdateForm').style.display='block'" style="padding: 10px 20px; font-size: 14px;">
|
|
<i class="fas fa-plus"></i> New Update
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
|
<div id="postUpdateForm" style="display: none; background: rgba(255,255,255,0.03); padding: 35px; border-radius: 24px; margin-bottom: 40px; border: 1px solid var(--glass-border); backdrop-filter: blur(10px);">
|
|
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 25px;">
|
|
<div style="width: 40px; height: 40px; background: var(--gradient-primary); border-radius: 12px; display: flex; align-items: center; justify-content: center;">
|
|
<i class="fas fa-bullhorn" style="color: #fff;"></i>
|
|
</div>
|
|
<h3 style="margin: 0; font-size: 22px;">Share Progress</h3>
|
|
</div>
|
|
<form method="POST">
|
|
<input type="hidden" name="action" value="post_update">
|
|
<div style="margin-bottom: 20px;">
|
|
<label style="display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;">Update Title</label>
|
|
<input type="text" name="update_title" required placeholder="e.g., Major Milestone: Beta Launch"
|
|
style="width: 100%; padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); border-radius: 14px; color: #fff; font-family: inherit; font-size: 16px; outline: none; transition: border-color 0.3s;"
|
|
onfocus="this.style.borderColor='var(--accent-blue)'" onblur="this.style.borderColor='var(--border-color)'">
|
|
</div>
|
|
<div style="margin-bottom: 25px;">
|
|
<label style="display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;">Content</label>
|
|
<textarea name="update_content" rows="6" required placeholder="Tell your investors and followers what's new..."
|
|
style="width: 100%; padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); border-radius: 14px; color: #fff; font-family: inherit; font-size: 16px; line-height: 1.6; outline: none; transition: border-color 0.3s; resize: vertical;"
|
|
onfocus="this.style.borderColor='var(--accent-blue)'" onblur="this.style.borderColor='var(--border-color)'"></textarea>
|
|
</div>
|
|
<div style="display: flex; gap: 15px;">
|
|
<button type="submit" class="btn btn-primary" style="flex: 2; padding: 16px; font-weight: 700;">Post & Notify Everyone</button>
|
|
<button type="button" class="btn btn-secondary" onclick="document.getElementById('postUpdateForm').style.display='none'" style="flex: 1; padding: 16px;">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
$stmt = db()->prepare("SELECT * FROM startup_updates WHERE startup_id = ? ORDER BY created_at DESC");
|
|
$stmt->execute([$startup_id]);
|
|
$updates = $stmt->fetchAll();
|
|
?>
|
|
<?php if (empty($updates)): ?>
|
|
<p style="color: var(--text-secondary); font-style: italic;">No updates have been posted yet.</p>
|
|
<?php else: ?>
|
|
<?php foreach ($updates as $upd): ?>
|
|
<div style="border-bottom: 1px solid var(--border-color); padding-bottom: 25px; margin-bottom: 25px;">
|
|
<h4 style="margin: 0 0 10px 0; font-size: 20px;"><?= htmlspecialchars($upd['title']) ?></h4>
|
|
<div style="font-size: 13px; color: var(--text-secondary); margin-bottom: 15px;">
|
|
<i class="fas fa-clock"></i> Posted on <?= date('M d, Y', strtotime($upd['created_at'])) ?>
|
|
</div>
|
|
<p style="color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; font-size: 16px;"><?= htmlspecialchars($upd['content']) ?></p>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</section>
|
|
</div>
|
|
|
|
<div>
|
|
<!-- Sidebar with Financial Stats -->
|
|
<section class="card" style="margin-bottom: 30px; border-left: 4px solid var(--accent-blue);">
|
|
<h4 style="margin-top: 0; color: var(--text-secondary); text-transform: uppercase; font-size: 12px; letter-spacing: 1px;">Venture Financials</h4>
|
|
<div style="margin: 20px 0;">
|
|
<div style="font-size: 32px; font-weight: 900; color: var(--text-primary);">£<?= number_format($startup['funding_raised']) ?></div>
|
|
<div style="font-size: 13px; color: var(--text-secondary);">Total Raised All-Time</div>
|
|
</div>
|
|
<div style="height: 1px; background: var(--border-color); margin: 20px 0;"></div>
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<div>
|
|
<div style="font-weight: 700;"><?= count($fundingHistory) ?></div>
|
|
<div style="font-size: 11px; color: var(--text-secondary);">Investments</div>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 700;"><?= $startup['followers_count'] ?? 0 ?></div>
|
|
<div style="font-size: 11px; color: var(--text-secondary);">Followers</div>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 700;">Seed</div>
|
|
<div style="font-size: 11px; color: var(--text-secondary);">Stage</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<?php if ($activeRound): ?>
|
|
<section class="card" style="margin-bottom: 30px; background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(0, 242, 255, 0.05) 100%);">
|
|
<h3 style="margin-top: 0;">Active Round</h3>
|
|
<div style="margin: 20px 0;">
|
|
<?php $percent = ($activeRound['funding_goal'] > 0) ? min(100, ($activeRound['funding_raised'] / $activeRound['funding_goal']) * 100) : 0; ?>
|
|
<div style="width: 100%; height: 10px; background: var(--border-color); border-radius: 5px; overflow: hidden; margin-bottom: 10px;">
|
|
<div style="width: <?= $percent ?>%; height: 100%; background: var(--gradient-primary);"></div>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; font-size: 14px; font-weight: 600;">
|
|
<span>£<?= number_format($activeRound['funding_raised']) ?></span>
|
|
<span style="color: var(--text-secondary);">£<?= number_format($activeRound['funding_goal']) ?> target</span>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ($user['role'] === 'investor'): ?>
|
|
<form method="POST" style="margin-top: 25px;">
|
|
<input type="hidden" name="action" value="invest">
|
|
<div class="form-group" style="margin-bottom: 15px;">
|
|
<label style="font-size: 13px; font-weight: 600;">Investment Amount (£)</label>
|
|
<input type="number" name="amount" class="form-control" min="100" step="100" value="1000" style="background: var(--surface-color); color: #fff; border: 1px solid var(--border-color); font-size: 18px; font-weight: 700;">
|
|
</div>
|
|
<button type="submit" class="btn btn-primary" style="width: 100%; padding: 15px; font-weight: 700; font-size: 16px;">Back this Venture</button>
|
|
</form>
|
|
<?php elseif ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
|
<div style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 12px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px;">
|
|
<i class="fas fa-info-circle"></i> This is your active funding round. Share the link with potential investors to reach your goal.
|
|
</div>
|
|
<div style="display: flex; flex-direction: column; gap: 10px;">
|
|
<form method="POST" onsubmit="return confirm('Are you sure you want to finish this round early? Future investments will be disabled until you start a new round.')">
|
|
<input type="hidden" name="action" value="finish_round">
|
|
<button type="submit" class="btn btn-secondary" style="width: 100%; border-color: var(--accent-blue); color: var(--accent-blue);"><i class="fas fa-check-circle"></i> Finish Round Early</button>
|
|
</form>
|
|
<form method="POST" onsubmit="return confirm('DANGER: This will cancel the current round and mark all investments as REFUNDED. This cannot be undone. Proceed?')">
|
|
<input type="hidden" name="action" value="cancel_round">
|
|
<button type="submit" class="btn btn-secondary" style="width: 100%; border-color: #ff5555; color: #ff5555;"><i class="fas fa-times-circle"></i> Cancel & Refund All</button>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php else: ?>
|
|
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
|
<section class="card" style="margin-bottom: 30px; text-align: center; border: 2px dashed var(--border-color);">
|
|
<i class="fas fa-plus-circle" style="font-size: 32px; color: var(--accent-blue); margin-bottom: 15px; opacity: 0.5;"></i>
|
|
<h4 style="margin: 0 0 10px 0;">No Active Round</h4>
|
|
<p style="font-size: 13px; color: var(--text-secondary); margin-bottom: 20px;">Ready to raise more capital?</p>
|
|
<a href="start_funding.php?id=<?= $startup_id ?>" class="btn btn-primary" style="width: 100%;">Start New Round</a>
|
|
</section>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
<section class="card">
|
|
<h3 style="margin-top: 0;">Founder</h3>
|
|
<?php
|
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$startup['founder_id']]);
|
|
$founder = $stmt->fetch();
|
|
?>
|
|
<div style="display: flex; align-items: center; gap: 15px; margin-top: 20px;">
|
|
<div style="width: 50px; height: 50px; background: var(--surface-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff; border: 2px solid var(--accent-blue);">
|
|
<?= substr($founder['full_name'], 0, 1) ?>
|
|
</div>
|
|
<div>
|
|
<div style="font-weight: 700;"><?= htmlspecialchars($founder['full_name'] ?? 'Founder') ?></div>
|
|
<div style="font-size: 13px; color: var(--text-secondary);"><?= htmlspecialchars($founder['university'] ?? 'Founder') ?></div>
|
|
</div>
|
|
</div>
|
|
<a href="messages.php?chat_with=<?= $founder['id'] ?>" class="btn btn-secondary" style="width: 100%; margin-top: 20px; padding: 12px; border-radius: 12px;">Send Message</a>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer style="margin-top: 80px; padding: 60px 0; border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.2);">
|
|
<div class="container" style="text-align: center;">
|
|
<div class="logo-container" style="justify-content: center; margin-bottom: 25px;">
|
|
<img src="assets/images/logo.svg" 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>
|