Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve customer details
Paweł Kowalewski5e9b65cfef70
diff --git a/Gruntfile.js b/Gruntfile.jsindex 6f76a15c8c..f445f91bfa 100644--- a/Gruntfile.js+++ b/Gruntfile.js@@ -157,7 +157,8 @@ module.exports = function(grunt) {"saleor/static/components/Sortable/Sortable.js","saleor/static/components/select2/dist/js/select2.js","saleor/static/js_src/dashboard.js",- "saleor/static/components/dotdotdot/src/js/jquery.dotdotdot.js"+ "saleor/static/components/dotdotdot/src/js/jquery.dotdotdot.js",+ "saleor/static/components/jquery.equalheights/jquery.equalheights.js"]}}diff --git a/bower.json b/bower.jsonindex 688799459f..1c19978265 100644--- a/bower.json+++ b/bower.json@@ -16,6 +16,7 @@"Sortable": "~1.2.0","select2": "~4.0.0","dropzone": "~4.0.1",- "dotdotdot": "~1.7.3"+ "dotdotdot": "~1.7.3",+ "jquery.equalheights": "~1.5.2"}}diff --git a/saleor/dashboard/customer/views.py b/saleor/dashboard/customer/views.pyindex cff119b7dd..8bd28a583b 100644--- a/saleor/dashboard/customer/views.py+++ b/saleor/dashboard/customer/views.py@@ -41,5 +41,6 @@ def customer_details(request, pk):queryset = User.objects.prefetch_related('orders', 'addresses').select_related('default_billing_address')customer = get_object_or_404(queryset, pk=pk)- ctx = {'customer': customer}+ customer_orders = customer.orders.all()+ ctx = {'customer': customer, 'customer_orders': customer_orders}return TemplateResponse(request, 'dashboard/customer/detail.html', ctx)diff --git a/saleor/dashboard/templates/dashboard/base.html b/saleor/dashboard/templates/dashboard/base.htmlindex 8d71b288aa..565d023974 100644--- a/saleor/dashboard/templates/dashboard/base.html+++ b/saleor/dashboard/templates/dashboard/base.html@@ -95,6 +95,7 @@</div></main>+ <div class="hide-on-med-only"></div><div class="hide-on-large-only"></div><div id="base-modal" class="modal"></div><div id="base-modal-fixed" class="modal modal-fixed-footer"></div>diff --git a/saleor/dashboard/templates/dashboard/customer/detail.html b/saleor/dashboard/templates/dashboard/customer/detail.htmlindex 29329c2865..d8b4d55926 100644--- a/saleor/dashboard/templates/dashboard/customer/detail.html+++ b/saleor/dashboard/templates/dashboard/customer/detail.html@@ -8,80 +8,94 @@{% block body_class %}body-customers{% endblock %}-{% block page_title %}<span class="mdi-action-account-circle"></span> {{ customer }}{% endblock %}+{% block header_menu %}+ {% url "dashboard:customers" as url %}+ {% include "dashboard/includes/_back-link.html" with url=url %}+{% endblock %}++{% block breadcrumbs %}+ <ul class="breadcrumbs">+ <li><a href="{% url "dashboard:customers" %}">{% trans "Customers" %}</a></li>+ <li>{{ customer }}</li>+ </ul>+{% endblock %}++{% block menu_sales_class %} active{% endblock %}{% block content %}<div class="row">- <div class="col l8">- <div class="panel panel-default">- <div class="panel-heading">- <span class="panel-title">Order history</span>- </div>- <div class="panel-body">- {% with customer.orders.all as orders %}- {% if orders %}- <table class="table">- <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 orders %}- <tr>- <td><a href="{% url 'dashboard:order-details' 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>- {% else %}- <span>-</span>- {% endif %}- {% endwith %}+ <div class="col s12 l8">+ <div class="card">+ <div class="data-table-header">+ <h5 class="data-table-title">{% trans "Order history" %}</h5></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 %}+ <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>+ {% else %}+ <tbody>+ <tr>+ <td>+ <span>{% trans "No orders found." %}</span>+ </td>+ </tr>+ </tbody>+ {% endif %}+ </table></div></div>- <div class="col l4">- <div class="panel panel-default">- <div class="panel-heading">- <span class="panel-title">{% trans "Default billing address" %}</span>- </div>- <div class="panel-body">- <div>- {% if customer.default_billing_address %}- {% with customer.default_billing_address as address %}- {% include 'dashboard/includes/_address.html' with address=address only %}- {% endwith %}- {% else %}- <span>No default billing address</span>- {% endif %}+ <div class="col s12 l4">+ <div class="row">+ <div class="col s12 m6 l12">+ <div class="card equal-height">+ <div class="card-content">+ <span class="card-title black-text">{% trans "Default shipping address" %}</span>++ {% if customer.default_shipping_address %}+ {% with customer.default_shipping_address as address %}+ {% include 'dashboard/includes/_address.html' with address=address only %}+ {% endwith %}+ {% else %}+ <span>{% trans "No default shipping address." %}</span>+ {% endif %}+ <i class="mdi-content-mail"></i> <a href="mailto:{{ customer.email }}">{{ customer.email }}</a>+ </div></div></div>- </div>- <div class="panel panel-default">- <div class="panel-heading">- <span class="panel-title">{% trans "Default shipping address" %}</span>- </div>- <div class="panel-body">- <div>- {% if customer.default_shipping_address %}- {% with customer.default_shipping_address as address %}- {% include 'dashboard/includes/_address.html' with address=address only %}- {% endwith %}- {% else %}- <span>No default shipping address</span>- {% endif %}- </div>- <div>- <i class="glyphicon glyphicon-envelope"></i> <a href="mailto:{{ customer.email }}">{{ customer.email }}</a>++ <div class="col s12 m6 l12">+ <div class="card equal-height">+ <div class="card-content">+ <span class="card-title black-text">{% trans "Default billing address" %}</span>++ {% if customer.default_billing_address %}+ {% with customer.default_billing_address as address %}+ {% include 'dashboard/includes/_address.html' with address=address only %}+ {% endwith %}+ {% else %}+ <span>{% trans "No default billing address." %}</span>+ {% endif %}+ </div></div></div></div>diff --git a/saleor/dashboard/templates/dashboard/customer/list.html b/saleor/dashboard/templates/dashboard/customer/list.htmlindex eb440d9e8e..3a198085dc 100644--- a/saleor/dashboard/templates/dashboard/customer/list.html+++ b/saleor/dashboard/templates/dashboard/customer/list.html@@ -19,9 +19,9 @@<form method="get"><div class="row">{{ form.email|materializecss:"s12 m4 l3" }}- {{ form.name|materializecss:"s8 m4 l3" }}+ {{ form.name|materializecss:"s7 m4 l3" }}- <div class="col s4 m2 l3">+ <div class="col s5 m3 l3"><button type="submit" class="btn btn--inline">{% trans "Search" %}</button>{% if form.is_bound %}<a class="btn btn--inline" href="{% url 'dashboard:customers' %}">{% trans "Clear" %}</a>diff --git a/saleor/dashboard/templates/dashboard/order/detail.html b/saleor/dashboard/templates/dashboard/order/detail.htmlindex f2b78feb26..b95cf18777 100644--- a/saleor/dashboard/templates/dashboard/order/detail.html+++ b/saleor/dashboard/templates/dashboard/order/detail.html@@ -65,43 +65,49 @@</div>{% with order.shipping_address as address %}- {% if address %}- <div class="card grey lighten-4">- <div class="card-content">- <span class="card-title black-text">{% trans "Shipping address" %}</span>-- {% include 'dashboard/includes/_address.html' with address=address only %}-- <div>- <i class="mdi-content-mail"></i> <a href="mailto:{{ order.get_user_email }}">{{ order.get_user_email }}</a>+ <div class="row">+ {% if address %}+ <div class="col s12 m6 l12">+ <div class="card grey lighten-4">+ <div class="card-content">+ <span class="card-title black-text">{% trans "Shipping address" %}</span>++ {% include 'dashboard/includes/_address.html' with address=address only %}++ <div>+ <i class="mdi-content-mail"></i> <a href="mailto:{{ order.get_user_email }}">{{ order.get_user_email }}</a>+ </div>+ </div>++ <div class="card-action">+ <a href="#base-modal-fixed" class="modal-trigger-custom"+ data-href="{% url "dashboard:address-edit" order_pk=order.pk address_type="shipping" %}">Edit</a>+ </div></div></div>+ {% endif %}- <div class="card-action">- <a href="#base-modal-fixed" class="modal-trigger-custom"- data-href="{% url "dashboard:address-edit" order_pk=order.pk address_type="shipping" %}">Edit</a>- </div>- </div>- {% endif %}- {% endwith %}-- <div class="card grey lighten-4">- <div class="card-content">- {% with order.billing_address as address %}- <span class="card-title black-text">{% trans "Billing address" %}</span>+ <div class="col s12 {% if address %}m6{% else %}m12{% endif %} l12">+ <div class="card grey lighten-4">+ <div class="card-content">+ {% with order.billing_address as address %}+ <span class="card-title black-text">{% trans "Billing address" %}</span>++ {% include 'dashboard/includes/_address.html' with address=address only %}+ <div>+ <i class="mdi-content-mail"></i> <a href="mailto:{{ order.get_user_email }}">{{ order.get_user_email }}</a>+ </div>+ {% endwith %}+ </div>- {% include 'dashboard/includes/_address.html' with address=address only %}- <div>- <i class="mdi-content-mail"></i> <a href="mailto:{{ order.get_user_email }}">{{ order.get_user_email }}</a>+ <div class="card-action">+ <a href="#base-modal-fixed" class="modal-trigger-custom"+ data-href="{% url "dashboard:address-edit" order_pk=order.pk address_type="billing" %}">Edit</a>+ </div></div>- {% endwith %}- </div>-- <div class="card-action">- <a href="#base-modal-fixed" class="modal-trigger-custom"- data-href="{% url "dashboard:address-edit" order_pk=order.pk address_type="billing" %}">Edit</a>+ </div></div>- </div>+ {% endwith %}</div><div class="col s12 l8 switch-two-columns">diff --git a/saleor/static/js_src/dashboard.js b/saleor/static/js_src/dashboard.jsindex 103ae2f8cb..2d14d8e020 100644--- a/saleor/static/js_src/dashboard.js+++ b/saleor/static/js_src/dashboard.js@@ -3,6 +3,10 @@ $(document).ready(function() {$('.button-collapse').sideNav();$('.modal-trigger').leanModal();+ if (isTablet()) {+ $('.equal-height').equalHeights();+ }+var $tabs = $('ul.tabs');if ($tabs.length) {$tabs.find('.tab').on('click', function (e) {@@ -16,7 +20,7 @@ $(document).ready(function() {}var $breadcrumbs = $('.breadcrumbs--ellipsed');- if ($breadcrumbs && !$('.hide-on-large-only').is(':visible')) {+ if ($breadcrumbs && isDesktop()) {var $breadcrumbsItems = $('.breadcrumbs--ellipsed-item');var breadcrumbsItemWidth = ($breadcrumbs.width() - $breadcrumbs.find('li:first').width()) / $breadcrumbsItems.length;$breadcrumbsItems.css('max-width', breadcrumbsItemWidth).dotdotdot({'height': 50});@@ -60,6 +64,14 @@ $(document).ready(function() {}).on('click', '.modal-close', function() {$('.modal').closeModal();});++ function isDesktop() {+ return !$('.hide-on-large-only').is(':visible');+ }++ function isTablet() {+ return !$('.hide-on-med-only').is(':visible');+ }});Dropzone.options.productImageForm = {paramName: "image",