my subscriptions page 7
This commit is contained in:
@@ -70,6 +70,11 @@ urlpatterns = [
|
||||
views.PrincipalSubscriptionCreateOrUpdateView.as_view(),
|
||||
name="principal_subscription_edit",
|
||||
),
|
||||
path(
|
||||
"principal_subscription/<int:pk>",
|
||||
views.PrincipalSubscriptionDetailView.as_view(),
|
||||
name="principal_subscription_detail",
|
||||
),
|
||||
path(
|
||||
"principal_subscription/delete/<int:pk>",
|
||||
views.PrincipalSubscriptionDeleteView.as_view(),
|
||||
@@ -92,7 +97,7 @@ urlpatterns = [
|
||||
),
|
||||
path("stripe/", views.SubscriptionPageView.as_view(), name="stripe"),
|
||||
path("active/", views.ActiveSubscriptionView.as_view(), name="active"),
|
||||
path("active/", views.CancelSubscriptionView.as_view(), name="cancel_subscription"),
|
||||
path("cancel-subscription/", views.CancelSubscriptionView.as_view(), name="cancel_subscription"),
|
||||
path("success/", views.SuccessView.as_view(), name="success"),
|
||||
path("cancel/", views.CancelView.as_view(), name="cancel"),
|
||||
# path("join-now/", views.IndexView.as_view(), name="index"),
|
||||
|
||||
@@ -186,7 +186,7 @@ class SubscriptionView(LoginRequiredMixin, generic.ListView):
|
||||
return context
|
||||
|
||||
|
||||
class SubscriptionDetailView(generic.DetailView):
|
||||
class SubscriptionDetailView(LoginRequiredMixin, generic.DetailView):
|
||||
page_name = resource_action.RESOURCE_MANAGE_SUBSCRIPTIONS
|
||||
resource = resource_action.RESOURCE_MANAGE_SUBSCRIPTIONS
|
||||
action = resource_action.ACTION_READ
|
||||
@@ -585,6 +585,20 @@ class PrincipalSubscriptionView(LoginRequiredMixin, generic.ListView):
|
||||
return context
|
||||
|
||||
|
||||
class PrincipalSubscriptionDetailView(LoginRequiredMixin, generic.DetailView):
|
||||
page_name = resource_action.RESOURCE_PRINCIPAL_SUBSCRIPTIONS
|
||||
resource = resource_action.RESOURCE_PRINCIPAL_SUBSCRIPTIONS
|
||||
action = resource_action.ACTION_READ
|
||||
model = PrincipalSubscription
|
||||
template_name = "manage_subscriptions/principal_subscription_details.html"
|
||||
context_object_name = "principal_subscription_obj"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["page_name"] = self.page_name
|
||||
return context
|
||||
|
||||
|
||||
class PrincipalSubscriptionDeleteView(LoginRequiredMixin, generic.View):
|
||||
page_name = resource_action.RESOURCE_MANAGE_SUBSCRIPTIONS
|
||||
resource = resource_action.RESOURCE_MANAGE_SUBSCRIPTIONS
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
{% extends 'layout/base_template.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<!-- Principal Subscription Title and Image -->
|
||||
<div class="col-md-12 mb-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body text-center">
|
||||
{% if principal_subscription_obj.subscription.image %}
|
||||
<img src="{{ principal_subscription_obj.subscription.image.url }}" class="img-fluid rounded mb-3" alt="{{ principal_subscription_obj.subscription.title }}" style="max-height: 200px;">
|
||||
{% endif %}
|
||||
<h3 class="card-title">{{ principal_subscription_obj.subscription.title }}</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Subscription and Principal Info -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card shadow-sm h-100 bg-dark text-light border-gold">
|
||||
<div class="card-header border-bottom-gold">
|
||||
<h5 class="card-title text-gold"><i class="bi bi-info-circle"></i> Subscription Info</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p><strong>Principal:</strong> {{ principal_subscription_obj.principal.first_name }} {{ principal_subscription_obj.principal.last_name }}</p>
|
||||
<p><strong>Status:</strong> {{ principal_subscription_obj.get_status_display }}</p>
|
||||
<p><strong>Start Date:</strong> {{ principal_subscription_obj.start_date }}</p>
|
||||
<p><strong>End Date:</strong> {{ principal_subscription_obj.end_date }}</p>
|
||||
<p><strong>Auto Renew:</strong> {{ principal_subscription_obj.auto_renew|yesno:"Yes,No" }}</p>
|
||||
<p><strong>Cancelled:</strong> {% if principal_subscription_obj.cancelled %}<span class="badge bg-danger">Yes</span>{% else %}<span class="badge bg-success">No</span>{% endif %}</p>
|
||||
|
||||
{% if principal_subscription_obj.coupon_code %}
|
||||
<p><strong>Coupon Code:</strong> {{ principal_subscription_obj.coupon_code }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Cancellation and Payment Info -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card shadow-sm h-100 bg-dark text-light border-gold">
|
||||
<div class="card-header border-bottom-gold">
|
||||
<h5 class="card-title text-gold"><i class="bi bi-credit-card"></i> Cancellation and Payment Info</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p><strong>Order ID:</strong> {{ principal_subscription_obj.order_id|default:"Not Provided" }}</p>
|
||||
<p><strong>Grace Period Ends:</strong> {{ principal_subscription_obj.grace_period_end_date|default:"Not Provided" }}</p>
|
||||
<p><strong>Stripe Subscription ID:</strong> {{ principal_subscription_obj.stripe_subscription_id|default:"Not Provided" }}</p>
|
||||
<p><strong>Comments:</strong> {{ principal_subscription_obj.comments|default:"Not Provided" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Cancellation Button -->
|
||||
{% if principal_subscription_obj.auto_renew and not principal_subscription_obj.cancelled %}
|
||||
<div class="col-md-12 mb-4">
|
||||
<div class="card shadow-sm bg-dark text-light border-gold">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="text-gold">Cancel Subscription</h5>
|
||||
<form method="POST" action="{% url 'manage_subscriptions:cancel_subscription' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="subscription_id" value="{{ principal_subscription_obj.id }}">
|
||||
<button type="submit" class="btn btn-outline-gold">Cancel Subscription</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
<style>
|
||||
.bg-dark {
|
||||
background-color: #000 !important;
|
||||
}
|
||||
.text-light {
|
||||
color: #f8f9fa !important;
|
||||
}
|
||||
.text-gold {
|
||||
color: #d4af37 !important;
|
||||
}
|
||||
.border-gold {
|
||||
border: 2px solid #d4af37 !important;
|
||||
}
|
||||
.border-bottom-gold {
|
||||
border-bottom: 2px solid #d4af37 !important;
|
||||
}
|
||||
.btn-outline-gold {
|
||||
color: #d4af37;
|
||||
border-color: #d4af37;
|
||||
}
|
||||
.btn-outline-gold:hover {
|
||||
background-color: #d4af37;
|
||||
color: #000;
|
||||
}
|
||||
</style>
|
||||
@@ -110,19 +110,13 @@
|
||||
d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z">
|
||||
</path>
|
||||
</svg></a></li>
|
||||
<!-- <li><a href="{% url 'manage_subscriptions:principal_subscription_delete' data_obj.id %}" class="bs-tooltip"
|
||||
data-bs-toggle="tooltip" data-bs-placement="top" title=""
|
||||
data-original-title="Delete" data-bs-original-title="Delete"
|
||||
aria-label="Delete"><svg xmlns="http://www.w3.org/2000/svg"
|
||||
width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round"
|
||||
class="feather feather-trash p-1 br-8 mb-1">
|
||||
<polyline points="3 6 5 6 21 6"></polyline>
|
||||
<path
|
||||
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2">
|
||||
</path>
|
||||
</svg></a></li> -->
|
||||
<li>
|
||||
<a href="{% url 'manage_subscriptions:principal_subscription_detail' data_obj.id %}">
|
||||
<span class="material-symbols-outlined">
|
||||
visibility
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="col-md-12 mb-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body text-center">
|
||||
{% if subscription.image %}
|
||||
{% if principal_subscription_obj.image %}
|
||||
<img src="{{ subscription.image.url }}" class="img-fluid rounded mb-3" alt="{{ subscription.title }}" style="max-height: 200px;">
|
||||
{% endif %}
|
||||
<h3 class="card-title">{{ subscription.title }}</h3>
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
<h2 class="card-title text-gold">{{ active_subscription.subscription.title }}</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="text-gold">Principal:</h5>
|
||||
<h5 class="text-gold">Full Name:</h5>
|
||||
<p>{{ active_subscription.principal.first_name }} {{ active_subscription.principal.last_name }}</p>
|
||||
<p><strong>Status:</strong> {{ active_subscription.get_status_display }}</p>
|
||||
<p><strong>Start Date:</strong> {{ active_subscription.start_date }}</p>
|
||||
|
||||
Reference in New Issue
Block a user