{$_name = ""} {if !empty($promo)} {if !empty($promo.name) && trim($promo.name)} {$_name = $promo.name} {elseif !empty($promo.id)} {$_name = _w("")} {else} {$_name = _w("New promo")} {/if} {else} {$_name = _w("Promo does not exist.")} {/if} {$_tabs = [ "rules" => [ "id" => "rules", "name" => _w("Tools") ], "orders" => [ "id" => "orders", "name" => _w("Orders") ], "costs" => [ "id" => "costs", "name" => _w("Costs") ] ]} {$_active_tab_id = "rules"} {if array_key_exists(waRequest::request("tab"), $_tabs)} {$_active_tab_id = waRequest::request("tab")} {/if} {$_pattern = '[0-9]{2}:[0-9]{2}'} {* PAGE *}
{* INCORRECT *} {if empty($promo)}

[`Promo not found.`]

{* CREATE OR EDIT *} {else}
{* HEADER *}

← [`Back`] {$_name|escape}

{if !empty($promo.id)}
[`Add a new promo based on this one`] [`Delete promo`] {* Test link *} {foreach $additional_html.action_link as $_html} {$_html} {/foreach}
{/if}
{* BODY *}
{if !empty($chart_data)}
[`Sales`] [`Orders`] [`Average order`] [`ROI`] [`Return On Investment for the selected period = Profit / Marketing costs`] [`Profit`] [`Expenses`]
[`Promo`]
{shop_currency_html($promo_totals.sales)} {$promo_totals.sales_percent|round}%
{$promo_totals.order_count|round} {$promo_totals.order_count_percent|round}%
{$_width = $promo_totals.avg_order_percent} {if $_width > 100}{$_width = 100}{/if}
{shop_currency_html($promo_totals.avg_order)} {$promo_totals.avg_order_percent|round}%
{if !empty($promo_totals.roi)}{$promo_totals.roi}%{else}—{/if} {shop_currency_html($promo_totals.profit)} {shop_currency_html($promo_totals.expense)}
[`Total`] [`Data of all paid orders received from storefronts enabled for this promo, including orders not matching the promo’s settings`]
{shop_currency_html($overall_totals.sales)}
{$overall_totals.order_count|round}
{$_width = 100} {if $promo_totals.avg_order_percent > $_width} {$_width = ($overall_totals.avg_order*100/$promo_totals.avg_order)} {/if}
{shop_currency_html($overall_totals.avg_order)}
{/if}
{* Name *}
[`Name`]
{if !empty($promo.id)}
[`ID`]: {$promo.id|escape}
{/if}
[`This name is not visible to website visitors.`]
{* Status *}
[`Status`]
{strip} {$_is_active = $promo.enabled} {$_status_icon_class = "play"} {$_status_title = _w("Active action")} {if !empty($promo.start_datetime)} {$_start_time = $promo.start_datetime|strtotime} {$_now = waDateTime::format('timestamp')} {if $_start_time > $_now} {$_status_icon_class = "alarm-clock"} {$_status_title = "[`Scheduled`]"} {/if} {/if}
{$_status_title|escape} [`Stop`]
[`Stopped`] [`Resume`]
{/strip}
[`Beginning`]
{$_date_view = ""} {$_date = ""} {$_time = ""} {if !empty($promo.start_datetime)} {$_date_view = $promo.start_datetime|wa_date} {$_date = $promo.start_datetime|wa_datetime:"Y-m-d"} {$_time = $promo.start_datetime|wa_datetime:"H:i"} {/if}
[`End`]
{$_date_view = ""} {$_date = ""} {$_time = ""} {if !empty($promo.finish_datetime)} {$_date_view = $promo.finish_datetime|wa_date} {$_date = $promo.finish_datetime|wa_datetime:"Y-m-d"} {$_time = $promo.finish_datetime|wa_datetime:"H:i"} {/if}
[`Storefronts`]
[`Storefronts`] ({$storefronts_count|escape}) [`Options`]
{$all_storefronts_count = $storefronts|default:[]|count}
{$some_storefronts = false} {if !empty($promo["id"]) && empty($promo["routes"][shopPromoRoutesModel::FLAG_ALL])} {$some_storefronts = true} {/if}
{foreach $additional_html.info_section as $_html} {$_html} {/foreach}
{strip} {/strip}

[`Add tools to run this promo campaign and to define when placed orders must be associated with this promo.`]

{strip} {function name="_render_rule" _rule=[]} {if !empty($_rule)} {$_rule_type_data = ifempty($available_rule_types, $_rule.rule_type, null)} {else} {$_rule = [ "id" => "", "rule_type" => "" ]} {/if}
{if !empty($_rule_type_data)} {$_rule_type_data.name|escape}{else}{$_rule.rule_type}{/if}
[`Edit`] [`Cancel`] {if !empty($_rule.id)} [`Delete`] {/if}
{/function} {/strip} {capture assign="_new_rule_template"} {_render_rule _rule=[]} {/capture} {foreach $promo.rules as $_rule} {_render_rule _rule=$_rule} {/foreach}
{foreach $additional_html.bottom as $_html} {$_html} {/foreach}
{* FOOTER *} {if !empty($promo.id)} {/if}
{capture assign="_hint_template"}
[`Date`]:
%date%
[`Sales`]:
%value%
{/capture} {strip} {capture assign="_saving_html"} [`Saving`]... {/capture} {capture assign="_saved_html"} [`Saved`] {/capture} {capture assign="_prepare_html"} [`Preparing`] ... {/capture} {/strip} {capture assign="_clone_confirm"}

[`Clone this promo?`]

[`All data of this promo will be copied to a new promo.`]

[`A new promo will be disabled by default.`]

{/capture} {capture assign="_delete_confirm"}

[`Delete promo?`]

[`All data of this promo will be deleted.`]

[`You will not be able to undo this action.`]

{/capture} {capture assign="_unsaved_data_dialog"}

[`This page contains unsaved changes.`]

[`You are about to leave this page without saving your changes. Are you sure?`]

{/capture} {/if}