64 lines
2.8 KiB
PHP
64 lines
2.8 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT * FROM plans ORDER BY price ASC');
|
|
$plans = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
?>
|
|
|
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
|
<h1 class="h2">Subscription Plans</h1>
|
|
<div class="btn-toolbar mb-2 mb-md-0">
|
|
<a href="create_plan.php" class="btn btn-sm btn-primary">
|
|
<i class="bi bi-plus-circle"></i>
|
|
Add New Plan
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<?php if (empty($plans)): ?>
|
|
<div class="col-12">
|
|
<div class="text-center py-5">
|
|
<i class="bi bi-tags" style="font-size: 4rem; color: #ccc;"></i>
|
|
<h2 class="mt-4">No Plans Found</h2>
|
|
<p class="text-muted">Please add subscription plans to see them here.</p>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($plans as $plan): ?>
|
|
<div class="col-md-4 mb-4">
|
|
<div class="card h-100 shadow-sm">
|
|
<div class="card-header text-center">
|
|
<h4 class="my-0 fw-normal"><?php echo htmlspecialchars($plan['name']); ?></h4>
|
|
</div>
|
|
<div class="card-body d-flex flex-column">
|
|
<h1 class="card-title pricing-card-title text-center">$<?php echo number_format($plan['price'], 2); ?><small class="text-muted fw-light">/<?php echo htmlspecialchars($plan['billing_cycle']); ?></small></h1>
|
|
<ul class="list-unstyled mt-3 mb-4 flex-grow-1">
|
|
<?php
|
|
$features = json_decode($plan['features'], true);
|
|
if ($features) {
|
|
foreach ($features as $feature) {
|
|
echo '<li><i class="bi bi-check-circle-fill text-success me-2"></i>' . htmlspecialchars($feature) . '</li>';
|
|
}
|
|
}
|
|
?>
|
|
</ul>
|
|
<div class="mt-auto">
|
|
<div class="d-flex justify-content-center gap-2">
|
|
<a href="edit_plan.php?id=<?php echo $plan['id']; ?>" class="btn btn-sm btn-outline-secondary w-100"><i class="bi bi-pencil"></i> Edit</a>
|
|
<a href="delete_plan.php?id=<?php echo $plan['id']; ?>" class="btn btn-sm btn-outline-danger w-100" onclick="return confirm('Are you sure you want to delete this plan?');"><i class="bi bi-trash"></i> Delete</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php
|
|
require_once 'templates/footer.php';
|
|
?>
|