Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve order table display for lastmile/local commerce #4810

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions templates/_partials/delivery/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,7 @@
</td>
{% endif %}
<td width="40%">
<ul class="list-unstyled">
{% for task in delivery.getTasks() %}
<li>
<small>
<span class="mr-1">{% include "_partials/task/type_icon.html.twig" with { task: task } %}</span>
{% if task.address.name is not empty %}
<span><b>{{ task.address.name }}, </b></span>
{% endif %}
<span>
{% if task.isCancelled() %}<del>{% endif %}
{{ task.address.streetAddress }}
{% if task.isCancelled() %}</del>{% endif %}
</span>
</small>
</li>
{% endfor %}
</ul>
{% set details = [ delivery.distance|meters_to_kilometers ] %}
{% if delivery.weight is not empty %}
{% set details = details|merge([ delivery.weight|grams_to_kilos ]) %}
{% endif %}
{% if delivery.hasPackages() %}
{% for package_quantity in delivery.packages %}
{% set details = details|merge([ package_quantity.quantity ~ ' × ' ~ package_quantity.package.name ]) %}
{% endfor %}
{% endif %}
<small>{{ details|join(' - ') }}</small>
{% include '_partials/delivery/summary.html.twig' with { delivery: delivery } %}
</td>
{% set deliveryState = delivery.computeState() %}
<td>
Expand Down
27 changes: 27 additions & 0 deletions templates/_partials/delivery/summary.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<ul class="list-unstyled">
{% for task in delivery.getTasks() %}
<li>
<small>
<span class="mr-1">{% include "_partials/task/type_icon.html.twig" with { task: task } %}</span>
{% if task.isCancelled() %}<del>{% endif %}
{% if task.address.name is not empty %}
<span><b>{{ task.address.name }}</b> - {{ task.address.streetAddress }}</span>
{% else %}
{{ task.address.streetAddress }}
{% endif %}
{% if task.isCancelled() %}</del>{% endif %}
</span>
</small>
</li>
{% endfor %}
</ul>
{% set details = [ delivery.distance|meters_to_kilometers ] %}
{% if delivery.weight is not empty %}
{% set details = details|merge([ delivery.weight|grams_to_kilos ]) %}
{% endif %}
{% if delivery.hasPackages() %}
{% for package_quantity in delivery.packages %}
{% set details = details|merge([ package_quantity.quantity ~ ' × ' ~ package_quantity.package.name ]) %}
{% endfor %}
{% endif %}
<small>{{ details|join(' - ') }}</small>
4 changes: 2 additions & 2 deletions templates/_partials/order/customer.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% if customer.hasUser() %}
<a href="{{ path('admin_user_details', { username: customer.username }) }}"
class="d-inline-block text-truncate" style="max-width: 120px;"
class="d-block text-truncate" style="max-width: 120px;"
title="{{ customer.user.username|e('html_attr') }}">
<i class="fa fa-user mr-1"></i>
<span>{{ customer.user.username }}</span>
Expand All @@ -14,7 +14,7 @@
</a>
{% else %}
<span
class="d-inline-block text-truncate" style="max-width: 120px;"
class="d-block text-truncate" style="max-width: 120px;"
title="{{ customer.emailCanonical|e('html_attr') }}">
<i class="fa fa-user mr-1"></i>
<span>{{ customer.emailCanonical }}</span>
Expand Down
29 changes: 18 additions & 11 deletions templates/_partials/order/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<thead>
<th>#</th>
{% if is_granted('ROLE_ADMIN') and (with_extras ?? true) %}
<th>{% trans %}order.list.customer{% endtrans %}</th>
<th>{% trans %}order.list.state{% endtrans %}</th>
<th>{% trans %}delivery.table.heading.owner{% endtrans %}</th>
{% endif %}
<th>{% trans %}order.list.state{% endtrans %}</th>
<th>{% trans %}order.list.summary{% endtrans %}</th>
{% if is_granted('ROLE_ADMIN') and (with_extras ?? true) %}
<th class="text-right">{% trans %}order.total_excluding_tax{% endtrans %}</th>
<th class="text-right">{% trans %}basics.platform_fees{% endtrans %}</th>
<th class="text-right">{% trans %}order.total_excluding_tax{% endtrans %}</th>
<th class="text-right">{% trans %}basics.platform_fees{% endtrans %}</th>
{% endif %}
<th class="text-right">{% trans %}order.total_including_tax{% endtrans %}</th>
{% if with_receipt ?? true %}
Expand Down Expand Up @@ -42,21 +42,28 @@
</a>
</td>
{% if is_granted('ROLE_ADMIN') and (with_extras ?? true) %}
<td width="10%">
<td width="5%">{% include '_partials/order/state.html.twig' %}</td>
<td>
{% if order.hasVendor() and not order.isMultiVendor() %}
{{ order.vendor.name }}
{% elseif order.delivery and order.delivery.store %}
{{ order.delivery.store.name }}
{% endif %}
</td>
{% endif %}
<td>
{% if order.customer is not null %}
{% include '_partials/order/customer.html.twig' with { customer: order.customer } %}
{% endif %}
{% include '_partials/order/summary.html.twig' %}
</td>
{% endif %}
<td width="5%">{% include '_partials/order/state.html.twig' %}</td>
<td>{% include '_partials/order/summary.html.twig' %}</td>
{% if is_granted('ROLE_ADMIN') and (with_extras ?? true) %}
<td class="text-right">
<td width="8%" class="text-right">
<span>{{ (order.itemsTotal - order.itemsTaxTotal)|price_format }}</span>
</td>
<td class="text-right">{{ order.getFeeTotal()|price_format }}</td>
<td width="8%" class="text-right">{{ order.getFeeTotal()|price_format }}</td>
{% endif %}
<td class="text-right">
<td width="8%" class="text-right">
<span>{{ order.total|price_format }}</span>
</td>
{% if with_receipt ?? true %}
Expand Down
14 changes: 6 additions & 8 deletions templates/_partials/order/summary.html.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% if order.fulfillmentMethod is not empty and order.fulfillmentMethod == 'collection' %}
<i class="fa fa-cube mr-2"></i>
{% else %}
<i class="fa fa-bicycle mr-2"></i>
{% endif %}
<span>
{% if order.hasVendor() %}
{% if order.fulfillmentMethod is not empty and order.fulfillmentMethod == 'collection' %}
<i class="fa fa-cube mr-2"></i>
{% else %}
<i class="fa fa-bicycle mr-2"></i>
{% endif %}
{% if order.isMultiVendor() %}
{% trans with {
'%name%': order.vendor.name
Expand All @@ -25,8 +25,6 @@
{% endif %}
{% endif %}
{% else %}
{% for item in order.items %}
{{ item.variant.name }}
{% endfor %}
{% include '_partials/delivery/summary.html.twig' with { delivery: order.delivery } %}
{% endif %}
</span>
Loading