Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Move order details to separate view

weronkaa05930bf5bcf
diff --git a/saleor/static/scss/demo/components/_order-details.scss b/saleor/static/scss/demo/components/_order-details.scss
index e22b24e3cd..2e51f8442b 100644
--- a/saleor/static/scss/demo/components/_order-details.scss
+++ b/saleor/static/scss/demo/components/_order-details.scss
@@ -1,6 +1,6 @@
.order-details {
&__header {
- margin: $global-margin 0 $global-margin * 2;
+ margin-bottom: $global-margin * 2;
}
&__table-header {
color: $gray;
diff --git a/saleor/static/scss/demo/components/_userprofile.scss b/saleor/static/scss/demo/components/_userprofile.scss
index 8d8c81edc4..101da6a4c8 100644
--- a/saleor/static/scss/demo/components/_userprofile.scss
+++ b/saleor/static/scss/demo/components/_userprofile.scss
@@ -43,66 +43,13 @@
}
}
&__orders {
- border: 0;
- a {
+ small {
+ text-decoration: underline;
color: $body-color;
}
- .card-header {
- background-color: transparent;
- border: 0;
+ &__row {
border-bottom: 1px solid $light-gray;
- padding-left: 0;
- padding-right: 0;
- }
- .collapsed {
- .card-header {
- border-color: $gray;
- .userprofile__orders__arrow-icon {
- transform: rotate(90deg);
- }
- }
- }
- &__arrow-icon {
- width: 10px;
- transform: rotate(270deg);
- transition: 0.3s;
- margin-right: $global-margin / 2;
- }
- .card-block {
- padding-left: $global-padding;
- padding-right: $global-padding;
- background-color: #F9F9F9;
- .col-md-3 {
- margin-top: $global-margin;
- }
- }
- &__details {
- address {
- margin-top: $global-margin;
- }
- &__products {
- span {
- color: $gray;
- }
- img {
- margin-right: $global-margin;
- @include media-breakpoint-down(md) {
- margin-bottom: $global-margin;
- }
- }
- .row {
- @include media-breakpoint-up(md) {
- margin-right: 0;
- }
- padding-top: $global-padding;
- &:not(:last-of-type) {
- border-bottom: 1px solid $light-gray;
- }
- &:nth-last-of-type(2) {
- border-bottom: 1px solid $gray;
- }
- }
- }
+ padding: $global-padding 0;
}
}
&__address-edit {
diff --git a/templates/order/details.html b/templates/order/details.html
index 5efb82e7af..0782c0cd9d 100644
--- a/templates/order/details.html
+++ b/templates/order/details.html
@@ -8,11 +8,19 @@
{% block title %}{% trans "Order" %} {{ order }} — {{ block.super }}{% endblock %}
{% block breadcrumb %}
+ {% if order.user == user %}
+ <ul class="breadcrumbs list-unstyled">
+ <li><a href="/">{% trans "Home" %}</a></li>
+ <li><a href="{% url 'profile:details' %}">{% trans "Your account" %}</a></li>
+ <li><a href="{{ order.get_absolute_url }}">{% trans "Order" %} {{ order }}</a></li>
+ </ul>
+ {% endif %}
{% 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 order-details">
<div class="col-lg-10 offset-lg-1">
@@ -27,6 +35,18 @@
{% endif %}
{% endif %}
</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>
diff --git a/templates/userprofile/details.html b/templates/userprofile/details.html
index 1eb96b5a25..a26382200c 100644
--- a/templates/userprofile/details.html
+++ b/templates/userprofile/details.html
@@ -80,82 +80,23 @@
<div class="tab-pane" id="orders" role="tabpanel">
<div id="accordion" role="tablist" aria-multiselectable="true">
{% for order in orders %}
- <div class="card userprofile__orders">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse{{ forloop.counter0 }}" aria-expanded="true" aria-controls="collapse{{ forloop.counter0 }}"{% if forloop.counter0 > 0 %} class="collapsed"{% endif %}>
- <div class="card-header" role="tab" id="head{{ forloop.counter0 }}">
+ <div class="userprofile__orders">
+ <div class="userprofile__orders__row">
<div class="row">
<div class="col-md-2 col-xs-5">
- <strong>{{ order }}</strong>
+ {{ order }}
</div>
<div class="col-md-4 col-xs-6">
{{ order.created }}
</div>
- <div class="col-md-3 col-xs-5">
- {% gross order.get_total %}
+ <div class="col-md-1 col-xs-5">
+ <span class="float-md-right">{% gross order.get_total %}</span>
</div>
- <div class="col-md-2 col-xs-6">
+ <div class="col-md-2 col-xs-5 offset-md-1">
{% render_status order.status order.get_status_display %}
</div>
- <div class="col-md-1 col-xs-1">
- <img class="userprofile__orders__arrow-icon float-xs-right" src="{% static 'img/gallery-arrow.svg' %}">
- </div>
- </div>
- </div>
- </a>
- <div id="collapse{{ forloop.counter0 }}" class="collapse{% if forloop.counter0 == 0 %} in{% endif %} userprofile__orders__details" role="tabpanel" aria-labelledby="head{{ forloop.counter0 }}">
- <div class="card-block">
- <div class="row">
- <div class="col-md-3 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-md-3 col-xs-6">
- <h3>{% trans "Billing address" %}</h3>
- <address>{% include "userprofile/snippets/address-short.html" with address=order.billing_address %}</address>
- </div>
- <div class="col-md-6 col-xs-12 userprofile__orders__details__products">
- {% for item in order %}
- {% for item_line in item %}
- <div class="row">
- <div class="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><br>
- x {{ item_line.quantity }}</p>
- </div>
- <div class="col-xs-3">
- <p class="float-xs-right">{% gross item_line.get_total %}</p>
- </div>
- </div>
- {% endfor %}
- <div class="row">
- <div class="col-xs-9">
- <p>{% trans "Delivery" %} ({{ item.shipping_method_name }})</p>
- </div>
- <div class="col-xs-3">
- <p class="float-xs-right">{% gross item.shipping_price %}</p>
- </div>
- </div>
- {% if order.discount_amount %}
- <div class="row">
- <div class="col-xs-9">
- <p>{{ order.discount_name }}</p>
- </div>
- <div class="col-xs-3">
- <p class="float-xs-right">{% gross order.discount|discount_amount_for:order.total %}</p>
- </div>
- </div>
- {% endif %}
- <div class="row">
- <div class="col-xs-9">
- <p><strong>{% trans "Total" %}</strong></p>
- </div>
- <div class="col-xs-3">
- <p class="float-xs-right"><strong>{% gross order.total %}</strong></p>
- </div>
- </div>
- {% endfor %}
- </div>
+ <div class="col-md-2 col-xs-2">
+ <a href="{{ order.get_absolute_url }}"><small class="float-xs-right">{% trans "Details" %}</small></a>
</div>
</div>
</div>