aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/templates
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-09-08 13:59:10 +0100
committerMatthew Lemon <y@yulqen.org>2024-09-08 13:59:10 +0100
commitdb531eaa027d2abcfcceabfef4b8aa9dc5ca1e5d (patch)
tree47dc0044d1a50c8ffbe689ab9f09ed3bda296ae8 /pyblackbird_cc/templates
parent50c7d5b46a9e25390ab4c4ff5dcb944a12df2bef (diff)
wip: implementing checkout
- also some formatting changes
Diffstat (limited to 'pyblackbird_cc/templates')
-rw-r--r--pyblackbird_cc/templates/base.html1
-rw-r--r--pyblackbird_cc/templates/payments/cancel.html10
-rw-r--r--pyblackbird_cc/templates/payments/cart_detail.html41
-rw-r--r--pyblackbird_cc/templates/payments/landingpage.html29
-rw-r--r--pyblackbird_cc/templates/payments/success.html11
5 files changed, 92 insertions, 0 deletions
diff --git a/pyblackbird_cc/templates/base.html b/pyblackbird_cc/templates/base.html
index 9e74a50..ce80ca3 100644
--- a/pyblackbird_cc/templates/base.html
+++ b/pyblackbird_cc/templates/base.html
@@ -47,6 +47,7 @@
<script defer src="{% static 'js/project.js' %}"></script>
<script src="{% static "bootstrap/js/bootstrap.js" %}"></script>
<script src="{% static "js/htmx.min.js" %}"></script>
+ <script src="https://js.stripe.com/v3/"></script>
{% endblock javascript %}
</head>
<body>
diff --git a/pyblackbird_cc/templates/payments/cancel.html b/pyblackbird_cc/templates/payments/cancel.html
new file mode 100644
index 0000000..efe0fd3
--- /dev/null
+++ b/pyblackbird_cc/templates/payments/cancel.html
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+
+{% block content %}
+ <div class="container my-5">
+ <div class="row">
+ <h2>Transaction Cancelled</h2>
+ <p>Your transaction was cancelled.</p>
+ </div>
+ </div>
+{% endblock content %} \ No newline at end of file
diff --git a/pyblackbird_cc/templates/payments/cart_detail.html b/pyblackbird_cc/templates/payments/cart_detail.html
new file mode 100644
index 0000000..ba8c43e
--- /dev/null
+++ b/pyblackbird_cc/templates/payments/cart_detail.html
@@ -0,0 +1,41 @@
+{% extends "base.html" %}
+{% load static %}
+
+{% block content %}
+<div class="container my-5">
+ <h1 class="mb-4">Shopping Cart</h1>
+ {% if cart_items %}
+ <table class="table">
+ <thead>
+ <tr>
+ <th>Product</th>
+ <th>Price</th>
+ <th>Quantity</th>
+ <th>Total</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for item in cart_items %}
+ <tr>
+ <td>{{ item.product.name }}</td>
+ <td>${{ item.product.price }}</td>
+ <td>{{ item.quantity }}</td>
+ <td>${{ item.total }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ <tfoot>
+ <tr>
+ <th colspan="3" class="text-end">Total:</th>
+ <th>${{ cart_total }}</th>
+ </tr>
+ </tfoot>
+ </table>
+ <div class="d-flex justify-content-end">
+ <a href="{% url 'checkout' %}" class="btn btn-primary">Checkout</a>
+ </div>
+ {% else %}
+ <p>Your cart is empty.</p>
+ {% endif %}
+</div>
+{% endblock %}
diff --git a/pyblackbird_cc/templates/payments/landingpage.html b/pyblackbird_cc/templates/payments/landingpage.html
new file mode 100644
index 0000000..9897301
--- /dev/null
+++ b/pyblackbird_cc/templates/payments/landingpage.html
@@ -0,0 +1,29 @@
+{% extends "base.html" %}
+{% block content %}
+ <div class="container my-5">
+ <div class="row">
+ <h2>Welcome to PyBlackbird - Buy this</h2>
+
+ <section>
+ <div class="product">
+ <div class="description">
+ <h3>{{ product.name }}</h3>
+ <hr/>
+ {% for price in prices %}
+
+ <div>
+ <h5>${{ price.get_display_price }}</h5>
+ <form action="{% url 'payments:create-checkout-session' price.id %}" method="POST">
+ {% csrf_token %}
+ <button type="submit" class="btn btn-primary">Checkout</button>
+ </form>
+ </div>
+
+ {% endfor %}
+ </div>
+ </div>
+ </section>
+
+
+ </div>
+{% endblock content %} \ No newline at end of file
diff --git a/pyblackbird_cc/templates/payments/success.html b/pyblackbird_cc/templates/payments/success.html
new file mode 100644
index 0000000..c1fb089
--- /dev/null
+++ b/pyblackbird_cc/templates/payments/success.html
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+
+{% load static %}
+
+{% block content %}
+ <div class="container my-5">
+ <div class="row">
+ <h2>Thanks for your order!</h2>
+ <p>You have successfully transacted.</p>
+ </div>
+{% endblock content %} \ No newline at end of file