495 lines
32 KiB
PHP
495 lines
32 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]);
|
|
if ($stmt->rowCount() > 0) {
|
|
$stmt = db()->prepare("UPDATE startups SET followers_count = followers_count + 1 WHERE id = ?");
|
|
$stmt->execute([$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]);
|
|
if ($stmt->rowCount() > 0) {
|
|
$stmt = db()->prepare("UPDATE startups SET followers_count = GREATEST(0, followers_count - 1) WHERE id = ?");
|
|
$stmt->execute([$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) {
|
|
$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 {
|
|
$stmt = db()->prepare("SELECT id FROM funding_rounds WHERE startup_id = ? AND status = 'Active'");
|
|
$stmt->execute([$startup_id]);
|
|
$round = $stmt->fetch();
|
|
|
|
if ($round) {
|
|
$stmt = db()->prepare("UPDATE funding_rounds SET status = 'Cancelled' WHERE id = ?");
|
|
$stmt->execute([$round['id']]);
|
|
|
|
$stmt = db()->prepare("UPDATE investments SET status = 'Refunded' WHERE funding_round_id = ?");
|
|
$stmt->execute([$round['id']]);
|
|
|
|
$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.";
|
|
|
|
$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();
|
|
|
|
$canSeeHistory = ($user['role'] === 'investor' || ($user['role'] === 'founder' && $startup['founder_id'] == $user_id));
|
|
|
|
$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">
|
|
<style>
|
|
.section-title { font-size: 24px; font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
|
|
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
|
|
.data-item { background: rgba(255,255,255,0.03); padding: 20px; border-radius: 16px; border: 1px solid var(--border-color); }
|
|
.data-label { font-size: 11px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px; margin-bottom: 8px; }
|
|
.data-value { font-size: 18px; font-weight: 700; color: #fff; }
|
|
.doc-link { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(0, 242, 255, 0.05); border: 1px solid var(--border-color); border-radius: 12px; color: var(--accent-blue); text-decoration: none; font-size: 14px; transition: all 0.2s; }
|
|
.doc-link:hover { background: rgba(0, 242, 255, 0.1); border-color: var(--accent-blue); }
|
|
</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>
|
|
<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; flex-wrap: wrap;">
|
|
<span><i class="fas fa-building"></i> <?= htmlspecialchars($startup['legal_name'] ?? $startup['name']) ?></span>
|
|
<span><i class="fas fa-globe"></i> <?= htmlspecialchars($startup['country'] ?? 'N/A') ?></span>
|
|
<span><i class="fas fa-industry"></i> <?= htmlspecialchars($startup['industry'] ?? 'General') ?> (<?= htmlspecialchars($startup['sub_industry'] ?? 'N/A') ?>)</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;"><?= htmlspecialchars($startup['operational_stage'] ?? 'Seed') ?></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 class="section-title"><i class="fas fa-info-circle" style="color: var(--accent-blue);"></i> About the Venture</h2>
|
|
<div style="margin-bottom: 25px;">
|
|
<h4 style="margin-bottom: 10px; font-size: 14px; text-transform: uppercase; color: var(--text-secondary); opacity: 0.7;">Business Model</h4>
|
|
<p style="font-size: 16px; line-height: 1.6; color: var(--text-secondary);"><?= nl2br(htmlspecialchars($startup['business_model'] ?: $startup['description'])) ?></p>
|
|
</div>
|
|
<div>
|
|
<h4 style="margin-bottom: 10px; font-size: 14px; text-transform: uppercase; color: var(--text-secondary); opacity: 0.7;">Product/Service</h4>
|
|
<p style="font-size: 16px; line-height: 1.6; color: var(--text-secondary);"><?= nl2br(htmlspecialchars($startup['product_service'] ?: 'Details coming soon.')) ?></p>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="card" style="margin-bottom: 40px;">
|
|
<h2 class="section-title"><i class="fas fa-handshake" style="color: var(--accent-blue);"></i> Co-founder Matching & Partnership</h2>
|
|
<div class="data-grid">
|
|
<div class="data-item">
|
|
<div class="data-label">Equity Offered</div>
|
|
<div class="data-value"><?= htmlspecialchars($startup['cofounder_equity_pct'] ?: 'N/A') ?></div>
|
|
</div>
|
|
<div class="data-item">
|
|
<div class="data-label">Commitment</div>
|
|
<div class="data-value"><?= htmlspecialchars($startup['cofounder_commitment'] ?: 'N/A') ?></div>
|
|
</div>
|
|
<div class="data-item">
|
|
<div class="data-label">Equity Type</div>
|
|
<div class="data-value"><?= htmlspecialchars($startup['cofounder_equity_type'] ?: 'N/A') ?></div>
|
|
</div>
|
|
</div>
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;">
|
|
<div class="data-item">
|
|
<div class="data-label">Core Responsibilities</div>
|
|
<div style="font-size: 14px; color: var(--text-secondary);"><?= nl2br(htmlspecialchars($startup['cofounder_responsibilities'] ?: 'N/A')) ?></div>
|
|
</div>
|
|
<div class="data-item">
|
|
<div class="data-label">Desired Background</div>
|
|
<div style="font-size: 14px; color: var(--text-secondary);"><?= nl2br(htmlspecialchars($startup['desired_cofounder_experience'] ?: 'N/A')) ?></div>
|
|
</div>
|
|
</div>
|
|
<div class="data-item" style="width: 100%;">
|
|
<div class="data-label">Other Partnership Details</div>
|
|
<div style="font-size: 14px; color: var(--text-secondary);"><?= nl2br(htmlspecialchars($startup['other_partnership_details'] ?: 'None reported.')) ?></div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="card" style="margin-bottom: 40px;">
|
|
<h2 class="section-title"><i class="fas fa-file-invoice-dollar" style="color: var(--accent-blue);"></i> Financial Position & Docs</h2>
|
|
<div class="data-grid" style="grid-template-columns: 1fr 1fr;">
|
|
<div class="data-item">
|
|
<div class="data-label">Current Cash Balance</div>
|
|
<div class="data-value">£<?= number_format($startup['current_cash_balance'] ?? 0, 2) ?></div>
|
|
</div>
|
|
<div class="data-item">
|
|
<div class="data-label">Monthly Burn Rate</div>
|
|
<div class="data-value">£<?= number_format($startup['burn_rate'] ?? 0, 2) ?></div>
|
|
</div>
|
|
</div>
|
|
<div style="background: rgba(255,255,255,0.02); padding: 15px; border-radius: 12px; margin-bottom: 25px; border: 1px solid var(--border-color);">
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
|
|
<div>
|
|
<div class="data-label" style="font-size: 10px;">Outstanding Debt</div>
|
|
<div style="font-size: 14px;"><?= htmlspecialchars($startup['outstanding_debt'] ?: 'None') ?></div>
|
|
</div>
|
|
<div>
|
|
<div class="data-label" style="font-size: 10px;">Accounts Receivable/Payable</div>
|
|
<div style="font-size: 14px;"><?= htmlspecialchars($startup['accounts_receivable_payable'] ?: 'N/A') ?></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<h4 style="margin-bottom: 15px; font-size: 14px; text-transform: uppercase; color: var(--text-secondary); opacity: 0.7;">Historical Documentation</h4>
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px;">
|
|
<?php
|
|
$docs = [
|
|
'Income Statements' => $startup['doc_income_statements'],
|
|
'Balance Sheets' => $startup['doc_balance_sheets'],
|
|
'Cash Flow' => $startup['doc_cash_flow_statements'],
|
|
'Revenue Breakdown' => $startup['doc_revenue_breakdown'],
|
|
'Gross Margin' => $startup['doc_gross_margin'],
|
|
'OpEx Breakdown' => $startup['doc_opex_breakdown']
|
|
];
|
|
foreach ($docs as $label => $path): if ($path):
|
|
?>
|
|
<a href="<?= htmlspecialchars($path) ?>" target="_blank" class="doc-link">
|
|
<i class="fas fa-file-pdf"></i> <?= $label ?>
|
|
</a>
|
|
<?php endif; endforeach; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Return Rates Comparison -->
|
|
<section class="card" style="margin-bottom: 40px; background: rgba(0, 242, 255, 0.03); border: 1px solid var(--accent-blue);">
|
|
<h2 style="margin-top: 0; margin-bottom: 25px; display: flex; align-items: center; gap: 12px;">
|
|
<i class="fas fa-percentage" style="color: var(--accent-blue);"></i> Expected Investor Returns
|
|
</h2>
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
|
|
<div style="padding: 20px; background: rgba(0,0,0,0.2); border-radius: 16px; border: 1px solid var(--border-color); text-align: center;">
|
|
<div style="font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;">Platform Recommendation</div>
|
|
<div style="font-size: 32px; font-weight: 900; color: var(--accent-blue);"><?= number_format($startup['recommended_return_rate'] ?? 5.0, 1) ?>%</div>
|
|
<div style="font-size: 11px; color: var(--text-secondary); margin-top: 5px;">AI analysis based on uploaded financials</div>
|
|
</div>
|
|
<div style="padding: 20px; background: rgba(0,0,0,0.2); border-radius: 16px; border: 1px solid var(--border-color); text-align: center;">
|
|
<div style="font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;">Founder's Proposal</div>
|
|
<div style="font-size: 32px; font-weight: 900; color: #fff;">
|
|
<?= $startup['founder_return_rate'] !== null ? number_format($startup['founder_return_rate'], 1) . '%' : 'N/A' ?>
|
|
</div>
|
|
<div style="font-size: 11px; color: var(--text-secondary); margin-top: 5px;">Target annual dividend yield set by founder</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Funding History Section -->
|
|
<?php if ($canSeeHistory): ?>
|
|
<section class="card" style="margin-bottom: 40px;">
|
|
<h2 class="section-title"><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);">
|
|
<p style="color: var(--text-secondary); margin: 0;">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); display: flex; align-items: center; justify-content: center;">
|
|
<span style="font-weight: 800; color: var(--accent-blue);"><?= substr($inv['investor_name'], 0, 1) ?></span>
|
|
</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: var(--accent-blue);">£<?= number_format($inv['amount']) ?></div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php endif; ?>
|
|
</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; margin-bottom: 15px;">
|
|
<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;"><?= htmlspecialchars($startup['operational_stage'] ?: '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="display: flex; flex-direction: column; gap: 10px;">
|
|
<form method="POST" onsubmit="return confirm('Finish this round?')">
|
|
<input type="hidden" name="action" value="finish_round">
|
|
<button type="submit" class="btn btn-secondary" style="width: 100%;"><i class="fas fa-check-circle"></i> Finish Round Early</button>
|
|
</form>
|
|
<form method="POST" onsubmit="return confirm('Cancel round and refund all?')">
|
|
<input type="hidden" name="action" value="cancel_round">
|
|
<button type="submit" class="btn btn-secondary" style="width: 100%; color: #ff5555;"><i class="fas fa-times-circle"></i> Cancel Round</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 capital?</p>
|
|
<a href="start_funding_round.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'] ?? 'U', 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'] ?? 'University') ?></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>
|
|
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
|
<a href="create_startup.php?id=<?= $startup_id ?>" class="btn btn-secondary" style="width: 100%; margin-top: 10px; padding: 12px; border-radius: 12px;"><i class="fas fa-edit"></i> Edit Profile</a>
|
|
<?php endif; ?>
|
|
</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;">
|
|
<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>
|