root/admin/shop/edit_order.tt
[%- meta.title = 'Edit Order' -%]
<style>
table.items th, td {
padding: 5px;
vertical-align: middle;
}
</style>
<form id="edit_order" action="[% c.uri_for( '/admin/shop/order', order.id, 'save' ) %]" method="post">
<p>
<label>Order Number: </label> [% order.id %]
</p>
<p>
<label>Price</label>
</p>
<table>
<tr>
<td>
Goods:
</td>
<td>
[% currency %][% order.total_price_without_postage | format('%.2f') %]
</td>
<tr>
</tr>
<td>
Postage:
</td>
<td>
[% currency %][% order.total_postage | format('%.2f') %]
</td>
</tr>
<tr>
<td>
Total:
</td>
<td>
[% currency %][% order.total_price | format('%.2f') %]
</td>
</tr>
</table>
<p>
<label for="status">Status</label>
<br>
<select name="status">
[%- FOREACH status IN statuses %]
<option value="[% status %]"[% ' selected="selected"' IF order.status == status %]>[% status %]</option>
[%- END %]
</select>
</p>
<table class="items">
<tr>
<th>
</th>
<th>
Item
</th>
<th>
Per item
</th>
<th>
Quantity
</th>
<th>
Goods
</th>
<th>
Postage option
</th>
<th>
Postage
</th>
<th>
Subtotal
</th>
</tr>
[%- FOREACH item IN order.order_items %]
<tr>
<td>
<input name="items" value="[% item.id %]" id="item_[% item.id %]" type="checkbox" onclick="javascript:if ( this.checked==true ) { return confirm('Are you sure you want to remove this item?'); }">
</td>
<td>
[% item.item.name | html %]
</td>
<td>
[% currency %][% item.unit_price | format('%.2f') %]
</td>
<td>
<input name="quantity_[% item.id %]" value="[% item.quantity %]" size="2" type="text">
</td>
<td>
[% currency %][% item.total_price_without_postage | format('%.2f') %]
</td>
<td>
<select name="postage_[% item.id %]">
<option value="">None chosen</option>
[%- FOREACH option IN item.item.postages %]
<option value="[% option.id %]"[% ' selected="selected"' IF item.postage.id == option.id %]>[% option.name %] ([% currency %][% option.price | format('%.2f') %])</option>
[%- END %]
</select>
</td>
<td>
[% currency %][% ( item.postage.price || 0 ) * ( item.quantity || 0 ) | format('%.2f') %]
</td>
<td>
[% currency %][% ( item.total_price || 0 ) | format('%.2f') %]
</td>
</tr>
[%- END %]
</table>
<p>
<input type="submit" value="Update Order">
<input name="cancel" type="submit" value="Cancel Order" onclick="javascript:return confirm('Are you sure you want to cancel this order?')">
</p>
</form>