{* PAGE *}
{* HEADER *}

[`Promos`]

{if !empty($additional_html)} {/if}
{wa_action app="shop" module="marketing" action="sidebar"} {* BODY *}
{if empty($status) || $status === shopPromoModel::STATUS_ACTIVE} {* ACTUAL *}

[`Active promos`]

{if !empty($active_promos)} {if !empty($active_storefront)}

[`Change the sort order of active promos by using drag&drop.`]

{else}

[`Select a storefront to change the sort order of active promos.`]

{/if} {/if}
{_render_promo_skeleton count=3}
{if !empty($active_promos)}
{foreach $active_promos as $_promo} {_render_promo _promo=$_promo} {/foreach}
{else}

[`No active promos.`]

{/if}
{/if} {if empty($status) || $status === shopPromoModel::STATUS_PLANNED} {* PLANNED *}

[`Scheduled promos`]

{if !empty($planned_promos)}
{_render_promo_skeleton count=3}
{foreach $planned_promos as $_promo} {$_promo.is_planned = 1} {_render_promo _promo=$_promo} {/foreach}
{else}

[`Scheduled promos automatically launch on their specified beginning time.`]

{/if}
{/if} {if empty($status) || $status === shopPromoModel::STATUS_COMPLETED} {* COMPLETED *}

[`Completed promos`]

[`Complete report`]
{if !empty($completed_promos)}
{_render_completed_promo_skeleton count=2}
{foreach $completed_promos as $_promo} {/foreach}
"name"]}"> [`Promo name`]{_render_sort_icon _data=["field" => "name"]} "start_datetime"]}"> [`Beginning`]{_render_sort_icon _data=["field" => "start_datetime"]} "finish_datetime"]}"> [`End`]{_render_sort_icon _data=["field" => "finish_datetime"]} "orders_count"]}"> [`Orders`]{_render_sort_icon _data=["field" => "orders_count"]} [`Sales`] [`ROI`]
{foreach ifset($promos_markers, $_promo.id, []) as $marker}
{$wa->shop->getIcon($marker.css_class)}
{/foreach}
{if !empty($_promo.start_datetime)} {$_promo.start_datetime|wa_date} {elseif !empty($_promo.create_datetime)} {$_promo.create_datetime|wa_date} {else} — {/if} {if !empty($_promo.finish_datetime)} {$_promo.finish_datetime|wa_date} {else} — {/if} {ifset($promos_stats, $_promo.id, 'orders_count', 0)} {shop_currency_html(ifset($promos_stats, $_promo.id, 'sales', 0))} {$roi_value = ifset($promos_stats, $_promo.id, 'roi', null)} {if !empty($promos_stats[$_promo.id]['paid_for_itself'])} {$roi_class = 'green'} {else} {$roi_class = 'red'} {/if} {if $roi_value !== null} {$roi_value}% {else} — {/if}
{$_url_params = ''} {$_get_params = waRequest::get()} {$_get_params['status'] = 'completed'} {foreach $_get_params as $_k => $_v} {if $_k != '_' && $_k != 'page' && $_v} {if is_array($_v)} {$_param = [$_k => $_v]} {$_url_params = "`$_url_params`&`$_param|http_build_query`"} {else} {$_url_params = "`$_url_params`&`$_k`=`$_v`"} {/if} {/if} {/foreach} {$_url_params = substr($_url_params, 1)} {wa_pagination page=$page total=ceil($total_completed_promos/20) attrs=['class' => "menu s-paginator-menu"] }
{else}

[`Promos are considered completed on their specified end time.`]

{/if}
{/if} {foreach $additional_html.bottom as $_html} {$_html} {/foreach}
{capture assign="_promo_pause_template_dialog"}

[`Pause promo`]

[`Promo “%promo_name%” will be paused.`]

[`Operation of all tools enabled for this promo will be discontinued—special product prices will be replaced by their ordinary prices, UTM tags will no longer be used to register incoming customer traffic, orders will not be counted by applied coupons, etc.`]

{/capture} {capture assign="_promo_play_template_dialog"}

[`Resume promo`]

[`Promo “%promo_name%” will be resumed.`]

{/capture} {capture assign="_sort_notice_dialog"} {/capture}