38873-vm/startup_details.php
Flatlogic Bot eb6f8a216e v35
2026-02-28 20:07:53 +00:00

331 lines
18 KiB
PHP

<?php
session_start();
require_once 'db/config.php';
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit;
}
$user_id = $_SESSION['user_id'];
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
$startupId = $_GET['id'] ?? null;
if (!$startupId) {
header('Location: startups.php');
exit;
}
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
$stmt->execute([$startupId]);
$startup = $stmt->fetch();
if (!$startup) {
die("Startup not found.");
}
// Check if user is the founder or an investor
$isFounder = ($_SESSION['user_id'] == $startup['founder_id']);
$isInvestor = ($user['role'] == 'investor');
// Basic permissions check
if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) {
die("You do not have permission to view this profile.");
}
// Fetch funding history if investor
$canSeeHistory = $isFounder || $isInvestor;
$fundingHistory = [];
if ($canSeeHistory) {
$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([$startupId]);
$fundingHistory = $stmt->fetchAll();
}
// Fetch founders
$stmt = db()->prepare("SELECT full_name as name FROM users WHERE id = ?");
$stmt->execute([$startup['founder_id']]);
$founder = $stmt->fetch();
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?= htmlspecialchars($startup['name']) ?> | Startup Details</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.0.0/css/all.min.css">
<style>
:root {
--accent-blue: #00f2ff;
--surface-color: #1a1a1a;
--text-secondary: #999;
--border-color: rgba(255,255,255,0.1);
}
.card {
background: var(--surface-color);
border: 1px solid var(--border-color);
border-radius: 24px;
padding: 35px;
position: relative;
overflow: hidden;
}
.section-title {
font-size: 20px;
font-weight: 800;
margin-bottom: 25px;
display: flex;
align-items: center;
gap: 12px;
}
.data-label {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--text-secondary);
margin-bottom: 8px;
}
.doc-link {
background: rgba(255,255,255,0.05);
padding: 12px 20px;
border-radius: 12px;
text-decoration: none;
color: #fff;
display: flex;
align-items: center;
gap: 10px;
font-size: 14px;
transition: all 0.2s;
border: 1px solid var(--border-color);
}
.doc-link:hover {
background: rgba(255,255,255,0.1);
transform: translateY(-2px);
}
.invest-btn {
background: var(--accent-blue);
color: #000;
padding: 16px 32px;
border-radius: 14px;
text-decoration: none;
font-weight: 800;
display: inline-flex;
align-items: center;
gap: 10px;
transition: all 0.3s;
box-shadow: 0 8px 24px rgba(0, 242, 255, 0.3);
}
.invest-btn:hover {
transform: scale(1.05);
box-shadow: 0 12px 32px rgba(0, 242, 255, 0.4);
}
</style>
</head>
<body style="background: #000; 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="funding_rounds.php">Founding Rounds</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;">
<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>
<div class="container" style="padding: 60px 20px;">
<div style="max-width: 900px; margin: 0 auto;">
<!-- Header Section -->
<div style="display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 50px;">
<div>
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 15px;">
<span style="background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); padding: 6px 14px; border-radius: 100px; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;">
<?= htmlspecialchars($startup['industry']) ?>
</span>
<span style="color: var(--text-secondary); font-size: 13px;">
<i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($startup['country']) ?>
</span>
</div>
<h1 style="font-size: 48px; font-weight: 900; margin: 0; line-height: 1.1; letter-spacing: -1px;">
<?= htmlspecialchars($startup['name']) ?>
</h1>
<p style="color: var(--text-secondary); margin-top: 10px; font-size: 16px;">
Founded by <span style="color: #fff; font-weight: 700;"><?= htmlspecialchars($founder['name']) ?></span>
</p>
</div>
<?php if ($isInvestor): ?>
<div style="display: flex; gap: 15px;">
<a href="messages.php?startup_id=<?= $startup['id'] ?>" style="background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: #fff; padding: 16px 24px; border-radius: 14px; text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; gap: 10px;">
<i class="far fa-comment-dots"></i> Message Founder
</a>
<a href="invest.php?id=<?= $startup['id'] ?>" class="invest-btn">
<i class="fas fa-rocket"></i> Invest Now
</a>
</div>
<?php elseif ($isFounder): ?>
<a href="create_startup.php?id=<?= $startup['id'] ?>" style="background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: #fff; padding: 16px 24px; border-radius: 14px; text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; gap: 10px;">
<i class="fas fa-edit"></i> Edit Profile
</a>
<?php endif; ?>
</div>
<!-- Product & Vision -->
<section class="card" style="margin-bottom: 40px;">
<h2 class="section-title"><i class="fas fa-eye" style="color: var(--accent-blue);"></i> Product & Vision</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="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>
</div>
</section>
<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>
<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>
<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>
</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>
<!-- 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>
<?php if (!empty($startup['recommended_return_reasoning'])): ?>
<div style="margin-top: 20px; padding: 15px; background: rgba(255,255,255,0.03); border-radius: 12px; border: 1px solid rgba(0, 242, 255, 0.1); font-size: 13px; line-height: 1.5; color: rgba(255,255,255,0.8);">
<div style="font-weight: 700; margin-bottom: 5px; color: var(--accent-blue); text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px;">Calculation Reasoning</div>
<?= htmlspecialchars($startup['recommended_return_reasoning']) ?>
</div>
<?php endif; ?>
</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;"><?= 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: 900; color: #fff; font-size: 18px;">£<?= number_format($inv['amount']) ?></div>
<div style="font-size: 12px; color: var(--accent-blue); font-weight: 700;"><?= $inv['equity_pct'] ?>% Equity</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
<?php endif; ?>
</div>
</div>
<footer style="padding: 60px 0; border-top: 1px solid var(--border-color); margin-top: 100px; text-align: center;">
<p style="color: var(--text-secondary); font-size: 14px;">&copy; <?= date('Y') ?> Venture Capitalist Platform. All rights reserved.</p>
</footer>
</body>
</html>