38873-vm/startup_details.php
Flatlogic Bot a7855afce8 v31
2026-02-28 19:47:28 +00:00

323 lines
18 KiB
PHP

<?php
require_once 'db/config.php';
session_start();
$startup_id = $_GET['id'] ?? null;
if (!$startup_id) {
header('Location: startups.php');
exit;
}
// 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;
}
// 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 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();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit;
}
if ($_POST['action'] === 'follow') {
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]);
}
header("Location: startup_details.php?id=$startup_id");
exit;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<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>
.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 style="background: var(--bg-color); color: #fff;">
<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>
</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>
<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="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>
</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);">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>
</div>
</body>
</html>