2023-01-21 14:15:36 -07:00

109 lines
3.8 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block head_title %}Account | {% endblock %}
{% block content %}
<article>
<header class="article__header--with-action">
<h1>{{customer.get_full_name}}</h1>
<a href="{% url 'storefront:customer-update' customer.pk %}" class="btn">Edit profile</a>
</header>
<section>
<h4>Info</h4>
<div class="customer__detail-section">
<div>
<strong>Email address</strong><br>
{{customer.email}}<br>
<a href="{% url 'account_email' %}">Manage</a>
</div>
<div>
<strong>Default shipping address</strong>
{% with shipping_address=customer.default_shipping_address %}
<address>
{{shipping_address.first_name}}
{{shipping_address.last_name}}<br>
{{shipping_address.street_address_1}}<br>
{% if shipping_address.street_address_2 %}
{{shipping_address.street_address_2}}<br>
{% endif %}
{{shipping_address.city}}, {{shipping_address.state}}, {{shipping_address.postal_code}}
</address>
{% endwith %}
</div>
</div>
</section>
<section>
<h4>Your addresses</h4>
<p>
<a href="{% url 'storefront:customer-address-create' user.pk %}" class="btn">+ New address</a>
</p>
<div>
{% for address in customer.addresses.all %}
<p>
<address>
{{address.first_name}}
{{address.last_name}}<br>
{{address.street_address_1}}<br>
{% if address.street_address_2 %}
{{address.street_address_2}}<br>
{% endif %}
{{address.city}}, {{address.state}}, {{address.postal_code}}
</address>
<a href="{% url 'storefront:address-update' customer.pk address.pk %}">Edit</a>
</p>
{% empty %}
<p>No other addresses.</p>
{% endfor %}
</div>
</section>
{% if customer.subscriptions.count > 0 %}
<section>
<h3>Your subscriptions</h3>
<table>
<thead>
<tr>
<th>Subscription</th>
<th colspan="2">Status</th>
</tr>
</thead>
<tbody>
{% for subscription in subscriptions %}
<tr>
<td>#{{ subscription.metadata.subscription_pk }}</td>
<td>{{ subscription.status }}</td>
<td><a href="https://dashboard.stripe.com/test/subscriptions/{{ subscription.id }}">manage &nearr;</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endif %}
<section>
<h3>Your orders</h3>
<table>
<thead>
<tr>
<th>Order No.</th>
<th>Date</th>
<th colspan="2">Total</th>
</tr>
</thead>
<tbody>
{% for order in order_list %}
<tr>
<td>#{{order.pk}}</td>
<td>{{order.created_at|date:"M j, Y"}}</td>
<td>${{order.total_amount}}</td>
<td><a href="{% url 'storefront:order-detail' customer.pk order.pk %}">See details &rarr;</a></td>
</tr>
{% empty %}
<span class="object__item">No orders</span>
{% endfor %}
</tbody>
</table>
</section>
</article>
{% endblock content %}