Skip to content

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

Add horizontal scroll to data tables on mobile

Paweł Kowalewski1d8a28764484
diff --git a/saleor/dashboard/templates/dashboard/customer/detail.html b/saleor/dashboard/templates/dashboard/customer/detail.html
index 12fa0bb0e3..94202a579d 100644
--- a/saleor/dashboard/templates/dashboard/customer/detail.html
+++ b/saleor/dashboard/templates/dashboard/customer/detail.html
@@ -26,42 +26,40 @@
<div class="row">
<div class="col s12 l8">
<div class="card">
- <div class="data-table-header">
- <h5 class="data-table-title">{% trans "Order history" %}</h5>
+ <div class="data-table-header{% if not customer_orders %} data-table-header--no-data{% endif %}">
+ <span class="card-title black-text">{% trans "Order history" %}</span>
</div>
- <table class="bordered hoverable responsive data-table">
- {% if customer_orders %}
- <thead>
- <tr>
- <th>{% trans "Number" %}</th>
- <th>{% trans "Placed on" %}</th>
- <th>{% trans "Payment" %}</th>
- <th>{% trans "Order status" %}</th>
- <th>{% trans "Total" %}</th>
- </tr>
- </thead>
- <tbody>
- {% for order in customer_orders %}
+ {% if customer_orders %}
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
<tr>
- <td><a href="{% url 'dashboard:order-details' order_pk=order.pk %}">{{ order }}</a></td>
- <td>{{ order.created }}</td>
- <td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>
- <td>{% render_status order.status order.get_status_display %}</td>
- <td>{% gross order.get_total %}</td>
+ <th>{% trans "Number" %}</th>
+ <th>{% trans "Placed on" %}</th>
+ <th>{% trans "Payment" %}</th>
+ <th>{% trans "Order status" %}</th>
+ <th>{% trans "Total" %}</th>
</tr>
- {% endfor %}
- </tbody>
- {% else %}
- <tbody>
- <tr>
- <td>
- <span>{% trans "No orders found." %}</span>
- </td>
- </tr>
- </tbody>
- {% endif %}
- </table>
+ </thead>
+ <tbody>
+ {% for order in customer_orders %}
+ <tr>
+ <td><a href="{% url 'dashboard:order-details' order_pk=order.pk %}">{{ order }}</a></td>
+ <td>{{ order.created }}</td>
+ <td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>
+ <td>{% render_status order.status order.get_status_display %}</td>
+ <td>{% gross order.get_total %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ {% else %}
+ <div class="card-content card-content--no-data">
+ <p>{% trans "No orders found." %}</p>
+ </div>
+ {% endif %}
</div>
</div>
<div class="col s12 l4">
diff --git a/saleor/dashboard/templates/dashboard/customer/list.html b/saleor/dashboard/templates/dashboard/customer/list.html
index 0ecf5d4bb8..d680a178a3 100644
--- a/saleor/dashboard/templates/dashboard/customer/list.html
+++ b/saleor/dashboard/templates/dashboard/customer/list.html
@@ -31,57 +31,58 @@
</div>
</form>
- <h5 class="data-table-title">{{ title }}</h5><br/>
<div class="card">
- <table class="bordered hoverable responsive data-table">
- {% if customers %}
- <thead>
- <tr>
- <th>{% trans "Email" %}</th>
- <th class="wide">{% trans "Name" %}</th>
- <th>{% trans "Location" %}</th>
- <th class="right-align">{% trans "Number of orders" %}</th>
- <th>{% trans "Last order" %}</th>
- </tr>
- </thead>
- <tbody>
- {% for customer in customers %}
- <tr>
- {% with customer.default_billing_address as default_address %}
- <td>
- <a href="{% url "dashboard:customer-details" pk=customer.pk %}">{{ customer.email }}</a>
- </td>
- <td>
- {{ default_address.first_name }} {{ default_address.last_name }}
- </td>
- <td>
- {{ default_address.city }}, {{ default_address.get_country_display }}
- </td>
- {% endwith %}
- <td class="right-align">
- {{ customer.num_orders }}
- </td>
- <td>
- {% if customer.last_order %}
- <a href="{% url 'dashboard:order-details' order_pk=customer.last_order %}">#{{ customer.last_order }}</a>
- {% else %}
- {% trans "N/A" %}
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- {% else %}
- <tbody>
- <tr>
- <td>
- <span>{% trans "No customers found." %}</span>
- </td>
- </tr>
- </tbody>
- {% endif %}
- </table>
+ <div class="data-table-header{% if not customers %} data-table-header--no-data{% endif %}">
+ <h5 class="card-title black-text">{{ title }}</h5>
+ </div>
+
+ {% if customers %}
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
+ <tr>
+ <th>{% trans "Email" %}</th>
+ <th class="wide">{% trans "Name" %}</th>
+ <th>{% trans "Location" %}</th>
+ <th class="right-align">{% trans "Number of orders" %}</th>
+ <th>{% trans "Last order" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for customer in customers %}
+ <tr>
+ {% with customer.default_billing_address as default_address %}
+ <td>
+ <a href="{% url "dashboard:customer-details" pk=customer.pk %}">{{ customer.email }}</a>
+ </td>
+ <td>
+ {{ default_address.first_name }} {{ default_address.last_name }}
+ </td>
+ <td>
+ {{ default_address.city }}, {{ default_address.get_country_display }}
+ </td>
+ {% endwith %}
+ <td class="right-align">
+ {{ customer.num_orders }}
+ </td>
+ <td>
+ {% if customer.last_order %}
+ <a href="{% url 'dashboard:order-details' order_pk=customer.last_order %}">#{{ customer.last_order }}</a>
+ {% else %}
+ {% trans "N/A" %}
+ {% endif %}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ {% else %}
+ <div class="card-content card-content--no-data">
+ <p>{% trans "No customers found." %}</p>
+ </div>
+ {% endif %}
</div>
{% include "dashboard/includes/_pagination.html" with page_obj=customers %}
{% endblock %}
diff --git a/saleor/dashboard/templates/dashboard/includes/_orders_table.html b/saleor/dashboard/templates/dashboard/includes/_orders_table.html
index 3c4da12885..7b3a84f76e 100644
--- a/saleor/dashboard/templates/dashboard/includes/_orders_table.html
+++ b/saleor/dashboard/templates/dashboard/includes/_orders_table.html
@@ -2,29 +2,31 @@
{% load prices_i18n %}
{% load status %}
-<table class="bordered hoverable responsive data-table">
- <thead>
- <tr>
- <th></th>
- <th>{% trans "Order status" %}</th>
- <th>{% trans "Payment status" %}</th>
- <th>{% trans "Customer" %}</th>
- <th>{% trans "Placed on" %}</th>
- <th>{% trans "Total" %}</th>
- </tr>
- </thead>
- <tbody>
- {% for order in orders %}
- <tr>
- <td>
- <a href="{% url 'dashboard:order-details' order_pk=order.pk %}">#{{ order.id }}</a>
- </td>
- <td>{% render_status order.status order.get_status_display %}</td>
- <td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>
- <td>{{ order.created }}</td>
- <td>{{ order.user|default:_("Guest") }}</td>
- <td>{% gross order.get_total %}</td>
- </tr>
- {% endfor %}
- </tbody>
-</table>
+<div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
+ <tr>
+ <th></th>
+ <th>{% trans "Order status" %}</th>
+ <th>{% trans "Payment status" %}</th>
+ <th>{% trans "Customer" %}</th>
+ <th>{% trans "Placed on" %}</th>
+ <th>{% trans "Total" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for order in orders %}
+ <tr>
+ <td>
+ <a href="{% url 'dashboard:order-details' order_pk=order.pk %}">#{{ order.id }}</a>
+ </td>
+ <td>{% render_status order.status order.get_status_display %}</td>
+ <td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>
+ <td>{{ order.created }}</td>
+ <td>{{ order.user|default:_("Guest") }}</td>
+ <td>{% gross order.get_total %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
diff --git a/saleor/dashboard/templates/dashboard/index.html b/saleor/dashboard/templates/dashboard/index.html
index 59511426da..71c902a998 100644
--- a/saleor/dashboard/templates/dashboard/index.html
+++ b/saleor/dashboard/templates/dashboard/index.html
@@ -8,10 +8,13 @@
<div class="row">
<div class="col s12">
<div class="card">
- <div class="card-content">
+ <div class="data-table-header{% if not preauthorized_payments %} data-table-header--no-data{% endif %}">
<span class="card-title black-text">{% trans "Preauthorized payments" %}</span>
- {% if preauthorized_payments %}
- <table class="table">
+ </div>
+
+ {% if preauthorized_payments %}
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
<thead>
<tr>
<th>{% trans "Order number" %}</th>
@@ -23,7 +26,7 @@
<tbody>
{% for payment in preauthorized_payments %}
<tr>
- <td><a href="{% url "dashboard:order-details" pk=payment.order.pk %}">{{ payment.order }}</a></td>
+ <td><a href="{% url "dashboard:order-details" order_pk=payment.order.pk %}">{{ payment.order }}</a></td>
<td>{{ payment.created }}</td>
<td>{{ payment.order.user|default:_("Guest") }}</td>
<td class="text-right">{% gross payment.get_total_price %}</td>
@@ -31,29 +34,37 @@
{% endfor %}
</tbody>
</table>
- {% else %}
+ </div>
+ {% else %}
+ <div class="card-content card-content--no-data">
<p>{% trans "No preauthorized payments." %}</p>
- {% endif %}
- </div>
+ </div>
+ {% endif %}
</div>
+
<div class="card">
- <div class="card-content">
+ <div class="data-table-header{% if not orders_to_ship %} data-table-header--no-data{% endif %}">
<span class="card-title black-text">{% trans "Orders ready for shipment" %}</span>
- {% if orders_to_ship %}
- {% include "dashboard/includes/_orders_table.html" with orders=orders_to_ship %}
- {% else %}
- <p>{% trans "No orders are ready for shipment." %}</p>
- {% endif %}
</div>
+
+ {% if orders_to_ship %}
+ {% include "dashboard/includes/_orders_table.html" with orders=orders_to_ship %}
+ {% else %}
+ <div class="card-content card-content--no-data">
+ <p>{% trans "No orders are ready for shipment." %}</p>
+ </div>
+ {% endif %}
</div>
+
<div class="card">
<div class="card-content">
<span class="card-title black-text">{% trans "Products with low stock" %}</span>
+
{% if low_stock %}
<ul class="list">
{% for product in low_stock %}
<li class="list-item">
- <a class="list-item-name list-item-name--single" href="{% url "dashboard:product-update" pk=product.pk %}">{{ product }}</a>
+ <a class="list-item-name list-item-name--single" href="{% url "dashboard:product-update" pk=product.pk %}#stock">{{ product }}</a>
</li>
{% endfor %}
</ul>
diff --git a/saleor/dashboard/templates/dashboard/order/detail.html b/saleor/dashboard/templates/dashboard/order/detail.html
index 8d0fab083a..435f5ba739 100644
--- a/saleor/dashboard/templates/dashboard/order/detail.html
+++ b/saleor/dashboard/templates/dashboard/order/detail.html
@@ -119,73 +119,76 @@
{% render_status group.status group.get_status_display %}
</h5>
</div>
- <table class="bordered hoverable responsive data-table">
- <thead>
- <tr>
- <th class="wide">{% trans "Item" %}</th>
- <th>{% trans "SKU" %}</th>
- <th class="right-align">{% trans "Price" %}</th>
- <th class="right-align">{% trans "Quantity" %}</th>
- <th class="right-align">{% trans "Total" %}</th>
- <th class="no-padded"></th>
- </tr>
- </thead>
- <tfoot>
- {% if group.shipping_price.gross or group.is_shipping_required %}
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
<tr>
- <td colspan="4">
- {% trans "Shipping" %} ({{ order.shipping_method }})
- </td>
- <td class="right-align">
- {% gross group.shipping_price %}
- </td>
- <td class="no-padded"></td>
+ <th class="wide">{% trans "Item" %}</th>
+ <th>{% trans "SKU" %}</th>
+ <th class="right-align">{% trans "Price" %}</th>
+ <th class="right-align">{% trans "Quantity" %}</th>
+ <th class="right-align">{% trans "Total" %}</th>
+ <th class="no-padded"></th>
</tr>
- {% endif %}
- <tr>
- <td colspan="4">{% trans "Total" %}</td>
- <td class="right-align">
- <strong>{% gross group.get_total %}</strong>
- </td>
- <td class="no-padded"></td>
- </tr>
- </tfoot>
-
- <tbody>
- {% for item in group.items.all %}
+ </thead>
+
+ <tfoot>
+ {% if group.shipping_price.gross or group.is_shipping_required %}
+ <tr>
+ <td colspan="4">
+ {% trans "Shipping" %} ({{ order.shipping_method }})
+ </td>
+ <td class="right-align">
+ {% gross group.shipping_price %}
+ </td>
+ <td class="no-padded"></td>
+ </tr>
+ {% endif %}
<tr>
- <td>
- {{ item.product_name }}<br>
- </td>
- <td>{{ item.product_sku }}</td>
- <td class="right-align">{% gross item.get_price_per_item %}</td>
- <td class="right-align">{{ item.quantity }}</td>
- <td class="right-align">{% gross item.get_total %}</td>
- <td class="right-align no-padded">
- <a class="dropdown-button" href="#" data-activates="line-actions-{{ item.pk }}" data-constrainwidth="false">
- <i class="mdi-navigation-more-vert"></i>
- </a>
-
- <ul id="line-actions-{{ item.pk }}" class="dropdown-content">
- <li>
- <a href="#base-modal" data-href="{% url 'dashboard:orderline-change-quantity' order_pk=order.pk line_pk=item.pk %}" class="modal-trigger-custom"
- {% if group.status != 'new' %} disabled{% endif %} title="{% trans "Change quantity" %}">
- {% trans "Change quantity" %}
- </a>
- </li>
- <li>
- <a href="#base-modal" data-href="{% url 'dashboard:orderline-split' order_pk=order.pk line_pk=item.pk %}" class="modal-trigger-custom"
- {% if group.status != 'new' %} disabled{% endif %} title="{% trans "Split line" %}">
- {% trans "Split order line" %}
- </a>
- </li>
- </ul>
+ <td colspan="4">{% trans "Total" %}</td>
+ <td class="right-align">
+ <strong>{% gross group.get_total %}</strong>
</td>
+ <td class="no-padded"></td>
</tr>
- {% endfor %}
- </tbody>
- </table>
+ </tfoot>
+
+ <tbody>
+ {% for item in group.items.all %}
+ <tr>
+ <td>
+ {{ item.product_name }}<br>
+ </td>
+ <td>{{ item.product_sku }}</td>
+ <td class="right-align">{% gross item.get_price_per_item %}</td>
+ <td class="right-align">{{ item.quantity }}</td>
+ <td class="right-align">{% gross item.get_total %}</td>
+ <td class="right-align no-padded">
+ <a class="dropdown-button" href="#" data-activates="line-actions-{{ item.pk }}" data-constrainwidth="false">
+ <i class="mdi-navigation-more-vert"></i>
+ </a>
+
+ <ul id="line-actions-{{ item.pk }}" class="dropdown-content">
+ <li>
+ <a href="#base-modal" data-href="{% url 'dashboard:orderline-change-quantity' order_pk=order.pk line_pk=item.pk %}" class="modal-trigger-custom"
+ {% if group.status != 'new' %} disabled{% endif %} title="{% trans "Change quantity" %}">
+ {% trans "Change quantity" %}
+ </a>
+ </li>
+ <li>
+ <a href="#base-modal" data-href="{% url 'dashboard:orderline-split' order_pk=order.pk line_pk=item.pk %}" class="modal-trigger-custom"
+ {% if group.status != 'new' %} disabled{% endif %} title="{% trans "Split line" %}">
+ {% trans "Split order line" %}
+ </a>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
{% if group.can_ship %}
<div class="card-action">
@@ -262,25 +265,27 @@
<div class="tab-content" id="payment-history">
{% if all_payments %}
<div class="card">
- <table class="bordered hoverable responsive data-table">
- <thead>
- <tr>
- <th></th>
- <th>{% trans "Date" %}</th>
- <th class="wide">{% trans "Payment status" %}</th>
- </tr>
- </thead>
-
- <tbody>
- {% for payment in all_payments %}
- <tr>
- <td><a href="{% url "dashboard:payment-details" pk=payment.pk %}">#{{ payment.id }}</a></td>
- <td>{{ payment.created }}</td>
- <td>{% render_status payment.status payment.get_status_display %}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
+ <tr>
+ <th></th>
+ <th>{% trans "Date" %}</th>
+ <th class="wide">{% trans "Payment status" %}</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {% for payment in all_payments %}
+ <tr>
+ <td><a href="{% url "dashboard:payment-details" pk=payment.pk %}">#{{ payment.id }}</a></td>
+ <td>{{ payment.created }}</td>
+ <td>{% render_status payment.status payment.get_status_display %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
</div>
{% else %}
<p>{% trans "No payments made for this order." %}</p>
@@ -288,30 +293,32 @@
</div>
<div class="card tab-content" id="order-history">
- <table class="bordered hooverable responsive data-table">
- <thead>
- <tr>
- <th>Date</th>
- <th>Order status</th>
- <th>User</th>
- <th class="wide">Comment</th>
- </tr>
- </thead>
-
- <tbody>
- {% for event in order.history.all %}
- <tr>
- <td>{{ event.date }}</td>
- <td>{% render_status event.status event.get_status_display %}</td>
- <td>
- {% if event.user %}
- {{ event.user }}
- {% endif %}
- </td>
- <td>{{ event.comment|default:"" }}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
+ <div class="data-table-container">
+ <table class="bordered hooverable responsive data-table">
+ <thead>
+ <tr>
+ <th>Date</th>
+ <th>Order status</th>
+ <th>User</th>
+ <th class="wide">Comment</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {% for event in order.history.all %}
+ <tr>
+ <td>{{ event.date }}</td>
+ <td>{% render_status event.status event.get_status_display %}</td>
+ <td>
+ {% if event.user %}
+ {{ event.user }}
+ {% endif %}
+ </td>
+ <td>{{ event.comment|default:"" }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
</div>
{% endblock %}
diff --git a/saleor/dashboard/templates/dashboard/payments/list.html b/saleor/dashboard/templates/dashboard/payments/list.html
index c1f40171a4..979c8091c9 100644
--- a/saleor/dashboard/templates/dashboard/payments/list.html
+++ b/saleor/dashboard/templates/dashboard/payments/list.html
@@ -20,31 +20,33 @@
{% if payments %}
<div class="card">
- <table class="bordered hoverable responsive data-table">
- <thead>
- <tr>
- <th></th>
- <th>{% trans "Date" %}</th>
- <th>{% trans "Payment" %}</th>
- <th class="right-align">{% trans "Amount" %}</th>
- <th class="wide">{% trans "Status" %}</th>
- </tr>
- </thead>
- <tbody>
- {% for payment in payments %}
- <tr>
- <td><a href="{% url "dashboard:payment-details" pk=payment.pk %}">#{{ payment.id }}</a></td>
- <td>{{ payment.created }}</td>
- <td>
- {% trans "Gateway" %}: {{ payment.variant }} &middot;
- <a href="{% url 'dashboard:order-details' order_pk=payment.order.pk %}"> {% trans "Order " %}{{ payment.order }}</a>
- </td>
- <td class="right-align">{% gross payment.get_total_price %}</td>
- <td>{% render_status payment.status payment.get_status_display %}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
+ <tr>
+ <th></th>
+ <th>{% trans "Date" %}</th>
+ <th>{% trans "Payment" %}</th>
+ <th class="right-align">{% trans "Amount" %}</th>
+ <th class="wide">{% trans "Status" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for payment in payments %}
+ <tr>
+ <td><a href="{% url "dashboard:payment-details" pk=payment.pk %}">#{{ payment.id }}</a></td>
+ <td>{{ payment.created }}</td>
+ <td>
+ {% trans "Gateway" %}: {{ payment.variant }} &middot;
+ <a href="{% url 'dashboard:order-details' order_pk=payment.order.pk %}"> {% trans "Order " %}{{ payment.order }}</a>
+ </td>
+ <td class="right-align">{% gross payment.get_total_price %}</td>
+ <td>{% render_status payment.status payment.get_status_display %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
</div>
{% include "dashboard/includes/_pagination.html" %}
diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.html
index a94e1c1035..066a7265f3 100644
--- a/saleor/dashboard/templates/dashboard/product/product_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_form.html
@@ -136,54 +136,57 @@
</div>
</div>
</div>
- <table class="bordered hoverable responsive data-table">
- {% if variants %}
- <thead>
- <tr>
- <th class="bulk-checkbox">
- <input type="checkbox" id="select-all-variants" class="filled-in select-all switch-actions">
- <label for="select-all-variants"></label>
- </th>
- <th>{% trans "SKU" %}</th>
- {% for attribute in attributes %}
- <th>{{ attribute.display|capfirst }}</th>
- {% endfor %}
- <th class="wide">{% trans "Variant name" %}</th>
- <th class="right-align">{% trans "Price" %}</th>
- </tr>
- </thead>
- <tbody>
- {% for variant in variants %}
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ {% if variants %}
+ <thead>
<tr>
- <td class="bulk-checkbox">
- <input id="id_variants_{{ variant.id }}" name="items" type="checkbox" value="{{ variant.id }}" class="filled-in switch-actions">
- <label for="id_variants_{{ variant.id }}"></label>
- </td>
- <td><a class="light-blue-text text-lighten-1" title="{% trans "Edit variant" %}"
- href="{% url 'dashboard:variant-update' product_pk=product.pk variant_pk=variant.pk %}">
- {{ variant.sku }}
- </a></td>
- {% for attr_display in variant|attributes_values_with_empty:attributes %}
- <td>
- {{ attr_display }}
- </td>
+ <th class="bulk-checkbox">
+ <input type="checkbox" id="select-all-variants" class="filled-in select-all switch-actions">
+ <label for="select-all-variants"></label>
+ </th>
+ <th>{% trans "SKU" %}</th>
+ {% for attribute in attributes %}
+ <th>{{ attribute.display|capfirst }}</th>
{% endfor %}
- <td>{{ variant.name }}</td>
- <td class="right-align">{% gross variant.get_price_per_item %}</td>
+ <th class="wide">{% trans "Variant name" %}</th>
+ <th class="right-align">{% trans "Price" %}</th>
</tr>
- {% endfor %}
- </tbody>
- {% else %}
- <tbody>
- <tr>
- <td>
- <span>{% trans "There are no variants for this product" %}</span>
- </td>
- </tr>
- </tbody>
- {% endif %}
- </table>
+ </thead>
+
+ <tbody>
+ {% for variant in variants %}
+ <tr>
+ <td class="bulk-checkbox">
+ <input id="id_variants_{{ variant.id }}" name="items" type="checkbox" value="{{ variant.id }}" class="filled-in switch-actions">
+ <label for="id_variants_{{ variant.id }}"></label>
+ </td>
+ <td><a class="light-blue-text text-lighten-1" title="{% trans "Edit variant" %}"
+ href="{% url 'dashboard:variant-update' product_pk=product.pk variant_pk=variant.pk %}">
+ {{ variant.sku }}
+ </a></td>
+ {% for attr_display in variant|attributes_values_with_empty:attributes %}
+ <td>
+ {{ attr_display }}
+ </td>
+ {% endfor %}
+ <td>{{ variant.name }}</td>
+ <td class="right-align">{% gross variant.get_price_per_item %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ {% else %}
+ <tbody>
+ <tr>
+ <td>
+ <span>{% trans "There are no variants for this product" %}</span>
+ </td>
+ </tr>
+ </tbody>
+ {% endif %}
+ </table>
+ </div>
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#variants">
</form>
</div>
@@ -215,46 +218,49 @@
</div>
</div>
</div>
- <table class="bordered hoverable responsive data-table">
- {% if stock_items %}
- <thead>
- <tr>
- <th class="bulk-checkbox">
- <input type="checkbox" id="select-all-stock" class="filled-in select-all switch-actions">
- <label for="select-all-stock"></label>
- </th>
- <th>{% trans "SKU" %}</th>
- <th class="right-align">{% trans "Quantity" %}</th>
- <th class="wide">{% trans "Location" %}</th>
- </tr>
- </thead>
-
- <tbody>
- {% for item in stock_items %}
+
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ {% if stock_items %}
+ <thead>
<tr>
- <td class="bulk-checkbox">
- <input name="items" type="checkbox" id="{{ item.id }}" class="filled-in switch-actions" value="{{ item.id }}">
- <label for="{{ item.id }}"></label>
+ <th class="bulk-checkbox">
+ <input type="checkbox" id="select-all-stock" class="filled-in select-all switch-actions">
+ <label for="select-all-stock"></label>
+ </th>
+ <th>{% trans "SKU" %}</th>
+ <th class="right-align">{% trans "Quantity" %}</th>
+ <th class="wide">{% trans "Location" %}</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {% for item in stock_items %}
+ <tr>
+ <td class="bulk-checkbox">
+ <input name="items" type="checkbox" id="{{ item.id }}" class="filled-in switch-actions" value="{{ item.id }}">
+ <label for="{{ item.id }}"></label>
+ </td>
+ <td><a class="light-blue-text text-lighten-1" title="{% trans "Edit variant" %}"
+ href="{% url 'dashboard:product-stock-update' product_pk=product.pk stock_pk=item.pk %}">
+ {{ item.variant.sku }}
+ </a></td>
+ <td class="right-align">{{ item.quantity }}</td>
+ <td>{{ item.location }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ {% else %}
+ <tbody>
+ <tr>
+ <td>
+ <span>{% trans "There is no stock for this product." %}</span>
</td>
- <td><a class="light-blue-text text-lighten-1" title="{% trans "Edit variant" %}"
- href="{% url 'dashboard:product-stock-update' product_pk=product.pk stock_pk=item.pk %}">
- {{ item.variant.sku }}
- </a></td>
- <td class="right-align">{{ item.quantity }}</td>
- <td>{{ item.location }}</td>
</tr>
- {% endfor %}
- </tbody>
- {% else %}
- <tbody>
- <tr>
- <td>
- <span>{% trans "There is no stock for this product." %}</span>
- </td>
- </tr>
- </tbody>
- {% endif %}
- </table>
+ </tbody>
+ {% endif %}
+ </table>
+ </div>
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#stock">
</form>
</div>
diff --git a/saleor/static/scss/widget/_card.scss b/saleor/static/scss/widget/_card.scss
index 42fd3431d7..d0c0bd5160 100644
--- a/saleor/static/scss/widget/_card.scss
+++ b/saleor/static/scss/widget/_card.scss
@@ -5,6 +5,10 @@
line-height: 28px;
margin-bottom: 10px;
}
+
+ &--no-data {
+ padding-top: 6px;
+ }
}
}
diff --git a/saleor/static/scss/widget/_data-table.scss b/saleor/static/scss/widget/_data-table.scss
index fd1cbee279..c6ffb050b5 100644
--- a/saleor/static/scss/widget/_data-table.scss
+++ b/saleor/static/scss/widget/_data-table.scss
@@ -1,9 +1,26 @@
@mixin data-table {
+ &-container {
+ @media #{$medium-and-down} {
+ overflow: scroll;
+ }
+
+ .card &:first-child, .card-title + & {
+ th {
+ border-top: none;
+ }
+ }
+ }
+
&-header {
padding: 21px 24px;
+
+ &--no-data {
+ padding: 20px 20px 0;
+ }
}
&-title {
+ font-weight: 300;
margin: 0;
.data-table-status {
@@ -90,12 +107,6 @@
box-shadow: none;
}
- .card &:first-child, .card-title + & {
- th {
- border-top: none;
- }
- }
-
.dropdown-button {
padding: 15px 28px;
}