78 lines
2.7 KiB
PHP
78 lines
2.7 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
include 'header.php';
|
|
|
|
if (!isset($_GET['plan_id'])) {
|
|
header('Location: /#plans');
|
|
exit;
|
|
}
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("SELECT * FROM plans WHERE id = ?");
|
|
$stmt->execute([$_GET['plan_id']]);
|
|
$plan = $stmt->fetch();
|
|
|
|
if (!$plan) {
|
|
// Plan not found
|
|
header('Location: /#plans');
|
|
exit;
|
|
}
|
|
?>
|
|
<div class="container mt-5">
|
|
<div class="row">
|
|
<div class="col-md-8 offset-md-2">
|
|
<h1 class="mb-4">Complete Your Order</h1>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<h4 class="card-title">Your Plan</h4>
|
|
<h5><?php echo htmlspecialchars($plan['name']); ?></h5>
|
|
<p class="price fs-4">$<?php echo htmlspecialchars(number_format($plan['price_monthly'], 2)); ?><span class="period">/mo</span></p>
|
|
<p><?php echo htmlspecialchars($plan['description']); ?></p>
|
|
</div>
|
|
</div>
|
|
|
|
<h4 class="mb-3">Your Details</h4>
|
|
<form id="signup-form" data-plan-id="<?php echo $plan['id']; ?>">
|
|
<!-- User details form -->
|
|
<div class="mb-3">
|
|
<label for="name" class="form-label">Full Name</label>
|
|
<input type="text" id="name" class="form-control" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="email" class="form-label">Email Address</label>
|
|
<input type="email" id="email" class="form-control" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="address" class="form-label">Service Address</label>
|
|
<input type="text" id="address" class="form-control" required>
|
|
</div>
|
|
|
|
<h4 class="mb-3 mt-4">Payment Details</h4>
|
|
<!-- Stripe Payment Element will go here -->
|
|
<div id="payment-element" class="mb-3"></div>
|
|
|
|
<!-- Used to display form errors -->
|
|
<div id="payment-message" class="hidden"></div>
|
|
|
|
<button id="submit" class="btn btn-primary btn-lg w-100">
|
|
<span id="button-text">Pay Now</span>
|
|
<span id="spinner" style="display: none;">Processing...</span>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://js.stripe.com/v3/"></script>
|
|
<script>
|
|
// Pass plan details to JS
|
|
const planDetails = {
|
|
id: <?php echo json_encode($plan['id']); ?>,
|
|
price: <?php echo json_encode($plan['price_monthly']); ?>
|
|
};
|
|
</script>
|
|
<script src="assets/js/signup.js?v=<?php echo time(); ?>"></script>
|
|
|
|
<?php include 'footer.php'; ?>
|