{include file="./index_head.tpl"}
{include file="./js/js_top.tpl"}
<script type="text/javascript">
    // Запоминанем разрешение экрана
    if (window.devicePixelRatio >= 2) {
        $.cookie("screen_width", screen.width * 2);
        $.cookie("screen_height", screen.height * 2);
    }
    else {
        $.cookie("screen_width", screen.width);
        $.cookie("screen_height", screen.height);
    }

    // Считываем режим https
    if (location.protocol == "https:")
        $.cookie("s_protocol", "s");
    else
        $.cookie("s_protocol", null);

    var num_field_min_width = "{$config.table_number_min_width}",
        num_field_max_width = "{$config.table_number_max_width}",
        other_field_min_width = "{$config.table_other_min_width}",
        other_field_max_width = "{$config.table_other_max_width}",
        wazzup_url = "{if $config.wazzup_url}{$config.wazzup_url}{else}wazzup24.com{/if}",
        cb_alert_data = `{$config.cb_alert}`.length != 0 ? JSON.parse(`{$config.cb_alert}`) : null;

    $(document).ready(function(){
        $('body').show();
        $('.version').text(NProgress.version);
        NProgress.set(0.3);

        if(cb_alert_data != null && cb_alert_data.show[user.group_id] && cb_alert_data.user_show[user.id]){
          if (cb_alert_data.type_pattern === 'Новый' || cb_alert_data.type_pattern === 'Новый темный') {
            cb_alert_new(
                cb_alert_data.id,
                cb_alert_data.title,
                cb_alert_data.text,
                cb_alert_data.button_name,
                cb_alert_data.button_url,
                cb_alert_data.check_show,
                cb_alert_data.url_img,
                cb_alert_data.type_pattern,
                cb_alert_data.base64_hash,
            );
          } else {
            cb_alert(
                cb_alert_data.id,
                cb_alert_data.title,
                cb_alert_data.text,
                cb_alert_data.button_name,
                cb_alert_data.button_url,
                cb_alert_data.check_show,
                cb_alert_data.url_img,
            );
          }
        }
    });
</script>
<script src="themes/clientbase/js/fixed-panel.js?{$revision}"></script>
<script src="themes/clientbase/js/preloader.js?{$revision}"></script>

{if $script_name == 'edit_calc.php' || $script_name == 'edit_button.php'}
{* в некоторых случаях не успевает догрузиться файл с классом Correlation, поэтому поднял выше скрипт *}
<script src="themes/clientbase/js/button/edit-button.js?{$revision}"></script>
<script src="themes/clientbase/js/button/correlation.js?{$revision}"></script>
<script type="text/javascript" src="include/js/script.js?{$revision}"></script>
{/if}

{include file="./index_add.tpl"}
{if $all_modules.social_messages.status eq 0}
    <script>
        var vkIsActive = true;
        $(document.ready = function () {
            checkVkMessage();
        });
    </script>
{/if}
{if ($user.fio == '[[EMPTY]]' || $user.phone == '[[EMPTY]]') && $script_name != 'edit_saas.php'}
    <script>
        jconfirm('Для продолжения работы, пожалуйста, заполните/подтвердите Ваши контактные данные в Личном кабинете аккаунта.',
            function () {
                location.href = 'edit_saas.php';
            },
            function () {
                location.href = 'edit_saas.php';
            }
        );
    </script>
{/if}
{if substr($user.phone, -10) == '[[NOWORK]]' && $script_name != 'edit_saas.php'}
    <script>
        jconfirm('Дождитесь пожалуйста активации вашего аккаунта.',
            function () {
                location.href = 'edit_saas.php';
            },
            function () {
                location.href = 'edit_saas.php';
            }
        );
    </script>
{/if}
</HEAD>

<BODY id="body_id" onload="on_window_resize()">
{if $header_lite} {* "облегченная" шапка *}
    <header class="header head_bgr no_print" id="top_header_div">
        <div class="header__second-bgr">
            {if !$user.id && !$config.title && !$config.logo}
                <div style="height: 35px"></div>
            {/if}
            <div class="header__top">
                {if $config.logo}
                    <a href="{$user_default_page}" title="{$lang.Back_to_top}" class="header__logo" style="padding-top: {$config.logo_top_margin}px; padding-bottom: {$config.logo_bottom_margin}px;">
                        <img src="cache/logo{$config.logo_rand}.{if $config.logo_svg}svg{else}png{/if}" align=left>
                        <span class="headname">
                            {$config.title|htmlspecialchars}
                        </span>
                    </a>
                {elseif $config.title}
                    <a href="{$user_default_page}" title="{$lang.Back_to_top}" class="header__logo" style="padding-top: {$config.logo_top_margin}px; padding-bottom: {$config.logo_bottom_margin}px;">
                        <span class="headname">
                            {$config.title|htmlspecialchars}
                        </span>
                    </a>
                {else}
                    <span class="empty" style="padding-top: {($config.logo_top_margin)+25}px; padding-bottom: {$config.logo_bottom_margin}px;"></span>
                {/if}

                {if $user_cats and $config.enable_new_design and $script_name neq 'login.php'}
                    <div class="header__categories-wrap">
                        <ul class="header__categories" id="mainmenu"
                            onmouseover="if (clear_header_cat_timer) clearTimeout(clear_header_cat_timer);clear_header_cat_timer=0;">
                            {foreach from=$user_cats item=one_cat name=user_cats}
                                <li
                                        class="header__category-item{if $one_cat.id eq $cur_cat} active header__category-item--active{/if}" {if $one_cat.icon2 and $one_cat.icon and $one_cat.id != $cur_cat} onmouseover="set_on_image({$one_cat.id}, '{$one_cat.icon2_ext}', '{$one_cat.icon2_hash}')" onmouseout="set_image({$one_cat.id}, '{$one_cat.icon_ext}', '{$one_cat.icon_hash}')" {/if}>
                                    <a {if $one_cat.show_text} title="{$one_cat.name}" {/if} id="active_cat_{$one_cat.id}"
                                                                                             href="{$one_cat.url}" {if $cur_cat and !$config.show_groups_in_menu and $config.category_click==2}onClick="if (prev_cat=={$one_cat.id}) return true; this.focus(); document.getElementById('cat'+prev_cat).style.display='none';document.getElementById('cat{$one_cat.id}').classList.add('active');document.getElementById('cat{$one_cat.id}').style.display='flex'; prev_cat={$one_cat.id}; return false"{/if}
                                                                                             ondblclick="location.href=this.href;">
                                        {if $one_cat.icon}<img
                                            id="img_cat_{$one_cat.id}" {if $one_cat.id eq $cur_cat} {if $one_cat.icon2}src="cache/img_cat_on_{$one_cat.id}.{$one_cat.icon2_ext}?hash={$one_cat.icon2_hash}" {else} src="cache/img_cat_{$one_cat.id}.{$one_cat.icon_ext}?hash={$one_cat.icon_hash}"{/if}  {else} src="cache/img_cat_{$one_cat.id}.{$one_cat.icon_ext}?hash={$one_cat.icon_hash}" {/if}>{/if}
                                        {if $one_cat.show_text == 0}
                                            <span class="header__category-name" style="margin-left: 3px;">{$one_cat.name}</span>
                                        {/if}
                                    </a>
                                </li>
                            {/foreach}
                        </ul>
                        {if $user.group_id eq 1 and $user.developer_mode and $script_name neq 'login.php'}
                            <div class="header__category-item--add"><a href="edit_cat.php?&cat=-1" title="{$lang.add_category}">+</a></div>
                        {/if}
                    </div>
                {/if}

                <div class="header__user-block">
                    <span class="header__user-item header__user-item--user-name header__user-item--not-hover">{$user.fio}</span>
                    <a style="margin-left: 2px" href="login.php?logout" title="{$lang.Exit}" class="header__user-item">
                        <img src="images/top_icon_exit.png" alt=""/>
                    </a>
                </div>
            </div>
        </div>
    </header>
{else}
    <header class="header head_bgr no_print" id="top_header_div">
        <div class="header__second-bgr">
            {if !$user.id && !$config.title && !$config.logo}
                <div style="height: 35px"></div>
            {/if}
            <!-- Top line in the header -->
            <div class="header__top">
                {if $config.logo}
                    <a href="{$user_default_page}" title="{$lang.Back_to_top}" class="header__logo" style="padding-top: {$config.logo_top_margin}px; padding-bottom: {$config.logo_bottom_margin}px;">
                        <img src="cache/logo{$config.logo_rand}.{if $config.logo_svg}svg{else}png{/if}">
                        <span class="headname">
                            {$config.title|htmlspecialchars}
                        </span>
                    </a>
                {elseif $config.title}
                    <a href="{$user_default_page}" title="{$lang.Back_to_top}" class="header__logo" style="padding-top: {$config.logo_top_margin}px; padding-bottom: {$config.logo_bottom_margin}px;">
                        <span class="headname">
                            {$config.title|htmlspecialchars}
                        </span>
                    </a>
                {else}
                    <span class="empty" style="padding-top: {($config.logo_top_margin)+25}px; padding-bottom: {$config.logo_bottom_margin}px;"></span>
                {/if}

                {if $user_cats and $config.enable_new_design and $script_name neq 'login.php'}
                    <div class="header__categories-wrap">
                        <ul class="header__categories" id="mainmenu"
                            onmouseover="if (clear_header_cat_timer) clearTimeout(clear_header_cat_timer);clear_header_cat_timer=0;">
                            {foreach from=$user_cats item=one_cat name=user_cats}
                                <li
                                        class="header__category-item{if $one_cat.id eq $cur_cat} active header__category-item--active{/if}" {if $one_cat.icon2 and $one_cat.icon and $one_cat.id != $cur_cat} onmouseover="set_on_image({$one_cat.id}, '{$one_cat.icon2_ext}', '{$one_cat.icon2_hash}')" onmouseout="set_image({$one_cat.id}, '{$one_cat.icon_ext}', '{$one_cat.icon_hash}')" {/if}>
                                    <a {if $one_cat.show_text} title="{$one_cat.name}" {/if} id="active_cat_{$one_cat.id}"
                                                                                             href="{$one_cat.url}" {if $cur_cat and !$config.show_groups_in_menu and $config.category_click==2}onClick="if (prev_cat=={$one_cat.id}) return true; this.focus(); document.getElementById('cat'+prev_cat).style.display='none';document.getElementById('cat{$one_cat.id}').classList.add('active');document.getElementById('cat{$one_cat.id}').style.display='flex'; prev_cat={$one_cat.id}; return false"{/if}
                                                                                             ondblclick="location.href=this.href;">
                                        {if $one_cat.icon}<img
                                            id="img_cat_{$one_cat.id}" {if $one_cat.id eq $cur_cat} {if $one_cat.icon2}src="cache/img_cat_on_{$one_cat.id}.{$one_cat.icon2_ext}?hash={$one_cat.icon2_hash}" {else} src="cache/img_cat_{$one_cat.id}.{$one_cat.icon_ext}?hash={$one_cat.icon_hash}"{/if}  {else} src="cache/img_cat_{$one_cat.id}.{$one_cat.icon_ext}?hash={$one_cat.icon_hash}" {/if}>{/if}
                                        {if $one_cat.show_text == 0}
                                            <span class="header__category-name" style="margin-left: 3px;">{$one_cat.name}</span>
                                        {/if}
                                    </a>

                                    {if $one_cat.user_tabs}
                                    <div class="hidden_cat_tables">
                                      <ul>
                                        {foreach from=$one_cat.user_tabs item=one_tab}
                                          {if $one_tab.type=="table"}
                                              <li class="header__submenu-item{if $one_tab.id eq $cur_table} active header__submenu-item--active{/if}">
                                                  <a
                                                    class="header__submenu-link"
                                                    href="fields.php?table={$one_tab.id}"
                                                    title="{$one_tab.name|htmlspecialchars}"
                                                  >{$one_tab.name}</a>
                                              </li>
                                          {elseif $one_tab.type=="report"}
                                              <li class="header__submenu-item{if $one_tab.id eq $cur_report} active header__submenu-item--active{/if}">
                                                  <a
                                                    class="header__submenu-link"
                                                    href="report.php?id={$one_tab.id}"
                                                    title="{$one_tab.name|htmlspecialchars}"
                                                  >{$one_tab.name}</a>
                                              </li>
                                          {else}
                                              <li class="header__submenu-item{if $one_tab.id eq $cur_calendar} active header__submenu-item--active{/if}">
                                                  <a
                                                    class="header__submenu-link"
                                                    href="calendar.php?id={$one_tab.id}"
                                                    title="{$one_tab.name|htmlspecialchars}"
                                                  >{$one_tab.name}</a>
                                              </li>
                                          {/if}
                                        {/foreach}
                                      </ul>
                                    </div>
                                    {/if}

                                </li>
                            {/foreach}
                        </ul>
                        {if $user.group_id eq 1 and $user.developer_mode and $script_name neq 'login.php'}
                            <div class="header__category-item--add">
                                <a href="edit_cat.php?&cat=-1" title="{$lang.add_category}">+</a>

                                <div class="header__category-add-hidden">
                                    <ul>
                                        <li><a href="edit_cat.php?&cat=-1&fast_add=1">{$lang.add_new_category}</a></li>
                                        <li><a href="edit_transfer.php">{$lang.add_addon}</a></li>
                                    </ul>
                                </div>
                            </div>
                        {/if}
                    </div>
                {/if}

                <div class="header__user-block" style="flex-direction: column;align-items: flex-end;">
                <div style="display: flex; align-items: center;">
                {if (($user.group_id eq 1) or ($user.sub_admin && $user.sub_admin_rights.modules)) and $script_name neq 'login.php'}
                    {if $config.type eq "SAAS" && $config.livechat_in_header && $config.site_url|strpos:"basemaster"===false}
                        <img src="images/lv_offline.png" id="lvi_6450">
                        <div class="online-consult__container">
                            <a class="header__user-item header__user-item--online-consultant" href="#">
                                {$lang.Livechat}

                            </a>
                            <script type="text/javascript" src="include/js/livechat.js?{$revision}"></script>
                            <img src="https://mstl.clientbase.ru/modules/livechat/test_online.php?r757561"
                                 id="lv_422" style="position:absolute;visibility:hidden"
                                 onload="lv_ref757561()">
                            <!-- Онлайн консультант -->
                            <div class="carrotquest-css-reset">
                                <div class="carrot-messenger-frame-container carrotquest-messenger-line-right carrotquest-messenger-line-anim carrotquest-messenger-line-anim-right_bottom ">
                                    <iframe id="carrot-messenger-frame" name="carrot-messenger-frame" class="carrot-messenger-frame" data-resize-height="1" style="height: 981px;" src="https://mstl.clientbase.ru/modules/livechat/client_side.php"></iframe>
                                    <div class="close__button_carrot">
                                        <button>
                                            <svg height="20px" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="20px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                                    <style type="text/css">
                                                        {literal}
                                                        <![CDATA[
                                                        .st0{display:inline;}
                                                        .st1{fill:none;stroke:#000000;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
                                                        .st2{display:none;}
                                                        ]]>
                                                        {/literal}
                                                    </style>
                                                <g class="st2" id="cross">
                                                    <g class="st0">
                                                        <line class="st1" x1="112.5" x2="401" y1="112.5" y2="401"/><line class="st1" x1="401" x2="112.5" y1="112.5" y2="401"/>
                                                    </g>
                                                </g>
                                                <g id="cross_copy">
                                                    <path d="M268.064,256.75l138.593-138.593c3.124-3.124,3.124-8.189,0-11.313c-3.125-3.124-8.189-3.124-11.314,0L256.75,245.436   L118.157,106.843c-3.124-3.124-8.189-3.124-11.313,0c-3.125,3.124-3.125,8.189,0,11.313L245.436,256.75L106.843,395.343   c-3.125,3.125-3.125,8.189,0,11.314c1.562,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343L256.75,268.064l138.593,138.593   c1.563,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343c3.124-3.125,3.124-8.189,0-11.314L268.064,256.75z"/>
                                                </g>
                                                </svg>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>

                    {elseif $config.type eq "SAAS" && $config.livechat_in_header && $config.site_url|strpos:"clientbase"===false}
                        <img src="images/lv_offline.png" id="lvi_6450"
                             style="margin-bottom: 20px;">
                        <div class="online-consult__container">
                            <a class="header__user-item header__user-item--online-consultant" href="#">
                                {$lang.Livechat}

                            </a>
                            <script type="text/javascript" src="include/js/livechat.js?{$revision}"></script>
                            <img src="https://livechat.basemaster.com/modules/livechat/test_online.php?r757561"
                                 id="lv_422" style="position:absolute;visibility:hidden"
                                 onload="lv_ref757561()">
                            <!-- Онлайн консультант -->
                            <div class="carrotquest-css-reset">
                                <div class="carrot-messenger-frame-container carrotquest-messenger-line-right carrotquest-messenger-line-anim carrotquest-messenger-line-anim-right_bottom ">
                                    <iframe id="carrot-messenger-frame" name="carrot-messenger-frame" class="carrot-messenger-frame" data-resize-height="1" style="height: 981px;" src="https://livechat.basemaster.com/modules/livechat/client_side.php"></iframe>
                                    <div class="close__button_carrot">
                                        <button>
                                            <svg height="20px" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="20px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                                    <style type="text/css">
                                                        {literal}
                                                        <![CDATA[
                                                        .st0{display:inline;}
                                                        .st1{fill:none;stroke:#000000;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
                                                        .st2{display:none;}
                                                        ]]>
                                                        {/literal}
                                                    </style>
                                                <g class="st2" id="cross">
                                                    <g class="st0">
                                                        <line class="st1" x1="112.5" x2="401" y1="112.5" y2="401"/><line class="st1" x1="401" x2="112.5" y1="112.5" y2="401"/>
                                                    </g>
                                                </g>
                                                <g id="cross_copy">
                                                    <path d="M268.064,256.75l138.593-138.593c3.124-3.124,3.124-8.189,0-11.313c-3.125-3.124-8.189-3.124-11.314,0L256.75,245.436   L118.157,106.843c-3.124-3.124-8.189-3.124-11.313,0c-3.125,3.124-3.125,8.189,0,11.313L245.436,256.75L106.843,395.343   c-3.125,3.125-3.125,8.189,0,11.314c1.562,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343L256.75,268.064l138.593,138.593   c1.563,1.562,3.609,2.343,5.657,2.343s4.095-0.781,5.657-2.343c3.124-3.125,3.124-8.189,0-11.314L268.064,256.75z"/>
                                                </g>
                                                </svg>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    {/if}
                {/if}

                {if (($user.group_id eq 1) or ($user.sub_admin && $user.sub_admin_rights.saas)) and $script_name neq 'login.php'
                        and !$demo_base_id and !$client_demo_id and $saas_config.login|substr:0:8 != 'devcopy-' and ($config.show_lk_link or $config.copyright)}
                    {if $config.type eq "SAAS"}
                        <a class="header__user-item" href="edit_saas.php">{$lang.Saas_cabinet}</a>
                    {elseif !$full_version}
                        <a class="header__user-item" href="activate.php">{$lang.Activation}</a>
                    {else}
                        <a class="header__user-item" href="edit_lic.php">{$lang.lk_title}</a>
                    {/if}
                {/if}


                {if $user.id > 0 and $script_name neq 'login.php'}
                {if $user.group_id eq 1 || ($user.sub_admin eq 1 && ($user.sub_admin_rights.own_acc==1 || $user.sub_admin_rights.access_subadmin==1))}
                    {if !$config.read_mode && $user.fio != '[[EMPTY]]' && $user.phone != '[[EMPTY]]'}
                        <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_cat.php" title="{$lang.Settings}" id="top_menu_settings"></a>
                    {/if}
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.logo_color==1}
                    <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_color.php" title="{$lang.Settings}"></a>
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.users==1}
                    {if $user.are_fields_editable}
                        <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_user.php" title="{$lang.Settings}"></a>
                    {/if}
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.access==1}
                        <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_group.php" title="{$lang.Settings}"></a>
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.mailing==1}
                        <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_mailing.php" title="{$lang.Settings}"></a>
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.backup==1}
                        <a class="header__user-item header__user-item_img header__user-item--settings" href="backup.php" title="{$lang.Settings}"></a>
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.logs==1}
                    <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_log.php" title="{$lang.Settings}"></a>
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.invite==1}
                    <a class="header__user-item header__user-item_img header__user-item--settings" href="invite.php" title="{$lang.Settings}"></a>
                {elseif $user.sub_admin eq 1 && $user.sub_admin_rights.addit==1}
                    <a class="header__user-item header__user-item_img header__user-item--settings" href="edit_add.php" title="{$lang.Settings}"></a>
                {/if}

                {if $b_events.tip.access}
                  <button
                    type="button"
                    id="header_tips"
                    class="header__user-item header__user-item_img header__user-item--tips"
                    title="{$lang.Tips}"
                    count-data="{$b_events.tip.count}"
                    onclick="eventView('tip')"
                  >
                    <span class="header__tips">{$b_events.tip.count}</span>
                  </button>
                {/if}


                {if $config.groups_use_favorites[$user.group_id]}
                <button type="button" class="header__user-item header__user-item_img header__user-item--favorites"
                        id="header_favorites"
                        onclick="eventView('favorite');ajax_get_favorites()"
                        title="{$lang.favorite_lines}">
                </button>
                {/if}

                {if $user.group_id != 777}
                    <button type="button" class="header__user-item header__user-item_img header__user-item--search"
                            id="header_search"
                            onclick="eventView('search');ajax_get_tables();"
                            title="{$lang.Search}">
                    </button>
                {/if}
                {if $mailstableid and $user.group_id != 777}
                    {if  $window_alert_for_mail}
                        <button type="button" class="header__user-item header__user-item_img header__user-item--mail" onclick="give_pass_mail()" title="{$mailstab}">
                            {if $mailstab > 0}
                            <span class="header__tips">{$mailstab}</span>
                            {/if}
                        </button>
                    {elseif $window_alert_for_mail_wrong}
                        <button type="button" class="header__user-item header__user-item_img header__user-item--mail" onclick="wrong_mail()" title="{$mailstab}">
                            {if $mailstab > 0}
                            <span class="header__tips">{$mailstab}</span>
                            {/if}
                        </button>
                    {else}
                        <a class="header__user-item header__user-item_img header__user-item--mail " href="fields.php?table={$mailstableid}" title="{$mailstab}">
                            {if $mailstab > 0}
                            <span class="header__tips">{$mailstab}</span>
                            {/if}
                        </a>
                    {/if}
                {/if}

                {if $default_calendars == -1}
                    <button type="button" class="header__user-item header__user-item_img header__user-item--calendar"
                            id="header_calendar"
                            onclick="eventView('calendar')" title="{$lang.Calendars}"
                            {if $window_calendar_data.allTodayEventCnt[$dayToday][$user.id]}
                                count-data="{$window_calendar_data.allTodayEventCnt[$dayToday][$user.id]}"
                            {/if}>
                    {if $window_calendar_data.allTodayEventCnt[$dayToday][$user.id] > 0}
                        <span class="header__tips">{$window_calendar_data.allTodayEventCnt[$dayToday][$user.id]}</span>
                    {/if}
                    </button>
                {elseif $default_calendars > 0}
                    <a class="header_events_count header__user-item header__user-item_img header__user-item--calendar"
                       href="calendar.php?id={$default_calendars}"
                       title="{$lang.Calendars}"
                        {if $window_calendar_data.allTodayEventCnt[$dayToday][$user.id]}
                            count-data="{$window_calendar_data.allTodayEventCnt[$dayToday][$user.id]}"
                        {/if}>
                    {if $window_calendar_data.allTodayEventCnt[$dayToday][$user.id] > 0 }
                        <span class="header__tips" >{$window_calendar_data.allTodayEventCnt[$dayToday][$user.id]}</span>
                    {/if}
                    </a>
                {/if}
                {if $user.acc_messages}
                    <button type="button" class="header__user-item header__user-item_img header__user-item--messages"
                            id="header_messages"
                            title="{$lang.Messages}"
                            count-data="{$b_events.message.count}">
                    <div id="chat-tray" class="messages__tooltip hidden">
                        <div
                          class="messages__tooltip-item"
                          id="user__messages"
                          onclick="eventView('message'); event.stopPropagation();"
                          style="position: relative;"
                        >
                          <div>{$lang.Messages}</div>
                          <span
                            id="cb_messages__messages-count"
                            class="header__tips"
                            style="left: unset; bottom: unset; right: -5px; top: 0; display: none;"
                          ></span>
                        </div>

                        {if $all_modules.livechat.status == 0 and $user.group_id != 777}
                            <div class="messages__tooltip-item" id="ok_manager__messages">
                                <div>{$lang.Managers_livechat}</div>
                                <span class="header__tips"></span>
                            </div>
                        {/if}
                    </div>
                    <span class="header__tips">{$b_events.message.count}</span>
                    </button>
                {/if}

                {if $all_bizprocs or $user.group_id==1 or $user.sub_admin_rights.addit_bizproc}
                    <button type="button" class="header__user-item header__user-item_img header__user-item--business-processes"
                            onclick="bizproc_view()" title="{$lang.Business_processes}">
                    </button>
                {/if}
                {if $user.browser_caller}
                    <a href="phone.php" class="header__user-item header__user-item--phone" title="Окно для звонков" id="header__item-phone"><img
                                src="images/phone-icon.png" alt=""/></a>
                {elseif $records_table_link}
                    <a href="fields.php?table={$records_table_link}" class="header__user-item header__user-item--phone"
                           title="Таблица записи разговоров"></a>
                {/if}

                {if (($user.group_id==1 or $user.sub_admin==1) and $config.support_link_on and $config.addit_help and !$tariff_limits.tp_off)}
                    <a href="edit_support.php" title="{$lang.Support}" class="header__user-item header__user-item_img header__user-item--help"
                       id="tech_count">
                {if $config.techsupport_tickets > 0}
                    <span class="header__tips">{$config.techsupport_tickets}</span>
                    </a>
                {else}
                    </a>
                {/if}
                {/if}

                {if $user.are_fields_editable && !$config.read_mode && $user.fio != '[[EMPTY]]' && $user.phone != '[[EMPTY]]'}
                  {if $user.avatar and $config.enable_new_design}
                    <a class="user_avatar" href="user_profile.php">
                      <img src="cache/user{$user.id}.png">
                    </a>
                  {else}
                    <a class="header__user-item header__user-item--user" href="user_profile.php">{$user.fio|escape}</a>
                  {/if}
                {else}
                    <span class="header__user-item header__user-item--user">{if $user.fio != '[[EMPTY]]' && $user.phone != '[[EMPTY]]'}{$user.fio}{/if}</span>
                {/if}
                {/if}
                    <a href="login.php?{if $check_code_page}check_code_page=1{/if}&logout" title="{$lang.Exit}"
                        onclick="if (unsubscribe_from_push()) { return false; }"
                        class="header__user-item header__user-item_img header__user-item--logout"
                    ></a>
                    <script>
                        function unsubscribe_from_push() {
                            if (typeof messaging !== 'undefined') {
                                messaging.deleteToken();
                                messaging.getToken().then((currentToken) => {});
                            }
                            document.cookie = "subscribe=unsubscribe; expires=" + (new Date(Date.now() + 9e11));
                        }
                    </script>
                </div>
                {if $user.id > 0 and $script_name neq 'login.php' and $config.single_user_mode}
                    <i style="margin-right: 25px;"><a href="edit_config.php">({$lang.single_user_mode})</a></i> {*!! нужно изменить*}
                {/if}
                </div>
            </div>
            <!-- End of top line in the header -->
              {if $user_cats and !$config.enable_new_design and $script_name neq 'login.php'}
                <div class="header__categories-wrap">
                    <ul class="header__categories" id="mainmenu"
                        onmouseover="if (clear_header_cat_timer) clearTimeout(clear_header_cat_timer);clear_header_cat_timer=0;">
                        {foreach from=$user_cats item=one_cat name=user_cats}
                            <li
                                    class="header__category-item{if $one_cat.id eq $cur_cat} active header__category-item--active{/if} {if $config.show_groups_in_menu}header__category-item-group-hover{/if}" {if $one_cat.icon2 and $one_cat.icon and $one_cat.id != $cur_cat} 
                                        onmouseover="set_on_image({$one_cat.id}, '{$one_cat.icon2_ext}', '{$one_cat.icon2_hash}')" 
                                        onmouseout="if(!this.classList.contains('click-active')) set_image({$one_cat.id}, '{$one_cat.icon_ext}', '{$one_cat.icon_hash}')" 
                                    {/if}>
                                <a {if $one_cat.show_text} title="{$one_cat.name}" {/if} id="active_cat_{$one_cat.id}"
                                                                                        href="{$one_cat.url}" {if $cur_cat and !$config.show_groups_in_menu and $config.category_click==2}onClick="if (prev_cat=={$one_cat.id}) return true; this.focus(); document.getElementById('cat'+prev_cat).style.display='none';document.getElementById('cat{$one_cat.id}').classList.add('active');document.getElementById('cat{$one_cat.id}').style.display='flex'; prev_cat={$one_cat.id}; return false"{/if}
                                                                                        ondblclick="location.href=this.href;">
                                    {if $one_cat.icon}<img
                                        id="img_cat_{$one_cat.id}" {if $one_cat.id eq $cur_cat} {if $one_cat.icon2}src="cache/img_cat_on_{$one_cat.id}.{$one_cat.icon2_ext}?hash={$one_cat.icon2_hash}" {else} src="cache/img_cat_{$one_cat.id}.{$one_cat.icon_ext}?hash={$one_cat.icon_hash}"{/if}  {else} src="cache/img_cat_{$one_cat.id}.{$one_cat.icon_ext}?hash={$one_cat.icon_hash}" {/if}>{/if}
                                    {if $one_cat.show_text == 0}
                                        <span class="header__category-name" style="margin-left: 3px;">{$one_cat.name}</span>
                                    {/if}
                                </a>
                                {if $config.show_groups_in_menu}
                                    <div class="header__category-dropdown-source" style="display:none;">
                                        <div class="header__categories-group__wrapper">
                                            {if $one_cat.menu_items_no_group || $one_cat.menu_groups}
                                                {if $one_cat.menu_items_no_group}
                                                    <div class="header__categories-group__wrapper-item no-group-wrapper">
                                                        {foreach from=$one_cat.menu_items_no_group item=one_item}
                                                            <a href="{$one_item.url}">{$one_item.name}</a>
                                                        {/foreach}
                                                    </div>
                                                {/if}

                                                {foreach from=$one_cat.menu_groups item=one_group}
                                                    <div class="header__categories-group__wrapper-item">
                                                        <h3>{$one_group.name}</h3>

                                                        {foreach from=$one_group.items item=one_item}
                                                            <a href="{$one_item.url}">{$one_item.name}</a>
                                                        {/foreach}
                                                    </div>
                                                {/foreach}
                                            {else}
                                                <div class="header__categories-group__wrapper-item no-group-wrapper">
                                                    <span>{$lang.no_table|default:"В базе отсутствуют таблицы"}</span>
                                                </div>
                                            {/if}
                                        </div>
                                    </div>
                                {/if}
                            </li>
                        {/foreach}
                    </ul>
                    {if $config.show_groups_in_menu}
                        <div class="header__categories-group" id="headerCategoriesDropdown" data-popup-mode="{$config.popup_menu_show_type|default: 'hover'}">
                            <div class="header__categories-group__wrapper" id="headerCategoriesDropdownContent"></div>
                        </div>
                    {/if}
                    {if $user.group_id eq 1 and $user.developer_mode and $script_name neq 'login.php'}
                        <div class="header__category-item--add">
                          <a href="edit_cat.php?&cat=-1" title="{$lang.add_category}">+</a>

                          <div class="header__category-add-hidden">
                            <ul>
                                <li><a href="edit_cat.php?&cat=-1&fast_add=1">{$lang.add_new_category}</a></li>
                                <li><a href="edit_transfer.php">{$lang.add_addon}</a></li>
                            </ul>
                          </div>
                        </div>
                    {/if}
                  </div>
                {/if}
                {if $cur_cat and !$config.enable_new_design}
                    <div class="header__submenu" id="submenu" class="no_print">
                        {foreach from=$user_cats item=one_cat}
                            <ul style="display:{if $one_cat.id eq $cur_cat}flex {else}none{/if}" class="header__submenu-list {if $one_cat.id eq $cur_cat}header__submenu-list-active{/if}"
                                id="cat{$one_cat.id}">
                                {foreach from=$one_cat.user_tabs item=one_tab}
                                    {if $one_tab.type=="table"}
                                        <li class="header__submenu-item{if $one_tab.id eq $cur_table} active header__submenu-item--active{/if}">
                                            <a
                                              class="header__submenu-link"
                                              href="fields.php?table={$one_tab.id}"
                                              title="{$one_tab.name|htmlspecialchars}"
                                            >{$one_tab.name}</a>
                                        </li>
                                    {elseif $one_tab.type=="report"}
                                        <li class="header__submenu-item{if $one_tab.id eq $cur_report} active header__submenu-item--active{/if}">
                                            <a
                                              class="header__submenu-link"
                                              href="report.php?id={$one_tab.id}"
                                              title="{$one_tab.name|htmlspecialchars}"
                                            >{$one_tab.name}</a>
                                        </li>
                                    {else}
                                        <li class="header__submenu-item{if $one_tab.id eq $cur_calendar} active header__submenu-item--active{/if}">
                                            <a
                                              class="header__submenu-link"
                                              href="calendar.php?id={$one_tab.id}"
                                              title="{$one_tab.name|htmlspecialchars}"
                                            >{$one_tab.name}</a>
                                        </li>
                                    {/if}
                                {/foreach}
                            </ul>
                        {/foreach}
                        {if ($user.group_id == 1 || $user.sub_admin_rights.cats.{$cur_cat} == 2) and $user.developer_mode}
                            <div class="header__submenu-item--add flexMenu-viewMore">
                                <a href="#" title="Добавить сущности в категорию">+</a>
                                <ul class="flexMenu-popup header__submenu-dropdownmenu" style="position: absolute; display: none;">
                                    <li class="header__submenu-item">
                                        <a class="header__submenu-link" href="edit_table.php?cat={$cur_cat}&table=-1"
                                           title="{$lang.Add_table}">{$lang.Add_table}
                                        </a>
                                    </li>
                                    <li class="header__submenu-item">
                                        <a class="header__submenu-link" href="edit_report.php?cat={$cur_cat}&report=-1"
                                           title="{$lang.Add_report}">{$lang.Add_report}
                                        </a>
                                    </li>
                                    <li class="header__submenu-item">
                                        <a class="header__submenu-link" href="edit_calendar.php?cat={$cur_cat}&calendar=-1"
                                           title="{$lang.Add_calendar}">{$lang.Add_calendar}
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        {/if}
                    </div>
                {/if}

                {if $line_id !== "new" and !$config.enable_new_design}
                {foreach from=$user_filters item=filters_group key=pid}
                    {if $user_filters|@count > 1 || $filters_group|@count > 1}
                        <div id="filters_div{$pid}"
                             class="header__filter{foreach from=$parent_filters_group_set[{$pid}] item=parent_group} child_filters{$parent_group} {/foreach}"
                             {if $pid!=0 and !$pid|in_array:$cur_filters}style="display:none"{/if}>
                            <ul class="header__filter-list">
                                {foreach from=$filters_group item=one_filter}
                                    <li class="header__filter-item{if $one_filter.id eq $cur_filter or $all_filters_on} active active header__filter-item--active{/if}" {if $one_filter.show_title}title="{$one_filter.expert_user}"{/if}>
                                            <a class="header__filter-link{if $user_filters[{$one_filter.id}]} header__filter-link--toggle{/if} {if $one_filter.count_records_on}with-counter{/if}"
                                               {if $one_filter.count_records_on}
                                                data-filter-id="{$one_filter.id}"
                                               {/if}
                                               href="fields.php?table={$table_id}{if $rel_table}&rel_table={$rel_table}&rel_line={$rel_line}&rel_field={$rel_field}{/if}&filter={$one_filter.id}{if $archive or $line_status eq 1}&archive{/if}{if $deleted or $line_status eq 2}&deleted{/if}{if $all_records}&all{/if}"
                                               {if $user_filters[{$one_filter.id}]}onclick="display_filter_group({$one_filter.id},{$pid}); return false;"
                                                   ondblclick="location.href=this.href;"{/if}>{$one_filter.name}{if $one_filter.count_records_on} (<span class="filter-counter">{$one_filter.count_records}</span>){/if}{if $user_filters[{$one_filter.id}]}
                                                <span id="active_filters_group{$one_filter.id}"
                                                      class="child_active_filters_group{$pid} {foreach from=$parent_filters_group_set[{$pid}] item=parent_group}child_active_filters_group{$parent_group} {/foreach}"
                                                      {if !$one_filter.id|in_array:$cur_filters}style="color:#bbbbbb"{/if}>
                                                        ▼</span>{/if}</a>
                                    </li>
                                {/foreach}
                            </ul>
                            {if ($user.group_id == 1 || $user.sub_admin_rights.tables.{$table_id} == 2) and $user.developer_mode}
                                <div class="header__filter-item--add">
                                    <a href="edit_filter.php?table={$table_id}&filter=-1&pid={$pid}"
                                       title="{$lang.Add_filter}" target="_blank">+</a>
                                </div>
                            {/if}
                        </div>
                    {/if}
                {/foreach}
                {/if}
        {if $cur_bizproc}

            <div id="bizproc_block" class="no_print">
                <div class="bizproc_wrapper">
                    <a class="bullet_button" href="" title="{$lang.Stop_bizproc}" onclick="allow_out_bizproc=1;
                            document.getElementById('bizproc_block').style.display='none';
                            if(document.getElementById('trip_arrow'))
                            document.getElementById('trip_arrow').style.display='none';
                    {if $table_id}
                        {if $line_id}
                            history.pushState(null, null, '?table={$table_id}&line={$line_id}');
                        {else}
                            history.pushState(null, null, '?table={$table_id}');
                        {/if}
                    {/if}
                    {if $report.id}
                        history.pushState(null, null, '?id={$report.id}');
                    {/if}
                        return false;">
                    </a>
                    <table>
                        <tr>
                            <td id="bizproc_icon_block">
                                <img src="{if $cur_bizproc.icon}cache/bp_ass_{$cur_bizproc.id}.png{else}images/valera.png{/if}">
                            <td id="bizproc_cur_step">
                                <div style="padding: 12px 0 10px">
                                    <b>{if $cur_bp_step.done}<s>{/if}{$lang.Step} {$cur_bp_step.num}
                                            . {$cur_bp_step.name}{if $cur_bp_step.done}</s>{/if}</b>
                                    {if $cur_bp_step.done}
                                        <span id="bizproc_done"><img src="images/inv_check.png"> {$lang.Done}
                                            !</span>
                                    {else}
                                        {if $cur_bp_step.att_file}<span id="bizproc_help"><img
                                                    src="images/inf_gray_circle.png"> <a
                                                    href="bizproc.php?proc={$cur_bizproc.id}&step={$cur_bp_step.num}&download"
                                                    onclick="allow_out_bizproc=1">{$lang.Support}</a></span>{/if}
                                        {if $cur_bp_step.video}<span id="bizproc_video"><img
                                                    src="images/inf_gray_circle.png"> <a href="{$cur_bp_step.video}"
                                                                                         target="_blank"
                                                                                         onclick="allow_out_bizproc=1">{$lang.Video_lesson}</a>
                                            </span>{/if}
                                    {/if}
                                </div>
                                <div style="padding: 0 0 25px">{if $cur_bp_step.done}
                                    <s>{/if}{$cur_bp_step.description}{if $cur_bp_step.done}</s>{/if}</div>
                                <div id="bizproc_step_block">
                                    {section name=circle1 loop=$cur_bp_step.num-1}<img
                                        src="images/light_green_circle.png"
                                        title="{$lang.Step} {$smarty.section.circle1.index+1}: {$cur_bp_steps[$smarty.section.circle1.index].name}"> {/section}
                                    <img src="images/green_circle.png"
                                         title="{$lang.Step} {$cur_bp_step.num}: {$cur_bp_step.name}">
                                    {section name=circle2 loop=$cur_bizproc.count_steps-$cur_bp_step.num}<img
                                        src="images/light_gray_circle.png"
                                        title="{$lang.Step} {$smarty.section.circle2.index+$cur_bp_step.num+1}: {$cur_bp_steps[$smarty.section.circle2.index+$cur_bp_step.num].name}"> {/section}
                                    {if $cur_bp_step.done }<span id="bizproc_next_step_link"><a href=""
                                                                                                onclick="document.getElementById('bizproc_cur_step').style.display='none'; document.getElementById('bizproc_next_step').style.display=''; return false;">{$lang.Next_step}
                                            <img src="images/green_arrow.png"></a></span>{/if}

                                    {if $act_bp_step['action'] == 'demo' && ($act_bp_step['table_type'] == 'r' || $act_bp_step['table_type'] == 'c' || $act_bp_step['table_type']=='') && $act_bp_step.num < $cur_bizproc.count_steps}
                                        <span id="bizproc_next_step_link"><a href=""
                                                                             onclick="window.location.search = '?bizproc={$cur_bizproc.id}&step={$next_bp_step.num}';allow_out_bizproc=1; return false;">{$lang.Next_step}
                                                <img src="images/green_arrow.png"></a></span>
                                    {/if}

                                    <span id="bizproc_next_step_link_my" style="display:none"><a href=""
                                                                                                 onclick="window.location.search = '?bizproc={$cur_bizproc.id}&step={$next_bp_step.num}&table_id={$cur_bp_step.table_id}&line={$smarty.get.line}';allow_out_bizproc=1; return false;">{$lang.Next_step}
                                            <img src="images/green_arrow.png"></a></span>

                                </div>
                            </td>
                            <td id="bizproc_next_step" style="display:none">
                                <div style="padding: 12px 0 10px">
                                    <b>{$lang.Step} {$next_bp_step.num}. {$next_bp_step.name}</b>
                                    {if $next_bp_step.att_file}<span id="bizproc_help"><img
                                                src="images/inf_gray_circle.png"> <a
                                                href="bizproc.php?proc={$cur_bizproc.id}&step={$next_bp_step.num}&download"
                                                onclick="allow_out_bizproc=1">{$lang.Support}</a></span>{/if}
                                    {if $next_bp_step.video}<span id="bizproc_video"><img
                                                src="images/inf_gray_circle.png"> <a href="{$next_bp_step.video}"
                                                                                     target="_blank"
                                                                                     onclick="allow_out_bizproc=1">{$lang.Video_lesson}</a>
                                        </span>{/if}
                                </div>
                                <div style="padding: 0 0 25px">{$next_bp_step.description}</div>
                                <div id="bizproc_step_block">
                                    {section name=circle1 loop=$next_bp_step.num-1}
                                        <img src="images/light_green_circle.png">
                                    {/section}
                                    <img src="images/green_circle.png">
                                    {section name=circle2 loop=$cur_bizproc.count_steps-$next_bp_step.num}
                                        <img src="images/light_gray_circle.png">
                                    {/section}
                                </div>
                            </td>
                        </tr>
                    </table>
                    <img id="bizproc_bottom_triangle" src="images/bp_triangle.png">
                </div>
            </div>
        {/if}

        {if $no_access_to_filter}
          <div id="no_access_to_filter" style="background: #fff; padding-top: 20px;">
            <div class="notifySearch no_print" style="background: #FFCCCC;">
              <div style="cursor: auto;">
                <span>{$no_access_to_filter}</span>
              </div>
              <a class="bullet_button" onclick="removeFilterFromUrl();" title="{$lang.Reset_search}"></a>
            </div>

            <script>
                function removeFilterFromUrl() {
                    let url = new URL(location.href);
                    url.searchParams.delete('filter');
                    location.href = url.pathname + url.search
                }
            </script>
          </div>
        {/if}

        {if $search_text || $field_search_error|default:[]|count_cb > 0}
          <div style="background: #fff; padding-top: 20px;">
            <div class="notifySearch no_print"{if count_cb($field_search_error) > 0} style="background: #FFCCCC;"{/if}>
              <div {if !$smarty.get.search}onclick="display_ext_search()"{/if}>
                {if count_cb($field_search_error) > 0}
                  <div style="padding: 0 {if $search_text}0 15px 0px{/if};">
                    <span>{$lang['search_failed_fields_need_to_be_shared']}:</span>
                    {foreach from=$field_search_error item=value name=foo}"{$value}"{if !$smarty.foreach.foo.last}, {/if}{/foreach}
                  </div>
                {/if}

                {if $search_text}<b>{$lang.Search}{if $search_template_name} {$lang.search_template} {$search_template_name}{/if}:</b> {$search_text|replace:'<':'&lt;'|replace:'>':'&gt;'}{/if}
              </div>

              <a
                class="bullet_button"
                href="fields.php?table={$table_id}{if $rel_table}&rel_table={$rel_table}&rel_line={$rel_line}&rel_field={$rel_field}{/if}{if $filter_id}&filter={$filter_id}{/if}{if $archive}&archive{/if}{if $deleted}&deleted{/if}&search_reset=on"
                title="{$lang.Reset_search}"
              ></a>
            </div>
          </div>
        {/if}
        </div>
    </header>
    {*close top_header_div*}
    <div id="top_header_back" class="no_print" style="height:0px;width:0px;"></div>
{/if} {* -- if $header_lite *}

<div id="all_nonmenu_text"
     {if $cur_cat}onmouseover="if (!clear_header_cat_timer) clear_header_cat_timer = window.setTimeout(ClearHeaderCat, 1500);"{/if}>
    <div class="content">

        {if $edit_page}
            <table align=center class="no_print">
                <tr>
                    <td>
                            <ul id="wiz">
                            {if $user.group_id==1}
                                <li class="wiz_option"><a href="edit_cat.php"
                                                          {if $edit_page eq 'categories'}class="on"{/if}>{$lang.Configuration}</a>
                                </li>
                                <li class="wiz_option"><a href="edit_color.php"
                                                          {if $edit_page eq 'schemes'}class="on"{/if}>{$lang.Logo_and_colors}</a>
                                </li>
                                <li class="wiz_option"><a href="edit_user.php"
                                                          {if $edit_page eq 'users'}class="on"{/if}>{$lang.Users}</a>
                                </li>
                                <li class="wiz_option"><a href="edit_group.php"
                                                          {if $edit_page eq 'groups'}class="on"{/if}>{$lang.Access}</a>
                                </li>
                                {if !$tariff_limits.mailing_off}
                                <li class="wiz_option"><a href="edit_mailing.php"
                                                          {if $edit_page eq 'smtp'}class="on"{/if}>{$lang.Mailer}</a>
                                </li>
                                {/if}
                                {if $autocall_on}
                                    <li class="wiz_option"><a href="edit_autocall.php"
                                                              {if $edit_page eq 'autocall'}class="on"{/if}>{$lang.Autocall}</a>
                                    </li>
                                {/if}
                                <li class="wiz_option"><a href="backup.php" id="wiz_backup_btn"
                                                          {if $edit_page eq 'backup'}class="on"{/if}>{$lang.Backup_short}</a>
                                </li>
                                <li class="wiz_option"><a href="edit_log.php"
                                                          {if $edit_page eq 'logs'}class="on"{/if}>{$lang.Logs}</a></li>
                                {if !$tariff_limits.mp_off}
                                <li class="wiz_option"><a href="edit_transfer.php"
                                                          {if $edit_page eq 'addons' or $edit_page eq 'modules'}class="on"{/if}>{$lang.Marketplace}</a>
                                </li>
                                {/if}
                                <li class="wiz_option"><a href="edit_add.php"
                                                          {if $edit_page eq 'addition'}class="on"{/if}>{$lang.More}</a>
                                </li>
                            {elseif $user.sub_admin==1}
                                {if $user.sub_admin_rights.own_acc==1 || $user.sub_admin_rights.access_subadmin==1}
                                    <li class="wiz_option"><a href="edit_cat.php"
                                                              {if $edit_page eq 'categories'}class="on"{/if}>{$lang.Configuration}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.logo_color}
                                    <li class="wiz_option"><a href="edit_color.php"
                                                              {if $edit_page eq 'schemes'}class="on"{/if}>{$lang.Logo_and_colors}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.users}
                                    <li class="wiz_option"><a href="edit_user.php"
                                                              {if $edit_page eq 'users'}class="on"{/if}>{$lang.Users}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.access}
                                    <li class="wiz_option"><a href="edit_group.php"
                                                              {if $edit_page eq 'groups'}class="on"{/if}>{$lang.Access}</a>
                                    </li>
                                {/if}
                                {if ($user.sub_admin_rights.mailing || $user.sub_admin_rights.smtp) && !$tariff_limits.mailing_off}
                                    <li class="wiz_option"><a href="edit_{if !$user.sub_admin_rights.mailing}smtp{else}mailing{/if}.php"
                                                              {if $edit_page eq 'smtp'}class="on"{/if}>{$lang.Mailer}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.modules and $autocall_on}
                                    <li class="wiz_option"><a href="edit_autocall.php"
                                                              {if $edit_page eq 'autocall'}class="on"{/if}>{$lang.Autocall}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.backup}
                                    <li class="wiz_option"><a href="backup.php"
                                                              {if $edit_page eq 'backup'}class="on"{/if}>{$lang.Backup_short}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.logs}
                                    <li class="wiz_option"><a href="edit_log.php"
                                                              {if $edit_page eq 'logs'}class="on"{/if}>{$lang.Logs}</a>
                                    </li>
                                {/if}
                                {if ($user.sub_admin_rights.addons || $user.sub_admin_rights.modules) && !$tariff_limits.mp_off}
                                    <li class="wiz_option"><a href="{if $user.sub_admin_rights.addons}edit_transfer.php{else}edit_modules.php{/if}"
                                                              {if $edit_page eq 'addons' or $edit_page eq 'modules'}class="on"{/if}>{$lang.Marketplace}</a>
                                    </li>
                                {/if}
                                {if $user.sub_admin_rights.addit}
                                    <li class="wiz_option"><a href="edit_add.php"
                                                              {if $edit_page eq 'addition'}class="on"{/if}>{$lang.More}</a>
                                    </li>
                                {/if}
                            {/if}
                            </ul>
                    </td>
                </tr>
            </table>
        {/if}

        {if $line_id !== "new" && $session_data > 0}
            <div class="fixed-panel no_print">
                {if $session_data || ($can_add and !$archive and !$deleted)}
                    <ul class="fixed-panel__dropdown-list hidden">
                        {if $user.group_id eq 1 and $user.developer_mode}
                            <a class="settings no_print fixed-panel__dropdown-item--settings" href="edit_config.php" style="background-color:transparent;" target="_blank"></a>
                        {/if}
                        {foreach from=$session_data key=key item=data}
                            <li data-title="{if $data.title}
                                                {if $lang.conf[$data.title]}{$lang.conf[$data.title]}{else}{$data.title}{/if}
                                            {else}
                                                {$lang.Add_record}{$lang.import_p1|escape}{if $lang.conf[$data.name]}{$lang.conf[$data.name]}{else}{$data.name}{/if}{$lang.import_p2|escape}
                                            {/if}" class="fixed-panel__dropdown-item">
                                <a class="fixed-panel__item" onclick="window.open('view_line2.php?table={$data.id}&line=new')">
                                    {if $lang.conf[$data.name]}{$lang.conf[$data.name]|truncate:1:""}{else}{$data.name|truncate:1:""}{/if}
                                </a>
                            </li>
                        {/foreach}
                    </ul>
                    {if $config.enable_new_design}
                        <button type="button" class="fixed-panel__item fixed-panel__item--main new-design" id="fixed-button">
                            <div class="fixed-panel__image fixed-panel__image--main fixed-panel__image-reverse-animation--main"></div>
                            <div class="fixed-panel-hidden-text">{$lang.Add_record}</div>
                            <div class="fixed-panel-hidden-expand"></div>
                        </button>
                    {else}
                        <button type="button" class="fixed-panel__item fixed-panel__item--main" id="fixed-button">
                            <div class="fixed-panel__image fixed-panel__image--main fixed-panel__image-reverse-animation--main"></div>
                        </button>
                    {/if}
                {/if}
            </div>
        {/if}

{if $config.enable_new_design}
<style>
.fields__wrap {
  border-radius: 10px;
  box-shadow: 0 5px 30px 0px rgba(0, 0, 0, 0.1);
}

.header {
  position: relative;
}

.header__categories,
.header__submenu-list,
.header__filter-list,
.header__category-item--add,
.header__submenu-item--add,
.header__filter-item--add {
  -webkit-transform: unset;
          transform: unset;
}

.header--translate {
  -webkit-transform: unset;
          transform: unset;
}

.header__categories-wrap {
  align-self: stretch;
  align-items: flex-end;
}

.header__categories > .header__category-item{
height: 100%;
background: none;
border: 1px solid transparent;
box-sizing: border-box;
}
.header__categories > .header__category-item:hover{
position: relative;
z-index: 31;
}
.header__categories .header__category-item--active {
background-color: #fff;
}

.fixed-panel__dropdown-item::after {
  right: 50%;
  padding-right: 28px;
}

.fixed-panel__dropdown-item--active::after {
opacity: 1;

  -webkit-animation: unset;
          animation: unset;

}

.fixed-panel__dropdown-list {
  margin-bottom: 20px;
}

.fixed-panel-hidden-text {
    width: 0;
    overflow: hidden;
    transition: 0.3s;
}
.fixed-panel-hidden-expand {
  display: none;
}
.fixed-panel__item--main.main-button-expanded {
  width: unset;
  border-radius: 24px;
  padding: 0 20px;
  position: relative;
}

.fixed-panel__item--main.main-button-expanded .fixed-panel-hidden-text {
  display: initial;
  width: auto;
  overflow: unset;
  color: #fff;
  margin-left: 20px;
  /*font-size: 16px;*/
  border-radius: 12px;
}

.fixed-panel__item--main.main-button-expanded .fixed-panel-hidden-expand{
  position: absolute;
  display: initial;
  left: 30%;
  right: 30%;
  bottom: 100%;
  height: 30px;
  /*background-image: url(../../../images/arrow-up.png);*/
  background-repeat: no-repeat;
  background-position: top center;
  opacity: 0.5;
}

.fields__row-count {
  margin: 5px 0 0;
}

.hidden-column:first-child::after {
  background-image: unset;
}

.hidden-column:last-child::before {
  background-image: unset;
}

.fields__header {
  margin: unset;
  width: 100%;
  padding: 0 32px 20px;
  box-sizing: border-box;
  border-bottom: unset;
}

.fields__header-settings {
  flex-shrink: 0;
}

.fields__actions-search {
  width: 40%;
  display: flex;
  justify-content: flex-end;
}

.fields__actions-search form {
  max-width: 240px;
}

.header__category-item--add {
  margin-left: 16px;
  height: 70%;
  padding-top: 4px;
  padding-right: unset;
  box-sizing: border-box;
  align-items: flex-start;
}

.header__category-item a,
.header__category-item button,
.header__categories .flexMenu-viewMore>a {
  background: none;
}

.header__category-item a {
  box-sizing: border-box;
  height: 100%;
}

.header__category-item.hover .hidden_cat_tables{
  display: flex !important;
  display: -webkit-box !important;
  display: -webkit-flex !important;
  display: -ms-flexbox !important;
}
.flexMenu-viewMore .header__category-item:hover .hidden_cat_tables{
display: none !important;
}
.hidden_cat_tables {
  display: none;
  padding: 44px 0 100px 50px;
  box-sizing: border-box;
  flex-direction: column;
  position: fixed;
  left: 6%;
  right: 6%;
  -webkit-box-shadow: 0px 10px 26px 2px rgba(0, 0, 0, 0.2);
  -moz-box-shadow: 0px 10px 26px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0px 10px 26px 2px rgba(0, 0, 0, 0.2);
  border-radius: 0 0 10px 10px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 30;
}
.hidden_cat_tables .hidden_cat_tables_heading {
font-size: 24px;
font-weight: 600;
margin-bottom: 40px;
}
.hidden_cat_tables ul{
  display: flex;
  flex-wrap: wrap;
  /*justify-content: space-evenly;*/
}
.hidden_cat_tables ul .header__submenu-item {
min-height: 106px;
width: 300px;
background-color: #fff;
border-radius: 10px;
margin-bottom: 24px;
margin-right: 30px;
box-sizing: border-box;
}
.hidden_cat_tables ul .header__submenu-item a{
text-align: left;
font-size: 21px;
padding: 0;
font-weight: 500;
}
.header__category-item .hidden_cat_tables a.header__submenu-link {
    white-space: normal;
    padding: 18px 22px;
    height: 100%;
    box-sizing: border-box;
    width: 100%;
    max-width: unset;
}
.header__categories .flexMenu-viewMore {
height: 100%;
border: 1px solid transparent;
box-sizing: border-box;
}
.header__categories .flexMenu-viewMore.more-active-li {
background-color: #bce7e8;
border-radius: 7px 7px 0 0;
}
.header__categories .flexMenu-viewMore > a{
height: calc(100% + 1px) ;
box-sizing: border-box;
bottom: -1px;
}
.header__category-item--active {
box-shadow: none;
}

.header__categories {
  height: 70%;
  min-height: 40px;
  align-items: flex-end;
}

.header__top {
  -webkit-box-align: start;
  -webkit-align-items: flex-start;
      -ms-flex-align: start;
          align-items: flex-start;
}

.custom-checkbox__wrap .custom-checkbox.checked {
  border-color: #ffdd4e;
  background: -webkit-linear-gradient(bottom, #c8ac43, #ffdd4e);
  background: linear-gradient(to top, #c8ac43, #ffdd4e);
}

.custom-checkbox__wrap .custom-checkbox.checked::before,
.custom-checkbox__wrap .custom-checkbox.checked::after {
  content: "";
  position: absolute;

  display: block;
  height: 2px;

  background-color: #635b37;
}

.custom-checkbox__wrap .custom-checkbox.checked::before {
  top: 40%;
  left: 9%;

  width: 6px;

  -webkit-transform: rotate(45deg);

          transform: rotate(45deg);
}

.custom-checkbox__wrap .custom-checkbox.checked::after {
  top: 9%;
  left: 18%;

  width: 14px;
  -webkit-transform: rotate(-55deg);
          transform: rotate(-55deg);
}

.fields__row-top-count-item {
  border-radius: 8px;
  background: none;
  border: 1px solid transparent;
}
.fields__row-top-count-item:hover {
  border: 1px solid #eeeeee;
  border-radius: 8px !important;
  color: #000000;
}

.fields__row-top-count.no_print span.fields__row-top-count-item{
  border: 1px solid #eeeeee;
  background: none;
}
.footer {
  padding: 28px 32px 50px;
  border-top: unset;
}

.new-fields-actions-list {
  display: flex;
  position: absolute;
  left: 0;
  top: 0;
  /*bottom: 0;*/
  right: 0;
  background: #fff;
  z-index: 10;
  align-items: center;
  /*height: 100% !important;*/
}
.new-fields-actions-list.hidden-action-list {
  display: none;
}

.new-fields-actions-list .fields__actions-item {
  max-height: 18px;
  background: #fff;
  color: #959595;
  padding: 0 5px 5px 5px;
  z-index: 20;
  text-transform: none;
  font-size: 17px;
}
.new-fields-actions-list .custom-checkbox__wrap {
width: 28px;
}

.new-fields-actions-list .fields__dropdown-menu a{
    /*font-size: 11px;
    padding: 3px 6px;*/

    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
}

.fields__row--fixed .new-fields-actions-list {
padding-left: 36px;
}

.header__top {
    align-items: center;
}

.header__user-block {
    padding-top: 0;
}

.fields__actions-item--additional img{
    width: 8px;
    height: 8px;
    padding: 2px;
    transform: rotate(180deg);
    /*border-radius: 50%;
    border: 1px solid transparent;*/
    margin-bottom: 2px;
    margin-right: 2px;
}
.fields__dropdown-wrap:has( .fields__dropdown-menu.active) img{
    transform: unset;
}

.fields__dropdown-menu.active {
    display: block !important;
}

.custom-select {
  position: relative;
  border-radius: 10px;
  margin-left: 14px;
  width: 200px;
}

.select-selected {
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  min-height: 40px;
  border: #999 1px solid;
  color: #999;
  opacity: 0.65;
  font-size: 16px;
  font-weight: 500;
  border-radius: 10px;
  background-image: url(./images/arrow-down-filled-gray.svg);
  background-repeat: no-repeat;
  background-size: 8px;
  background-position: left 10px center;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-selected.select-visible {
  position: relative;
  z-index: 100;
  opacity: 1;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background-color: #fff;
  border: none;
  box-shadow: rgba(69, 69, 69, 0.3) 0px 0 5px 2px;
}

.select-items {
  position: absolute;
  background-color: #fff;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  padding: 10px 0;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 99;
  min-width: 100%;
  width: fit-content;
  box-shadow: rgba(69, 69, 69, 0.3) 0px 0 5px 2px;
  overflow: auto;
  overflow-x: hidden;
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  transform: scaleY(1);
  transform-origin: top;
  transition: transform 0.2s ease-out;
}

.select-items.select-hide {
  max-height: 0;
  transform: scaleY(0);
}

.select-item {
  padding: 10px 20px;
  border-bottom: 1px solid #ddd;
  color: #000;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  background-color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

.select-item:last-child {
  border-bottom: none;
}

.select-item:hover {
  background-color: #e9e9e9;
}

.select-items div:hover, .same-as-selected {
  background-color: #e9e9e9;
}

.table-items-type-select {
  border: #999 1px solid;
  color: #999;
  opacity: 0.65;
  font-size: 16px;
  font-weight: 500;
  -moz-appearance: none;
  -webkit-appearance: none;
  background-image: none;
  margin-left: 14px;
  border-radius: 10px;
  padding: 6px 10px 6px 30px;
  background-image: url(./images/arrow-down-filled-gray.svg);
  background-repeat: no-repeat;
  background-size: 8px;
  background-position: 10px center !important;
  cursor: pointer;
  transition: all 0.2s;
}

.table-items-type-select:hover,
.table-items-type-select:focus,
.table-items-type-select:active {
  opacity: 1;
}
.table-items-type-select::-ms-expand {
  display: none;
}
#type-select.table-items-type-select {
  text-transform: capitalize;
}

.table-items-type-select:not(:has(option)) {
    display: none;
}

.fields__actions-search form {
  position: relative;
  align-items: center;
}

.fields__search-form .fields__search-submit {
  width: 30px;
  height: 30px;
  position: absolute;
  left: 5px;
  top: 5px;
  margin: 0;
  background-size: 12px;
  background-position: center;
  transition: all 0.2s;
}


#ext_search_icon{
  padding: 5px;
  width: 16px;
  margin-bottom: 10px;
  background-position: center;
}
.ext_search_open {

}

.ext_search_close {

}

.ext_search_open:hover {
  background-position: center;
}

.fields__search-bar {
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid #E1DFDF;
}

.fields__search-form .def_fast_search_edit_val.form-control {
    box-sizing: border-box;
    min-height: 40px;
    font-size: 16px;
    font-weight: 500;
    color: #999;
    border: 1px solid #999;
    opacity: 0.65;
    transition: all 0.2s;
    background-image: none;
}

.def_fast_search_edit_val.form-control:hover,
.def_fast_search_edit_val.form-control:focus,
.def_fast_search_edit_val.form-control:active {
  opacity: 1;
}

.def_fast_search_edit_val.form-control {
  height: 40px;
  font-size: 19px;
  padding-left: 40px !important;
  width: 100%;
  box-shadow: none;
  border-radius: 8px;
  background-image: url("./images/top_icon_search-gray.svg");
  background-repeat: no-repeat;
  background-size: 15px;
  background-position: 14px center;
}

.user_avatar {
margin-left: 10px;
margin-right: 5px;
border-radius: 50%;
overflow: hidden;
width: 40px;
height: 40px;
display: flex;
}
.user_avatar img {
    flex-shrink: 0;
}

.header__category-item--add {
    position: relative;
}

.fields__header-title{
  font-size: 22px;
}

.fields__search-template {
  padding-top: 0;
}
</style>
{/if}
