Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add partial for rendering orders' list
Marcin Gębala1a7259fb8524
diff --git a/saleor/dashboard/templates/dashboard/includes/_orders_table.html b/saleor/dashboard/templates/dashboard/includes/_orders_table.htmlnew file mode 100644index 0000000000..0a29a8eea8--- /dev/null+++ b/saleor/dashboard/templates/dashboard/includes/_orders_table.html@@ -0,0 +1,30 @@+{% load i18n %}+{% load prices_i18n %}+{% load status %}++<table class="table">+ <thead>+ <tr>+ <th>{% trans "Order" %}</th>+ <th>{% trans "Date" %}</th>+ <th>{% trans "Customer" %}</th>+ <th>{% trans "Order status" %}</th>+ <th>{% trans "Payment 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.id }}</a>+ </td>+ <td>{{ order.created }}</td>+ <td>{{ order.user|default:"Anonymous" }}</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>{% gross order.get_total %}</td>+ </tr>+ {% endfor %}+ </tbody>+</table>\ No newline at end of filediff --git a/saleor/dashboard/templates/dashboard/index.html b/saleor/dashboard/templates/dashboard/index.htmlindex a1a7742b09..04f88f087d 100644--- a/saleor/dashboard/templates/dashboard/index.html+++ b/saleor/dashboard/templates/dashboard/index.html@@ -46,24 +46,7 @@</div><div class="panel-body">{% if orders_to_ship %}- <table class="table">- <thead>- <tr>- <th>Order</th>- <th>Customer</th>- <th>Total</th>- </tr>- </thead>- <tbody>- {% for order in orders_to_ship %}- <tr>- <td><a href="{% url "dashboard:order-details" pk=order.pk %}">{{ order }}</a></td>- <td>{{ order.user|default:"Anonymous" }}</td>- <td>{% gross order.get_total %}</td>- </tr>- {% endfor %}- </tbody>- </table>+ {% include "dashboard/includes/_orders_table.html" with orders=orders_to_ship %}{% else %}<span>No orders</span>{% endif %}diff --git a/saleor/dashboard/templates/dashboard/order/list.html b/saleor/dashboard/templates/dashboard/order/list.htmlindex 212418848e..7afa528cd7 100644--- a/saleor/dashboard/templates/dashboard/order/list.html+++ b/saleor/dashboard/templates/dashboard/order/list.html@@ -10,28 +10,7 @@<div class="col-lg-12"><h1 class="page-header">{% trans "Orders" %}</h1>{% include "dashboard/includes/_status_filters.html" %}- <table class="table table-bordered">- <thead>- <tr>- <th>{% trans "Order number" %}</th>- <th>{% trans "Customer" %}</th>- <th>{% trans "Amount" %}</th>- <th>{% trans "Status" %}</th>- </tr>- </thead>- <tbody>- {% for order in object_list %}- <tr>- <td>- <a href="{% url 'dashboard:order-details' pk=order.pk %}">{{ order.id }}</a>- </td>- <td>{{ order.user|default:"Anonymous" }}</td>- <td>{% gross order.get_total %}</td>- <td>{% render_status order.status order.get_status_display %}</td>- </tr>- {% endfor %}- </tbody>- </table>+ {% include "dashboard/includes/_orders_table.html" with orders=object_list %}{% include "dashboard/includes/_pagination.html" %}</div></div>