{* CSS *} {$wa->css()} {* JS *}
{if !empty($order)}
{* CONTENT *}
{* TITLE *}

{$wa->shop->orderId($order.id)} {if $order.state} {$order.state->getName()|escape} {if $last_action_datetime} {$last_action_datetime|wa_datetime:'datetime'} {/if} {else} [`Unknown state`]: {$order.state_id} {/if}

{* CUSTOMER INFO *}
{if $order.contact.id|default:'0'} {else} {/if}
{$customers_rights = $wa->userRights('customers')}

{if $customers_rights && $order.contact.id|default:'0'} {$order.contact.name|default:'[`(no name)`]'} {else} {$order.contact.name|default:'[`(no name)`]'} {if !$order.contact.id|default:'0'} [`deleted`]{/if} {/if} {if $order.contact.registered|default:false} {/if} {if $customer.number_of_orders == 1} [`New customer`] {else} {_w('%d order', '%d orders', $customer.number_of_orders)} {/if}

{* SHIPPING *} {if ($shipping_address) || !empty($params.shipping_name)}

[`Shipping`]{if !empty($params.shipping_name)} —{/if} {ifset($params.shipping_name)}

{if $shipping_address}

{$shipping_address}

{if !empty($shipping_custom_fields)}

{foreach $shipping_custom_fields as $f} {$f.title}: {$f.value|escape}
{/foreach}

{/if} {if $customer_delivery_date || $customer_delivery_date_str}

[`Preferred shipping time:`] {if $customer_delivery_date} {wa_date('date', $customer_delivery_date, waDateTime::getDefaultTimezone())|escape} {elseif $customer_delivery_date_str} {$customer_delivery_date_str|escape} {/if} {if $customer_delivery_time} {if $customer_delivery_date}   {/if} {$customer_delivery_time.from_hours|escape}:{$customer_delivery_time.from_minutes|escape} - {$customer_delivery_time.to_hours|escape}:{$customer_delivery_time.to_minutes|escape} {/if}

{/if} {if !empty($courier)}

[`Courier`] — {$courier.name|escape}

{/if} {strip} {$edit_shipping_details_available = false} {if !empty($order.state)} {$available_actions = $order.state->getActions()} {$edit_shipping_details_available = !empty($available_actions.editshippingdetails)} {/if} {if $edit_shipping_details_available || !empty($shipping_date)}

{if !empty($shipping_date)} [`Shipping time`]: {wa_date('date', $shipping_date, waDateTime::getDefaultTimezone())|escape} {$shipping_time_start|escape} - {$shipping_time_end|escape} {if !empty($order.state)}
{/if} {/if}

{/if} {/strip} {if !empty($params.tracking_number)}

[`Shipment tracking number`] — {$params.tracking_number|escape}

{/if} {if !empty($tracking) && $order.state_id != 'completed'}
{$tracking}
{/if} {/if} {/if} {* PAYMENT *} {if !empty($params.payment_name)}

[`Payment`] — {$params.payment_name}

{if $billing_address !== null}

{$billing_address}

{/if} {/if}
{* SIDEBAR *}
{* BUTTON *}
{* PAID BADGE *} {if !empty($order.paid_date)}
[`Paid`]
{elseif !empty($order.auth_date)}
[`Payment authorized`]
{/if} {* MAP *} {if $shipping_address}
{$map}
{/if}
{* ORDER COMMENT *} {if $order.comment}
{$order.comment|escape}
{/if} {* ORDER CONTENT *} {if $order.items} {$subtotal = 0} {foreach $order.items as $item} {$subtotal = $subtotal + $item.price*$item.quantity} {/foreach} {else} {/if} {if isset($params.shipping_name) || $order.shipping > 0} {/if}
[`Qty`] [`Total`]
{if $item.type != 'service'} {if !empty($item.image_id)} {$wa->shop->productImgHtml(['id' => $item.product_id, 'image_id' => $item.image_id, 'image_filename' => $item.image_filename, 'ext' => $item.ext], '48x48')} {else} {/if} {/if} {if $item.type == 'service'}+ {/if} {$item.name|escape} {if isset($item.sku_code)}
{$item.sku_code|escape} {/if} {if !empty($item.stock)}
@{$item.stock.name|escape} {/if} {if !empty($item.stock_icon)}
{$item.stock_icon} {/if}
{wa_currency_html($item.price, $order.currency)} × {$item.quantity} {wa_currency_html($item.price * $item.quantity, $order.currency)}

[`Subtotal`]

{wa_currency_html($subtotal, $order.currency)}
[`Order content is unknown`]
[`Discount`] {if !empty($order.coupon)} {$order.coupon.code|escape} {/if} − {wa_currency_html($order.discount, $order.currency)}
[`Shipping`] {wa_currency_html($order.shipping, $order.currency)}
[`Tax`] {wa_currency_html($order.tax, $order.currency)}
[`Total`] {wa_currency_html($order.total, $order.currency)}
{/if}