From 98fedc4d56c04a25c31b304beca0b77ae83c54a1 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sat, 28 Feb 2026 22:09:11 +0000 Subject: [PATCH] v46 --- startup_details.php | 133 +++++++++++++++++++++++++++++++++++++++- startups.php | 59 +++++++++++++++++- update_round_status.php | 42 +++++++++++++ 3 files changed, 231 insertions(+), 3 deletions(-) create mode 100644 update_round_status.php diff --git a/startup_details.php b/startup_details.php index 0d706bd..2d5f832 100644 --- a/startup_details.php +++ b/startup_details.php @@ -40,7 +40,7 @@ if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) { die("You do not have permission to view this profile."); } -// Fetch funding history if investor +// Fetch funding history $canSeeHistory = $isFounder || $isInvestor; $fundingHistory = []; if ($canSeeHistory) { @@ -55,6 +55,19 @@ if ($canSeeHistory) { $fundingHistory = $stmt->fetchAll(); } +// Fetch approved investments for dividends calculation (Founder only) +$approvedInvestments = []; +if ($isFounder) { + $stmt = db()->prepare(" + SELECT i.*, u.full_name as investor_name + FROM investments i + JOIN users u ON i.investor_id = u.id + WHERE i.startup_id = ? AND i.status = 'approved' + "); + $stmt->execute([$startupId]); + $approvedInvestments = $stmt->fetchAll(); +} + // Fetch founders $stmt = db()->prepare("SELECT id, full_name as name FROM users WHERE id = ?"); $stmt->execute([$startup['founder_id']]); @@ -66,6 +79,33 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $goal = $startup['active_goal'] ?: 0; $raised = $startup['active_raised'] ?: 0; $progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0; + +/** + * Helper to calculate time left for next dividend + */ +function getNextDividendInfo($createdAt) { + $created = new DateTime($createdAt); + $day = $created->format('d'); + + $now = new DateTime(); + $thisMonth = new DateTime($now->format('Y-m-') . $day); + + // If today is past the day, next is next month + if ($thisMonth <= $now) { + $next = clone $thisMonth; + $next->modify('+1 month'); + } else { + $next = $thisMonth; + } + + $interval = $now->diff($next); + $days = $interval->days; + + return [ + 'date' => $next->format('M d, Y'), + 'days_left' => $days + ]; +} ?> @@ -155,6 +195,44 @@ $progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0; box-shadow: 0 0 15px rgba(0, 242, 255, 0.3); border-radius: 100px; } + .dividend-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: 15px; + background: rgba(255,255,255,0.02); + border-radius: 16px; + border: 1px solid var(--border-color); + margin-bottom: 10px; + } + .btn-status-small { + padding: 10px 15px; + font-size: 12px; + font-weight: 700; + border-radius: 10px; + border: 1px solid transparent; + cursor: pointer; + transition: all 0.2s; + display: flex; + align-items: center; + gap: 6px; + background: transparent; + text-decoration: none; + } + .btn-cancel-small { + border-color: rgba(255, 59, 48, 0.3); + color: #ff3b30; + } + .btn-cancel-small:hover { + background: rgba(255, 59, 48, 0.1); + } + .btn-finish-small { + border-color: rgba(48, 209, 88, 0.3); + color: #30d158; + } + .btn-finish-small:hover { + background: rgba(48, 209, 88, 0.1); + } @@ -191,6 +269,12 @@ $progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0;
+ +
+ Round status updated successfully! +
+ +
@@ -246,6 +330,53 @@ $progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0;
£
+ + +
+
+ + + +
+
+ + + +
+
+ + + + + + +
+

Monthly Dividends Due

+
+

Track upcoming monthly payments to your investors based on your % offered return.

+
+ + +
+
+
+
Invested £
+
+
+
£
+
+ days left +
+
+
+
diff --git a/startups.php b/startups.php index f5d99e4..ca57218 100644 --- a/startups.php +++ b/startups.php @@ -28,7 +28,7 @@ $stmt->execute(); $trendingIds = $stmt->fetchAll(PDO::FETCH_COLUMN); $stmt = db()->prepare(" - SELECT s.*, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status + SELECT s.*, fr.id as round_id, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status FROM startups s LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active' WHERE s.founder_id = ? @@ -72,6 +72,36 @@ $myStartups = $stmt->fetchAll(); 50% { transform: scale(1.05); } 100% { transform: scale(1); } } + .btn-status { + padding: 8px 12px; + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + border-radius: 8px; + border: 1px solid transparent; + cursor: pointer; + transition: all 0.2s; + flex: 1; + display: flex; + align-items: center; + justify-content: center; + gap: 5px; + background: transparent; + } + .btn-cancel { + border-color: rgba(255, 59, 48, 0.3); + color: #ff3b30; + } + .btn-cancel:hover { + background: rgba(255, 59, 48, 0.1); + } + .btn-finish { + border-color: rgba(48, 209, 88, 0.3); + color: #30d158; + } + .btn-finish:hover { + background: rgba(48, 209, 88, 0.1); + } @@ -115,6 +145,12 @@ $myStartups = $stmt->fetchAll(); List New Startup
+ +
+ Round status updated successfully! +
+ +
@@ -153,9 +189,28 @@ $myStartups = $stmt->fetchAll(); £ Raised %
-
+
+ + +
+
+ + + +
+
+ + + +
+
+
diff --git a/update_round_status.php b/update_round_status.php new file mode 100644 index 0000000..a341502 --- /dev/null +++ b/update_round_status.php @@ -0,0 +1,42 @@ +prepare(" + SELECT fr.*, s.founder_id + FROM funding_rounds fr + JOIN startups s ON fr.startup_id = s.id + WHERE fr.id = ? +"); +$stmt->execute([$round_id]); +$round = $stmt->fetch(); + +if (!$round || $round['founder_id'] != $user_id) { + die("Unauthorized action."); +} + +// Update the round status +$stmt = db()->prepare("UPDATE funding_rounds SET status = ? WHERE id = ?"); +$stmt->execute([$status, $round_id]); + +// If closed/cancelled, we should also ensure the startup status is updated if needed, +// though the app uses funding_rounds status for 'Active' logic. +// In startups.php, it checks: LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active' + +header('Location: startups.php?success=status_updated'); +exit;