This commit is contained in:
Flatlogic Bot 2026-02-28 19:47:28 +00:00
parent d3e6f9d8d1
commit a7855afce8
2 changed files with 369 additions and 530 deletions

View File

@ -1,50 +1,53 @@
<?php
require_once 'db/config.php';
require_once 'ai/LocalAIApi.php';
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'founder') {
header("Location: login.php");
header('Location: login.php');
exit;
}
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/ai/LocalAIApi.php';
$error = '';
$success = '';
$startup_id = $_GET['id'] ?? null;
$existingStartup = null;
$startup_id = (int)($_GET['id'] ?? 0);
if ($startup_id > 0) {
if ($startup_id) {
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ? AND founder_id = ?");
$stmt->execute([$startup_id, $_SESSION['user_id']]);
$existingStartup = $stmt->fetch();
if (!$existingStartup) {
header('Location: dashboard.php');
exit;
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Basic Info
$name = trim($_POST['name'] ?? '');
$legal_name = trim($_POST['legal_name'] ?? '');
$country = trim($_POST['country'] ?? '');
$industry = trim($_POST['industry'] ?? '');
$sub_industry = trim($_POST['sub_industry'] ?? '');
$business_model = trim($_POST['business_model'] ?? '');
$product_service = trim($_POST['product_service'] ?? '');
$operational_stage = trim($_POST['operational_stage'] ?? '');
$name = $_POST['name'] ?? '';
$legal_name = $_POST['legal_name'] ?? '';
$country = $_POST['country'] ?? '';
$industry = $_POST['industry'] ?? '';
$sub_industry = $_POST['sub_industry'] ?? '';
$business_model = $_POST['business_model'] ?? '';
$product_service = $_POST['product_service'] ?? '';
$operational_stage = $_POST['operational_stage'] ?? '';
// Co-founder matching fields
$cofounder_equity_pct = $_POST['cofounder_equity_pct'] ?? '';
$cofounder_equity_type = $_POST['cofounder_equity_type'] ?? '';
$cofounder_responsibilities = $_POST['cofounder_responsibilities'] ?? '';
$desired_cofounder_experience = $_POST['desired_cofounder_experience'] ?? '';
$cofounder_commitment = $_POST['cofounder_commitment'] ?? '';
$other_partnership_details = $_POST['other_partnership_details'] ?? '';
// Co-founder Matching
$cofounder_equity_pct = trim($_POST['cofounder_equity_pct'] ?? '');
$cofounder_equity_type = trim($_POST['cofounder_equity_type'] ?? '');
$cofounder_responsibilities = trim($_POST['cofounder_responsibilities'] ?? '');
$desired_cofounder_experience = trim($_POST['desired_cofounder_experience'] ?? '');
$cofounder_commitment = trim($_POST['cofounder_commitment'] ?? '');
$other_partnership_details = trim($_POST['other_partnership_details'] ?? '');
// Current Financials
// Financial stats
$current_cash_balance = (float)($_POST['current_cash_balance'] ?? 0);
$outstanding_debt = trim($_POST['outstanding_debt'] ?? '');
$accounts_receivable_payable = trim($_POST['accounts_receivable_payable'] ?? '');
$burn_rate = (float)($_POST['burn_rate'] ?? 0);
$outstanding_debt = $_POST['outstanding_debt'] ?? '';
$accounts_receivable_payable = $_POST['accounts_receivable_payable'] ?? '';
// File Uploads
$upload_dir = 'assets/docs/financials/';
if (!is_dir($upload_dir)) {
mkdir($upload_dir, 0775, true);
@ -55,8 +58,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
'doc_balance_sheets',
'doc_cash_flow_statements',
'doc_revenue_breakdown',
'doc_gross_margin',
'doc_opex_breakdown'
'doc_gross_margin'
];
$uploaded_paths = [];
@ -120,7 +122,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
name = ?, legal_name = ?, country = ?, industry = ?, sub_industry = ?, business_model = ?, product_service = ?, operational_stage = ?,
cofounder_equity_pct = ?, cofounder_equity_type = ?, cofounder_responsibilities = ?, desired_cofounder_experience = ?, cofounder_commitment = ?, other_partnership_details = ?,
current_cash_balance = ?, outstanding_debt = ?, accounts_receivable_payable = ?, burn_rate = ?,
doc_income_statements = ?, doc_balance_sheets = ?, doc_cash_flow_statements = ?, doc_revenue_breakdown = ?, doc_gross_margin = ?, doc_opex_breakdown = ?,
doc_income_statements = ?, doc_balance_sheets = ?, doc_cash_flow_statements = ?, doc_revenue_breakdown = ?, doc_gross_margin = ?,
recommended_return_rate = ?
WHERE id = ? AND founder_id = ?");
@ -129,7 +131,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$cofounder_equity_pct, $cofounder_equity_type, $cofounder_responsibilities, $desired_cofounder_experience, $cofounder_commitment, $other_partnership_details,
$current_cash_balance, $outstanding_debt, $accounts_receivable_payable, $burn_rate,
$uploaded_paths['doc_income_statements'], $uploaded_paths['doc_balance_sheets'], $uploaded_paths['doc_cash_flow_statements'],
$uploaded_paths['doc_revenue_breakdown'], $uploaded_paths['doc_gross_margin'], $uploaded_paths['doc_opex_breakdown'],
$uploaded_paths['doc_revenue_breakdown'], $uploaded_paths['doc_gross_margin'],
$recommended_return_rate, $existingStartup['id'], $_SESSION['user_id']
]);
$final_id = $existingStartup['id'];
@ -138,16 +140,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
name, legal_name, country, industry, sub_industry, business_model, product_service, operational_stage,
cofounder_equity_pct, cofounder_equity_type, cofounder_responsibilities, desired_cofounder_experience, cofounder_commitment, other_partnership_details,
current_cash_balance, outstanding_debt, accounts_receivable_payable, burn_rate,
doc_income_statements, doc_balance_sheets, doc_cash_flow_statements, doc_revenue_breakdown, doc_gross_margin, doc_opex_breakdown,
doc_income_statements, doc_balance_sheets, doc_cash_flow_statements, doc_revenue_breakdown, doc_gross_margin,
founder_id, recommended_return_rate, status
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'private')");
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'private')");
$stmt->execute([
$name, $legal_name, $country, $industry, $sub_industry, $business_model, $product_service, $operational_stage,
$cofounder_equity_pct, $cofounder_equity_type, $cofounder_responsibilities, $desired_cofounder_experience, $cofounder_commitment, $other_partnership_details,
$current_cash_balance, $outstanding_debt, $accounts_receivable_payable, $burn_rate,
$uploaded_paths['doc_income_statements'], $uploaded_paths['doc_balance_sheets'], $uploaded_paths['doc_cash_flow_statements'],
$uploaded_paths['doc_revenue_breakdown'], $uploaded_paths['doc_gross_margin'], $uploaded_paths['doc_opex_breakdown'],
$uploaded_paths['doc_revenue_breakdown'], $uploaded_paths['doc_gross_margin'],
$_SESSION['user_id'], $recommended_return_rate
]);
$final_id = db()->lastInsertId();
@ -155,99 +157,108 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
db()->commit();
$success = "Startup profile saved successfully! Recommended return rate: " . number_format($recommended_return_rate, 2) . "%";
header("refresh:2;url=startup_details.php?id=" . $final_id);
// Refresh local data
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
$stmt->execute([$final_id]);
$existingStartup = $stmt->fetch();
} catch (Exception $e) {
db()->rollBack();
$error = "Error: " . $e->getMessage();
$error = "Database error: " . $e->getMessage();
}
}
}
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
?>
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= $existingStartup ? 'Edit Profile' : 'Step 1: Setup Startup Profile' ?> — <?= 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">
<meta charset="UTF-8">
<title><?= $existingStartup ? 'Edit' : 'Create' ?> Startup Profile | Venture Capitalist</title>
<link rel="stylesheet" href="assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body style="padding: 60px 20px; background: #0f0f13;">
<body style="background: var(--bg-color); color: #fff;">
<div class="container" style="max-width: 900px; margin: 0 auto;">
<div class="card" style="padding: 40px;">
<h1 style="font-size: 32px; font-weight: 800; margin-bottom: 10px;"><?= $existingStartup ? 'Edit Startup Profile' : 'Step 1: Company Profile Setup' ?></h1>
<p style="color: var(--text-secondary); margin-bottom: 30px;">
<?= $existingStartup ? 'Update your venture details below.' : 'This information is required to establish your startup entity and calculate investor return projections.' ?>
</p>
<div class="container" style="padding: 40px 20px;">
<div style="max-width: 800px; margin: 0 auto;">
<h1 style="font-weight: 900; font-size: 32px; margin-bottom: 30px;"><?= $existingStartup ? 'Edit' : 'Create' ?> Startup Profile</h1>
<?php if ($error): ?>
<div style="background: rgba(255, 0, 0, 0.1); border: 1px solid rgba(255, 0, 0, 0.3); color: #ff5555; padding: 15px; border-radius: 12px; margin-bottom: 25px;">
<i class="fas fa-exclamation-circle" style="margin-right: 8px;"></i> <?= htmlspecialchars($error) ?>
<div style="background: rgba(255, 59, 48, 0.1); color: #ff3b30; padding: 15px; border-radius: 12px; border: 1px solid #ff3b30; margin-bottom: 25px;">
<i class="fas fa-exclamation-circle"></i> <?= $error ?>
</div>
<?php endif; ?>
<?php if ($success): ?>
<div style="background: rgba(0, 255, 0, 0.1); border: 1px solid rgba(0, 255, 0, 0.3); color: #55ff55; padding: 15px; border-radius: 12px; margin-bottom: 25px;">
<i class="fas fa-check-circle" style="margin-right: 8px;"></i> <?= htmlspecialchars($success) ?>
<div style="background: rgba(76, 217, 100, 0.1); color: #4cd964; padding: 15px; border-radius: 12px; border: 1px solid #4cd964; margin-bottom: 25px;">
<i class="fas fa-check-circle"></i> <?= $success ?>
<div style="margin-top: 10px;">
<a href="startup_details.php?id=<?= $final_id ?>" class="btn btn-secondary" style="padding: 8px 15px; font-size: 13px;">View Live Profile</a>
</div>
</div>
<?php else: ?>
<form method="POST" enctype="multipart/form-data">
<h3 style="margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; font-size: 18px;"><i class="fas fa-info-circle"></i> 1. Basic Company Information</h3>
<?php endif; ?>
<?php if (!$success || $existingStartup): ?>
<form method="POST" enctype="multipart/form-data" class="card" style="padding: 30px; border-radius: 24px;">
<h3 style="margin-top: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; font-size: 18px;"><i class="fas fa-info-circle"></i> 1. Basic Company Information</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;">
<div>
<label>Startup Name *</label>
<label>Public Name (Marketing) *</label>
<input type="text" name="name" required value="<?= htmlspecialchars($existingStartup['name'] ?? '') ?>">
</div>
<div>
<label>Registered Legal Name *</label>
<label>Legal Entity Name *</label>
<input type="text" name="legal_name" required value="<?= htmlspecialchars($existingStartup['legal_name'] ?? '') ?>">
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;">
<div>
<label>Country of Incorporation *</label>
<input type="text" name="country" required value="<?= htmlspecialchars($existingStartup['country'] ?? '') ?>">
</div>
<div>
<label>Industry *</label>
<label>Primary Industry *</label>
<select name="industry" required>
<?php $ind = $existingStartup['industry'] ?? ''; ?>
<option value="">Select Industry</option>
<option value="Fintech" <?= $ind == 'Fintech' ? 'selected' : '' ?>>Fintech</option>
<option value="Healthtech" <?= $ind == 'Healthtech' ? 'selected' : '' ?>>Healthtech</option>
<option value="Edtech" <?= $ind == 'Edtech' ? 'selected' : '' ?>>Edtech</option>
<option value="SaaS" <?= $ind == 'SaaS' ? 'selected' : '' ?>>SaaS</option>
<option value="AI & Robotics" <?= $ind == 'AI & Robotics' ? 'selected' : '' ?>>AI & Robotics</option>
<option value="Clean Energy" <?= $ind == 'Clean Energy' ? 'selected' : '' ?>>Clean Energy</option>
<option value="Other" <?= $ind == 'Other' ? 'selected' : '' ?>>Other</option>
<option value="">Select...</option>
<option value="FinTech" <?= ($existingStartup['industry'] ?? '') === 'FinTech' ? 'selected' : '' ?>>FinTech</option>
<option value="HealthTech" <?= ($existingStartup['industry'] ?? '') === 'HealthTech' ? 'selected' : '' ?>>HealthTech</option>
<option value="SaaS" <?= ($existingStartup['industry'] ?? '') === 'SaaS' ? 'selected' : '' ?>>SaaS</option>
<option value="E-commerce" <?= ($existingStartup['industry'] ?? '') === 'E-commerce' ? 'selected' : '' ?>>E-commerce</option>
<option value="CleanTech" <?= ($existingStartup['industry'] ?? '') === 'CleanTech' ? 'selected' : '' ?>>CleanTech</option>
<option value="EdTech" <?= ($existingStartup['industry'] ?? '') === 'EdTech' ? 'selected' : '' ?>>EdTech</option>
<option value="Other" <?= ($existingStartup['industry'] ?? '') === 'Other' ? 'selected' : '' ?>>Other</option>
</select>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;">
<div>
<label>Sub-Industry *</label>
<input type="text" name="sub_industry" required value="<?= htmlspecialchars($existingStartup['sub_industry'] ?? '') ?>">
<label>Sub-Industry / Niche</label>
<input type="text" name="sub_industry" value="<?= htmlspecialchars($existingStartup['sub_industry'] ?? '') ?>" placeholder="e.g. AI-driven logistics">
</div>
<div>
<label>Operational Stage *</label>
<select name="operational_stage" required>
<?php $stage = $existingStartup['operational_stage'] ?? ''; ?>
<option value="">Select Stage</option>
<option value="Idea" <?= $stage == 'Idea' ? 'selected' : '' ?>>Idea / Concept</option>
<option value="MVP" <?= $stage == 'MVP' ? 'selected' : '' ?>>MVP (Minimum Viable Product)</option>
<option value="Pre-revenue" <?= $stage == 'Pre-revenue' ? 'selected' : '' ?>>Pre-revenue (Early Traction)</option>
<option value="Revenue-generating" <?= $stage == 'Revenue-generating' ? 'selected' : '' ?>>Revenue-generating</option>
<option value="Scaling" <?= $stage == 'Scaling' ? 'selected' : '' ?>>Scaling / Growth</option>
<label>Business Model *</label>
<select name="business_model" required>
<option value="">Select...</option>
<option value="B2B" <?= ($existingStartup['business_model'] ?? '') === 'B2B' ? 'selected' : '' ?>>B2B</option>
<option value="B2C" <?= ($existingStartup['business_model'] ?? '') === 'B2C' ? 'selected' : '' ?>>B2C</option>
<option value="Marketplace" <?= ($existingStartup['business_model'] ?? '') === 'Marketplace' ? 'selected' : '' ?>>Marketplace</option>
<option value="SaaS" <?= ($existingStartup['business_model'] ?? '') === 'SaaS' ? 'selected' : '' ?>>SaaS Subscription</option>
</select>
</div>
</div>
<div style="margin-bottom: 20px;">
<label>Business Model Description *</label>
<textarea name="business_model" required style="height: 80px;"><?= htmlspecialchars($existingStartup['business_model'] ?? '') ?></textarea>
<label>Operational Stage *</label>
<select name="operational_stage" required>
<option value="">Select...</option>
<option value="Pre-revenue" <?= ($existingStartup['operational_stage'] ?? '') === 'Pre-revenue' ? 'selected' : '' ?>>Pre-revenue / Prototype</option>
<option value="Early-traction" <?= ($existingStartup['operational_stage'] ?? '') === 'Early-traction' ? 'selected' : '' ?>>Early Traction (Paying customers)</option>
<option value="Growth" <?= ($existingStartup['operational_stage'] ?? '') === 'Growth' ? 'selected' : '' ?>>Growth (Consistent MRR)</option>
<option value="Scale" <?= ($existingStartup['operational_stage'] ?? '') === 'Scale' ? 'selected' : '' ?>>Scaling (National/International)</option>
</select>
</div>
<div style="margin-bottom: 30px;">
<label>Product/Service Description *</label>
<label>Briefly describe your Product/Service *</label>
<textarea name="product_service" required style="height: 80px;"><?= htmlspecialchars($existingStartup['product_service'] ?? '') ?></textarea>
</div>
@ -310,8 +321,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
'doc_balance_sheets' => 'Balance Sheets',
'doc_cash_flow_statements' => 'Cash Flow Statements',
'doc_revenue_breakdown' => 'Revenue Breakdown',
'doc_gross_margin' => 'Gross Margin Data',
'doc_opex_breakdown' => 'OpEx Breakdown'
'doc_gross_margin' => 'Gross Margin Data'
];
foreach ($doc_labels as $f_name => $label):
?>

View File

@ -2,493 +2,322 @@
require_once 'db/config.php';
session_start();
$user_id = $_SESSION['user_id'] ?? null;
if (!$user_id) { header('Location: login.php'); exit; }
$startup_id = $_GET['id'] ?? null;
if (!$startup_id) {
header('Location: startups.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 = ?");
// Fetch startup details
$stmt = db()->prepare("SELECT s.*, u.full_name as founder_name
FROM startups s
JOIN users u ON s.founder_id = u.id
WHERE s.id = ?");
$stmt->execute([$startup_id]);
$startup = $stmt->fetch();
if (!$startup) { header('Location: startups.php'); exit; }
if (!$startup) {
header('Location: startups.php');
exit;
}
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
$error = '';
$success = '';
// Fetch funding history
$stmt = db()->prepare("SELECT i.*, u.full_name as investor_name
FROM investments i
JOIN users u ON i.investor_id = u.id
WHERE i.startup_id = ?
ORDER BY i.created_at DESC");
$stmt->execute([$startup_id]);
$fundingHistory = $stmt->fetchAll();
// 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();
// Check if user is the founder
$isFounder = isset($_SESSION['user_id']) && $_SESSION['user_id'] == $startup['founder_id'];
$isInvestor = isset($_SESSION['user_id']) && $_SESSION['role'] === 'investor';
// For investors, check if they can see history (maybe only after some interaction?)
// For now, let everyone see.
$canSeeHistory = true;
// Handle following
$isFollowing = false;
if (isset($_SESSION['user_id'])) {
$stmt = db()->prepare("SELECT 1 FROM startup_followers WHERE startup_id = ? AND user_id = ?");
$stmt->execute([$startup_id, $_SESSION['user_id']]);
$isFollowing = (bool)$stmt->fetch();
}
// Actions: follow/unfollow, invest, post_update, finish_round, cancel_round
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit;
}
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) {
if ($isFollowing) {
$stmt = db()->prepare("DELETE FROM startup_followers WHERE startup_id = ? AND user_id = ?");
$stmt->execute([$startup_id, $_SESSION['user_id']]);
$stmt = db()->prepare("UPDATE startups SET followers_count = followers_count - 1 WHERE id = ?");
$stmt->execute([$startup_id]);
} else {
$stmt = db()->prepare("INSERT INTO startup_followers (startup_id, user_id) VALUES (?, ?)");
$stmt->execute([$startup_id, $_SESSION['user_id']]);
$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();
}
header("Location: startup_details.php?id=$startup_id");
exit;
}
}
$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>
<!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">
<meta charset="UTF-8">
<title><?= htmlspecialchars($startup['name']) ?> | Venture Capitalist</title>
<link rel="stylesheet" href="assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/dist/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); }
.doc-link {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 20px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--border-color);
border-radius: 12px;
text-decoration: none;
color: #fff;
font-size: 14px;
transition: all 0.2s;
}
.doc-link:hover {
background: rgba(255, 255, 255, 0.1);
border-color: var(--accent-blue);
transform: translateY(-2px);
}
.data-label { color: var(--text-secondary); font-size: 12px; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
</style>
</head>
<body>
<body style="background: var(--bg-color); color: #fff;">
<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 style="background: linear-gradient(to right, #001f3f, #000); padding: 60px 0; border-bottom: 1px solid var(--border-color);">
<div class="container">
<div style="display: flex; justify-content: space-between; align-items: flex-end;">
<div>
<a href="startups.php" style="color: var(--accent-blue); text-decoration: none; font-size: 14px; margin-bottom: 20px; display: inline-block;">
<i class="fas fa-arrow-left"></i> Back to Discover
</a>
<div style="display: flex; align-items: center; gap: 20px;">
<div style="width: 80px; height: 80px; background: var(--surface-color); border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 900; color: var(--accent-blue); border: 2px solid var(--border-color);">
<?= substr($startup['name'], 0, 1) ?>
</div>
<div>
<h1 style="margin: 0; font-size: 42px; font-weight: 900;"><?= htmlspecialchars($startup['name']) ?></h1>
<div style="display: flex; gap: 15px; margin-top: 10px; color: var(--text-secondary);">
<span><i class="fas fa-industry"></i> <?= htmlspecialchars($startup['industry']) ?></span>
<span><i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($startup['country']) ?></span>
<span><i class="fas fa-users"></i> <?= $startup['followers_count'] ?> Followers</span>
</div>
</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>
</div>
<div style="display: flex; gap: 10px;">
<form method="POST">
<input type="hidden" name="action" value="follow">
<button type="submit" class="btn <?= $isFollowing ? 'btn-secondary' : 'btn-primary' ?>" style="padding: 12px 25px; border-radius: 12px;">
<i class="fas <?= $isFollowing ? 'fa-check' : 'fa-plus' ?>"></i> <?= $isFollowing ? 'Following' : 'Follow' ?>
</button>
</form>
<?php if ($isInvestor): ?>
<a href="messages.php?start_chat=<?= $startup['founder_id'] ?>&startup_id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 12px 25px; border-radius: 12px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;">
<i class="fas fa-envelope"></i> Contact Founder
</a>
<?php endif; ?>
<?php if ($isFounder): ?>
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 12px 25px; border-radius: 12px; text-decoration: none;">
<i class="fas fa-edit"></i> Edit Profile
</a>
<?php endif; ?>
</div>
</div>
</div>
</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 class="container" style="padding: 40px 0; display: grid; grid-template-columns: 2fr 1fr; gap: 40px;">
<div>
<section class="card" style="margin-bottom: 40px;">
<h2 class="section-title"><i class="fas fa-info-circle" style="color: var(--accent-blue);"></i> Executive Summary</h2>
<p style="font-size: 18px; line-height: 1.6; color: rgba(255,255,255,0.9);">
<?= nl2br(htmlspecialchars($startup['product_service'])) ?>
</p>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 40px;">
<div>
<h4 style="color: var(--text-secondary); text-transform: uppercase; font-size: 12px; letter-spacing: 1px;">Business Model</h4>
<p style="font-weight: 700; font-size: 16px;"><?= htmlspecialchars($startup['business_model']) ?></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>
<h4 style="color: var(--text-secondary); text-transform: uppercase; font-size: 12px; letter-spacing: 1px;">Operational Stage</h4>
<p style="font-weight: 700; font-size: 16px;"><?= htmlspecialchars($startup['operational_stage']) ?></p>
</div>
</section>
</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>
<section class="card" style="margin-bottom: 40px;">
<h2 class="section-title"><i class="fas fa-chart-line" style="color: var(--accent-blue);"></i> Financial Health</h2>
<div style="background: rgba(255,255,255,0.02); padding: 25px; border-radius: 20px; border: 1px solid var(--border-color); margin-bottom: 25px;">
<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 class="data-label">Cash on Hand</div>
<div style="font-size: 24px; font-weight: 900; color: #4cd964;">£<?= number_format($startup['current_cash_balance']) ?></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 class="data-label">Monthly Burn</div>
<div style="font-size: 24px; font-weight: 900; color: #ff3b30;">£<?= number_format($startup['burn_rate']) ?></div>
</div>
</div>
</section>
</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']
];
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>
<!-- 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>
<!-- 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 style="text-align: right;">
<div style="font-weight: 800; font-size: 18px; color: var(--accent-blue);">£<?= number_format($inv['amount']) ?></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>
<?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 style="text-align: right;">
<div style="font-weight: 800; font-size: 18px; color: var(--accent-blue);">£<?= number_format($inv['amount']) ?></div>
</div>
</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) ?>
<?php endforeach; ?>
</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>
<?php endif; ?>
</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;">&copy; <?= date('Y') ?> <?= htmlspecialchars($platformName) ?>. All rights reserved.</p>
<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);">Investors</div>
</div>
<div style="text-align: right;">
<div style="font-weight: 700;">£<?= number_format($startup['funding_goal']) ?></div>
<div style="font-size: 11px; color: var(--text-secondary);">Current Goal</div>
</div>
</div>
<div style="margin-top: 25px;">
<div style="height: 8px; background: rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden;">
<div style="width: <?= min(100, ($startup['funding_raised'] / ($startup['funding_goal'] ?: 1)) * 100) ?>%; height: 100%; background: var(--accent-blue);"></div>
</div>
<div style="display: flex; justify-content: space-between; font-size: 11px; margin-top: 8px; color: var(--text-secondary);">
<span><?= number_format(($startup['funding_raised'] / ($startup['funding_goal'] ?: 1)) * 100, 1) ?>% Funded</span>
<span>£<?= number_format(max(0, $startup['funding_goal'] - $startup['funding_raised'])) ?> Left</span>
</div>
</div>
<?php if ($isInvestor): ?>
<a href="portfolio.php?invest_id=<?= $startup_id ?>" class="btn btn-primary" style="width: 100%; margin-top: 25px; padding: 15px; border-radius: 12px; text-decoration: none; display: block; text-align: center; font-weight: 800;">
Invest Now
</a>
<?php endif; ?>
</section>
<section class="card">
<h4 style="margin-top: 0; color: var(--text-secondary); text-transform: uppercase; font-size: 12px; letter-spacing: 1px;">The Founder</h4>
<div style="display: flex; align-items: center; gap: 15px; margin: 20px 0;">
<div style="width: 50px; height: 50px; border-radius: 15px; background: var(--surface-color); display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-color);">
<i class="fas fa-user-tie" style="color: var(--accent-blue);"></i>
</div>
<div>
<div style="font-weight: 700; font-size: 16px;"><?= htmlspecialchars($startup['founder_name']) ?></div>
<div style="font-size: 12px; color: var(--text-secondary);">Founder & CEO</div>
</div>
</div>
<div style="font-size: 14px; line-height: 1.5; color: var(--text-secondary);">
Managed and verified by Venture Capitalist Platform.
</div>
</section>
</div>
</footer>
</div>
<script src="assets/js/main.js"></script>
</body>
</html>
</html>