v72
This commit is contained in:
parent
4f94d39ce7
commit
3f9d35d276
@ -40,6 +40,11 @@ if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) {
|
|||||||
die("You do not have permission to view this profile.");
|
die("You do not have permission to view this profile.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if following
|
||||||
|
$stmt = db()->prepare("SELECT 1 FROM startup_followers WHERE user_id = ? AND startup_id = ?");
|
||||||
|
$stmt->execute([$user_id, $startupId]);
|
||||||
|
$isFollowing = (bool)$stmt->fetch();
|
||||||
|
|
||||||
// Fetch funding history
|
// Fetch funding history
|
||||||
$canSeeHistory = $isFounder || $isInvestor;
|
$canSeeHistory = $isFounder || $isInvestor;
|
||||||
$fundingHistory = [];
|
$fundingHistory = [];
|
||||||
@ -236,6 +241,33 @@ function getNextDividendInfo($createdAt) {
|
|||||||
background-color: rgba(0,0,0,0.9);
|
background-color: rgba(0,0,0,0.9);
|
||||||
backdrop-filter: blur(4px);
|
backdrop-filter: blur(4px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.follow-btn {
|
||||||
|
padding: 16px 24px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-weight: 800;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 14px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
border: 1px solid var(--accent-primary);
|
||||||
|
}
|
||||||
|
.follow-btn.following {
|
||||||
|
background: var(--accent-primary);
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.follow-btn.not-following {
|
||||||
|
background: transparent;
|
||||||
|
color: var(--accent-primary);
|
||||||
|
}
|
||||||
|
.follow-btn:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 15px rgba(0, 255, 128, 0.2);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body style="background: var(--bg-color); color: var(--text-primary);">
|
<body style="background: var(--bg-color); color: var(--text-primary);">
|
||||||
@ -293,6 +325,9 @@ function getNextDividendInfo($createdAt) {
|
|||||||
<span style="color: var(--text-secondary); font-size: 13px;">
|
<span style="color: var(--text-secondary); font-size: 13px;">
|
||||||
<i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($startup['country']) ?>
|
<i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($startup['country']) ?>
|
||||||
</span>
|
</span>
|
||||||
|
<span style="color: var(--text-secondary); font-size: 13px;">
|
||||||
|
<i class="fas fa-users"></i> <span id="follower-count"><?= number_format($startup['followers_count']) ?></span> Followers
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<h1 style="font-size: 48px; font-weight: 900; margin: 0; line-height: 1.1; letter-spacing: -1px;">
|
<h1 style="font-size: 48px; font-weight: 900; margin: 0; line-height: 1.1; letter-spacing: -1px;">
|
||||||
<?= htmlspecialchars($startup['name']) ?>
|
<?= htmlspecialchars($startup['name']) ?>
|
||||||
@ -302,20 +337,27 @@ function getNextDividendInfo($createdAt) {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($isInvestor): ?>
|
|
||||||
<div style="display: flex; gap: 15px;">
|
<div style="display: flex; gap: 15px;">
|
||||||
<a href="messages.php?chat_with=<?= $startup['founder_id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
|
<?php if (!$isFounder): ?>
|
||||||
<i class="far fa-comment-dots"></i> Message Founder
|
<button id="main-follow-btn" class="follow-btn <?= $isFollowing ? 'following' : 'not-following' ?>" onclick="toggleFollow(<?= $startup['id'] ?>)">
|
||||||
</a>
|
<i class="fas <?= $isFollowing ? 'fa-check' : 'fa-plus' ?>"></i>
|
||||||
<a href="invest.php?id=<?= $startup['id'] ?>" class="invest-btn">
|
<span><?= $isFollowing ? 'Following' : 'Follow' ?></span>
|
||||||
<i class="fas fa-rocket"></i> Invest Now
|
</button>
|
||||||
</a>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($isInvestor): ?>
|
||||||
|
<a href="messages.php?chat_with=<?= $startup['founder_id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
|
||||||
|
<i class="far fa-comment-dots"></i> Message Founder
|
||||||
|
</a>
|
||||||
|
<a href="invest.php?id=<?= $startup['id'] ?>" class="invest-btn">
|
||||||
|
<i class="fas fa-rocket"></i> Invest Now
|
||||||
|
</a>
|
||||||
|
<?php elseif ($isFounder): ?>
|
||||||
|
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
|
||||||
|
<i class="fas fa-edit"></i> Edit Profile
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($isFounder): ?>
|
|
||||||
<a href="create_startup.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 16px 24px;">
|
|
||||||
<i class="fas fa-edit"></i> Edit Profile
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($startup['round_status'] === 'Active'): ?>
|
<?php if ($startup['round_status'] === 'Active'): ?>
|
||||||
@ -639,6 +681,47 @@ window.onclick = function(event) {
|
|||||||
closeWalletModal();
|
closeWalletModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleFollow(startupId) {
|
||||||
|
const btn = document.getElementById('main-follow-btn');
|
||||||
|
const icon = btn.querySelector('i');
|
||||||
|
const span = btn.querySelector('span');
|
||||||
|
const countSpan = document.getElementById('follower-count');
|
||||||
|
|
||||||
|
fetch('api/follow_startup.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
body: 'startup_id=' + startupId
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
if (data.action === 'followed') {
|
||||||
|
btn.classList.remove('not-following');
|
||||||
|
btn.classList.add('following');
|
||||||
|
icon.classList.remove('fa-plus');
|
||||||
|
icon.classList.add('fa-check');
|
||||||
|
span.innerText = 'Following';
|
||||||
|
} else {
|
||||||
|
btn.classList.remove('following');
|
||||||
|
btn.classList.add('not-following');
|
||||||
|
icon.classList.remove('fa-check');
|
||||||
|
icon.classList.add('fa-plus');
|
||||||
|
span.innerText = 'Follow';
|
||||||
|
}
|
||||||
|
if (countSpan) {
|
||||||
|
countSpan.innerText = data.followers_count.toLocaleString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert('Error: ' + data.error);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user