{if !empty($actions_html)} {foreach $actions_html as $h} {$h} {/foreach} {/if}

{wa_currency_html($order.total, $order.currency)} {$wa->shop->orderId($order.id)} {* @event backend_order.%plugin_id%.title_suffix *} {if !empty($backend_order)}{foreach $backend_order as $_}{ifset($_.title_suffix)}{/foreach}{/if} {if $order.state} {$order.state->getName()|escape} {if $last_action_datetime} {$last_action_datetime|wa_datetime:'humandatetime'} {$last_action_datetime|wa_datetime:'datetime'} {/if} {else} [`Unknown state`]: {$order.state_id} {/if}

    {foreach $buttons as $b}
  • {$b}
  • {/foreach} {* @event backend_order.%plugin_id%.action_button *} {if !empty($backend_order)}{foreach $backend_order as $_}{if (!empty($_.action_button))}
  • {$_.action_button}
  • {/if}{/foreach}{/if}
{if $customer_essentials.id|default:'0'} {else} {/if}
{$customers_rights = $wa->userRights('customers')}
{if $customers_rights && $customer_essentials.id|default:'0'} {$customer_essentials.name|default:'[`(no name)`]'|escape} {else} {$customer_essentials.name|default:'[`(no customer information)`]'|escape} {/if} {if $customer_essentials.registered|default:false} {/if} {if !empty($customer) && !empty($customer_essentials.id)} {if $customer.number_of_orders == 1} [`New customer`] {else} {_w('%d order', '%d orders', $customer.number_of_orders)} {/if} {/if}
{if $main_contact_info} {include file="./../customers/include.top_fields.html" top=$main_contact_info similar_contacts=$similar_contacts need_other_values=true inline} {/if} {if !empty($params.customer_timezone)}

[`Client current time:`] {waDateTime::format('time', null, $params.customer_timezone)} {$params.customer_timezone}

{/if}
{if $order.comment}
{$order.comment|escape}
{/if} {* @event backend_order.%plugin_id%.info_section *} {if !empty($backend_order)}{foreach $backend_order as $_}{if (!empty($_.info_section))}{$_.info_section}{/if}{/foreach}{/if}
{if ($shipping_address) || !empty($params.shipping_name)}
[`Shipping`]{if !empty($params.shipping_name)} —{/if} {ifset($params.shipping_name)}
{if $shipping_address}

{$shipping_address_html}

{if !empty($shipping_custom_fields)}

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

{/if} {if $customer_delivery_date || $customer_delivery_time || $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} {strip} {$customer_delivery_time.from_hours|escape}:{$customer_delivery_time.from_minutes|escape}{$customer_delivery_time.to_hours|escape}:{$customer_delivery_time.to_minutes|escape} {/strip} {/if}

{/if} {/if} {$_package = shopShipping::extractItemsTotal($order.params, true)} {if $_package} {if !empty($_package.package_total_weight)}

[`Total order weight`]: {$_package.package_total_weight}

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

[`Total order dimensions`]: {$_package.package_total_width}×{$_package.package_total_length}×{$_package.package_total_height}

{/if} {/if} {if $shipping_address} {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} {if !empty($params.tracking_number)}
[`Shipment tracking number`] — {$params.tracking_number|escape}
{/if} {if !empty($tracking) && $order.state_id != 'completed'}
{$tracking}
{/if} {if !empty($edit_shipping_details_available)} [`Shipping details`] {/if}
{/if}
{if !empty($order.paid_date)} {/if} [`Payment`] {if !empty($params.payment_name)} {$params.payment_name|escape} {/if}
{if $billing_address !== null}

{$billing_address}

{/if} {if !empty($order.paid_date)}

{sprintf('[`Order was paid on %s`]', $order.paid_date|wa_date:'humandate')}

{elseif !empty($order.auth_date)}

{sprintf('[`Order payment was captured on %s`]', $order.auth_date|wa_date:'humandate')}

{else} {if $order.state_id === 'deleted'}

[`Payment links are not eligible for deleted orders.`]

{else} {if $order.state_id == 'refunded'}

[`Order payment was refunded`]

{else}

[`Order was not paid yet`]

{/if}
[`Payment link`]
{*
{$order.payment_url}
*} [`Open link`] {/if} {/if}
{$visible_fulfilment_mode = !in_array($order.state_id, ['shipped', 'completed', 'refunded', 'deleted'])} {$_has_granted_calc_profit = $wa->user()->getRights('shop', 'reports')} {$_sum_purchase_price = 0} {$_total_items_profit = 0} {$_total_service_items_profit = 0} {if $order.items} {if $visible_fulfilment_mode} {else} {/if} {$subtotal = 0} {$current_chapter = $wa->whichUI()} {foreach $order.items as $item} {if $item.type=='product'} {if '1.3' == $current_chapter} {$link_edit = shopHelper::getBackendEditorUrl($item.product_id, 'product')} {else} {$link_edit = shopHelper::getBackendEditorUrl($item.product_id, 'prices')} {/if} {else} {$link_edit = "?action=products#/services/{$item.service_id}/"} {/if} {if $visible_fulfilment_mode} {/if} {$subtotal = $subtotal + $item.price*$item.quantity} {/foreach} {else} {/if} {$_colspan = (empty($visible_fulfilment_mode)) ? 2 : 3} {if !empty($subtotal)} {/if} {if isset($params.shipping_name) || $order.shipping > 0} {/if} {if !empty($order.tax|default:'')} {/if}
{$_description = _w('Fulfillment mode is for your personal control of assembling an order. Checked items are not synced with the server and other users.')}

{$_description}

[`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], '96x96', ["class" => "s-ordered-product-image"])} {else} {/if} {/if}
{if $item.type == 'service'}+{/if} {if !empty($item.deleted)} {$item.name|escape|default:"[`(no name)`]"} {if empty($item.product_id) && empty($item.sku_id)} {else} {if $item.type == 'product'}[`deleted product`]{else}[`deleted service`]{/if} {/if} {else} {$item.name|escape} {/if} {if empty($item.deleted) && $item.type == 'product' && $item.current_product_name|escape != $item.name|escape}
[`Current name`]: {$item.current_product_name|escape}
{/if} {if !empty($item.sku_code) && empty($item.deleted)}
{$item.sku_code|escape} {/if} {if !empty($item.stock)}
@{$item.stock.name|escape} {/if} {if !empty($item.stock_icon)}
{$item.stock_icon} {/if} {if $item.product_codes}
{foreach $item.product_codes as $_code} {/foreach}
{if !empty($_code.icon) && $_code.code_plugin_enabled} {else} {/if} {$_code.name|escape} {strip} {if count($_code.values) >= $item.quantity} {else} {/if} {sprintf_wp("%s out of %s", count($_code.values), $item.quantity)} {/strip}
{/if}
× {$item.quantity}
{wa_currency_html($item.price, $order.currency)} {if !empty($item.stock_unit)} {$item.stock_unit.name_short|escape} {/if}
0} title="{sprintf_wp("Total discount for this order item: %s.", wa_currency($item.total_discount, $order.currency))|escape}"{/if}>{wa_currency_html($item.price * $item.quantity, $order.currency)} {if $_has_granted_calc_profit && $item.purchase_price > 0} {if $item.tax_included == '1'} {$_item_profit = ($item.price - $item.purchase_price - $item.price / (100 + $item.tax_percent) * $item.tax_percent) * $item.quantity} {else} {$_item_profit = ($item.price - $item.purchase_price) * $item.quantity} {/if} {$_item_percent_profit = 0} {if $item.quantity > 0} {$_item_percent_profit = (($_item_profit / $item.purchase_price) * 100 / $item.quantity)|round} {/if} {$_total_items_profit = $_total_items_profit + $_item_profit} {$_sum_purchase_price = $_sum_purchase_price + $item.purchase_price * $item.quantity}
{if $item.price - $item.purchase_price > 0}+{/if}{wa_currency_html($_item_profit, $order.currency)} ({$_item_percent_profit}%)
{/if} {if $_has_granted_calc_profit && $item.type == 'service'} {$_total_service_items_profit = $_total_service_items_profit + $item.price * $item.quantity} {/if}
[`Order content is unknown`]

[`Subtotal`]

{wa_currency_html($subtotal, $order.currency)}
[`Discount`] {if !empty($order.coupon.code)} {if !empty($order.coupon.id) && $order.coupon.right} {/if} {$order.coupon.code|escape} {if !empty($order.coupon.id) && $order.coupon.right} {/if} {/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 $_has_granted_calc_profit && $_sum_purchase_price} {$_total_profit = $_total_items_profit + $_total_service_items_profit - $order.discount} {$_total_percent_profit = (($_total_profit / $_sum_purchase_price) * 100)|round}
{if $_total_profit > 0}+{/if}{wa_currency_html($_total_profit, $order.currency)} ({$_total_percent_profit}%)
{/if}

[`Order timeline`]

{foreach $bottom_buttons as $b} {$b} {/foreach}

{foreach $log as $row}
{$row.datetime|wa_datetime:"humandatetime"}
{if $row.action_id} {if $row.contact_id} {$row.contact_name|escape} {elseif $row.action_id == 'callback' && !empty($row.plugin)} {if !empty($row.plugin_icon_url)} {/if} {$row.plugin|default:''|escape} {/if} {if !empty($row.params.actor_courier_name)} {if $row.contact_id}
{/if} {$row.params.actor_courier_name|escape} {/if} {if $row.action}{$row.action->getOption('log_record')|escape}{else}{$row.action_id}{/if} {if $row.text} {$row.text|regex_replace:'@\\r?(\n)@':'$1'|nl2br}

{/if} {else} {if $row.text} {$row.text|regex_replace:'@\\r?(\n)@':'$1'|nl2br} {/if} {/if}
{if !empty($row.params.refund_items) && is_array($row.params.refund_items)}
[`Items removed from the order:`]
{strip} {/strip}
{/if} {if !empty($row.params.is_delivery_cost_removed)}
[`Shipping cost will be deleted.`]
{/if} {if !empty($row.params.return_stock)}
{ifset($row.params.return_stock_name,$row.params.return_stock)|string_format:"[`Items were returned to stock “%s”.`]"|escape}
{/if}
{/foreach}