This commit is contained in:
Flatlogic Bot 2026-02-28 21:47:38 +00:00
parent 871eb7711b
commit 48562f356c
8 changed files with 66 additions and 39 deletions

View File

@ -13,13 +13,18 @@ $countries = require_once 'includes/countries.php';
$success = ''; $success = '';
$error = ''; $error = '';
$stmt = db()->prepare("SELECT * FROM startups WHERE founder_id = ?"); $startupId = $_GET['id'] ?? null;
$stmt->execute([$_SESSION['user_id']]); $existingStartup = null;
$existingStartup = $stmt->fetch();
if ($startupId) {
$stmt = db()->prepare("SELECT * FROM startups WHERE id = ? AND founder_id = ?");
$stmt->execute([$startupId, $_SESSION['user_id']]);
$existingStartup = $stmt->fetch();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = $_POST['name'] ?? ''; $name = $_POST['name'] ?? '';
$description = $_POST['description'] ?? ''; // New field for Short Pitch $description = $_POST['description'] ?? '';
$legal_name = $_POST['legal_name'] ?? ''; $legal_name = $_POST['legal_name'] ?? '';
$country = $_POST['country'] ?? ''; $country = $_POST['country'] ?? '';
$industry = $_POST['industry'] ?? ''; $industry = $_POST['industry'] ?? '';
@ -37,6 +42,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$current_cash_balance = $_POST['current_cash_balance'] ?? 0.0; $current_cash_balance = $_POST['current_cash_balance'] ?? 0.0;
$burn_rate = $_POST['burn_rate'] ?? 0.0; $burn_rate = $_POST['burn_rate'] ?? 0.0;
$founder_return_rate = isset($_POST['founder_return_rate']) && $_POST['founder_return_rate'] !== '' ? (float)$_POST['founder_return_rate'] : null;
$doc_fields = [ $doc_fields = [
'doc_income_statements', 'doc_income_statements',
@ -115,43 +121,40 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
if ($existingStartup) { if ($existingStartup) {
// Count columns: 24 columns in SET clause
$stmt = db()->prepare("UPDATE startups SET $stmt = db()->prepare("UPDATE startups SET
name = ?, description = ?, legal_name = ?, country = ?, industry = ?, sub_industry = ?, business_model = ?, product_service = ?, operational_stage = ?, name = ?, description = ?, 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 = ?, cofounder_equity_pct = ?, cofounder_equity_type = ?, cofounder_responsibilities = ?, desired_cofounder_experience = ?, cofounder_commitment = ?, other_partnership_details = ?,
current_cash_balance = ?, burn_rate = ?, current_cash_balance = ?, burn_rate = ?,
doc_income_statements = ?, doc_balance_sheets = ?, doc_cash_flow_statements = ?, doc_revenue_breakdown = ?, doc_gross_margin = ?, doc_income_statements = ?, doc_balance_sheets = ?, doc_cash_flow_statements = ?, doc_revenue_breakdown = ?, doc_gross_margin = ?,
recommended_return_rate = ?, recommended_return_reasoning = ? recommended_return_rate = ?, recommended_return_reasoning = ?, founder_return_rate = ?
WHERE id = ? AND founder_id = ?"); WHERE id = ? AND founder_id = ?");
// Execute parameters: 24 columns + 2 WHERE params = 26
$stmt->execute([ $stmt->execute([
$name, $description, $legal_name, $country, $industry, $sub_industry, $business_model, $product_service, $operational_stage, $name, $description, $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, $cofounder_equity_pct, $cofounder_equity_type, $cofounder_responsibilities, $desired_cofounder_experience, $cofounder_commitment, $other_partnership_details,
$current_cash_balance, $burn_rate, $current_cash_balance, $burn_rate,
$uploaded_paths['doc_income_statements'], $uploaded_paths['doc_balance_sheets'], $uploaded_paths['doc_cash_flow_statements'], $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_revenue_breakdown'], $uploaded_paths['doc_gross_margin'],
$recommended_return_rate, $recommended_return_reasoning, $existingStartup['id'], $_SESSION['user_id'] $recommended_return_rate, $recommended_return_reasoning, $founder_return_rate,
$existingStartup['id'], $_SESSION['user_id']
]); ]);
$final_id = $existingStartup['id']; $final_id = $existingStartup['id'];
} else { } else {
// Count columns: 26 columns
$stmt = db()->prepare("INSERT INTO startups ( $stmt = db()->prepare("INSERT INTO startups (
name, description, legal_name, country, industry, sub_industry, business_model, product_service, operational_stage, name, description, 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, cofounder_equity_pct, cofounder_equity_type, cofounder_responsibilities, desired_cofounder_experience, cofounder_commitment, other_partnership_details,
current_cash_balance, burn_rate, current_cash_balance, burn_rate,
doc_income_statements, doc_balance_sheets, doc_cash_flow_statements, doc_revenue_breakdown, doc_gross_margin, doc_income_statements, doc_balance_sheets, doc_cash_flow_statements, doc_revenue_breakdown, doc_gross_margin,
founder_id, recommended_return_rate, recommended_return_reasoning, status founder_id, recommended_return_rate, recommended_return_reasoning, founder_return_rate, status
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'private')"); ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'private')");
// Execute parameters: 25 ? placeholders + 'private' literal = 26 items
$stmt->execute([ $stmt->execute([
$name, $description, $legal_name, $country, $industry, $sub_industry, $business_model, $product_service, $operational_stage, $name, $description, $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, $cofounder_equity_pct, $cofounder_equity_type, $cofounder_responsibilities, $desired_cofounder_experience, $cofounder_commitment, $other_partnership_details,
$current_cash_balance, $burn_rate, $current_cash_balance, $burn_rate,
$uploaded_paths['doc_income_statements'], $uploaded_paths['doc_balance_sheets'], $uploaded_paths['doc_cash_flow_statements'], $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_revenue_breakdown'], $uploaded_paths['doc_gross_margin'],
$_SESSION['user_id'], $recommended_return_rate, $recommended_return_reasoning $_SESSION['user_id'], $recommended_return_rate, $recommended_return_reasoning, $founder_return_rate
]); ]);
$final_id = db()->lastInsertId(); $final_id = db()->lastInsertId();
} }
@ -195,6 +198,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<?php if ($success): ?> <?php if ($success): ?>
<div style="background: rgba(48, 209, 88, 0.1); color: #30d158; padding: 15px; border-radius: 12px; border: 1px solid #30d158; margin-bottom: 25px;"> <div style="background: rgba(48, 209, 88, 0.1); color: #30d158; padding: 15px; border-radius: 12px; border: 1px solid #30d158; margin-bottom: 25px;">
<i class="fas fa-check-circle"></i> <?= $success ?> <i class="fas fa-check-circle"></i> <?= $success ?>
<?php if (!$startupId): ?>
<div style="margin-top: 15px;">
<a href="start_funding_round.php?id=<?= $final_id ?>" class="btn btn-primary" style="display: inline-block;">Launch Funding Round Now</a>
</div>
<?php endif; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -281,6 +289,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
</div> </div>
</div> </div>
<div style="margin-top: 20px; border-top: 1px solid #333; padding-top: 20px;">
<label style="display: block; margin-bottom: 8px; font-weight: 700;">Proposed Investor Return (%)</label>
<input type="number" step="0.1" name="founder_return_rate" value="<?= htmlspecialchars($existingStartup['founder_return_rate'] ?? '') ?>" placeholder="e.g. 8.5" style="width: 100%; padding: 12px; border-radius: 8px; background: #222; border: 1px solid var(--accent-color); color: #fff; font-size: 16px; font-weight: 700;">
<small style="color: #aaa; display: block; margin-top: 8px;">Your proposed annual dividend yield. The platform also computes a recommendation based on your financials.</small>
</div>
<div style="margin-top: 30px;"> <div style="margin-top: 30px;">
<h3 style="font-size: 16px; margin-bottom: 15px; color: #fff;">Upload Financial Documents (PDF/Images)</h3> <h3 style="font-size: 16px; margin-bottom: 15px; color: #fff;">Upload Financial Documents (PDF/Images)</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;"> <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">

View File

@ -46,8 +46,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
db()->beginTransaction(); db()->beginTransaction();
try { try {
// Update startup with round-specific settings // Update startup with round-specific settings
$stmt = db()->prepare("UPDATE startups SET status = ?, founder_return_rate = ? WHERE id = ?"); // We also update funding_target so that general views show the current target
$stmt->execute([$status, $founder_rate, $startup_id]); $stmt = db()->prepare("UPDATE startups SET status = ?, founder_return_rate = ?, funding_target = ? WHERE id = ?");
$stmt->execute([$status, $founder_rate, $goal, $startup_id]);
// Create the round // Create the round
$stmt = db()->prepare("INSERT INTO funding_rounds (startup_id, funding_goal, status) VALUES (?, ?, 'Active')"); $stmt = db()->prepare("INSERT INTO funding_rounds (startup_id, funding_goal, status) VALUES (?, ?, 'Active')");
@ -70,7 +71,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Step 2: Start Funding Round <?= htmlspecialchars($platformName) ?></title> <title>Launch Funding Round <?= htmlspecialchars($platformName) ?></title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>"> <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"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
@ -79,7 +80,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div class="container" style="max-width: 600px; margin: 0 auto;"> <div class="container" style="max-width: 600px; margin: 0 auto;">
<div class="card" style="padding: 40px;"> <div class="card" style="padding: 40px;">
<h1 style="font-size: 28px; font-weight: 800; margin-bottom: 10px;">Step 2: Launch Funding Round</h1> <h1 style="font-size: 28px; font-weight: 800; margin-bottom: 10px;">Launch Funding Round</h1>
<p style="color: var(--text-secondary); margin-bottom: 30px;"> <p style="color: var(--text-secondary); margin-bottom: 30px;">
Set your investment targets and return rates for <strong><?= htmlspecialchars($startup['name']) ?></strong>. Set your investment targets and return rates for <strong><?= htmlspecialchars($startup['name']) ?></strong>.
</p> </p>
@ -92,7 +93,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<?php if ($success): ?> <?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;"> <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;">
<?= htmlspecialchars($success) ?> <i class="fas fa-check-circle"></i> <?= htmlspecialchars($success) ?>
</div> </div>
<?php else: ?> <?php else: ?>
<div style="background: rgba(0, 242, 255, 0.05); border: 1px solid var(--accent-blue); padding: 20px; border-radius: 16px; margin-bottom: 30px; text-align: center;"> <div style="background: rgba(0, 242, 255, 0.05); border: 1px solid var(--accent-blue); padding: 20px; border-radius: 16px; margin-bottom: 30px; text-align: center;">
@ -105,12 +106,14 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div style="margin-bottom: 20px;"> <div style="margin-bottom: 20px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px;">Funding Goal (£) *</label> <label style="display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px;">Funding Goal (£) *</label>
<input type="number" name="funding_goal" min="100" step="100" required placeholder="e.g. 50000" <input type="number" name="funding_goal" min="100" step="100" required placeholder="e.g. 50000"
value="<?= htmlspecialchars($startup['funding_target'] ?: '') ?>"
style="width: 100%; padding: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; color: #fff; font-size: 18px; font-weight: 700;"> style="width: 100%; padding: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; color: #fff; font-size: 18px; font-weight: 700;">
</div> </div>
<div style="margin-bottom: 25px;"> <div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px;">Your Proposed Dividend (%) <span style="font-weight: 400; opacity: 0.6;">(Optional)</span></label> <label style="display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px;">Your Proposed Dividend (%) <span style="font-weight: 400; opacity: 0.6;">(Optional)</span></label>
<input type="number" name="founder_return_rate" step="0.1" min="0" max="100" placeholder="e.g. 8.5" <input type="number" name="founder_return_rate" step="0.1" min="0" max="100" placeholder="e.g. 8.5"
value="<?= htmlspecialchars($startup['founder_return_rate'] !== null ? $startup['founder_return_rate'] : '') ?>"
style="width: 100%; padding: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; color: #fff; font-size: 16px;"> style="width: 100%; padding: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; color: #fff; font-size: 16px;">
<small style="color: var(--text-secondary); display: block; margin-top: 8px; line-height: 1.4;"> <small style="color: var(--text-secondary); display: block; margin-top: 8px; line-height: 1.4;">
This is the annual return rate you propose to investors. It will be displayed alongside the platform recommendation. This is the annual return rate you propose to investors. It will be displayed alongside the platform recommendation.
@ -120,8 +123,8 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<div style="margin-bottom: 30px;"> <div style="margin-bottom: 30px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px;">Listing Status</label> <label style="display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px;">Listing Status</label>
<select name="listing_status" style="width: 100%; padding: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; color: #fff;"> <select name="listing_status" style="width: 100%; padding: 14px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 12px; color: #fff;">
<option value="public">Public (Visible to all investors)</option> <option value="public" <?= $startup['status'] === 'public' ? 'selected' : '' ?>>Public (Visible to all investors)</option>
<option value="private">Private (Only visible via direct link)</option> <option value="private" <?= $startup['status'] === 'private' ? 'selected' : '' ?>>Private (Only visible via direct link)</option>
</select> </select>
</div> </div>

View File

@ -121,16 +121,16 @@ $myStartups = $stmt->fetchAll();
<i class="fas fa-rocket" style="font-size: 64px; color: var(--accent-blue); opacity: 0.2; margin-bottom: 30px;"></i> <i class="fas fa-rocket" style="font-size: 64px; color: var(--accent-blue); opacity: 0.2; margin-bottom: 30px;"></i>
<h3>No startups found</h3> <h3>No startups found</h3>
<p style="color: var(--text-secondary);">Start your journey by listing your first startup or idea.</p> <p style="color: var(--text-secondary);">Start your journey by listing your first startup or idea.</p>
<a href="create_startup.php" class="btn btn-primary" style="margin-top: 25px;">Start Funding Round</a> <a href="create_startup.php" class="btn btn-primary" style="margin-top: 25px;">List First Startup</a>
</div> </div>
<?php else: ?> <?php else: ?>
<?php foreach ($myStartups as $startup): <?php foreach ($myStartups as $startup):
$goal = $startup['active_goal'] ?? $startup['funding_target']; $goal = $startup['active_goal'] ?: 0;
$raised = $startup['active_raised'] ?? $startup['funding_raised']; $raised = $startup['active_raised'] ?: 0;
$progress = ($raised > 0 && ($raised / ($goal ?: 1)) * 100 < 1) ? 1 : round(($raised / ($goal ?: 1)) * 100); $progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0;
$isTrending = in_array($startup['id'], $trendingIds); $isTrending = in_array($startup['id'], $trendingIds);
?> ?>
<div class="card" style="position: relative;"> <div class="card" style="position: relative; display: flex; flex-direction: column;">
<?php if ($isTrending): ?> <?php if ($isTrending): ?>
<div class="trending-badge"> <div class="trending-badge">
<i class="fas fa-fire"></i> Trending <i class="fas fa-fire"></i> Trending
@ -140,22 +140,32 @@ $myStartups = $stmt->fetchAll();
<div> <div>
<h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3> <h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3>
</div> </div>
<span style="font-size: 10px; text-transform: uppercase; padding: 4px 8px; background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); border-radius: 4px; border: 1px solid rgba(0, 242, 255, 0.3);"> <span style="font-size: 10px; text-transform: uppercase; padding: 4px 8px; background: <?= $startup['round_status'] === 'Active' ? 'rgba(48, 209, 88, 0.1)' : 'rgba(255, 255, 255, 0.05)' ?>; color: <?= $startup['round_status'] === 'Active' ? '#30d158' : '#aaa' ?>; border-radius: 4px; border: 1px solid <?= $startup['round_status'] === 'Active' ? 'rgba(48, 209, 88, 0.3)' : 'rgba(255, 255, 255, 0.1)' ?>;">
<?= $startup['round_status'] === 'Active' ? 'Active Round' : 'No Active Round' ?> <?= $startup['round_status'] === 'Active' ? 'Active Round' : 'Inactive' ?>
</span> </span>
</div> </div>
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 25px; line-height: 1.6; height: 42px; overflow: hidden;"> <p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 25px; line-height: 1.6; height: 42px; overflow: hidden;">
<?= htmlspecialchars(substr($startup['description'], 0, 120)) ?>... <?= htmlspecialchars(substr($startup['description'], 0, 120)) ?><?= strlen($startup['description']) > 120 ? '...' : '' ?>
</p> </p>
<div style="margin-bottom: 10px; font-weight: 600; display: flex; justify-content: space-between; font-size: 13px;">
<span>£<?= number_format($raised) ?> Raised</span> <?php if ($startup['round_status'] === 'Active'): ?>
<span style="color: var(--text-secondary);"><?= $progress ?>%</span> <div style="margin-bottom: 10px; font-weight: 600; display: flex; justify-content: space-between; font-size: 13px;">
</div> <span>£<?= number_format($raised) ?> Raised</span>
<div style="width: 100%; height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin-bottom: 25px;"> <span style="color: var(--text-secondary);"><?= $progress ?>%</span>
<div style="width: <?= min(100, $progress) ?>%; height: 100%; background: var(--gradient-primary);"></div> </div>
</div> <div style="width: 100%; height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin-bottom: 25px;">
<div style="display: flex; gap: 10px;"> <div style="width: <?= min(100, $progress) ?>%; height: 100%; background: var(--gradient-primary);"></div>
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-outline" style="flex: 1; padding: 10px; font-size: 13px;">View Details</a> </div>
<?php else: ?>
<div style="margin-bottom: 25px; padding: 15px; background: rgba(255,255,255,0.02); border-radius: 12px; border: 1px dashed var(--border-color); text-align: center;">
<a href="start_funding_round.php?id=<?= $startup['id'] ?>" style="color: var(--accent-blue); text-decoration: none; font-size: 13px; font-weight: 700;">
<i class="fas fa-plus-circle"></i> Launch Funding Round
</a>
</div>
<?php endif; ?>
<div style="display: flex; gap: 10px; margin-top: auto;">
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-outline" style="flex: 1; padding: 10px; font-size: 13px;">View Profile</a>
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 10px; font-size: 13px;"><i class="fas fa-edit"></i></a> <a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 10px; font-size: 13px;"><i class="fas fa-edit"></i></a>
</div> </div>
</div> </div>