-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathlist.html.twig
147 lines (147 loc) · 5.95 KB
/
list.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{% if deliveries|length > 0 %}
<table class="table table-condensed">
<thead>
<th>#</th>
{% if with_store is defined and with_store %}
<th>{{ 'delivery.table.heading.owner'|trans }}</th>
{% endif %}
<th>{{ 'delivery.table.heading.summary'|trans }}</th>
<th>{{ 'order.list.state'|trans }}</th>
<th>{{ 'task.type.DROPOFF'|trans }}</th>
<th>{{ 'delivery.table.heading.courier'|trans }}</th>
{% if with_order is defined and with_order %}
<th class="text-center">{{ 'delivery.table.heading.order'|trans }}</th>
{% endif %}
<th>{% trans %}basics.price{% endtrans %}</th>
<th></th>
<th></th>
<th></th>
</thead>
<tbody>
{% for delivery in deliveries %}
<tr data-testid="delivery__list_item">
<td>
<a href="{{ path(routes.view, { id: delivery.id }) }}" data-testid="delivery_id">
{% if delivery.order is not null %}
{{ delivery.order.number }}
{% else %}
#{{ delivery.id }}
{% endif %}
</a>
</td>
{% if with_store is defined and with_store %}
<td width="20%">
{% if delivery.owner is not empty %}
{% if deliveries.route is defined %}
<a href="{{ path(deliveries.route, deliveries.params|merge({
(deliveries.paginatorOptions.filterFieldParameterName): delivery.owner is instanceof('AppBundle\\Entity\\LocalBusiness') ? 'r.id' : 's.id',
(deliveries.paginatorOptions.filterValueParameterName): delivery.owner.id })) }}">
{{ delivery.owner.name }}
</a>
{% else %}
<span>{{ delivery.owner.name }}</span>
{% endif %}
{% endif %}
</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>
</td>
{% set deliveryState = delivery.computeState() %}
<td>
<span title="{{ deliveryState.toLabel()|trans }}" style="color: {{ deliveryState.toColor() }}">
<i class="fa fa-lg fa-{{ deliveryState.toFontAwesome() }}"></i>
</span>
</td>
<td width="10%">
<small>
{% if delivery.dropoff.before|date('Ymd') == 'now'|date('Ymd') %}
{{ delivery.dropoff.before|time_diff }}
{% else %}
{{ delivery.dropoff.before|format_datetime('short', 'short') }}
{% endif %}
</small>
</td>
<td width="10%">
{% if delivery.pickup.isAssigned() and delivery.dropoff.isAssigned() %}
{% if delivery.pickup.assignedCourier == delivery.dropoff.assignedCourier %}
<a href="{{ path('admin_user_details', { username: delivery.pickup.assignedCourier.username }) }}">
<img src="{{ path('user_avatar', { username: delivery.pickup.assignedCourier.username }) }}" width="20" height="20"> @{{ delivery.pickup.assignedCourier.username }}
</a>
{% endif %}
{% endif %}
</td>
{% if with_order is defined and with_order %}
<td class="text-center">
{% if delivery.order is defined and delivery.order is not empty %}
<a href="{{ path('admin_order', { id: delivery.order.id }) }}">
{{ delivery.order.number }}
</a>
{% endif %}
</td>
{% endif %}
<td width="12%">
{% if delivery.order is defined and delivery.order is not empty %}
<span class="d-flex justify-content-between align-items-center">
<span class="text-muted">{% trans %}order.total_excluding_tax{% endtrans %}</span>
<span class="text-monospace">{{ (delivery.order.itemsTotal - delivery.order.itemsTaxTotal)|price_format }}</span>
</span>
<span class="d-flex justify-content-between align-items-center">
<span class="text-muted">{% trans %}order.total_including_tax{% endtrans %}</span>
<span class="text-monospace">{{ delivery.order.total|price_format }}</span>
</span>
{% else %}
<p>-</p>
{% endif %}
</td>
<td class="text-center">
{% if delivery.hasImages() and store is defined %}
<a href="{{ path(routes.download_images, { storeId: store.id, deliveryId: delivery.id }) }}">
<i class="fa fa-lg fa-camera"></i>
</a>
{% endif %}
</td>
<td class="text-center" width="10%">
<small class="text-muted">{{ delivery.createdAt|time_diff }}</small>
</td>
<td class="text-right">
<a href="{{ path(routes.view, { id: delivery.id }) }}">{{ 'basics.view'|trans }}</a>
<div {{ react_component('BarcodesModal', {
items: delivery.items|serialize('json', {groups: ['task', 'task_collection', 'barcode', 'address']})
}) }}></div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">
{{ empty_message|default('basics.no_entries')|trans }}
</p>
{% endif %}