v7
This commit is contained in:
parent
2f6215ae8e
commit
9141a82a52
2
db/migrations/05_investment_refund_status.sql
Normal file
2
db/migrations/05_investment_refund_status.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-- Migration: Add Refunded status to investments
|
||||||
|
ALTER TABLE investments MODIFY COLUMN status ENUM('pending', 'approved', 'rejected', 'Refunded') DEFAULT 'pending';
|
||||||
@ -1,51 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
require_once 'db/config.php';
|
||||||
|
require_once 'mail/MailService.php';
|
||||||
|
|
||||||
if (!isset($_SESSION['user_id'])) {
|
if (!isset($_SESSION['user_id'])) {
|
||||||
header("Location: login.php");
|
header('Location: login.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/db/config.php';
|
$user_id = $_SESSION['user_id'];
|
||||||
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$user_id]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
$startup_id = (int)($_GET['id'] ?? 0);
|
$startup_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
if (!$startup_id) {
|
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ?");
|
||||||
header("Location: startups.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch startup details (handle missing founder due to account deletion)
|
|
||||||
$stmt = db()->prepare("SELECT s.*, u.full_name as founder_name, u.university as founder_uni, u.graduation_year FROM startups s LEFT JOIN users u ON s.founder_id = u.id WHERE s.id = ?");
|
|
||||||
$stmt->execute([$startup_id]);
|
$stmt->execute([$startup_id]);
|
||||||
$startup = $stmt->fetch();
|
$startup = $stmt->fetch();
|
||||||
|
|
||||||
if (!$startup) {
|
if (!$startup) {
|
||||||
header("Location: startups.php");
|
header('Location: startups.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
// Check for active funding round
|
||||||
$stmt->execute([$_SESSION['user_id']]);
|
|
||||||
$user = $stmt->fetch();
|
|
||||||
|
|
||||||
// Fetch active funding round
|
|
||||||
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? AND status = 'Active' LIMIT 1");
|
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? AND status = 'Active' LIMIT 1");
|
||||||
$stmt->execute([$startup_id]);
|
$stmt->execute([$startup_id]);
|
||||||
$activeRound = $stmt->fetch();
|
$activeRound = $stmt->fetch();
|
||||||
|
|
||||||
// Fetch round history
|
// Handle Founder Actions
|
||||||
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE startup_id = ? ORDER BY created_at DESC");
|
|
||||||
$stmt->execute([$startup_id]);
|
|
||||||
$rounds = $stmt->fetchAll();
|
|
||||||
|
|
||||||
$error = '';
|
$error = '';
|
||||||
$success = '';
|
$success = '';
|
||||||
|
|
||||||
// Handle Round Controls (Founder Only)
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $user['role'] === 'founder' && $startup['founder_id'] == $user_id) {
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $startup['founder_id'] == $_SESSION['user_id']) {
|
|
||||||
$action = $_POST['action'];
|
$action = $_POST['action'];
|
||||||
$round_id = (int)($_POST['round_id'] ?? 0);
|
$round_id = isset($_POST['round_id']) ? (int)$_POST['round_id'] : 0;
|
||||||
|
|
||||||
if ($action === 'finish_round_early' && $activeRound && $activeRound['id'] == $round_id) {
|
if ($action === 'finish_round' && $activeRound && $activeRound['id'] == $round_id) {
|
||||||
$stmt = db()->prepare("UPDATE funding_rounds SET status = 'Closed' WHERE id = ?");
|
$stmt = db()->prepare("UPDATE funding_rounds SET status = 'Closed' WHERE id = ?");
|
||||||
$stmt->execute([$round_id]);
|
$stmt->execute([$round_id]);
|
||||||
$success = "Funding round finished early. No new investments allowed.";
|
$success = "Funding round finished early. No new investments allowed.";
|
||||||
@ -125,6 +115,49 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['
|
|||||||
$stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
|
$stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
|
||||||
$stmt->execute([$startup['founder_id'], "New investment of £" . number_format($amount) . " in " . $startup['name'] . "!"]);
|
$stmt->execute([$startup['founder_id'], "New investment of £" . number_format($amount) . " in " . $startup['name'] . "!"]);
|
||||||
|
|
||||||
|
// Check if goal reached for automated notification system
|
||||||
|
$stmt = db()->prepare("SELECT * FROM funding_rounds WHERE id = ?");
|
||||||
|
$stmt->execute([$activeRound['id']]);
|
||||||
|
$updatedRound = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($updatedRound['funding_raised'] >= $updatedRound['funding_goal']) {
|
||||||
|
// Update status to 'Closed'
|
||||||
|
$stmt = db()->prepare("UPDATE funding_rounds SET status = 'Closed' WHERE id = ?");
|
||||||
|
$stmt->execute([$updatedRound['id']]);
|
||||||
|
|
||||||
|
// Notify Founder (DB)
|
||||||
|
$stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
|
||||||
|
$stmt->execute([$startup['founder_id'], "Congratulations! The funding round for " . $startup['name'] . " has reached its goal of £" . number_format($updatedRound['funding_goal']) . "!"]);
|
||||||
|
|
||||||
|
// Notify All Investors for this round (DB + Email)
|
||||||
|
$stmt = db()->prepare("SELECT DISTINCT u.id, u.email, u.full_name FROM investments i JOIN users u ON i.investor_id = u.id WHERE i.funding_round_id = ? AND i.status = 'approved'");
|
||||||
|
$stmt->execute([$updatedRound['id']]);
|
||||||
|
$investorsToNotify = $stmt->fetchAll();
|
||||||
|
|
||||||
|
foreach ($investorsToNotify as $invUser) {
|
||||||
|
// DB Notification
|
||||||
|
$stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
|
||||||
|
$stmt->execute([$invUser['id'], "Great news! The funding round for " . $startup['name'] . " that you invested in has reached its goal!"]);
|
||||||
|
|
||||||
|
// Email Notification
|
||||||
|
$subject = "Funding Goal Reached for " . $startup['name'];
|
||||||
|
$html = "<h1>Goal Reached!</h1><p>Hi " . htmlspecialchars($invUser['full_name']) . ", the funding round for <strong>" . htmlspecialchars($startup['name']) . "</strong> has successfully reached its goal. Thank you for being a part of this journey!</p>";
|
||||||
|
$text = "Goal Reached! Hi " . $invUser['full_name'] . ", the funding round for " . $startup['name'] . " has successfully reached its goal. Thank you for being a part of this journey!";
|
||||||
|
MailService::sendMail($invUser['email'], $subject, $html, $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Email Founder
|
||||||
|
$stmt = db()->prepare("SELECT email, full_name FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$startup['founder_id']]);
|
||||||
|
$founderUser = $stmt->fetch();
|
||||||
|
if ($founderUser) {
|
||||||
|
$subject = "Funding Goal Reached: " . $startup['name'];
|
||||||
|
$html = "<h1>Congratulations!</h1><p>Your funding round for <strong>" . htmlspecialchars($startup['name']) . "</strong> has reached its goal of £" . number_format($updatedRound['funding_goal']) . ".</p>";
|
||||||
|
$text = "Congratulations! Your funding round for " . $startup['name'] . " has reached its goal of £" . number_format($updatedRound['funding_goal']) . ".";
|
||||||
|
MailService::sendMail($founderUser['email'], $subject, $html, $text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
db()->commit();
|
db()->commit();
|
||||||
$success = "Investment successful! You've backed the current round.";
|
$success = "Investment successful! You've backed the current round.";
|
||||||
// Refresh active round data
|
// Refresh active round data
|
||||||
@ -175,145 +208,160 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="container" style="padding-top: 50px; padding-bottom: 50px;">
|
<main class="container" style="padding-top: 50px; padding-bottom: 50px;">
|
||||||
|
<?php if ($error): ?>
|
||||||
|
<div class="alert alert-danger" style="margin-bottom: 30px;"><?= htmlspecialchars($error) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($success): ?>
|
||||||
|
<div class="alert alert-success" style="margin-bottom: 30px;"><?= htmlspecialchars($success) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div style="display: grid; grid-template-columns: 2fr 1.2fr; gap: 40px;">
|
<div style="display: grid; grid-template-columns: 2fr 1.2fr; gap: 40px;">
|
||||||
<div>
|
<div>
|
||||||
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 30px;">
|
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 30px;">
|
||||||
<div style="width: 80px; height: 80px; background: var(--gradient-primary); border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; color: #fff; box-shadow: 0 10px 30px rgba(0, 122, 255, 0.3);">
|
<div style="width: 80px; height: 80px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 20px; display: flex; align-items: center; justify-content: center; color: white; font-size: 32px; font-weight: 700;">
|
||||||
<?= substr($startup['name'], 0, 1) ?>
|
<?= substr($startup['name'], 0, 1) ?>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h1 style="margin-bottom: 5px;"><?= htmlspecialchars($startup['name']) ?></h1>
|
<h1 style="margin: 0; font-size: 36px;"><?= htmlspecialchars($startup['name']) ?></h1>
|
||||||
<div style="color: var(--text-secondary); font-size: 14px;">
|
<div style="color: var(--text-secondary); display: flex; align-items: center; gap: 10px;">
|
||||||
Founded by <?= $startup['founder_name'] ? htmlspecialchars($startup['founder_name']) : '<em>Account Deleted</em>' ?>
|
<span><i class="fas fa-calendar-alt"></i> Founded <?= date('M Y', strtotime($startup['created_at'])) ?></span>
|
||||||
<?php if ($startup['founder_uni']): ?> (<?= htmlspecialchars($startup['founder_uni']) ?>)<?php endif; ?>
|
<span class="badge"><?= ucfirst($startup['status']) ?></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card" style="margin-bottom: 30px;">
|
<section class="card" style="margin-bottom: 40px;">
|
||||||
<h3>About Startup</h3>
|
<h2 style="margin-top: 0; margin-bottom: 20px;">About the Venture</h2>
|
||||||
<p style="color: var(--text-secondary); line-height: 1.8; white-space: pre-line;">
|
<p style="font-size: 18px; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap;"><?= htmlspecialchars($startup['description']) ?></p>
|
||||||
<?= htmlspecialchars($startup['description']) ?>
|
</section>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card" style="margin-bottom: 30px;">
|
<?php if ($activeRound): ?>
|
||||||
<h3>Investment Terms (Dividend-Only Returns)</h3>
|
<section class="card" style="border-left: 5px solid var(--primary);">
|
||||||
<div style="padding: 20px; background: rgba(0, 122, 255, 0.05); border: 1px solid rgba(0, 122, 255, 0.2); border-radius: 12px; margin-top: 15px;">
|
<h3 style="margin-top: 0;">Active Funding Round</h3>
|
||||||
<p style="font-size: 14px; margin-bottom: 10px;"><i class="fas fa-info-circle"></i> <strong>How it works:</strong></p>
|
<div class="progress-container" style="margin: 20px 0;">
|
||||||
<ul style="font-size: 14px; color: var(--text-secondary); margin-left: 20px; line-height: 1.6;">
|
<?php
|
||||||
<li>Investors are entitled to a share of future profits as **dividends**.</li>
|
$percent = ($activeRound['funding_goal'] > 0) ? min(100, ($activeRound['funding_raised'] / $activeRound['funding_goal']) * 100) : 0;
|
||||||
<li>No voting rights or equity control are granted to investors.</li>
|
?>
|
||||||
<li>Returns are primarily distributed through profit-sharing mechanisms.</li>
|
<div class="progress-bar" style="width: <?= $percent ?>%"></div>
|
||||||
<li>Each funding round is independent and maintains its own investment pot.</li>
|
</div>
|
||||||
</ul>
|
<div style="display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 20px;">
|
||||||
</div>
|
<span style="font-size: 24px;">£<?= number_format($activeRound['funding_raised']) ?> raised</span>
|
||||||
</div>
|
<span style="color: var(--text-secondary);">Target: £<?= number_format($activeRound['funding_goal']) ?></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
||||||
<h3>Funding Round History</h3>
|
<div style="display: flex; gap: 10px; margin-top: 20px;">
|
||||||
<div style="margin-top: 20px;">
|
<form method="POST" onsubmit="return confirm('Finish this round early? No more investments will be accepted.');">
|
||||||
<?php foreach ($rounds as $r): ?>
|
<input type="hidden" name="action" value="finish_round">
|
||||||
<div style="display: flex; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--border-color); font-size: 14px;">
|
<input type="hidden" name="round_id" value="<?= $activeRound['id'] ?>">
|
||||||
<div>
|
<button type="submit" class="btn btn-secondary">Finish Round Early</button>
|
||||||
<div style="font-weight: 600;"><?= date('M d, Y', strtotime($r['created_at'])) ?> Round</div>
|
</form>
|
||||||
<div style="color: var(--text-secondary);">Target: £<?= number_format($r['funding_goal']) ?></div>
|
<form method="POST" onsubmit="return confirm('CANCEL this round? All investors in this specific round will be automatically refunded. This cannot be undone.');">
|
||||||
</div>
|
<input type="hidden" name="action" value="cancel_round">
|
||||||
<div style="text-align: right;">
|
<input type="hidden" name="round_id" value="<?= $activeRound['id'] ?>">
|
||||||
<div style="font-weight: 700;">£<?= number_format($r['funding_raised']) ?> Raised</div>
|
<button type="submit" class="btn btn-outline" style="color: #dc3545; border-color: #dc3545;">Cancel Round & Refund</button>
|
||||||
<span style="font-size: 10px; text-transform: uppercase; color: <?= $r['status'] === 'Active' ? '#00f2ff' : ($r['status'] === 'Closed' ? '#55ff55' : '#ff5555') ?>;">
|
</form>
|
||||||
<?= $r['status'] ?>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php elseif ($user['role'] === 'investor'): ?>
|
||||||
</div>
|
<form method="POST" style="background: #f8fafc; padding: 25px; border-radius: 15px; margin-top: 20px;">
|
||||||
</div>
|
<input type="hidden" name="action" value="invest">
|
||||||
|
<label style="display: block; margin-bottom: 10px; font-weight: 600;">Investment Amount (£)</label>
|
||||||
|
<div style="display: flex; gap: 10px;">
|
||||||
|
<input type="number" name="amount" min="50" step="10" value="100" class="form-control" style="flex: 1;">
|
||||||
|
<button type="submit" class="btn btn-primary">Back this Venture</button>
|
||||||
|
</div>
|
||||||
|
<p style="margin-top: 10px; font-size: 14px; color: var(--text-secondary);">Minimum investment is £50. Your support helps students grow.</p>
|
||||||
|
</form>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
<?php else: ?>
|
||||||
|
<section class="card" style="background: #f8fafc; text-align: center; padding: 40px;">
|
||||||
|
<div style="font-size: 48px; color: var(--text-secondary); margin-bottom: 20px;"><i class="fas fa-lock"></i></div>
|
||||||
|
<h3>No Active Funding Round</h3>
|
||||||
|
<p style="color: var(--text-secondary);">This startup is not currently raising funds, or the previous round has closed.</p>
|
||||||
|
|
||||||
|
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
||||||
|
<button class="btn btn-primary" style="margin-top: 20px;" onclick="document.getElementById('newRoundForm').style.display='block'">Launch New Funding Round</button>
|
||||||
|
|
||||||
|
<div id="newRoundForm" style="display: none; margin-top: 30px; text-align: left; background: white; padding: 25px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.05);">
|
||||||
|
<h4>Round Details</h4>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="hidden" name="action" value="start_new_round">
|
||||||
|
<div class="form-group" style="margin-bottom: 20px;">
|
||||||
|
<label>New Funding Target (£)</label>
|
||||||
|
<input type="number" name="new_target" min="50" step="50" class="form-control" placeholder="e.g. 5000" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Start Round</button>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="document.getElementById('newRoundForm').style.display='none'">Cancel</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<?php if ($activeRound): ?>
|
<section class="card" style="margin-bottom: 30px;">
|
||||||
<div class="card" style="margin-bottom: 30px; background: var(--surface-color); border: 1px solid var(--border-color);">
|
<h3 style="margin-top: 0; margin-bottom: 20px;">Venture Stats</h3>
|
||||||
<h3 style="margin-bottom: 25px;">Current Funding Round</h3>
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
|
||||||
|
<div style="background: #f8fafc; padding: 15px; border-radius: 12px; text-align: center;">
|
||||||
<div style="margin-bottom: 30px;">
|
<div style="color: var(--text-secondary); font-size: 13px; text-transform: uppercase; margin-bottom: 5px;">Total Rounds</div>
|
||||||
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
|
<?php
|
||||||
<span style="font-weight: 700; font-size: 24px;">£<?= number_format($activeRound['funding_raised'], 0) ?></span>
|
$stmt = db()->prepare("SELECT COUNT(*) FROM funding_rounds WHERE startup_id = ?");
|
||||||
<span style="color: var(--text-secondary); font-size: 14px; align-self: flex-end;">of £<?= number_format($activeRound['funding_goal'], 0) ?></span>
|
$stmt->execute([$startup_id]);
|
||||||
|
$roundCount = $stmt->fetchColumn();
|
||||||
|
?>
|
||||||
|
<div style="font-size: 20px; font-weight: 700;"><?= $roundCount ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 100%; height: 12px; background: var(--border-color); border-radius: 6px; overflow: hidden;">
|
<div style="background: #f8fafc; padding: 15px; border-radius: 12px; text-align: center;">
|
||||||
<div style="width: <?= min(100, ($activeRound['funding_raised'] / ($activeRound['funding_goal'] ?: 1)) * 100) ?>%; height: 100%; background: var(--gradient-primary); box-shadow: 0 0 20px rgba(0, 122, 255, 0.5);"></div>
|
<div style="color: var(--text-secondary); font-size: 13px; text-transform: uppercase; margin-bottom: 5px;">Backers</div>
|
||||||
</div>
|
<?php
|
||||||
<div style="text-align: right; font-size: 12px; color: var(--text-secondary); margin-top: 8px;">
|
$stmt = db()->prepare("SELECT COUNT(DISTINCT investor_id) FROM investments WHERE startup_id = ? AND status = 'approved'");
|
||||||
<?= round(($activeRound['funding_raised'] / ($activeRound['funding_goal'] ?: 1)) * 100) ?>% Raised
|
$stmt->execute([$startup_id]);
|
||||||
|
$backerCount = $stmt->fetchColumn();
|
||||||
|
?>
|
||||||
|
<div style="font-size: 20px; font-weight: 700;"><?= $backerCount ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<?php if ($success): ?>
|
<section class="card">
|
||||||
<div style="background: rgba(0, 255, 0, 0.1); border: 1px solid rgba(0, 255, 0, 0.3); color: #55ff55; padding: 12px; border-radius: 8px; margin-bottom: 20px;">
|
<h3 style="margin-top: 0; margin-bottom: 20px;">Founder</h3>
|
||||||
<?= htmlspecialchars($success) ?>
|
<?php
|
||||||
</div>
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
<?php elseif ($error): ?>
|
$stmt->execute([$startup['founder_id']]);
|
||||||
<div style="background: rgba(255, 0, 0, 0.1); border: 1px solid rgba(255, 0, 0, 0.3); color: #ff5555; padding: 12px; border-radius: 8px; margin-bottom: 20px;">
|
$founder = $stmt->fetch();
|
||||||
<?= htmlspecialchars($error) ?>
|
?>
|
||||||
</div>
|
<?php if ($founder): ?>
|
||||||
<?php endif; ?>
|
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 20px;">
|
||||||
|
<div style="width: 50px; height: 50px; border-radius: 50%; background: #eee; overflow: hidden;">
|
||||||
<?php if ($user['role'] === 'investor'): ?>
|
<?php if ($founder['profile_photo']): ?>
|
||||||
<form method="POST">
|
<img src="<?= htmlspecialchars($founder['profile_photo']) ?>" style="width: 100%; height: 100%; object-fit: cover;">
|
||||||
<input type="hidden" name="action" value="invest">
|
<?php else: ?>
|
||||||
<div style="margin-bottom: 20px;">
|
<div style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--primary); color: white;">
|
||||||
<label style="display: block; margin-bottom: 8px; font-size: 14px;">Investment Amount (£)</label>
|
<?= substr($founder['full_name'], 0, 1) ?>
|
||||||
<input type="number" name="amount" min="50" step="50" required style="width: 100%; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: #fff; font-size: 18px; font-weight: 700;">
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div style="font-weight: 600;"><?= htmlspecialchars($founder['full_name']) ?></div>
|
||||||
|
<div style="font-size: 13px; color: var(--text-secondary);"><?= htmlspecialchars($founder['university']) ?></div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary" style="width: 100%; padding: 15px;">Back This Project</button>
|
|
||||||
</form>
|
|
||||||
<?php elseif ($startup['founder_id'] == $_SESSION['user_id']): ?>
|
|
||||||
<div style="display: flex; flex-direction: column; gap: 10px;">
|
|
||||||
<form method="POST">
|
|
||||||
<input type="hidden" name="action" value="finish_round_early">
|
|
||||||
<input type="hidden" name="round_id" value="<?= $activeRound['id'] ?>">
|
|
||||||
<button type="submit" class="btn btn-secondary" style="width: 100%; padding: 12px; font-size: 14px;">Finish Round Early</button>
|
|
||||||
</form>
|
|
||||||
<form method="POST" onsubmit="return confirm('Are you sure you want to cancel this funding round? All investors will be automatically refunded.')">
|
|
||||||
<input type="hidden" name="action" value="cancel_round">
|
|
||||||
<input type="hidden" name="round_id" value="<?= $activeRound['id'] ?>">
|
|
||||||
<button type="submit" class="btn btn-secondary" style="width: 100%; padding: 12px; font-size: 14px; border-color: #ff5555; color: #ff5555;">Cancel Funding Round</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
<a href="messages.php?user_id=<?= $founder['id'] ?>" class="btn btn-outline" style="width: 100%; text-align: center; display: block;">Send Message</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<div style="color: var(--text-secondary); font-style: italic;">Founder account deleted. Venture is community-managed.</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</section>
|
||||||
<?php else: ?>
|
|
||||||
<div class="card" style="margin-bottom: 30px; text-align: center; border: 1px dashed var(--border-color);">
|
|
||||||
<i class="fas fa-hourglass-end" style="font-size: 32px; color: var(--text-secondary); margin-bottom: 15px; opacity: 0.5;"></i>
|
|
||||||
<h3>No Active Round</h3>
|
|
||||||
<p style="color: var(--text-secondary); font-size: 14px;">This startup is not currently seeking investment.</p>
|
|
||||||
|
|
||||||
<?php if ($startup['founder_id'] == $_SESSION['user_id']): ?>
|
|
||||||
<div style="margin-top: 25px; text-align: left;">
|
|
||||||
<h4 style="margin-bottom: 15px; font-size: 14px;">Start a New Round</h4>
|
|
||||||
<form method="POST">
|
|
||||||
<input type="hidden" name="action" value="start_new_round">
|
|
||||||
<div style="margin-bottom: 15px;">
|
|
||||||
<label style="display: block; margin-bottom: 5px; font-size: 12px; color: var(--text-secondary);">New Funding Goal (£)</label>
|
|
||||||
<input type="number" name="new_target" min="50" step="50" required style="width: 100%; padding: 10px; border-radius: 8px; background: var(--surface-color); border: 1px solid var(--border-color); color: #fff;">
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary" style="width: 100%; padding: 10px; font-size: 14px;">Launch Round</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<h3>Risk Disclosure</h3>
|
|
||||||
<p style="font-size: 12px; color: var(--text-secondary); line-height: 1.5;">
|
|
||||||
Student startups carry high risk. Dividends are not guaranteed and depend on the profitability of the venture. Each round is independent.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<footer style="margin-top: 50px; padding: 40px 0; border-top: 1px solid #eee; text-align: center; color: var(--text-secondary);">
|
||||||
|
<div class="container">
|
||||||
|
<p>© <?= date('Y') ?> Gatsby — Built for Student Entrepreneurs.</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user