stripe card
This commit is contained in:
@@ -377,6 +377,27 @@ class SubscriptionPageView(TemplateView):
|
||||
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context = super().get_context_data(**kwargs)
|
||||
request = self.request
|
||||
if request.user.is_authenticated:
|
||||
print("request.user: ", request.user)
|
||||
if request.user.principal_type.name == "event_user":
|
||||
subscription_id = 1
|
||||
elif request.user.principal_type.name == "event_manager":
|
||||
subscription_id = 2
|
||||
else:
|
||||
subscription_id = None
|
||||
|
||||
if subscription_id is not None:
|
||||
subscription = Subscription.objects.get(id=subscription_id)
|
||||
context['subscription_amount'] = subscription.amount
|
||||
else:
|
||||
# Handle error or default case
|
||||
context['error'] = "Invalid principal type or subscription not found."
|
||||
return context
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
def stripe_config(request):
|
||||
|
||||
@@ -597,6 +597,16 @@
|
||||
margin-top: 90px;
|
||||
}
|
||||
|
||||
.gold-text {
|
||||
color: rgb(209 170 88);
|
||||
}
|
||||
.feat-card {
|
||||
border: 1px solid #d1aa588c;
|
||||
padding: 18px;
|
||||
width: 300px;
|
||||
border-radius: 6px;
|
||||
background-color: #00000080;
|
||||
}
|
||||
|
||||
/* mediascreen */
|
||||
@media (max-width: 1199px) {
|
||||
@@ -711,9 +721,9 @@
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
.baner-section .store-app {
|
||||
/* .baner-section .store-app {
|
||||
justify-content: center;
|
||||
}
|
||||
} */
|
||||
|
||||
.baner-btn {
|
||||
text-align: center;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{% load static %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@@ -12,6 +13,9 @@
|
||||
<link rel="stylesheet" href="{% static 'src/assets/css/payment/style.css' %}">
|
||||
<title>Good times</title>
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -70,38 +74,37 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Button trigger modal -->
|
||||
<!-- <div class="baner-btn">
|
||||
<button class="common-btn">Join now</button>
|
||||
</div> -->
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal-body">
|
||||
<div class="your-plan">
|
||||
<div class="your-plans-main">
|
||||
<div class="monthly-div-main">
|
||||
<div class="monthly-div">
|
||||
<p class="your-heading">Monthly</p>
|
||||
<p class="your-subheading">$5.55 /<span> month</span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="your-plans-btn">
|
||||
<!-- <button class="common-btn" id="submitBtn">Subscribe</button> -->
|
||||
<button class="common-btn" id="submitBtn">Join now</button>
|
||||
</div>
|
||||
<!-- <div class="container d-flex justify-content-center align-items-center"
|
||||
style="min-height: 100vh; background-color: #1a1a1a;"> -->
|
||||
<!-- Dark background for the overall page -->
|
||||
<div class="feat-card">
|
||||
<div class="card text-center mb-2">
|
||||
<!-- Dark card with gold border -->
|
||||
<h5 class="gold-text mb-0 p-1" style="background-color: #f1d59f6e;">Subscription Details
|
||||
</div>
|
||||
<div class="card-body mb-2 text-center"> <!-- Golden text for the body -->
|
||||
<!-- Assuming you have a variable named subscription_amount accessible in your template. Replace accordingly. -->
|
||||
<h5 class="card-title gold-text">Subscription Amount </h5>
|
||||
<div class="text-center">
|
||||
<p class="gold-text mb-0">£ {{ subscription_amount }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Adventure-btn text-center">
|
||||
<button class="common-btn" id="submitBtn">Join now</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="baner-img" data-aos="zoom-in-up" data-aos-duration="1000">
|
||||
<img loading="lazy" src="{% static '/images/banner-mobile.png' %}" alt>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="baner-img" data-aos="zoom-in-up" data-aos-duration="1000">
|
||||
<img loading="lazy" src="{% static '/images/banner-mobile.png' %}" alt>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div>
|
||||
|
||||
<!-- </div>
|
||||
</div> -->
|
||||
</section>
|
||||
|
||||
@@ -430,6 +433,7 @@
|
||||
// new
|
||||
// Event handler
|
||||
document.querySelector("#submitBtn").addEventListener("click", () => {
|
||||
this.setAttribute('disabled', true);
|
||||
// Get Checkout Session ID
|
||||
fetch("https://goodtimes.betadelivery.com/subscriptions/create-checkout-session/")
|
||||
.then((result) => { return result.json(); })
|
||||
|
||||
Reference in New Issue
Block a user