<script type="application/javascript">
    lk_login = '{$saas_config.login}';
    lk_plan_info = {$data.plan_info};
    lk_space_used = {$data.quota};
    lk_users_count = {$saas_config.users_count};
    c_all_cost = {$data.c_all_cost};
    c_conf_cost = {$data.c_conf_cost};
    c_addons_cost = {$data.c_addons_cost};
    c_options_cost = {$data.c_options_cost};
    all_options_cost = {$data.all_options_cost};
    lk_cm = '{$data.cm}';
    lk_months_default = {$data.months_default};
    lk_tariff_default = {$data.tariff.id};
    lk_tariff_default_order = {$data.tariff.plan_order};
    lk_discount = {$data.discount};
</script>

{assign var="tariff_default" value="{if $data.tariff.cost == 0}{$data.tariff_default}{else}{$data.tariff.id}{/if}"}

{if $data.important_notice}
    <div class="panel panel-default">
        <div class="panel-heading" style="background-color:#FADADD">{$lang.lk_important_notifications}</div>
        <div class="panel-body">
            <div class="row" style="margin:0">
                {$data.important_notice}
            </div>
        </div>
    </div>
{/if}

{*New for free users window*}
{if $data.tariff.free}
    <div class="panel panel-default">
        <div class="panel-heading">{$lang.lk_fee_rate}</div>
        <div class="panel-body">
            <div class="row">
                <form class="form-inline">
                    <div class="col-sm-12 hidden" id="lk_contact_info_please" style='color: red;'>
                        {$lang.lk_contact_info_please}
                    </div>
                </form>
            </div>
            <div class="row">
                <form class="form-inline">
                    {if $data.tariff.free}
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_expire_k">
                            <select class="form-control" id="lk_info_tariff_f" onchange="lk_change_tariff_buy();">
                                {foreach from=$data.tariff_edit key=key item=val}
                                    <option value="{$val.id}"
                                            class="{$val.type}-tariff"
                                            data-st="{$val.st}" data-ru="{$val.ru}" data-pro="{$val.pro}" data-proru="{$val.proru}"
                                            {if $val.type != 'st'}style="display:none"{/if}
                                            {if $val.id == $tariff_default}selected{/if}>{$val.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    {/if}
                    <div class="{if $data.tariff.free}col-xs-5{else}col-sm-12{/if}
                    {if $data.tariff.free}text-left{else}text-center{/if}"
                         id="lk_expire_v">
                        <select class="form-control" id="lk_info_months_f" onchange="lk_change_tariff_buy();">
                            {foreach from=$data.months key=key item=val}
                                <option value="{$val}"
                                        {if $val eq $data.months_default}selected{/if}>{$key}</option>
                            {/foreach}
                        </select>
                    </div>
                </form>
            </div>
            <div class="row" id="ru-tariff-button" style="display:none">
                <form class="form-inline">
                    <div class="col-xs-5 col-sm-6 text-right no-padding">
                        <label for="lk_ru_tariff_f">RU-{$lang.server}</label><span class='help_bt' h_id='lk_ru_tariff'></span>:
                    </div>
                    <div class="col-xs-5 text-left">
                        <input type="checkbox" id="lk_ru_tariff_f" value="1" onclick="lk_change_tariff_list(this, 1)">
                    </div>
                </form>
            </div>
            <script>if ($('.ru-tariff').length == 0 && $('.proru-tariff').length == 0) $('#ru-tariff-button').hide();</script>
            <div class="row" id="pro-tariff-button" style="margin-top: 7px">
                <form class="form-inline">
                    <div class="col-xs-5 col-sm-6 text-right no-padding">
                        <label for="lk_pro_tariff_f">PRO-{$lang.Version|mb_convert_case:MB_CASE_LOWER}</label><span class='help_bt' h_id='lk_pro_tariff'></span>:
                    </div>
                    <div class="col-xs-5 text-left">
                        <input type="checkbox" id="lk_pro_tariff_f" value="1" onclick="lk_change_tariff_list(this, 1)">
                    </div>
                </form>
            </div>
            <script>if ($('.pro-tariff').length == 0 && $('.proru-tariff').length == 0) $('#pro-tariff-button').hide();</script>
            <div class="row">
                <form class="form-inline">
                    <div class="col-sm-12 text-center" id="lk_info_coupon_code_k">
                        <span class="promo_code"
                              onclick="lk_change('info', 'update', 'coupon_code'); return false;">{$lang.lk_promo_code}</span>
                    </div>
                    <div class="col-sm-12 text-center hidden" id="lk_info_coupon_code_v">
                        <div class="form-group">
                            {$lang.lk_promo_code_label}:&nbsp;<input class="form-control" id="lk_info_coupon_code_f"
                                                                     value="{$data.coupon_default}">
                            <a href="#" id="lk_info_coupon_apply"
                               onclick="lk_edit('info', 'update', 'coupon_code'); return false;">{$lang.lk_apply}</a>
                            <span id="lk_info_coupon_code_c">&nbsp;</span>
                            {if $data.coupon_default}<script>$(function(){ lk_edit('info', 'update', 'coupon_code') })</script>{/if}
                        </div>
                    </div>
                </form>
            </div>

            <div id="lk_payment">
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_acc_k">{$lang.lk_cost_acc}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_acc_v">
                            {if $data['all_cost'][$tariff_default][1] * $data.months_default != $data['all_cost'][$tariff_default][$data.months_default]}
                                <span style="text-decoration: line-through">
                                    {($data['all_cost'][$tariff_default][1] + $data['conf_cost'][$tariff_default][1]) * $data.months_default}</span>
                                <span style="color: red">
                                    {$data['all_cost'][$tariff_default][$data.months_default] + $data['conf_cost'][$tariff_default][$data.months_default]} {$data.cm}</span>
                            {else}
                                {$data['all_cost'][$tariff_default][$data.months_default] + $data['conf_cost'][$tariff_default][$data.months_default]} {$data.cm}
                            {/if}
                        </div>
                    </form>
                </div>
                {if $data.tariff_options}
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_options_k">{$lang.lk_cost_options}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_options_v">
                            {$data['options_cost'][$tariff_default] * $data.months_default} {$data.cm}
                        </div>
                    </form>
                </div>
                {/if}
                {if $data['addons_cost'][$tariff_default][$data.months_default]}
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_addons_k">{$lang.lk_cost_addons}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_addons_v">
                            {$data['addons_cost'][$tariff_default][$data.months_default]} {$data.cm}
                        </div>
                    </form>
                </div>
                {/if}
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_sale_k">{$lang.lk_cost_sale}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_sale_v"
                             {if $data.months_default neq 1}style="color: red;"{/if}>
                            {($data['all_cost'][$tariff_default][1] +
                              $data['conf_cost'][$tariff_default][1]) * $data.months_default -
                             ($data['all_cost'][$tariff_default][$data.months_default] +
                              $data['conf_cost'][$tariff_default][$data.months_default])} {$data.cm}
                            ({round(100 -
                            (($data['all_cost'][$tariff_default][$data.months_default] +
                              $data['conf_cost'][$tariff_default][$data.months_default]) /
                            (($data['all_cost'][$tariff_default][1] +
                              $data['conf_cost'][$tariff_default][1]) * $data.months_default)) * 100)}%)
                        </div>
                    </form>
                </div>
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_total_k">{$lang.lk_cost_total}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_total_v"
                             {if $data.months_default neq 1}style="color: red;"{/if}>
                            <b>{$data['all_cost'][$tariff_default][$data.months_default] +
                                $data['conf_cost'][$tariff_default][$data.months_default] +
                                $data['options_cost'][$tariff_default] * $data.months_default + 
                                $data['addons_cost'][$tariff_default][$data.months_default]} {$data.cm}</b>
                        </div>
                    </form>
                </div>
                <div class="row">
                    <form class="form-inline">
                        <div class="col-sm-12 text-center" id="lk_cost_total_k">
                            {if $data.paypal_id}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_paypal}"
                                   onclick="first_buy(2);">
                            {else}
                            {if $data.domain_info.partner_domain == 'Нет'}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_yandex}"
                                   onclick="first_buy(3);">
                            {/if}
                            {if $data.domain_info.tinkoff_terminal}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_tinkoff}"
                                   onclick="first_buy(4);">
                            {/if}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_invoice}"
                                   onclick="first_buy(1);">
                            {/if}
                            {*<input class="btn btn-light" type="button" value="{$lang.lk_pay_robokassa}"
                                   onclick="first_buy(0);">*}
                            {if !$data.tariff.free && !$data.trusted_fee}
                                <input class="btn btn-light" type="button" value="{$lang.lk_trusted_fee}"
                                       onclick="trusted_fee();">
                            {/if}
                        </div>
                    </form>
                </div>
            </div>

            <div id="lk_activate" class="row hidden" style="margin-top:7px">
                <form class="form-inline">
                    <div class="col-sm-12 text-center">
                        <input class="btn btn-light" type="button" value="{$lang.Activation}"
                               onclick="activate_coupon();">
                        <input class="btn btn-light" type="button" value="{$lang.Cancel}"
                               onclick="$('#lk_info_coupon_code_f').val(''); lk_edit('info', 'update', 'coupon_code');">
                        <input type="hidden" id="lk_info_activate_coupon_f">
                    </div>
                </form>
            </div>
        </div>
    </div>
{/if}
{*New widnow tariff*}
<div class="panel panel-default">
    <div class="panel-heading">{$lang.lk_current_tarif}</div>
    <div class="panel-body">
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding">
                    <label for="lk_info_tariff_f">{$lang.lk_tariff}</label><span class='help_bt' h_id='lk_tariff'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_info_tariff_v">
                    <span id="lk_info_tariff_s">
                        <b>{if $lang.short_name != 'ru' && isset($data.tariff_edit[{$data.tariff.id}])}{$data.tariff_edit[{$data.tariff.id}].eng_name}{else}{$data.tariff.name}{/if}</b>
                    </span>&nbsp;
                    <b>
                        {if $data.tariff.free}
                            0 {$data.cm}/{$lang.Month|mb_convert_case:MB_CASE_LOWER}
                        {else}
                            {$data['all_cost'][$tariff_default][1] + $data['conf_cost'][$tariff_default][1]} {$data.cm}/{$lang.Month|mb_convert_case:MB_CASE_LOWER}
                        {/if}
                    </b>
                    {if !$data.tariff.free && 
                        $data.tariff.name|strpos:'Maximum' === false && 
                        $data.tariff.name|mb_strpos:'Максимум' === false && 
                        $saas_config.login|substr:0:8 != 'partner-'}
                        <a href="#" onclick="lk_change('info', 'update', 'tariff'); return false;">{$lang.lk_change}</a>
                    {/if}
                    {if $data.tariff.free}
                        <span style="color:gray;">({$lang.lk_free_plan})</span>
                    {/if}


                </div>
                <div class="col-xs-5 text-left hidden" id="lk_info_tariff_e">
                    <div class="form-group">
                        {if !$data.tariff.free && 
                            $data.tariff.name|strpos:'Maximum' === false && 
                            $data.tariff.name|mb_strpos:'Максимум' === false && 
                            $saas_config.login|substr:0:8 != 'partner-'}
                            <select class="form-control" id="lk_info_tariff_f" onchange="lk_change_tariff()">
                                {foreach from=$data.tariff_edit key=key item=val}
                                    <option value="{$val.id}"
                                            class="{$val.type}-tariff"
                                            data-st="{$val.st}" data-ru="{$val.ru}" data-pro="{$val.pro}" data-proru="{$val.proru}"
                                            {if $val.type != $data.tariff.type}style="display:none"{/if}
                                            {if $val.id == $data.tariff.id}selected{/if}>{$val.plan_name}</option>
                                {/foreach}
                            </select>
                        {else}
                            <input type="hidden" id="lk_info_tariff_f" value="{$data.tariff.id}">
                        {/if}
                        <a href="#" style="display:none"
                           onclick="if (lk_plan_info[+$('#lk_info_tariff_f').val()].plan_order > lk_tariff_default_order) jconfirm('{$lang.lk_tariff_change_warning}', () => lk_edit('info', 'update', 'tariff'), () => false); else {if $data.tariff.last_change > date('Y-m-d H:i:s', time() - 3600 * 24 * 30)}if (lk_plan_info[+$('#lk_info_tariff_f').val()].plan_order  < lk_tariff_default_order) jalert('{$lang.lk_tariff_no_change} {date('d.m.Y H:i', strtotime($data.tariff.last_change) + 3600 * 24 * 30)}'); else {/if}lk_edit('info', 'update', 'tariff'); return false;">{$lang.lk_save}</a>
                        <span id="lk_info_tariff_c">&nbsp;</span>
                    </div>
                </div>
            </form>
        </div>
        <div class="row" id="ru-tariff-button" style="display:none">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding">
                    <label for="lk_ru_tariff_f">RU-{$lang.server}</label><span class='help_bt' h_id='lk_ru_tariff'></span>:
                </div>
                <div class="col-xs-5 text-left">
                    <input type="checkbox" id="lk_ru_tariff_f" value="1" onclick="lk_change_tariff_list(this, 0)" {if $data.tariff.type == 'ru' || $data.tariff.type == 'proru'}checked{/if}>
                </div>
            </form>
        </div>
        <div class="row" id="pro-tariff-button" style="display:none">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding">
                    <label for="lk_pro_tariff_f">PRO-{$lang.Version|mb_convert_case:MB_CASE_LOWER}</label><span class='help_bt' h_id='lk_pro_tariff'></span>:
                </div>
                <div class="col-xs-5 text-left">
                    <input type="checkbox" id="lk_pro_tariff_f" value="1" onclick="lk_change_tariff_list(this, 0)" {if $data.tariff.type == 'pro' || $data.tariff.type == 'proru'}checked{/if}>
                </div>
            </form>
        </div>
        {*истекает срок*}
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_expire_k">{$lang.lk_expire}<span class='help_bt'
                                                                                                             h_id='lk_expire'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_expire_v">
                    {if !$data.tariff.free}
                        <b>{$data.expire|form_local_time}</b>
                        {if $data.trusted_fee}
                            <span>({$lang.lk_trusted_fee})</span>
                        {/if}
                        {if $saas_config.login|substr:0:8 != 'partner-' && $data.tariff.name != 'Maximum Plus' && $data.tariff.name|substr:-5 != 'PROmo' && $data.tariff.display != 'Архив' && $data.months}
                            <a href="#" onclick="lk_change('info', 'update', 'expire'); return false;">{$lang.lk_extend}</a>
                        {/if}
                    {else}
                        <b>{$data.expire|form_local_time}</b>
                    {/if}
                </div>
            </form>
        </div>
        <div id="lk_buy" class="hidden">
            <div class="row">
                <form class="form-inline">
                    <div class="col-sm-12 hidden" id="lk_contact_info_please" style='color: red;'>
                        {$lang.lk_contact_info_please}
                    </div>
                </form>
            </div>
            <div class="row">
                <form class="form-inline">
                    {if $data.tariff.free}
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_expire_k">
                            <select class="form-control" id="lk_info_tariff_f" onchange="lk_change_tariff_buy();">
                                {foreach from=$data.tariff_edit key=key item=val}
                                    <option value="{$val.id}"
                                            {if $val.id eq $tariff_default}selected{/if}>{$val.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    {/if}
                    <div class="{if $data.tariff.free}col-xs-5{else}col-sm-12{/if}
                    {if $data.tariff.free}text-left{else}text-center{/if}"
                         id="lk_expire_v">
                        <select class="form-control" id="lk_info_months_f" onchange="lk_change_tariff_buy();">
                            {foreach from=$data.months key=key item=val}
                                <option value="{$val}"
                                        {if $val eq $data.months_default}selected{/if}>{$key}</option>
                            {/foreach}
                        </select>
                    </div>
                </form>
            </div>
            <div class="row">
                <form class="form-inline">
                    <div class="col-sm-12 text-center" id="lk_info_coupon_code_k">
                        <span class="promo_code"
                              onclick="lk_change('info', 'update', 'coupon_code'); return false;">{$lang.lk_promo_code}</span>
                    </div>
                    <div class="col-sm-12 text-center hidden" id="lk_info_coupon_code_v">
                        <div class="form-group">
                            {$lang.lk_promo_code_label}:&nbsp;<input class="form-control" id="lk_info_coupon_code_f"
                                                                     value="{$data.coupon_default}">
                            <a href="#"
                               onclick="lk_edit('info', 'update', 'coupon_code'); return false;">{$lang.lk_apply}</a>
                            <span id="lk_info_coupon_code_c">&nbsp;</span>
                            {if $data.coupon_default}<script>$(function(){ lk_edit('info', 'update', 'coupon_code') })</script>{/if}
                        </div>
                    </div>
                </form>
            </div>

            <div id="lk_payment">
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_acc_k">{$lang.lk_cost_acc}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_acc_v">
                            {if $data['all_cost'][$tariff_default][1] * $data.months_default != $data['all_cost'][$tariff_default][$data.months_default]}
                                <span style="text-decoration: line-through">
                                    {($data['all_cost'][$tariff_default][1] + $data['conf_cost'][$tariff_default][1]) * $data.months_default}</span>
                                <span style="color: red">
                                    {$data['all_cost'][$tariff_default][$data.months_default] + $data['conf_cost'][$tariff_default][$data.months_default]} {$data.cm}</span>
                            {else}
                                {$data['all_cost'][$tariff_default][$data.months_default] + $data['conf_cost'][$tariff_default][$data.months_default]} {$data.cm}
                            {/if}
                        </div>
                    </form>
                </div>
                {if $data.tariff_options}
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_options_k">{$lang.lk_cost_options}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_options_v">
                            {$data['options_cost'][$tariff_default] * $data.months_default} {$data.cm}
                        </div>
                    </form>
                </div>
                {/if}
                {if $data['addons_cost'][$tariff_default][$data.months_default]}
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_addons_k">{$lang.lk_cost_addons}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_addons_v">
                            {if $data.tariff.addons_discont}
                                <span style="text-decoration: line-through">
                                    {$data['addons_cost'][$tariff_default][$data.months_default] / (1 - $data.tariff.addons_discont / 100)}</span>
                                <span style="color: red">
                                    {$data['addons_cost'][$tariff_default][$data.months_default]} {$data.cm} (-{$data.tariff.addons_discont}% {$lang.thanks_to} PRO)</span>
                            {else}
                                {$data['addons_cost'][$tariff_default][$data.months_default]} {$data.cm}
                            {/if}
                        </div>
                    </form>
                </div>
                {/if}

                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_sale_k">{$lang.lk_cost_sale}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_sale_v"
                             {if $data.months_default neq 1}style="color: red;"{/if}>
                            {($data['all_cost'][$tariff_default][1] +
                              $data['conf_cost'][$tariff_default][1]) * $data.months_default -
                             ($data['all_cost'][$tariff_default][$data.months_default] +
                              $data['conf_cost'][$tariff_default][$data.months_default])} {$data.cm}
                            ({round(100 -
                            (($data['all_cost'][$tariff_default][$data.months_default] +
                              $data['conf_cost'][$tariff_default][$data.months_default]) /
                            (($data['all_cost'][$tariff_default][1] +
                              $data['conf_cost'][$tariff_default][1]) * $data.months_default)) * 100)}%)
                        </div>
                    </form>
                </div>
                <div class="row">
                    <form class="form-inline">
                        <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_total_k">{$lang.lk_cost_total}:</div>
                        <div class="col-xs-5 text-left" id="lk_cost_total_v"
                             {if $data.months_default neq 1}style="color: red;"{/if}>
                            <b>{$data['all_cost'][$tariff_default][$data.months_default] +
                                $data['conf_cost'][$tariff_default][$data.months_default] +
                                $data['options_cost'][$tariff_default] * $data.months_default + 
                                $data['addons_cost'][$tariff_default][$data.months_default]} {$data.cm}</b>
                        </div>
                    </form>
                </div>
                <div class="row">
                    <form class="form-inline">
                        <div class="col-sm-12 text-center" id="lk_cost_total_k">
                            {if $data.paypal_id}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_paypal}"
                                   onclick="first_buy(2);">
                            {else}
                            {if $data.domain_info.partner_domain == 'Нет'}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_yandex}"
                                   onclick="first_buy(3);">
                            {/if}
                            {if $data.domain_info.tinkoff_terminal}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_tinkoff}"
                                   onclick="first_buy(4);">
                            {/if}
                            <input class="btn btn-light" type="button" value="{$lang.lk_pay_invoice}"
                                   onclick="first_buy(1);">
                            {/if}
                            {*<input class="btn btn-light" type="button" value="{$lang.lk_pay_robokassa}"
                                   onclick="first_buy(0);">*}
                            {if !$data.tariff.free && !$data.trusted_fee}
                                <input class="btn btn-light" type="button" value="{$lang.lk_trusted_fee}"
                                       onclick="trusted_fee();">
                            {/if}
                        </div>
                    </form>
                </div>
            </div>

            <div id="lk_activate" class="row hidden" style="margin-top:7px">
                <form class="form-inline">
                    <div class="col-sm-12 text-center">
                        <input class="btn btn-light" type="button" value="{$lang.Activation}"
                               onclick="activate_coupon();">
                        <input class="btn btn-light" type="button" value="{$lang.Cancel}"
                               onclick="$('#lk_info_coupon_code_f').val(''); lk_edit('info', 'update', 'coupon_code');">
                        <input type="hidden" id="lk_info_activate_coupon_f">
                    </div>
                </form>
            </div>
        </div>
        {if !$app_host|lower|in_array:$partners_array}
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_configuration_k">
                    {$lang.lk_configuration}<span class='help_bt' h_id='lk_configuration'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_configuration_v">
                    <b>{$data.configuration} {* $data['conf_cost'][{$data.tariff.id}][1]} {$lang.lk_cur_mount *}</b>
                </div>
            </form>
        </div>
        {if $data['addons_cost'][$tariff_default][1]}
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cost_addons_k">
                    {$lang.Addons}<span class='help_bt' h_id='Addons'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_cur_cost_v">
                    <b>{$data['addons_cost'][$tariff_default][1]} {$data.cm}/{$lang.Month|mb_convert_case:MB_CASE_LOWER}</b>
                    <a href="edit_transfer.php" target="_blanc">{$lang.Go|mb_strtolower}</a>
                </div>
            </form>
        </div>
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_cur_cost_k">
                    {$lang.lk_cur_cost}<span class='help_bt' h_id='lk_cur_cost'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_cur_cost_v">
                    <b>{$data.cur_cost|number_format:0:'.':' '} {$data.cm}/{$lang.Month|mb_convert_case:MB_CASE_LOWER}</b>
                </div>
            </form>
        </div>
        {/if}
        {if $data.tariff_options}
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding">
                    {$lang.lk_tariff_options}<span class='help_bt' h_id='lk_tariff_options'></span>:
                </div>
                <div class="col-xs-5 text-left">
                {foreach from=$data.tariff_options item=tariff_options key=group_name name=group_options}
                    {if $group_name}
                        <div>
                            <img src="images/none.gif" style="margin: 0 0 7px 1px" 
                                 onclick="if (this.src.slice(-8) == 'none.gif') this.src = 'images/block.gif'; else this.src = 'images/none.gif';
                                          $('#option_group_{$smarty.foreach.group_options.index}').toggle();">
                            <span>{$group_name}</span>
                        </div>
                    {/if}
                    <div {if $group_name}style="display:none" id="option_group_{$smarty.foreach.group_options.index}"{/if}>
                    {foreach from=$tariff_options item=option key=option_id}
                        <div>
                            <input type="checkbox" value="{$option_id}" data-key="{$option.key}" data-group="{$group_name}" 
                                   onclick="lk_switch_tariff_option(this, {$option.cost}, {$data.tariff.id})" 
                                   {if $option.enabled}checked{/if} {if $option.disabled}disabled{/if}>&nbsp;
                            <span>{$option.name}</span>&nbsp;
                            {if $data.tariff.id > 1}
                                <span>{$option.cost} {$data.cm}/{$lang.Month|mb_convert_case:MB_CASE_LOWER}</span>&nbsp;
                                <span class='help_bt' h_id='lk_{$option.key}_option'></span>
                            {/if}
                        </div>
                    {/foreach}
                    </div>
                {/foreach}
                </div>
            </form>
        </div>
        {/if}
        {/if}
    </div>
</div>

{*New usage stats*}
<div class="panel panel-default">
    <div class="panel-heading">
        {$lang.lk_usage_stat}
    </div>
    <div class="panel-body">
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_create_users_k">{$lang.lk_create_users}<span class='help_bt'
                                                                                                                         h_id='lk_create_users'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_create_users_v">
                    {$saas_config.users_count}/<span id="lk_create_users_a">{if $data.tariff.user==999}{$lang.lk_unlimited}{else}{$data.users_avalibe}{/if}</span>
                </div>
            </form>
        </div>
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_used_space_k">{$lang.lk_used_space}<span class='help_bt'
                                                                                                                     h_id='lk_used_space'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_used_space_v">{$data.quota}/{$data.tariff.quota * 1000} (<b>{($data.quota/$data.tariff.quota*0.1)|round}%</b>)</div>
            </form>
        </div>
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_load_factor_k">{$lang.lk_load_factor}
                    <span class='help_bt' h_id='lk_load_factor'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_load_factor_v">
                    {$data.coeffect_load}/{$data.tariff.coeffect_load}</div>
            </form>
        </div>
        <div class="row">
            <form class="form-inline">
                <div class="col-xs-5 col-sm-6 text-right no-padding" id="lk_letters_by_24_hours_k">{$lang.lk_letters_by_24_hours}
                    <span class='help_bt' h_id='lk_letters_by_24_hours'></span>:
                </div>
                <div class="col-xs-5 text-left" id="lk_letters_by_24_hours_v">
                    {$data.tariff.emails_adress_avalibe}
                </div>
            </form>
        </div>
    </div>
</div>

{*Дополнительный скрипт для конфигурации 3.0.4*}
{if $data.configuration|strstr:"3.0.4"}

<script>
function definitionLkConf() {
    let lkConfiguration = `{$data.configuration}`;
    let lkNeedConfiguration = "Стандартная конфигурация 3.0.4";

    if (lkConfiguration.includes(lkNeedConfiguration)) {
      let checkboxProTariff = document.querySelector('#lk_pro_tariff_f');
      let textProConfirm = lang.lk_message_change_pro;
      let checkboxRuTariff  = document.querySelector('#lk_ru_tariff_f');
      let textRuConfirm = lang.lk_message_change_ru;

{if $data.tariff.name == 'Free'}
      checkboxProTariff.checked = true;
      lk_change_tariff_list(checkboxProTariff, 1);
      checkboxRuTariff.checked = true;
      lk_change_tariff_list(checkboxRuTariff, 1);
{/if}

      checkedChangeInfo(checkboxProTariff, textProConfirm);
      checkedChangeInfo(checkboxRuTariff, textRuConfirm);
    };
};

function checkedChangeInfo(elemCheckbox, textConfirm) {

  elemCheckbox.onclick = null;

  elemCheckbox.addEventListener('change', function() {
    if (this.checked === false) {

      this.checked = true;

      function successChecked() {
        elemCheckbox.checked = false;
        lk_change_tariff_list(elemCheckbox, {if $data.tariff.name == 'Free'}1{else}0{/if});
      };

      function noSuccessChecked() {
        return;
      }

      jconfirm(textConfirm, successChecked, noSuccessChecked);
    } else {
      lk_change_tariff_list(elemCheckbox, {if $data.tariff.name == 'Free'}1{else}0{/if});
    }
  });
};

definitionLkConf();
</script>

{elseif $data.tariff.name == 'Free'}

<script>
function definitionLkConf() {
    if ($('.ru-tariff').length > 0 || $('.proru-tariff').length > 0) {
        let checkboxRuTariff  = document.querySelector('#lk_ru_tariff_f');
        checkboxRuTariff.checked = true;
        lk_change_tariff_list(checkboxRuTariff, 1);
    }
    if ($('.st-tariff').length == 0 && $('.ru-tariff').length == 0) {
        let checkboxProTariff  = document.querySelector('#lk_pro_tariff_f');
        checkboxProTariff.checked = true;
        checkboxProTariff.disabled = true;
        lk_change_tariff_list(checkboxProTariff, 1);
    }
}
definitionLkConf();
</script>

{/if}
