117 lines
5.6 KiB
PHP
117 lines
5.6 KiB
PHP
<?php
|
|
session_start();
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'investor') {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
// Check if already completed
|
|
$stmt = db()->prepare("SELECT onboarding_completed FROM users WHERE id = ?");
|
|
$stmt->execute([$_SESSION['user_id']]);
|
|
$user = $stmt->fetch();
|
|
|
|
if ($user['onboarding_completed']) {
|
|
header("Location: dashboard.php");
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
$countries = require 'includes/countries.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$bio = trim($_POST['bio'] ?? '');
|
|
$interests = isset($_POST['interests']) ? implode(',', $_POST['interests']) : '';
|
|
$investment_appetite = trim($_POST['investment_appetite'] ?? '');
|
|
$country = $_POST['country'] ?? '';
|
|
|
|
if (empty($bio) || empty($interests) || empty($investment_appetite) || empty($country)) {
|
|
$error = "Please fill in all required fields.";
|
|
} else {
|
|
$stmt = db()->prepare("UPDATE users SET bio = ?, interests = ?, investment_appetite = ?, country = ?, onboarding_completed = 1 WHERE id = ?");
|
|
try {
|
|
$stmt->execute([$bio, $interests, $investment_appetite, $country, $_SESSION['user_id']]);
|
|
header("Location: dashboard.php");
|
|
exit;
|
|
} catch (PDOException $e) {
|
|
$error = "Database error: " . $e->getMessage();
|
|
}
|
|
}
|
|
}
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
$interests_options = ['Tech', 'Sustainability', 'Healthcare', 'Fintech', 'Education', 'Consumer', 'Social Impact', 'AI', 'SaaS', 'E-commerce'];
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Investor Onboarding — <?= htmlspecialchars($platformName) ?></title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&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.4.0/css/all.min.css">
|
|
</head>
|
|
<body style="display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 40px 20px;">
|
|
|
|
<div class="card" style="width: 100%; max-width: 600px;">
|
|
<div class="logo" style="text-align: center; margin-bottom: 20px;"><?= htmlspecialchars($platformName) ?></div>
|
|
<h2 style="margin-bottom: 10px;">Create Your Investor Profile</h2>
|
|
<p style="color: var(--text-secondary); margin-bottom: 30px;">Tell us about your investment preferences.</p>
|
|
|
|
<?php if ($error): ?>
|
|
<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;">
|
|
<?= htmlspecialchars($error) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<form method="POST">
|
|
<div style="margin-bottom: 25px;">
|
|
<label style="display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500;">Investment Bio (Max 250 characters)</label>
|
|
<textarea name="bio" required maxlength="250" style="width: 100%; padding: 12px; border-radius: 12px; background: var(--surface-color); border: 1px solid var(--border-color); color: #fff; height: 120px; resize: none;" placeholder="E.g. Angel investor focused on climate tech and early-stage SaaS..."></textarea>
|
|
</div>
|
|
|
|
<div style="margin-bottom: 25px;">
|
|
<label style="display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500;">Country of Residence</label>
|
|
<select name="country" required style="width: 100%; padding: 12px; border-radius: 12px; background: var(--surface-color); border: 1px solid var(--border-color); color: #fff;">
|
|
<option value="">Select a country...</option>
|
|
<?php foreach ($countries as $c): ?>
|
|
<option value="<?= htmlspecialchars($c) ?>"><?= htmlspecialchars($c) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div style="margin-bottom: 25px;">
|
|
<label style="display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500;">Industries of Interest</label>
|
|
<div style="display: flex; flex-wrap: wrap; gap: 10px;">
|
|
<?php foreach ($interests_options as $option): ?>
|
|
<label style="cursor: pointer;">
|
|
<input type="checkbox" name="interests[]" value="<?= $option ?>" style="display: none;" class="interest-checkbox">
|
|
<div class="interest-tag" style="padding: 8px 16px; border: 1px solid var(--border-color); border-radius: 30px; font-size: 14px; transition: all 0.2s;">
|
|
<?= $option ?>
|
|
</div>
|
|
</label>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="margin-bottom: 30px;">
|
|
<label style="display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500;">Investment Appetite (Avg. check size)</label>
|
|
<input type="text" name="investment_appetite" required style="width: 100%; padding: 12px; border-radius: 12px; background: var(--surface-color); border: 1px solid var(--border-color); color: #fff;" placeholder="e.g. £500 - £5,000 per startup">
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary" style="width: 100%; padding: 15px;">Complete Investor Profile</button>
|
|
</form>
|
|
</div>
|
|
|
|
<style>
|
|
.interest-checkbox:checked + .interest-tag {
|
|
background: var(--gradient-primary);
|
|
border-color: transparent;
|
|
color: #fff;
|
|
}
|
|
</style>
|
|
|
|
</body>
|
|
</html>
|