diff --git a/assets/docs/cvs/placeholder.pdf b/assets/docs/cvs/placeholder.pdf new file mode 100644 index 0000000..ed97684 --- /dev/null +++ b/assets/docs/cvs/placeholder.pdf @@ -0,0 +1 @@ +%PDF-1.4 Placeholder CV \ No newline at end of file diff --git a/db/migrations/18_add_cv_and_country_to_users.sql b/db/migrations/18_add_cv_and_country_to_users.sql new file mode 100644 index 0000000..5ac84f0 --- /dev/null +++ b/db/migrations/18_add_cv_and_country_to_users.sql @@ -0,0 +1,3 @@ +-- Add CV and Country fields to users table +ALTER TABLE users ADD COLUMN IF NOT EXISTS cv_url VARCHAR(255) DEFAULT NULL; +ALTER TABLE users ADD COLUMN IF NOT EXISTS country VARCHAR(100) DEFAULT NULL; diff --git a/edit_profile.php b/edit_profile.php index 4d21e34..073c00d 100644 --- a/edit_profile.php +++ b/edit_profile.php @@ -14,6 +14,9 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $error = ''; $success = ''; +// Centralized country list +$countries = require 'includes/countries.php'; + if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['action']) && $_POST['action'] === 'update_profile') { $full_name = trim($_POST['full_name']); @@ -22,17 +25,47 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $degree_program = trim($_POST['degree_program']); $skills = trim($_POST['skills']); $startup_industries = trim($_POST['startup_industries']); + $country = $_POST['country'] ?? ''; - if ($full_name) { - $stmt = db()->prepare("UPDATE users SET full_name = ?, bio = ?, university = ?, degree_program = ?, skills = ?, startup_industries = ? WHERE id = ?"); - $stmt->execute([$full_name, $bio, $university, $degree_program, $skills, $startup_industries, $user_id]); - $success = "Profile updated successfully!"; - // Refresh user data - $stmt = db()->prepare("SELECT * FROM users WHERE id = ?"); - $stmt->execute([$user_id]); - $user = $stmt->fetch(); - } else { - $error = "Full name is required."; + $cv_url = $user['cv_url']; + + // Handle CV Upload + if (isset($_FILES['cv_file']) && $_FILES['cv_file']['error'] === UPLOAD_ERR_OK) { + $file_tmp = $_FILES['cv_file']['tmp_name']; + $file_name = $_FILES['cv_file']['name']; + $file_ext = strtolower(pathinfo($file_name, PATHINFO_EXTENSION)); + $allowed_exts = ['pdf', 'doc', 'docx']; + + if (in_array($file_ext, $allowed_exts)) { + $upload_dir = 'assets/docs/cvs/'; + if (!is_dir($upload_dir)) { + mkdir($upload_dir, 0777, true); + } + $new_file_name = 'cv_' . $user_id . '_' . time() . '.' . $file_ext; + $target_path = $upload_dir . $new_file_name; + + if (move_uploaded_file($file_tmp, $target_path)) { + $cv_url = $target_path; + } else { + $error = "Failed to upload CV."; + } + } else { + $error = "Invalid CV file type. Only PDF, DOC, and DOCX are allowed."; + } + } + + if (!$error) { + if ($full_name) { + $stmt = db()->prepare("UPDATE users SET full_name = ?, bio = ?, university = ?, degree_program = ?, skills = ?, startup_industries = ?, country = ?, cv_url = ? WHERE id = ?"); + $stmt->execute([$full_name, $bio, $university, $degree_program, $skills, $startup_industries, $country, $cv_url, $user_id]); + $success = "Profile updated successfully!"; + // Refresh user data + $stmt = db()->prepare("SELECT * FROM users WHERE id = ?"); + $stmt->execute([$user_id]); + $user = $stmt->fetch(); + } else { + $error = "Full name is required."; + } } } elseif (isset($_POST['action']) && $_POST['action'] === 'delete_account') { try { @@ -109,7 +142,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-
+
@@ -119,6 +152,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ +
+ + +
+
@@ -131,10 +177,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-
+
+ + +
+ + +
+ Current CV +
+ + +
+ +
diff --git a/founder_onboarding.php b/founder_onboarding.php index 92276a0..df90e04 100644 --- a/founder_onboarding.php +++ b/founder_onboarding.php @@ -18,6 +18,7 @@ if ($user['onboarding_completed']) { } $error = ''; +$countries = require 'includes/countries.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $degree_program = trim($_POST['degree_program'] ?? ''); @@ -163,7 +164,12 @@ $all_industries = ['AI & Machine Learning', 'Fintech', 'SaaS', 'Climate Tech', '
- +
diff --git a/includes/countries.php b/includes/countries.php new file mode 100644 index 0000000..8de66b4 --- /dev/null +++ b/includes/countries.php @@ -0,0 +1,28 @@ +prepare("UPDATE users SET bio = ?, interests = ?, investment_appetite = ?, onboarding_completed = 1 WHERE id = ?"); + $stmt = db()->prepare("UPDATE users SET bio = ?, interests = ?, investment_appetite = ?, country = ?, onboarding_completed = 1 WHERE id = ?"); try { - $stmt->execute([$bio, $interests, $investment_appetite, $_SESSION['user_id']]); + $stmt->execute([$bio, $interests, $investment_appetite, $country, $_SESSION['user_id']]); header("Location: dashboard.php"); exit; } catch (PDOException $e) { @@ -70,6 +72,16 @@ $interests_options = ['Tech', 'Sustainability', 'Healthcare', 'Fintech', 'Educat
+
+ + +
+
diff --git a/profile.php b/profile.php index 5a68fad..9757e5e 100644 --- a/profile.php +++ b/profile.php @@ -19,6 +19,11 @@ if (!$target_user) { } $is_own_profile = ($current_user_id == $target_user_id); + +$stmt_current = db()->prepare("SELECT role FROM users WHERE id = ?"); +$stmt_current->execute([$current_user_id]); +$current_user = $stmt_current->fetch(); + $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; // Fetch target user's startups if they are a founder @@ -106,13 +111,18 @@ if ($target_user['role'] === 'founder') {
- -
+
+ Message -
- + + + + Download CV + + +
@@ -127,7 +137,7 @@ if ($target_user['role'] === 'founder') {
Location
-
+
@@ -202,4 +212,4 @@ if ($target_user['role'] === 'founder') { - + \ No newline at end of file diff --git a/seed_data.php b/seed_data.php index 5e725b9..e9bb3b2 100644 --- a/seed_data.php +++ b/seed_data.php @@ -38,7 +38,8 @@ $founders = [ 'graduation_year' => 2018, 'bio' => 'Former software engineer at Google with a passion for logistics and AI.', 'interests' => 'AI, Logistics, E-commerce', - 'country' => 'USA', + 'country' => 'United States of America', + 'cv_url' => 'assets/docs/cvs/placeholder.pdf', 'skills' => 'Python, TensorFlow, Cloud Architecture', 'years_experience' => 5, 'previous_startup_exp' => 1, @@ -72,7 +73,8 @@ $founders = [ 'graduation_year' => 2015, 'bio' => 'Marine biologist turned entrepreneur.', 'interests' => 'Sustainability, Marine Biology', - 'country' => 'UK', + 'country' => 'United Kingdom', + 'cv_url' => 'assets/docs/cvs/placeholder.pdf', 'skills' => 'Biochemistry, Product Development', 'years_experience' => 8, 'previous_startup_exp' => 0, @@ -107,6 +109,7 @@ $founders = [ 'bio' => 'Finance veteran with 10 years in investment banking.', 'interests' => 'Fintech, Banking, Blockchain', 'country' => 'Italy', + 'cv_url' => 'assets/docs/cvs/placeholder.pdf', 'skills' => 'Financial Modeling, Compliance', 'years_experience' => 12, 'previous_startup_exp' => 1, @@ -151,12 +154,12 @@ $investors = [ 'bio' => 'Angel investor with a background in SaaS.', 'interests' => 'SaaS, B2B', 'investment_appetite' => '$50k - $250k', - 'country' => 'USA' + 'country' => 'United States of America' ] ]; -$stmt_user = $db->prepare("INSERT INTO users (full_name, email, password, role, university, graduation_year, bio, interests, country, skills, years_experience, previous_startup_exp, investment_appetite, verified, onboarding_completed) - VALUES (:full_name, :email, :password, :role, :university, :graduation_year, :bio, :interests, :country, :skills, :years_experience, :previous_startup_exp, :investment_appetite, 1, 1)"); +$stmt_user = $db->prepare("INSERT INTO users (full_name, email, password, role, university, graduation_year, bio, interests, country, cv_url, skills, years_experience, previous_startup_exp, investment_appetite, verified, onboarding_completed) + VALUES (:full_name, :email, :password, :role, :university, :graduation_year, :bio, :interests, :country, :cv_url, :skills, :years_experience, :previous_startup_exp, :investment_appetite, 1, 1)"); $stmt_startup = $db->prepare("INSERT INTO startups ( name, description, founder_id, funding_target, status, @@ -171,10 +174,19 @@ $stmt_startup = $db->prepare("INSERT INTO startups ( :cofounder_equity_pct, :cofounder_equity_type, :cofounder_responsibilities, :desired_cofounder_experience, :cofounder_commitment, :other_partnership_details, :current_cash_balance, :burn_rate, :outstanding_debt, :accounts_receivable_payable, 'assets/docs/financials/placeholder.pdf', 'assets/docs/financials/placeholder.pdf', 'assets/docs/financials/placeholder.pdf', 'assets/docs/financials/placeholder.pdf', 'assets/docs/financials/placeholder.pdf', 'assets/docs/financials/placeholder.pdf', - :recommended_return_rate, :founder_return_rate"); + :recommended_return_rate, :founder_return_rate)"); $stmt_round = $db->prepare("INSERT INTO funding_rounds (startup_id, funding_goal, status) VALUES (:startup_id, :funding_goal, 'Active')"); +// Create CV directory if not exists +if (!is_dir('assets/docs/cvs/')) { + mkdir('assets/docs/cvs/', 0777, true); +} +// Create placeholder CV if not exists +if (!file_exists('assets/docs/cvs/placeholder.pdf')) { + file_put_contents('assets/docs/cvs/placeholder.pdf', '%PDF-1.4 Placeholder CV'); +} + echo "Seeding founders...\n"; foreach ($founders as $f) { $stmt_user->execute([ @@ -187,6 +199,7 @@ foreach ($founders as $f) { ':bio' => $f['bio'], ':interests' => $f['interests'], ':country' => $f['country'], + ':cv_url' => $f['cv_url'] ?? NULL, ':skills' => $f['skills'], ':years_experience' => $f['years_experience'], ':previous_startup_exp' => $f['previous_startup_exp'], @@ -226,7 +239,7 @@ foreach ($founders as $f) { ':startup_id' => $startup_id, ':funding_goal' => $f['funding_target'] ]); - echo "Created founder {$f['full_name']} and startup {$f['startup_name']}\n"; + echo "Created founder {" . $f['full_name'] . "} and startup {" . $f['startup_name'] . "}\n"; } } @@ -242,13 +255,14 @@ foreach ($investors as $i) { ':bio' => $i['bio'], ':interests' => $i['interests'], ':country' => $i['country'], + ':cv_url' => NULL, ':skills' => NULL, ':years_experience' => 0, ':previous_startup_exp' => 0, ':investment_appetite' => $i['investment_appetite'] ]); if ($db->lastInsertId()) { - echo "Created investor {$i['full_name']}\n"; + echo "Created investor {" . $i['full_name'] . "}\n"; } }