diff --git a/create_startup.php b/create_startup.php
index 057a98b..13e802a 100644
--- a/create_startup.php
+++ b/create_startup.php
@@ -126,7 +126,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
cofounder_equity_pct = ?, cofounder_equity_type = ?, cofounder_responsibilities = ?, desired_cofounder_experience = ?, cofounder_commitment = ?, other_partnership_details = ?,
current_cash_balance = ?, burn_rate = ?,
doc_income_statements = ?, doc_balance_sheets = ?, doc_cash_flow_statements = ?, doc_revenue_breakdown = ?, doc_gross_margin = ?,
- recommended_return_rate = ?, recommended_return_reasoning = ?, founder_return_rate = ?
+ recommended_return_rate = ?, recommended_return_reasoning = ?, founder_return_rate = ?, repayment_term = ?
WHERE id = ? AND founder_id = ?");
$stmt->execute([
@@ -135,7 +135,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$current_cash_balance, $burn_rate,
$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'],
- $recommended_return_rate, $recommended_return_reasoning, $founder_return_rate,
+ $recommended_return_rate, $recommended_return_reasoning, $founder_return_rate, $repayment_term,
$existingStartup['id'], $_SESSION['user_id']
]);
$final_id = $existingStartup['id'];
@@ -145,7 +145,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
cofounder_equity_pct, cofounder_equity_type, cofounder_responsibilities, desired_cofounder_experience, cofounder_commitment, other_partnership_details,
current_cash_balance, burn_rate,
doc_income_statements, doc_balance_sheets, doc_cash_flow_statements, doc_revenue_breakdown, doc_gross_margin,
- founder_id, recommended_return_rate, recommended_return_reasoning, founder_return_rate, status
+ founder_id, recommended_return_rate, recommended_return_reasoning, founder_return_rate, repayment_term, status
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'private')");
$stmt->execute([
@@ -290,6 +290,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+
+
+ " min="1" max="60" required style="width: 100%; padding: 12px; border-radius: 8px; background: #222; border: 1px solid var(--accent-color); color: #fff; font-size: 16px; font-weight: 700;">
+ The duration over which you will repay the investment plus interest.
+
Your proposed annual dividend yield. The platform also computes a recommendation based on your financials.
diff --git a/dashboard.php b/dashboard.php
index c0ddad0..3a192c9 100644
--- a/dashboard.php
+++ b/dashboard.php
@@ -6,6 +6,8 @@ if (!isset($_SESSION['user_id'])) {
}
require_once __DIR__ . '/db/config.php';
+require_once __DIR__ . "/sync_funding.php";
+syncRepayments();
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
@@ -17,14 +19,12 @@ if (!$user) {
exit;
}
-// Security: Check if verified
if ($user['verified'] == 0) {
session_destroy();
header("Location: login.php?error=not_verified");
exit;
}
-// Check if onboarding is complete
if ($user['role'] === 'founder' && $user['onboarding_completed'] == 0) {
header("Location: founder_onboarding.php");
exit;
@@ -32,10 +32,7 @@ if ($user['role'] === 'founder' && $user['onboarding_completed'] == 0) {
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
-// Identify Trending Startups (Top 3 in followers or funding)
$trendingIds = [];
-
-// Top 3 Followed
$stmt = db()->prepare("
SELECT s.id
FROM startups s
@@ -48,7 +45,6 @@ $stmt->execute();
$topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN);
$trendingIds = array_merge($trendingIds, $topFollowed);
-// Top 3 Funded (Total)
$stmt = db()->prepare("
SELECT id
FROM startups
@@ -59,9 +55,15 @@ $stmt->execute();
$topFunded = $stmt->fetchAll(PDO::FETCH_COLUMN);
$trendingIds = array_unique(array_merge($trendingIds, $topFunded));
-// Fetch user's data based on role
$myStartups = [];
$myInvestments = [];
+$repaymentSummary = [
+ 'total_raised' => 0,
+ 'total_obligation' => 0,
+ 'monthly_outgoing' => 0,
+ 'active_investors' => 0,
+ 'next_payment_date' => null
+];
if ($user['role'] === 'founder') {
$stmt = db()->prepare("
@@ -73,6 +75,21 @@ if ($user['role'] === 'founder') {
");
$stmt->execute([$_SESSION['user_id']]);
$myStartups = $stmt->fetchAll();
+
+ // Repayment Summary Calculation
+ $stmt = db()->prepare("
+ SELECT
+ SUM(i.amount) as total_raised,
+ SUM(i.total_return) as total_obligation,
+ SUM(CASE WHEN i.status = 'approved' THEN i.monthly_dividend ELSE 0 END) as monthly_outgoing,
+ COUNT(DISTINCT CASE WHEN i.status = 'approved' THEN i.investor_id END) as active_investors,
+ MIN(CASE WHEN i.status = 'approved' THEN i.next_payment_date END) as next_payment_date
+ FROM investments i
+ JOIN startups s ON i.startup_id = s.id
+ WHERE s.founder_id = ?
+ ");
+ $stmt->execute([$_SESSION['user_id']]);
+ $repaymentSummary = $stmt->fetch();
} else {
$stmt = db()->prepare("SELECT i.*, s.name as startup_name FROM investments i JOIN startups s ON i.startup_id = s.id WHERE i.investor_id = ? ORDER BY i.created_at DESC");
$stmt->execute([$_SESSION['user_id']]);
@@ -104,8 +121,6 @@ function number_get_formatted($num) {
.profile-link-card:hover {
transform: translateY(-2px);
}
-
- /* Modal Styles */
.modal {
display: none;
position: fixed;
@@ -117,6 +132,26 @@ function number_get_formatted($num) {
background-color: rgba(0,0,0,0.9);
backdrop-filter: blur(4px);
}
+ .repayment-stat-card {
+ background: rgba(255,255,255,0.03);
+ border: 1px solid var(--border-color);
+ border-radius: 16px;
+ padding: 20px;
+ text-align: left;
+ }
+ .repayment-stat-label {
+ font-size: 11px;
+ text-transform: uppercase;
+ letter-spacing: 1px;
+ color: var(--text-secondary);
+ font-weight: 700;
+ margin-bottom: 8px;
+ }
+ .repayment-stat-value {
+ font-size: 20px;
+ font-weight: 900;
+ color: #fff;
+ }
@@ -167,6 +202,35 @@ function number_get_formatted($num) {
Your command center for the next big thing.
+
+
+
+
Funding & Repayment Overview
+
+
+
Total Raised
+
£= number_format($repaymentSummary['total_raised'] ?? 0, 0) ?>
+
+
+
Total Obligation
+
£= number_format($repaymentSummary['total_obligation'] ?? 0, 0) ?>
+
+
+
Monthly Outgoing
+
£= number_format($repaymentSummary['monthly_outgoing'] ?? 0, 0) ?>
+
+
+
Active Investors
+
= $repaymentSummary['active_investors'] ?? 0 ?>
+
+
+
Next Due Date
+
= $repaymentSummary['next_payment_date'] ? date('M d, Y', strtotime($repaymentSummary['next_payment_date'])) : 'None' ?>
+
+
+
+
+
@@ -433,7 +497,6 @@ function updateRound(roundId, status) {
}
}
-// Close modal when clicking outside
window.onclick = function(event) {
const modal = document.getElementById('wallet-modal');
if (event.target == modal) {
@@ -443,4 +506,4 @@ window.onclick = function(event) {
-