Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add template with order details for unregistered buyers
weronkab8460fadf22e
diff --git a/saleor/static/scss/demo/components/order-details.scss b/saleor/static/scss/demo/components/order-details.scssnew file mode 100644index 0000000000..3cfd8c547b--- /dev/null+++ b/saleor/static/scss/demo/components/order-details.scss@@ -0,0 +1,34 @@+.order-details {+ &__header {+ margin: $global-margin * 2 0;+ }+ &__table-header {+ color: $gray;+ border-bottom: 1px solid $light-gray;+ padding-bottom: $global-padding / 2;+ margin-top: $global-margin * 2;+ .col-md-3 {+ text-align: right;+ }+ }+ &__table {+ span {+ color: $gray;+ }+ img {+ margin-right: $global-margin;+ }+ p {+ margin: $global-margin / 2 0;+ }+ .col-xs-3 {+ padding: 0;+ }+ .row {+ padding: $global-padding / 2 0;+ &:not(:last-of-type) {+ border-bottom: 1px solid $light-gray;+ }+ }+ }+}\ No newline at end of filediff --git a/saleor/static/scss/demo/storefront.scss b/saleor/static/scss/demo/storefront.scssindex 467be745e8..c92b38482f 100644--- a/saleor/static/scss/demo/storefront.scss+++ b/saleor/static/scss/demo/storefront.scss@@ -15,3 +15,4 @@@import "components/cart-dropdown";@import "components/checkout";@import "components/forms";+@import "components/order-details";diff --git a/templates/order/details.html b/templates/order/details.htmlindex a6eab35c81..f9c4546654 100644--- a/templates/order/details.html+++ b/templates/order/details.html@@ -7,27 +7,26 @@{% block title %}{% trans "Order" %} {{ order }} — {{ block.super }}{% endblock %}-{% block outerbreadcrumb %}+{% block breadcrumb %}{% if order.user == user %}- <ul class="breadcrumb" itemprop="breadcrumb">+ <ul class="breadcrumbs list-unstyled"><li><a href="/">{% trans "Home" %}</a></li>- <li><a href="{% url 'profile:orders' %}">{% trans "Your orders" %}</a></li>- <li><a href="{% url 'order:details' token=order.token %}">{{ order }}</a></li>- </ul>+ <li><a href="{% url 'profile:details' %}">{% trans "Orders" %}</a></li>+ <li><a href="{{ order.get_absolute_url }}">{{ order }}</a></li>+ </ul>{% endif %}-{% endblock outerbreadcrumb %}+{% endblock breadcrumb %}{% block content %}{# This view is available by just knowing url, #}{# so we don't show all details (like delivery address) #}{# unless current user is owner of the order. #}- <div class="row">- <div class="col-sm-12">- <h3 class="page-header page-header--order">- <span class="text-muted">{% blocktrans %}Order {{ order }}: {% endblocktrans %}</span>+ <div class="row order-details">+ <div class="col-lg-10 offset-lg-1">+ <h2 class="order-details__header">+ <span>{% blocktrans %}Order {{ order }}: {% endblocktrans %}</span>{{ order.get_status_display }}-{% if not order.is_fully_paid %}{% if order.is_pre_authorized %}<a href="{% url "order:payment" token=order.token %}" class="btn btn-info">{% trans "Payment details" %}</a>@@ -35,98 +34,77 @@<a href="{% url "order:payment" token=order.token %}" class="btn btn-primary">{% trans "Pay for order" %}</a>{% endif %}{% endif %}- </h3>- </div>- </div>-- <div class="row">- {% if order.user == user %}- <div class="col-sm-6">- <div class="panel panel-default">- <div class="panel-heading">- {% trans "Billing address" %}+ </h2>+ {% if order.user == user %}+ <div class="row">+ <div class="col-xs-6">+ <h3>{% trans "Shipping address" %}</h3>+ <address>{% include "userprofile/snippets/address-short.html" with address=order.shipping_address %}</address>+ </div>+ <div class="col-xs-6">+ <h3>{% trans "Billing address" %}</h3>+ <address>{% include "userprofile/snippets/address-short.html" with address=order.billing_address %}</address>+ </div>+ </div>+ {% endif %}+ <div class="row order-details__table-header hidden-sm-down">+ <div class="col-md-6">+ <small>{% trans "Product" %}</small>+ </div>+ <div class="col-md-3">+ <small>{% trans "Quantity" %}</small>+ </div>+ <div class="col-md-3">+ <small>{% trans "Price" %}</small>+ </div>+ </div>+ <div class="order-details__table">+ {% for item in order %}+ {% for item_line in item %}+ <div class="row">+ <div class="col-md-6 col-xs-9">+ <img src="{{ item_line.product.images.first.image.crop.60x60 }}" class="float-xs-left">+ <p>{{ item_line.product }}<br>+ <span>{{ item_line.product_name }}</span></p></div>- <div class="panel-body">- <address>{% include "userprofile/snippets/address-details.html" with address=order.billing_address %}</address>+ <div class="col-md-6 col-xs-3">+ <div class="col-md-6 col-xs-12">+ <p class="float-xs-right">x {{ item_line.quantity }}</p>+ </div>+ <div class="col-md-6 col-xs-12">+ <p class="float-xs-right">{% gross item_line.get_total %}</p>+ </div></div>+ </div>+ {% endfor %}+ <div class="row">+ <div class="col-xs-8">+ <p>{% trans "Delivery" %} ({{ item.shipping_method_name }})</p>+ </div>+ <div class="col-xs-4">+ <p class="float-xs-right">{% gross item.shipping_price %}</p>+ </div></div>- </div>- {% if order.is_shipping_required %}- <div class="col-sm-6">- <div class="panel panel-default">- <div class="panel-heading">- {% trans "Shipping address" %}- </div>- <div class="panel-body">- <address>{% include "userprofile/snippets/address-details.html" with address=order.shipping_address %}</address>- </div>+ {% if order.discount_amount %}+ <div class="row">+ <div class="col-xs-8">+ <p>{{ order.discount_name }}</p>+ </div>+ <div class="col-xs-4">+ <p class="float-xs-right">{% gross order.discount|discount_amount_for:order.total %}</p></div>+ </div>+ {% endif %}+ <div class="row">+ <div class="col-xs-8">+ <p><strong>{% trans "Total" %}</strong></p>+ </div>+ <div class="col-xs-4">+ <p class="float-xs-right"><strong>{% gross order.total %}</strong></p>+ </div></div>- {% endif %}- {% endif %}- </div>-- {% for group in groups %}- <div class="panel panel-default">- <div class="panel-heading">- {% blocktrans with number=forloop.counter %}Shipment #{{ number }}{% endblocktrans %}- <span class="pull-right">- <span class="label label-default">{{ group.get_status_display }}</span>- </span>- </div>- <table class="table">- <thead>- <tr>- <th class="col-sm-6">{% trans "Name" %}</th>- <th class="col-sm-3 text-right">{% trans "Price" %}</th>- <th class="col-sm-3 text-right">{% trans "Subtotal" %}</th>- </tr>- </thead>- <tfoot>- <tr>- <th colspan="2">{% trans "Total" %}</th>- <th class="text-right">{% gross group.get_total %}</th>- </tr>- </tfoot>- <tbody>- {% for item in group %}- <tr>- <td>{{ item.product }}{% if item.quantity != 1 %} <em>×{{ item.quantity }}</em>{% endif %}</td>- <td class="text-right">{% gross item.get_price_per_item %}</td>- <td class="text-right">{% gross item.get_total %}</td>- </tr>- {% endfor %}- {% if group.shipping_price.gross %}- <tr>- <td class="col-sm-4">- {% trans "Shipping" %}- </td>- <td class="text-right">{% gross group.shipping_price %}</td>- <td class="text-right">{% gross group.shipping_price %}</td>- </tr>- {% endif %}- </tbody>- </table>- </div>- {% endfor %}- {% if order.discount_amount %}- <div class="panel panel-default">- <div class="panel-heading">- {{ order.discount_name }}- </div>- <div class="panel-body text-right">- <strong>{% gross order.discount|discount_amount_for:order.total %}</strong>- </div>+ {% endfor %}+ </div></div>- {% endif %}- {% if order.discount_amount or groups|length > 1 %}- <div class="panel panel-default">- <div class="panel-heading">- {% trans "Total" %}- </div>- <div class="panel-body text-right">- <strong>{% gross order.total %}</strong>- </div>- </div>- {% endif %}+ </div>{% endblock content %}diff --git a/templates/userprofile/orders.html b/templates/userprofile/orders.htmldeleted file mode 100644index 58a10d32b4..0000000000--- a/templates/userprofile/orders.html+++ /dev/null@@ -1,57 +0,0 @@-{% extends "base.html" %}-{% load i18n %}-{% load gross from prices_i18n %}--{% block title %}{% trans "Your orders" %} — {{ block.super }}{% endblock %}--{% block breadcrumb %}- {{ block.super }}- <li><a href="{% url 'profile:orders' %}">{% trans "Your orders" %}</a></li>-{% endblock breadcrumb %}--{% block content %}- <table class="table table-striped">- <thead>- <tr>- <th class="col-sm-2">- {% trans "Order #" %}- </th>- <th class="col-sm-2">- {% trans "Date" %}- </th>- <th class="col-sm-2">- {% trans "Price" %}- </th>- <th class="col-sm-2">- {% trans "Status" %}- </th>- <th class="col-sm-2">- {% trans "Last status change" %}- </th>- </tr>- </thead>- <tbody>- {% for order in orders %}- <tr>- <td class="col-sm-2">- <a href="{{ order.get_absolute_url }}">{{ order }}</a>- </td>- <td class="col-sm-2">- {{ order.created }}- </td>- <td class="col-sm-2">- {% gross order.get_total %}- </td>- <td class="col-sm-2">- <span class="label label-default">{{ order.get_status_display }}</span>- </td>- <td class="col-sm-2">- {{ order.last_status_change }}- </td>- </tr>- {% endfor %}- </tbody>- </table>--{% endblock content %}-