666 lines
34 KiB
PHP
666 lines
34 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 s.*, fr.id as round_id, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status
|
|
FROM startups s
|
|
LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active'
|
|
WHERE s.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['user_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
|
|
$canSeeHistory = $isFounder || $isInvestor;
|
|
$fundingHistory = [];
|
|
if ($canSeeHistory) {
|
|
$stmt = db()->prepare("
|
|
SELECT i.*, u.full_name as investor_name, u.id as investor_user_id
|
|
FROM investments i
|
|
LEFT 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([$startupId]);
|
|
$fundingHistory = $stmt->fetchAll();
|
|
}
|
|
|
|
// Fetch approved investments for dividends calculation (Founder only)
|
|
$approvedInvestments = [];
|
|
if ($isFounder) {
|
|
$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 = ? AND i.status = 'approved'
|
|
");
|
|
$stmt->execute([$startupId]);
|
|
$approvedInvestments = $stmt->fetchAll();
|
|
}
|
|
|
|
// Fetch founders
|
|
$stmt = db()->prepare("SELECT id, full_name as name FROM users WHERE id = ?");
|
|
$stmt->execute([$startup['user_id']]);
|
|
$founder = $stmt->fetch();
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
|
|
// Calculate progress
|
|
$goal = $startup['active_goal'] ?: 0;
|
|
$raised = $startup['active_raised'] ?: 0;
|
|
$progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0;
|
|
|
|
/**
|
|
* Helper to calculate time left for next dividend
|
|
*/
|
|
function getNextDividendInfo($createdAt) {
|
|
$created = new DateTime($createdAt);
|
|
$day = $created->format('d');
|
|
|
|
$now = new DateTime();
|
|
$thisMonth = new DateTime($now->format('Y-m-') . $day);
|
|
|
|
// If today is past the day, next is next month
|
|
if ($thisMonth <= $now) {
|
|
$next = clone $thisMonth;
|
|
$next->modify('+1 month');
|
|
} else {
|
|
$next = $thisMonth;
|
|
}
|
|
|
|
$interval = $now->diff($next);
|
|
$days = $interval->days;
|
|
|
|
return [
|
|
'date' => $next->format('M d, Y'),
|
|
'days_left' => $days
|
|
];
|
|
}
|
|
?>
|
|
<!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);
|
|
}
|
|
.progress-bar-container {
|
|
width: 100%;
|
|
height: 12px;
|
|
background: rgba(255,255,255,0.05);
|
|
border-radius: 100px;
|
|
overflow: hidden;
|
|
margin: 20px 0;
|
|
border: 1px solid var(--border-color);
|
|
}
|
|
.progress-bar-fill {
|
|
height: 100%;
|
|
background: var(--gradient-primary);
|
|
box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
|
|
border-radius: 100px;
|
|
}
|
|
.dividend-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 15px;
|
|
background: rgba(255,255,255,0.02);
|
|
border-radius: 16px;
|
|
border: 1px solid var(--border-color);
|
|
margin-bottom: 10px;
|
|
}
|
|
.btn-status-small {
|
|
padding: 10px 15px;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
border-radius: 10px;
|
|
border: 1px solid transparent;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
background: transparent;
|
|
text-decoration: none;
|
|
}
|
|
.btn-cancel-small {
|
|
border-color: rgba(255, 59, 48, 0.3);
|
|
color: #ff3b30;
|
|
}
|
|
.btn-cancel-small:hover {
|
|
background: rgba(255, 59, 48, 0.1);
|
|
}
|
|
.btn-finish-small {
|
|
border-color: rgba(48, 209, 88, 0.3);
|
|
color: #30d158;
|
|
}
|
|
.btn-finish-small:hover {
|
|
background: rgba(48, 209, 88, 0.1);
|
|
}
|
|
|
|
/* Modal Styles */
|
|
.modal {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 2000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0,0,0,0.85);
|
|
backdrop-filter: blur(8px);
|
|
}
|
|
.modal-content {
|
|
background-color: #1a1a24;
|
|
margin: 10% auto;
|
|
padding: 40px;
|
|
border: 1px solid var(--border-color);
|
|
width: 420px;
|
|
border-radius: 32px;
|
|
box-shadow: 0 25px 60px rgba(0,0,0,0.7);
|
|
}
|
|
</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;">
|
|
<!-- Money Pot Widget in Header -->
|
|
<div onclick="openWalletModal('add')" style="cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: rgba(0, 242, 255, 0.1); border-radius: 50px; border: 1px solid rgba(0, 242, 255, 0.2);">
|
|
<i class="fas fa-wallet" style="color: var(--accent-blue); font-size: 12px;"></i>
|
|
<span id="header-wallet-balance" style="font-size: 13px; font-weight: 800; color: #fff;">£<?= number_format($user['balance'], 2) ?></span>
|
|
</div>
|
|
|
|
<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;">
|
|
|
|
<?php if (isset($_GET['success'])): ?>
|
|
<div style="background: rgba(48, 209, 88, 0.1); border: 1px solid rgba(48, 209, 88, 0.3); color: #30d158; padding: 15px; border-radius: 12px; margin-bottom: 25px; font-size: 14px; text-align: center;">
|
|
Round status updated successfully!
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- 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 <a href="profile.php?id=<?= $founder['id'] ?>" style="color: #fff; font-weight: 700; text-decoration: none; border-bottom: 1px dashed var(--accent-blue);"><?= htmlspecialchars($founder['name']) ?></a>
|
|
</p>
|
|
</div>
|
|
|
|
<?php if ($isInvestor): ?>
|
|
<div style="display: flex; gap: 15px;">
|
|
<a href="messages.php?chat_with=<?= $startup['user_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>
|
|
|
|
<?php if ($startup['round_status'] === 'Active'): ?>
|
|
<!-- Funding Progress -->
|
|
<section class="card" style="margin-bottom: 40px; border-color: rgba(0, 242, 255, 0.3); background: rgba(0, 242, 255, 0.02);">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<h2 class="section-title" style="margin-bottom: 0;"><i class="fas fa-chart-pie" style="color: var(--accent-blue);"></i> Active Funding Round</h2>
|
|
<span style="font-weight: 800; color: var(--accent-blue);"><?= $progress ?>% Complete</span>
|
|
</div>
|
|
<div class="progress-bar-container">
|
|
<div class="progress-bar-fill" style="width: <?= min(100, $progress) ?>%;"></div>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; font-weight: 700;">
|
|
<div>
|
|
<div style="font-size: 11px; color: var(--text-secondary); text-transform: uppercase;">Raised</div>
|
|
<div style="font-size: 20px;">£<?= number_format($raised) ?></div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<div style="font-size: 11px; color: var(--text-secondary); text-transform: uppercase;">Goal</div>
|
|
<div style="font-size: 20px;">£<?= number_format($goal) ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ($isFounder): ?>
|
|
<div style="display: flex; gap: 15px; margin-top: 30px; border-top: 1px solid var(--border-color); padding-top: 25px;">
|
|
<form action="update_round_status.php" method="POST" style="margin: 0;" onsubmit="return confirm('Finish this round early?');">
|
|
<input type="hidden" name="round_id" value="<?= $startup['round_id'] ?>">
|
|
<input type="hidden" name="status" value="Closed">
|
|
<button type="submit" class="btn-status-small btn-finish-small">
|
|
<i class="fas fa-check-circle"></i> Finish Round Early
|
|
</button>
|
|
</form>
|
|
<form action="update_round_status.php" method="POST" style="margin: 0;" onsubmit="return confirm('Cancel this funding round?');">
|
|
<input type="hidden" name="round_id" value="<?= $startup['round_id'] ?>">
|
|
<input type="hidden" name="status" value="Cancelled">
|
|
<button type="submit" class="btn-status-small btn-cancel-small">
|
|
<i class="fas fa-times-circle"></i> Cancel Round
|
|
</button>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($isFounder): ?>
|
|
<!-- Money Pot (Founder View) -->
|
|
<section class="card" style="margin-bottom: 40px; background: linear-gradient(135deg, #1a1a24 0%, #101018 100%); border: 1px solid rgba(0, 242, 255, 0.2);">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
|
|
<h2 class="section-title" style="margin-bottom: 0;"><i class="fas fa-wallet" style="color: var(--accent-blue);"></i> Startup Money Pot</h2>
|
|
<div style="display: flex; gap: 10px;">
|
|
<button onclick="openWalletModal('add')" class="btn" style="padding: 10px 20px; font-size: 13px; font-weight: 800; background: var(--accent-blue); color: #000; border-radius: 12px; border: none; cursor: pointer;">Add Funds</button>
|
|
<button onclick="openWalletModal('withdraw')" class="btn" style="padding: 10px 20px; font-size: 13px; font-weight: 800; background: rgba(255,255,255,0.05); color: #fff; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); cursor: pointer;">Withdraw</button>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; align-items: center; gap: 30px;">
|
|
<div>
|
|
<div style="font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px;">Available Capital</div>
|
|
<div id="startup-wallet-balance" style="font-size: 36px; font-weight: 900; color: #fff; margin-top: 5px;">£<?= number_format($user['balance'], 2) ?></div>
|
|
</div>
|
|
<div style="padding-left: 30px; border-left: 1px solid var(--border-color);">
|
|
<div style="font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px;">Total Investments Received</div>
|
|
<div style="font-size: 24px; font-weight: 900; color: var(--accent-blue); margin-top: 5px;">£<?= number_format($startup['funding_raised'], 2) ?></div>
|
|
</div>
|
|
</div>
|
|
<p style="margin-top: 20px; color: var(--text-secondary); font-size: 13px; opacity: 0.8;">
|
|
<i class="fas fa-info-circle"></i> This pot holds all investments received. You can withdraw funds for business operations or add funds to cover investor dividends.
|
|
</p>
|
|
</section>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($isFounder && !empty($approvedInvestments)): ?>
|
|
<!-- Dividend Management (Founder Only) -->
|
|
<section class="card" style="margin-bottom: 40px; border-color: rgba(48, 209, 88, 0.3);">
|
|
<h2 class="section-title"><i class="fas fa-hand-holding-usd" style="color: #30d158;"></i> Monthly Dividends Due</h2>
|
|
<div style="margin-bottom: 20px;">
|
|
<p style="color: var(--text-secondary); font-size: 14px;">Track upcoming monthly payments to your investors based on your <strong><?= number_format($startup['founder_return_rate'] ?? 0, 1) ?>%</strong> offered return.</p>
|
|
</div>
|
|
|
|
<?php foreach ($approvedInvestments as $inv):
|
|
$monthlyYield = ($inv['amount'] * ($startup['founder_return_rate'] ?? 0) / 100) / 12;
|
|
$nextPay = getNextDividendInfo($inv['created_at']);
|
|
?>
|
|
<div class="dividend-item">
|
|
<div>
|
|
<div style="font-weight: 700; font-size: 15px;"><?= htmlspecialchars($inv['investor_name']) ?></div>
|
|
<div style="font-size: 12px; color: var(--text-secondary);">Invested £<?= number_format($inv['amount']) ?></div>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<div style="font-size: 18px; font-weight: 900; color: #fff;">£<?= number_format($monthlyYield, 2) ?></div>
|
|
<div style="font-size: 11px; color: <?= $nextPay['days_left'] < 7 ? '#ff3b30' : '#30d158' ?>; font-weight: 700;">
|
|
<i class="far fa-clock"></i> <?= $nextPay['days_left'] ?> days left
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</section>
|
|
<?php endif; ?>
|
|
|
|
<!-- 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):
|
|
$investorName = $inv['investor_name'] ?: 'Verified Investor';
|
|
?>
|
|
<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;">
|
|
<?php if ($inv['investor_user_id']): ?>
|
|
<a href="profile.php?id=<?= $inv['investor_user_id'] ?>" style="text-decoration: none;">
|
|
<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($investorName, 0, 1) ?></span>
|
|
</div>
|
|
</a>
|
|
<?php else: ?>
|
|
<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($investorName, 0, 1) ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div>
|
|
<div style="font-weight: 700;">
|
|
<?php if ($inv['investor_user_id']): ?>
|
|
<a href="profile.php?id=<?= $inv['investor_user_id'] ?>" style="color: inherit; text-decoration: none;"><?= htmlspecialchars($investorName) ?></a>
|
|
<?php else: ?>
|
|
<?= htmlspecialchars($investorName) ?>
|
|
<?php endif; ?>
|
|
</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>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Wallet Modal -->
|
|
<div id="wallet-modal" class="modal">
|
|
<div class="modal-content">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
|
|
<h2 id="modal-title" style="margin: 0; font-size: 24px; font-weight: 900; color: #fff;">Add Funds</h2>
|
|
<button onclick="closeWalletModal()" style="background: none; border: none; color: #999; cursor: pointer; font-size: 20px;"><i class="fas fa-times"></i></button>
|
|
</div>
|
|
<form id="wallet-form">
|
|
<input type="hidden" id="wallet-action" name="action" value="add">
|
|
<div style="margin-bottom: 25px;">
|
|
<label style="display: block; margin-bottom: 10px; font-size: 12px; color: #999; text-transform: uppercase; letter-spacing: 1px; font-weight: 700;">Amount (£)</label>
|
|
<input type="number" id="wallet-amount" name="amount" min="1" step="0.01" required placeholder="0.00"
|
|
style="width: 100%; padding: 18px; background: #000; border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; color: #fff; font-size: 24px; font-weight: 800;">
|
|
</div>
|
|
<button type="submit" id="wallet-submit-btn" class="btn btn-primary" style="width: 100%; padding: 18px; font-size: 16px; font-weight: 800; border-radius: 16px; background: var(--accent-blue); color: #000;">Confirm</button>
|
|
</form>
|
|
</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;">© <?= date('Y') ?> Gatsby Capitalist Platform. All rights reserved.</p>
|
|
</footer>
|
|
|
|
<script>
|
|
function openWalletModal(action) {
|
|
const modal = document.getElementById('wallet-modal');
|
|
const title = document.getElementById('modal-title');
|
|
const actionInput = document.getElementById('wallet-action');
|
|
const submitBtn = document.getElementById('wallet-submit-btn');
|
|
|
|
actionInput.value = action;
|
|
if (action === 'add') {
|
|
title.innerText = 'Add Funds';
|
|
submitBtn.innerText = 'Confirm Deposit';
|
|
submitBtn.style.background = 'var(--accent-blue)';
|
|
} else {
|
|
title.innerText = 'Withdraw Funds';
|
|
submitBtn.innerText = 'Confirm Withdrawal';
|
|
submitBtn.style.background = '#fff';
|
|
}
|
|
|
|
modal.style.display = 'block';
|
|
}
|
|
|
|
function closeWalletModal() {
|
|
document.getElementById('wallet-modal').style.display = 'none';
|
|
}
|
|
|
|
document.getElementById('wallet-form').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
const formData = new FormData(this);
|
|
|
|
fetch('api/wallet_transaction.php', {
|
|
method: 'POST',
|
|
body: formData
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
const formattedBalance = '£' + parseFloat(data.new_balance).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
|
|
document.getElementById('header-wallet-balance').innerText = formattedBalance;
|
|
if (document.getElementById('startup-wallet-balance')) {
|
|
document.getElementById('startup-wallet-balance').innerText = formattedBalance;
|
|
}
|
|
closeWalletModal();
|
|
alert(formData.get('action') === 'add' ? 'Funds added successfully!' : 'Withdrawal successful!');
|
|
} else {
|
|
alert('Error: ' + data.error);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error:', error);
|
|
alert('An unexpected error occurred.');
|
|
});
|
|
});
|
|
|
|
// Close modal when clicking outside
|
|
window.onclick = function(event) {
|
|
const modal = document.getElementById('wallet-modal');
|
|
if (event.target == modal) {
|
|
closeWalletModal();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|