v25
This commit is contained in:
parent
306361e5fb
commit
03c203ff92
@ -67,8 +67,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
||||
$title = $_POST['update_title'] ?? '';
|
||||
$content = $_POST['update_content'] ?? '';
|
||||
if ($title && $content) {
|
||||
$stmt = db()->prepare("INSERT INTO startup_updates (startup_id, title, content) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$startup_id, $title, $content]);
|
||||
// FIX: Added founder_id to the query to avoid 500 error
|
||||
$stmt = db()->prepare("INSERT INTO startup_updates (startup_id, founder_id, title, content) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([$startup_id, $user_id, $title, $content]);
|
||||
|
||||
// Notify followers
|
||||
$stmt = db()->prepare("SELECT user_id FROM startup_followers WHERE startup_id = ?");
|
||||
@ -200,10 +201,10 @@ if ($canSeeHistory) {
|
||||
|
||||
<main class="container" style="padding-top: 50px; padding-bottom: 50px;">
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger" style="margin-bottom: 30px;"><?= htmlspecialchars($error) ?></div>
|
||||
<div class="alert alert-danger" style="margin-bottom: 30px; padding: 15px; border-radius: 12px; background: rgba(255,77,77,0.1); border: 1px solid rgba(255,77,77,0.2); color: #ff4d4d;"><?= htmlspecialchars($error) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="alert alert-success" style="margin-bottom: 30px;"><?= htmlspecialchars($success) ?></div>
|
||||
<div class="alert alert-success" style="margin-bottom: 30px; padding: 15px; border-radius: 12px; background: rgba(0,242,255,0.1); border: 1px solid rgba(0,242,255,0.2); color: var(--accent-blue);"><?= htmlspecialchars($success) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div style="display: grid; grid-template-columns: 2fr 1.2fr; gap: 40px;">
|
||||
@ -216,14 +217,14 @@ if ($canSeeHistory) {
|
||||
<h1 style="margin: 0; font-size: 36px;"><?= htmlspecialchars($startup['name']) ?></h1>
|
||||
<div style="color: var(--text-secondary); display: flex; align-items: center; gap: 10px;">
|
||||
<span><i class="fas fa-calendar-alt"></i> Founded <?= date('M Y', strtotime($startup['created_at'])) ?></span>
|
||||
<span class="badge"><?= ucfirst($startup['status']) ?></span>
|
||||
<span class="badge" style="background: var(--accent-blue); color: #000; padding: 4px 10px; border-radius: 50px; font-size: 11px; font-weight: 700; text-transform: uppercase;"><?= ucfirst($startup['status']) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($startup['founder_id'] != $user_id): ?>
|
||||
<form method="POST">
|
||||
<?php if ($isFollowing): ?>
|
||||
<input type="hidden" name="action" value="unfollow">
|
||||
<button type="submit" class="btn btn-outline" style="border-radius: 50px; padding: 10px 25px;"><i class="fas fa-check"></i> Following</button>
|
||||
<button type="submit" class="btn btn-secondary" style="border-radius: 50px; padding: 10px 25px;"><i class="fas fa-check"></i> Following</button>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="action" value="follow">
|
||||
<button type="submit" class="btn btn-primary" style="border-radius: 50px; padding: 10px 25px;"><i class="fas fa-plus"></i> Follow</button>
|
||||
@ -281,30 +282,45 @@ if ($canSeeHistory) {
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="card" style="margin-bottom: 40px;">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
||||
<h2 style="margin: 0;">Public Updates</h2>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
|
||||
<h2 style="margin: 0; font-size: 28px; font-weight: 800;">Public Updates</h2>
|
||||
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
||||
<button class="btn btn-outline" onclick="document.getElementById('postUpdateForm').style.display='block'">Post Update</button>
|
||||
<button class="btn btn-primary" onclick="document.getElementById('postUpdateForm').style.display='block'" style="padding: 10px 20px; font-size: 14px;">
|
||||
<i class="fas fa-plus"></i> New Update
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($user['role'] === 'founder' && $startup['founder_id'] == $user_id): ?>
|
||||
<div id="postUpdateForm" style="display: none; background: rgba(255,255,255,0.02); padding: 25px; border-radius: 15px; margin-bottom: 30px; border: 1px solid var(--border-color);">
|
||||
<h4 style="margin-top: 0;">New Progress Report</h4>
|
||||
<div id="postUpdateForm" style="display: none; background: rgba(255,255,255,0.03); padding: 35px; border-radius: 24px; margin-bottom: 40px; border: 1px solid var(--glass-border); backdrop-filter: blur(10px);">
|
||||
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 25px;">
|
||||
<div style="width: 40px; height: 40px; background: var(--gradient-primary); border-radius: 12px; display: flex; align-items: center; justify-content: center;">
|
||||
<i class="fas fa-bullhorn" style="color: #fff;"></i>
|
||||
</div>
|
||||
<h3 style="margin: 0; font-size: 22px;">Share Progress</h3>
|
||||
</div>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="action" value="post_update">
|
||||
<div class="form-group" style="margin-bottom: 15px;">
|
||||
<label>Title</label>
|
||||
<input type="text" name="update_title" class="form-control" placeholder="e.g. Prototype Finished!" required style="background: var(--surface-color); color: #fff; border: 1px solid var(--border-color);">
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label style="display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;">Update Title</label>
|
||||
<input type="text" name="update_title" required placeholder="e.g., Major Milestone: Beta Launch"
|
||||
style="width: 100%; padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); border-radius: 14px; color: #fff; font-family: inherit; font-size: 16px; outline: none; transition: border-color 0.3s;"
|
||||
onfocus="this.style.borderColor='var(--accent-blue)'" onblur="this.style.borderColor='var(--border-color)'">
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom: 15px;">
|
||||
<label>What's happening?</label>
|
||||
<textarea name="update_content" class="form-control" rows="5" placeholder="Share your progress with backers and followers..." required style="background: var(--surface-color); color: #fff; border: 1px solid var(--border-color);"></textarea>
|
||||
<div style="margin-bottom: 25px;">
|
||||
<label style="display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;">Content</label>
|
||||
<textarea name="update_content" rows="6" required placeholder="Tell your investors and followers what's new..."
|
||||
style="width: 100%; padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); border-radius: 14px; color: #fff; font-family: inherit; font-size: 16px; line-height: 1.6; outline: none; transition: border-color 0.3s; resize: vertical;"
|
||||
onfocus="this.style.borderColor='var(--accent-blue)'" onblur="this.style.borderColor='var(--border-color)'"></textarea>
|
||||
</div>
|
||||
<div style="display: flex; gap: 15px;">
|
||||
<button type="submit" class="btn btn-primary" style="flex: 2; padding: 16px; font-weight: 700;">Post & Notify Everyone</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="document.getElementById('postUpdateForm').style.display='none'" style="flex: 1; padding: 16px;">Cancel</button>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Post & Notify Everyone</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="document.getElementById('postUpdateForm').style.display='none'">Cancel</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$stmt = db()->prepare("SELECT * FROM startup_updates WHERE startup_id = ? ORDER BY created_at DESC");
|
||||
$stmt->execute([$startup_id]);
|
||||
@ -315,11 +331,11 @@ if ($canSeeHistory) {
|
||||
<?php else: ?>
|
||||
<?php foreach ($updates as $upd): ?>
|
||||
<div style="border-bottom: 1px solid var(--border-color); padding-bottom: 25px; margin-bottom: 25px;">
|
||||
<h4 style="margin: 0 0 10px 0;"><?= htmlspecialchars($upd['title']) ?></h4>
|
||||
<h4 style="margin: 0 0 10px 0; font-size: 20px;"><?= htmlspecialchars($upd['title']) ?></h4>
|
||||
<div style="font-size: 13px; color: var(--text-secondary); margin-bottom: 15px;">
|
||||
<i class="fas fa-clock"></i> Posted on <?= date('M d, Y', strtotime($upd['created_at'])) ?>
|
||||
</div>
|
||||
<p style="color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap;"><?= htmlspecialchars($upd['content']) ?></p>
|
||||
<p style="color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; font-size: 16px;"><?= htmlspecialchars($upd['content']) ?></p>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
@ -381,11 +397,11 @@ if ($canSeeHistory) {
|
||||
<div style="display: flex; flex-direction: column; gap: 10px;">
|
||||
<form method="POST" onsubmit="return confirm('Are you sure you want to finish this round early? Future investments will be disabled until you start a new round.')">
|
||||
<input type="hidden" name="action" value="finish_round">
|
||||
<button type="submit" class="btn btn-outline" style="width: 100%; border-color: var(--accent-blue); color: var(--accent-blue);"><i class="fas fa-check-circle"></i> Finish Round Early</button>
|
||||
<button type="submit" class="btn btn-secondary" style="width: 100%; border-color: var(--accent-blue); color: var(--accent-blue);"><i class="fas fa-check-circle"></i> Finish Round Early</button>
|
||||
</form>
|
||||
<form method="POST" onsubmit="return confirm('DANGER: This will cancel the current round and mark all investments as REFUNDED. This cannot be undone. Proceed?')">
|
||||
<input type="hidden" name="action" value="cancel_round">
|
||||
<button type="submit" class="btn btn-outline" style="width: 100%; border-color: #ff5555; color: #ff5555;"><i class="fas fa-times-circle"></i> Cancel & Refund All</button>
|
||||
<button type="submit" class="btn btn-secondary" style="width: 100%; border-color: #ff5555; color: #ff5555;"><i class="fas fa-times-circle"></i> Cancel & Refund All</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -435,4 +451,4 @@ if ($canSeeHistory) {
|
||||
|
||||
<script src="assets/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user