Skip to content

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

Fix order details table

weronkafd64c5381a62
diff --git a/saleor/static/scss/components/_table.scss b/saleor/static/scss/components/_table.scss
index 171adb3124..28b9401a6e 100644
--- a/saleor/static/scss/components/_table.scss
+++ b/saleor/static/scss/components/_table.scss
@@ -10,5 +10,8 @@
&__row {
border-bottom: 1px solid $gray;
padding: $global-padding 0;
+ p {
+ margin-bottom: 0;
+ }
}
}
diff --git a/saleor/static/scss/layouts/_order-details.scss b/saleor/static/scss/layouts/_order-details.scss
index 3e84e3cf3d..1efd9516a1 100644
--- a/saleor/static/scss/layouts/_order-details.scss
+++ b/saleor/static/scss/layouts/_order-details.scss
@@ -6,6 +6,9 @@
margin-top: $global-margin * 2;
}
&__product {
+ .col-3 {
+ margin-top: $global-margin / 2;
+ }
a {
transition: 0.3s;
&:hover {
@@ -26,4 +29,16 @@
}
}
}
+ &__total {
+ padding-top: $global-padding;
+ color: $skull-gray;
+ }
+ &__last-row {
+ border-bottom-color: $skull-gray;
+ }
+ &__table-footer {
+ @include media-breakpoint-up(sm) {
+ padding-left: 5.75rem;
+ }
+ }
}
diff --git a/templates/order/order-details.html b/templates/order/order-details.html
index c647696de8..27f8a00830 100644
--- a/templates/order/order-details.html
+++ b/templates/order/order-details.html
@@ -8,17 +8,17 @@
{% if order.user == user %}
<div class="order-details__addresses">
<div class="row">
- {% if order.is_shipping_required %}
- <div class="col-6">
- <h3>
+ {% if order.is_shipping_required %}
+ <div class="col-6">
+ <h3>
{% trans "Shipping address" context "Order details address title" %}
- </h3>
- <address>{% include "userprofile/snippets/address-short.html" with address=order.shipping_address %}</address>
- </div>
- {% endif %}
+ </h3>
+ <address>{% include "userprofile/snippets/address-short.html" with address=order.shipping_address %}</address>
+ </div>
+ {% endif %}
<div class="col-6">
<h3>
- {% trans "Billing address" context "Order details address title" %}
+ {% trans "Billing address" context "Order details address title" %}
</h3>
<address>{% include "userprofile/snippets/address-short.html" with address=order.billing_address %}</address>
</div>
@@ -29,32 +29,33 @@
<div class="row">
<div class="col-md-6">
<small>
- {% trans "Product" context "Order details column title" %}
+ {% trans "Product" context "Order details column title" %}
</small>
</div>
<div class="col-md-3 text-right">
<small>
- {% trans "Quantity" context "Order details column title" %}
+ {% trans "Quantity" context "Order details column title" %}
</small>
</div>
<div class="col-md-3 text-right">
<small>
- {% trans "Price" context "Order details column title" %}
+ {% trans "Price" context "Order details column title" %}
</small>
</div>
</div>
</div>
- {% for item in order %}
- {% for item_line in item %}
+{% for item in order %}
+ {% for item_line in item %}
+ <div class="table__row order-details__product{% if forloop.last %} order-details__last-row{% endif %}">
<div class="row">
<div class="col-md-6 col-9">
<a class="link--clean" href="{{ item_line.product.get_absolute_url }}">
<img src="{% product_first_image item_line.product size="60x60" method="crop" %}"
- srcset="{% product_first_image item_line.product size="60x60" method="crop" %} 1x, {% product_first_image item_line.product size="120x120" method="crop" %} 2x"
- class="float-left">
+ srcset="{% product_first_image item_line.product size="60x60" method="crop" %} 1x, {% product_first_image item_line.product size="120x120" method="crop" %} 2x"
+ class="float-left">
<p>{{ item_line.product }}<br>
- <span>{{ item_line.product_name }}</span></p>
+ <small>{{ item_line.product_name }}</small></p>
</a>
</div>
<div class="col-md-6 col-3">
@@ -68,49 +69,53 @@
</div>
</div>
</div>
- {% endfor %}
- {% if order.is_shipping_required %}
- <div class="row">
- <div class="col-8">
- <p>
- {% blocktrans trimmed with shipping_method_name=item.shipping_method_name context "Order details delivery row text" %}
- Delivery ({{ shipping_method_name }})
- {% endblocktrans %}
- </p>
- {% if item.tracking_number %}
- <p>
- {% blocktrans trimmed with tracking_number=item.tracking_number context "Order details delivery row text" %}
- Tracking number: {{ tracking_number }}
- {% endblocktrans %}
- </p>
- {% endif %}
- </div>
- <div class="col-4">
- <p class="float-right">{% gross item.shipping_price html=True %}</p>
- </div>
- </div>
- {% endif %}
- {% if order.discount_amount %}
+ </div>
+ {% endfor %}
+ {% if order.is_shipping_required %}
+ <div class="table__row">
<div class="row">
- <div class="col-8">
- <p>{{ order.discount_name }}</p>
+ <div class="col-8 order-details__table-footer">
+ <p>
+ {% blocktrans trimmed with shipping_method_name=item.shipping_method_name context "Order details delivery row text" %}
+ Delivery ({{ shipping_method_name }})
+ {% endblocktrans %}
+ </p>
+ {% if item.tracking_number %}
+ <p>
+ {% blocktrans trimmed with tracking_number=item.tracking_number context "Order details delivery row text" %}
+ Tracking number: {{ tracking_number }}
+ {% endblocktrans %}
+ </p>
+ {% endif %}
</div>
<div class="col-4">
- <p class="float-right">{% discount_as_negative order.discount %}</p>
+ <p class="float-right">{% gross item.shipping_price html=True %}</p>
</div>
</div>
- {% endif %}
- <div class="total">
+ </div>
+ {% endif %}
+ {% if order.discount_amount %}
+ <div class="table__row">
<div class="row">
- <div class="col-8">
- <div class="total">
- <p><strong>{% trans "Total" context "Order details total text" %}</strong></p>
- </div>
+ <div class="col-8 order-details__table-footer">
+ <p>{{ order.discount_name }}</p>
</div>
<div class="col-4">
- <p class="float-right"><strong>{% gross order.total html=True %}</strong></p>
+ <p class="float-right">{% discount_as_negative order.discount %}</p>
</div>
</div>
</div>
- {% endfor %}
-
+ {% endif %}
+ <div class="order-details__total">
+ <div class="row">
+ <div class="col-8 order-details__table-footer">
+ <div class="total">
+ <h3>{% trans "Total" context "Order details total text" %}</h3>
+ </div>
+ </div>
+ <div class="col-4">
+ <p class="float-right">{% gross order.total html=True %}</p>
+ </div>
+ </div>
+ </div>
+{% endfor %}