<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Language" content="{$lang.short_name}">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="robots" content="noindex,nofollow">
  <title>{$report.name}</title>
  <link rel="icon" href="{$ul_path}/images/{if $config.alt_favicon}alt_{/if}favicon.{$config.fav_ext}" type="image/x-icon">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/libs/bootstrap/css/bootstrap.min.css?{$revision}">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/css/normalize.css?{$revision}" type="text/css">
  <link href="{$ul_path}/themes/clientbase/libs/fixedTable/fixedTable.css?{$revision}">
  <link rel="stylesheet" href="{$ul_path}/cache/cur_scheme_{$config.css_id}_{$config.css_id_sheme}.css?{$revision}" type="text/css">
  <link rel="stylesheet" href="{$ul_path}/style{if $config.css_id>1}_{$config.css_id}{/if}.css?{$revision}" type="text/css">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/css/variables.css?{$revision}" type="text/css">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/css/style.css?{$revision}" type="text/css">

  <script src="{$ul_path}/themes/clientbase/libs/jquery/jquery-3.2.1.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/jquery/jquery-migrate.min.js?{$revision}"></script>

  {if $config.alt_css}<link rel="stylesheet" href="{$ul_path}/{$config.alt_css|htmlspecialchars}" type="text/css">{/if}

  <script src="{$ul_path}/themes/clientbase/libs/nprogress/nprogress.js?{$revision}"></script>

  <script>
    var notifyStyle = {$config.notify_style}
    var adminGroup = {if $user.group_id}{$user.group_id}{else}null{/if};
    var tipsWheelGear = {if $user.developer_mode}{$user.developer_mode}{else}null{/if};
    var tipShowTableName = {$config.tips_show_table_name};
    window["x_auth_token"]="{$x_auth_token}";
  </script>

  <style>
    {if $config.link_preview_width}
      .autocomplete_val>img,
      .autocomplete_val>a>img,
      .autocomplete_val>span>img,
      .ui-menu-item-wrapper>img,
      .ui-menu-item-wrapper>a>img,
      #view_block .user-data__edit-block .sub-slave_fields .image-link img {
        width: {$config.link_preview_width}px !important;
      }
    {/if}

    {if $config.link_preview_height}
      .autocomplete_val>img,
      .autocomplete_val>a>img,
      .autocomplete_val>span>img,
      .ui-menu-item-wrapper>img,
      .ui-menu-item-wrapper>a>img,
      #view_block .user-data__edit-block .sub-slave_fields .image-link img {
        height: {$config.link_preview_height}px !important;
      }
    {/if}
  </style>

  <style type="text/css" media="screen">
    .no_print {
    }

    .print_border {
    }
  </style>

  <style type="text/css" media="print">
    .no_print {
        display: none !important;
    }

    .fields__row--header .fields__cell{
        border-bottom: 1px solid black;
    }

    .print_border {
        border-collapse: collapse;
    }

    .print_border td {
        border: 1px solid #6f6f6f;
    }

    .print_border th {
      border: 1px solid #6f6f6f;
    }
  </style>

  <script src="{$ul_path}/themes/clientbase/js/preloader.js?{$revision}"></script>
  <link rel="stylesheet" type="text/css" href="{$ul_path}/themes/clientbase/libs/jquery/autocomplete/jquery.autocomplete.css?{$revision}"/>
  <link rel="stylesheet" type="text/css" href="{$ul_path}/themes/clientbase/libs/jquery/autocomplete/lib/thickbox.css?{$revision}"/>
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/libs/spectrum-colorpicker/spectrum.css">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/libs/chosen/chosen.css?{$revision}">

  {*===node_libraries===*}

  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/libs/jquery/jquery-ui.min.css?{$revision}">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/libs/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css?{$revision}">

  <link href="{$ul_path}/themes/clientbase/libs/filestyle/filestyle.min.css?{$revision}">
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/libs/fancybox/jquery.fancybox.min.css?{$revision}">
  <script src="{$ul_path}/themes/clientbase/libs/jquery/jquery-ui.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/jquery/jquery.mask.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/jquery/widget.js?{$revision}"></script>

  <script>
    /*** Handle jQuery plugin naming conflict between jQuery UI and Bootstrap ***/
    $.widget.bridge('uibutton',  $.ui.button);
    $.widget.bridge('uitooltip', $.ui.tooltip);
  </script>

  <script src="{$ul_path}/mobile/ui/lib/bootstrap.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/jquery/jquery-migrate.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/jquery/jquery.cookie.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/jquery.mousewheel.js?{$revision}"></script>

  {if $lang.short_name == 'ru'}
    <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/i18n/datepicker-ru.js?{$revision}"></script>
  {else}
    {if $lang.short_name == 'en'}
      <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/i18n/jquery.ui.datepicker-en-GB.js{$revision}"></script>
    {else}
      <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/i18n/jquery.ui.datepicker-{$lang.i18n}.js{$revision}"></script>
    {/if}
  {/if}

  <script src="{$ul_path}/themes/clientbase/libs/autosize//autosize.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/spectrum-colorpicker/spectrum.js"></script>
  <script src="{$ul_path}/themes/clientbase/libs/spectrum-colorpicker/jquery.spectrum-ru.js"></script>
  <script src="{$ul_path}/themes/clientbase/libs/moment/moment-with-locales.js"></script>
  <script src="{$ul_path}/stocks/lib/vue-3.2.36.global.prod.js"></script>
  <script src="{$ul_path}/stocks/lib/vuex-4.0.2.global.prod.js"></script>
  <script src="{$ul_path}/stocks/lib/vue-i18n-9.1.10.global.prod.js"></script>
  <script src="{$ul_path}/stocks/lib/vue-demi-0.13.6-iife-min.js"></script>
  <script src="{$ul_path}/stocks/lib/pinia-2.0.17-iife.prod.js"></script>
  <script src="{$ul_path}/stocks/lib/lodash-4.17.21-min.js"></script>
  <script src="{$ul_path}/stocks/app/CB.js"></script>
  <script src="{$ul_path}/stocks/app/cb_services/display_chats_in_tray.js"></script>
  <script src="{$ul_path}/stocks/lib/sortable.min.js"></script>
  <script src="{$ul_path}/stocks/lib/vue-contextmenu.js"></script>
  <link rel="stylesheet" href="{$ul_path}/stocks/style/vue-contextmenu.css" />
  <script src="{$ul_path}/stocks/lib/vuedraggable.umd.js"></script>
  <script type="module" src="{$ul_path}/stocks/components/index.js"></script>

  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/autocomplete/jquery.autocomplete.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/ckeditor/ckeditor.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/ckeditor/adapters/jquery.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/i18n/jquery-ui-timepicker-addon.min.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/i18n/jquery-ui-timepicker-{$lang.short_name}.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/fancybox/jquery.fancybox.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/flexmenu.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/jquery-href_post.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/jquery/jquery.select_fast_edit.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/include/js/help_sys.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/include/js/xplayer.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/mybic.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/explode.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/base64.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/rgbcolor.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/lang/{$config.lang}.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/dialog.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/filestyle/filestyle.min.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/include/js/wrap_select.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/checkByMask.js?c1"></script>
  <script src="{$ul_path}/themes/clientbase/js/stick.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/js/autocomplete-settings.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/js/overlay.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/js/view-line-calcs.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/moment.min.js?{$revision}"></script>
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/libs/mithril.min.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/chosen/chosen.jquery.js?{$revision}"></script>

  {if $config.hotkeys}<script src="{$ul_path}/include/js/controls.js?{$revision}"></script>{/if}

  <script src="{$ul_path}/modules/livechat/livechat.js"></script>
  {*====================*}

  <link rel="stylesheet" type="text/css" href="{$ul_path}/themes/clientbase/css/report_builtin_style.css?{$revision}" />
  <script type="text/javascript" src="{$ul_path}/themes/clientbase/js/report_builtin_script.js?{$revision}"></script>

  {* Подключение плагина select2.js *}
  <script src="{$ul_path}/themes/clientbase/libs/select2/select2-4.0.13.full.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/select2/index.js?{$revision}"></script>
  <link rel="stylesheet" href="{$ul_path}/themes/clientbase/css/select2/select2.css?{$revision}">

  <script>
    var user_group_id       = '{$user.group_id}';
    var config_site_url     = '{$config.site_url}';
    var script_name         = '{$script_name}';
    var incorrect_crypt_key = '{$incorrect_crypt_key}';
    var bizproc_done        = '{$bizproc_done}';
    var config_alt_css      = '{$config.alt_css}';
    var csrf                = '{$csrf}';
    var prev_cat            = '{$cur_cat}';
    var cur_cat             =  prev_cat;
    var asterisk_login      = '{$user.asterisk_login}';
    var autocomplete        = $('.autocomplete');
    var online_consult      = {$config.livechat_in_header};
    var configType          = '{$config.type}';
    var userEmail           = '{$user.e_mail}',
        userPhone           = '{$user.phone}';
    var showFiltersList     = {$config.show_filters_list};
    var curSubtableId       = -1;
    var show_fields         = null;
    var clientbase_domain = 'clientbase.ru'

    {* Для отображаения имени собеседника как ссылки в ВК *}
    var vkNameLinkUser = '{$vk_name_link}';

    var tableId = '{$table_id}';
    var lineId = '{$line_id}';
    var cur_subtable = {if $cur_subtable}{json_encode($cur_subtable)}{else}undefined{/if};
    var cur_subtable_id;

    {if $rel_table}
      var relTable = {$rel_table};
      var relLine = {$rel_line};
      var relField = {$rel_field};
    {else}
      var relTable = 'undefined';
      var relLine = 'undefined';
      var relField = 'undefined';
    {/if}

    {if $all_filters_on}var allFiltersOn = {$all_filters_on};{else}var allFiltersOn = 'undefined';{/if}
    {if $filter_id}var filterId = {$filter_id};{else}var filterId = 'undefined';{/if}
    {if $archive}var isArchive = {$archive};{else}var isArchive = 'undefined';{/if}
    {if $deleted}var isDeleted = {$deleted};{else}var isDeleted = 'undefined';{/if}
    {if $all_records}var allRecords = {$all_records};{else}var allRecords = 'undefined';{/if}
    {if $page}var curPage = {$page};{else}var curPage = 'undefined';{/if}

    var colorpickerSetings = {
      showPalette: true,
      containerClassName: 'colorpicker-container',
      showInput: true,
      preferredFormat: 'hex',
      cancelText: '',
      palette: [
        ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
        ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
        ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
        ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
        ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
        ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
        ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
        ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
      ],
    };

    $(function () {
      if ($('textarea.html_editor').length > 0) {
        setTimeout(function() {
          $('textarea.html_editor').ckeditor(function() { }, { width: '600px', height: '300px'});
        }, 1000);
      }
    });
  </script>

  <script src="{$ul_path}/themes/clientbase/js/js_top.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/js/global_functions.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/js/global_variables.js?{$revision}"></script>
  {if $as_tables_assigned and $user.asterisk_login}
    <script type="text/javascript" src="{$ul_path}/modules/asterisk/js/asterisk_responses.js?{$revision}"></script>

    <script type="text/javascript">
      $(function() {
        open_key = '{$user.open_key}';
        main_server = '{$user.main_server}';
        asterisk_server = '{$user.asterisk_server}';
        asterisk_login = '{$user.asterisk_login}';
        asterisk_password = '{$user.asterisk_password}';
        asterisk_number = '{$user.asterisk_number}';
        asterisk_city_code = '{$user.asterisk_city_code}';
        asterisk_ban_code = '{$user.asterisk_ban_code}';
        asterisk_client_host = '{$user.asterisk_client_host}';
        asterisk_loc_num_length = '{$user.asterisk_loc_num_length}';
        asterisk_sips_added = '{$user.asterisk_sips_added}';

        {if $script_name != "phone.php"}
          if (asterisk_login && asterisk_sips_added) {
            setInterval(function() {
              module_asterisk_status();
            }, {if $user.asterisk_client_host}asterisk_timeout_main_new{else}asterisk_timeout_main_old{/if});
          }
        {/if}
      });
    </script>

    {if $user.browser_caller and $script_name=="phone.php"}
      <script type="text/javascript" src="{$ul_path}/modules/asterisk/js/browser_caller.js?{$revision}"></script>
      <script type="text/javascript" src="{$ul_path}/modules/asterisk/js/sipjs.js?{$revision}"></script>
    {/if}
  {/if}

  {$ADDITIONAL_JAVASCRIPT_INCLUDE}

  <script type="text/javascript">
    var help_available = 1;

    //Функция инициализации плагина JQuery:Chosen, add_func - функция которая вызывается до инициализации.
    function init_chosen(is_destroy = false, add_func = null, el = null) {
      add_func != null ? add_func() : '';

      if (el != null) {
        el.chosen();
        return;
      }

      $('select').each(function(i) {
        const $select = $(this);
        const selectId = $select.attr('id') ? $select.attr('id') : '';

        if (is_destroy) {
          $select.chosen("destroy");
        }

        setTimeout(() => {
          if (
            !$select.hasClass('combobox') && // поля типа Связь
            !$select.hasClass('dont_use_chosen') && // явный запрет использовать chosen
            !$select.hasClass('fields__fast-edit--combobox') &&
            !$select.hasClass('combobox--hidden') &&
            !$select.hasClass('select_tpl') &&  // выбор шаблона вычисления
            !$select.hasClass('conditions_select') && // условия для запуска в шаблонах
            !$select.hasClass('cons_cond') && // условие в вычислении
            !$select.hasClass('cons_union') && // select "и/или" для условий в вычислении
            selectId.indexOf('cond_union') < 0 && // select "и/или" для условий в информерах
            selectId.indexOf('cond_term') < 0
          ) {
            let sel = $select;
            let selected = sel.val(); // cache selected value, before reordering
            let opts_group_list = sel.children('optgroup');
            let opts_list = sel.children('option');

            opts_group_list.each(function(i, elem) {
              opts_list_in_group = $(elem).children('option');
              opts_list_in_group.sort(function(a, b) { return $(a).text() > $(b).text() ? 1 : -1; });
              $(elem).html('').append(opts_list_in_group);
            });

            opts_group_list.sort(function(a, b) { return $(a).text() > $(b).text() ? 1 : -1; });
            opts_list.sort(function(a, b) { return $(a).text() > $(b).text() ? 1 : -1; });
            sel.html('').append(opts_list).append(opts_group_list);
            sel.val(selected);

            const defaultWidth = $select.hasClass('strict-mode-select') || $select.hasClass('sync-mode-select') ? '100%' : $select.outerWidth() - 2;
            const chosenParams = { width : defaultWidth, search_contains : true }; // Для инициализации временно скрытых select-ов
            $select.chosen(chosenParams);

            setTimeout(function() {
              $($select).trigger("chosen:updated");
            }, 1);

            const chosenLink = $select.siblings('.chosen-container').find('a.chosen-single');
          }
        }, 0);
      });
    }

    function destroy_chosen() {
      $('select').each(function(i) {
        const $select = $(this);
        $select.chosen("destroy");
      });
    }

    function setChosenSelectOptionsDisplay(select) {
      $(select).siblings('.chosen-container').find('a.chosen-single').on('click', function() {
        const link = $(this);
        const container = $(select).siblings('.chosen-container');
        let chosenTop = container.offset().top - 3;
        let chosenLeft = container.offset().left;
        let posTop = $(select).outerHeight() + chosenTop;
        let selectWidth = $(select).width();
        let offset = { top: posTop, left : chosenLeft };

        if ($(select).parents('.subtable__cell').length > 0) { // Подтаблица
          chosenTop = container.offset().top - 1;
          selectWidth = $(select).outerWidth();
        } else {
          if ($(select).parents('.fields__cell').length > 0) { // Таблица
            chosenTop = container.offset().top - 8;
            selectWidth = $(select).width() - 6;
          } else { // Прочие поля
            chosenTop = container.offset().top - 1;
            selectWidth = $(select).outerWidth() - 1;
          }
        }

        offset = { top: posTop, left : chosenLeft };
        link.siblings('div.chosen-drop').offset(offset).width(selectWidth);
      });
    }

    $(document).ready(function() {
      {if !$preg_matches} {assign var=preg_matches value=0} {/if}
      {if $demo_base_id or preg_match('/^demo(\d+)/i', $smarty.server.HTTP_HOST, $preg_matches)}
        if ($.cookie('demo_create_acc') != '1') {
          $('.demo_create_acc, .demo_create_acc2').css('display', 'block');
        }
      {/if}
    });

    var lang_full = '{$config.lang}';
    var csrf = '{$csrf}';
    var page_hash = "{$user.user_hash}";

    {if $user.id > 0}
      var user = new Object;
      user.id = {$user.id};
      user.fio = "{str_replace(array("'",'"'),'',$user.fio)|escape}";
      user.group_id = {$user.group_id};
      user.acc_msg = {$user.acc_messages};
      user.notify_mes = {$user.notify_messages};
      user.display_notification_on = {$user.display_notification_on};
      user.sound_on = '{$user.sound_on}';
      user.cut_notify_text = '{$user.cut_notify_text}';
      user.browser_caller = {if $user.browser_caller and $script_name=="phone.php"}1{else}0{/if};
      user.group_id = '{$user.group_id}';
      user.sub_admin = '{$user.sub_admin}';
      user.sub_admin_rights_own_acc = '{$user.sub_admin_rights.own_acc}';
      user.sub_admin_rights_access_subadmin = '{$user.sub_admin_rights.access_subadmin}';
    {/if}

    var config = new Object;
    config['type'] = '{$config.type}';
    config['version'] = '{$config.version}';
    config['lang'] = '{$config.lang}';
    config['revision'] = '{$config.revision}';
    config['events_refresh'] = ('{$config.events_refresh}' ? '{$config.events_refresh}' : 30000);
    config['display_calendar_events'] = '{$config.display_calendar_events}';

    var last_ie_width = 0;
    var last_ie_height = 0;

    function on_window_resize() {
      {if $config.window_scroll neq 1}
        return;
      {/if}

      left_white = document.getElementById('left_white');
      right_white = document.getElementById('right_white');
      top_header_div = document.getElementById('top_header_div');
      fields_content_table = document.getElementById('fields_content_table');
      fields_buttons_table = document.getElementById('fields_buttons_table');
      popup_div_headers = document.getElementById('popup_div_headers')
      popup_table_headers = document.getElementById('popup_table_headers')
      window_width = document.documentElement.clientWidth;
      window_height = document.documentElement.clientHeight;

      if (page_loaded) {
        visible_popup = 0;
      } else if (document.getElementById('top_header_back')) {  //если есть фоновый div блок
        top_header_div.style.position = 'absolute';
        document.getElementById('top_header_back').style.height = top_header_div.offsetHeight + "px";
      }
    }

    var clear_header_cat_timer = 0;

    function ClearHeaderCat() {
      {if $cur_cat}
        document.getElementById('cat' + prev_cat).style.display = 'none';
        document.getElementById('cat{$cur_cat}').style.display = 'flex';
        document.getElementById('active_cat_' + prev_cat).blur();
        prev_cat ={$cur_cat};
        clear_header_cat_timer = 0;
      {/if}
    }

    function display_filter_group(filter_id, filter_pid) {
      if ($('#filters_div' + filter_id).css('display') != 'flex') {
        $('.child_active_filters_group' + filter_pid).css('color', '#bbbbbb');
        $('#active_filters_group' + filter_id).css('color', 'black');
        $('.child_filters' + filter_pid).css('display', 'none');
        $('#filters_div' + filter_id).css('display', 'flex');
      } else {
        $('#active_filters_group' + filter_id).css('color', '#bbbbbb');
        $('.child_filters' + filter_pid).css('display', 'none');
        $('#filters_div' + filter_id).css({ 'display': 'none' });
      }
    }

    {if $edit_page}
      function updateDragNDropValues(formElement, draggedItem) {
        $.ajax({
          url: formElement.prop('action'),
          type: 'post',
          data: formElement.serialize(),
          beforeSend: function() {
            const overlay = `<div class='overlay'><div>`;
            const preloader = create_preloader_block();

            preloader.css({
              'position': 'fixed',
              'top': '50%',
              'left': '0'
            });

            $('body').append(overlay);
            $('body').append(preloader);
          },
          success: function() {
            $('.overlay').hide();
            $('.preloader__block').hide();
            draggedItem.css("background-color", "inherit");
          }
        });
      }

      $(function () {
          {* /* присоединяем к таблице функцию drug'n'drop,
          необходимо присвоить таблице класс "sortableTable"*/ *}
          var sortTable = $(".sortableTable"),
              sortTableTr = $("tbody tr", sortTable);
          if (sortTableTr.length > 1) {
              {* Добавляем в таблицу пустые строки в начало и конец, чтобы облегчить драг крайних строк *}
              var firstTr = $("tr:first", sortTable),
                  colspan = $("td", firstTr).length,
                  height = firstTr.height() / 6;
              $("tr:first", sortTable).before("<tr class='noDrug'><td colspan='" + colspan + "' style='height:" + height + "px;'></td></tr>");
              $("tr:last", sortTable).after("<tr class='noDrug'><td colspan='" + colspan + "' style='height:" + height + "px;'></td></tr>");

              $("tbody", sortTable).sortable({
                  handle: 'td',                        {* // за что буем таскать *}
                  axis: "y",                           {* // ограничение по оси y *}
                  containment: "parent",               {* // в пределах какого "контейнера" *}
                  cursor: "move",                      {* // вид курсора *}
                  delay: 100,                          {* // задержка курсором перед перетаскиванием *}
                  distance: 0,                         {* // дистанция после которого элемент начинает перетаскиваться *}
                  cancel: ".mouseHoverTip, input, .noDrug",            {* // не перетаскивать за подсказки *}
                  helper: function (e, tr) {            {* // обработка плавающего элемента при перетаскивании *}
                      var originals = tr.children(),
                          helper = tr.clone(),
                          children = helper.children(),
                          index = 0;
                      for (var i = children.length; i--;) {
                          index = i - 1;
                          children.eq(index)
                              .css({
                                  "background-color": "#FFF6AD",
                                  "width": originals.eq(index).width()
                              });
                      }
                      return helper;
                  },
                  stop: function (event, ui) {            {* // функция запускаюшаяся при остановке перетаскивания *}
                      var workTr = $(this).find("tr").not(".noDrug");
                      for (var i = workTr.length; i--;) {
                          var numInput = workTr.eq(i).find("td").find("input"),
                              number = i + 1;
                          if (numInput.val() != number) {
                              ui.item.css("background-color", "#FFF6AD");
                          }
                          numInput.val(number);
                      }
                      updateDragNDropValues($(this).parents('form'), ui.item);
                  },
                  start: function (e, ui) {              {* // функция запускаюшаяся при старте перетаскивания *}
                      ui.placeholder.height(ui.item.height());
                  }
              });

              {* /* после загрузки страницы,
        в drag таблице в первой строке пропишем автоматически
        скомпилированные стили колонок inline, чтобы при
        перетаскивании размеры колонок не прыгали */ *}
              var startIndex = false;
              sortTable.css("height", sortTable.height());
              sortTableTr.eq(1).find('td').each(function (index, val) {
                  if (startIndex)
                      $(this).css("width", $(this).width());
                  if ($(this).find("input").length)
                      startIndex = true;
              });
              startIndex = false;
              sortTableTr.eq(2).find('td').each(function (index, val) {
                  if (startIndex)
                      $(this).css("width", $(this).width());
                  if ($(this).find("input").length)
                      startIndex = true;
              });

              {* /* вешаем появление стрелочки при наведении курсора на строку */ *}
              sortTableTr.hover(
                  function () {
                      $(this).find(".draggableImg").addClass('draggableImgHover');
                  },
                  function () {
                      $(this).find(".draggableImg").removeClass('draggableImgHover');
                  }
              );
          }
      });
    {/if}

    $(document).ready(function() {
      $('#fixed-button').on('click', function() {
          if (
            $(".fields__header-btn--add-agent").length !== 0 ||
            $(".action-btns__item--add-agent").length !== 0
          ) return location.href = "view_line{$config.vlm}.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 $page}&page={$page}{/if}&line=new{if $act_bp_step.action=='add_record'}&bizproc={$cur_bizproc.id}&step={if $act_bp_step.autostep}{$act_bp_step.num+1}{else}{$act_bp_step.num}&done{/if}{/if}"
      });

      my_cookie = $.cookie('bizproc_id');
      if (my_cookie) {
        $.cookie('bizproc_id', null);
        open_dialog_my(my_cookie);
      }

      setTimeout(function () {
        $(".display_notification:not(.display_notification_class_by_type_3)").slideUp(400, on_window_resize);
      }, 5000);
      xPlayer.init('cb_player', '');
    });

    function hide_this_notif(obj) {
      $(obj).parent().slideUp(400, on_window_resize);
      return false;
    }

    {if $show_dialog_configuration_revision}
      var dont_ask_configuration_revision_dialog = false;
      var backup_status = false;

      function progress_my_dialog() {
          var obj = {};
          obj.modal = true;
          obj.title = '<table cellpadding="0" cellspacing="0"><tr><td height="10"><p style="font-size:16px; font-weight:normal; color:#999; margin-top:3px; padding-left:8px;">{$lang.auto_backup_started}</p></td></tr></table>';
          obj.width = 350;
          obj.draggable = false;
          obj.resizable = false;
          obj.open = function (event, ui) {
              $(this).parent().find('.ui-dialog-title').html(obj.title);
          };

          $("#dialog_progress").dialog(obj);
          $('.ui-icon-closethick').remove();
          $('.ui-button-icon-space').remove();
          $('.ui-dialog-titlebar-close').removeClass('ui-button ui-corner-all ui-widget ui-button-icon-only');
          $('.ui-dialog-titlebar-close').text('');
          overlayHandler();
          $("div.ui-dialog").focus();
          return false;
      }

      $(function() {
        // Выводим уведомление о том что вышла новая ревизия
        jconfirm(
          'Выпущена новая ревизия конфигурации {$config.last_configuration_revision}. Ваша текущая версия {$config.configuration_revision}.<br> Обновиться до последней ревизии?<br><br><input type=checkbox style="margin:0px;" onclick="dont_ask_configuration_revision_dialog=this.checked;"> не напоминать в течение месяца',

          function() { // Да обновиться
            location.href = 'edit_saas.php';
          },

          function() { // Нет не обновляемся
            $.ajax({
              url: "edit_revis_conf.php",
              data: {
                'stop_revision_update': '1',
                'dont_ask_configuration_revision_dialog': dont_ask_configuration_revision_dialog,
                'csrf': csrf
              },
              dataType: "json",
            });
          }
        );
      });
    {/if}

    {$ADDITIONAL_JAVASCRIPT}
  </script>

  {if $incoming_window_alert}
    <script type="text/javascript">
      $(function() {
        if (!$.cookie('incoming_window_alert_disabled')) {
          jconfirm('<span>{$lang.phone_window_message}</span>' +
            '<br><br>' +
            '<div style="display: flex; align-items: center;">' +
            '<input style="margin-left: 15px;margin-right: 15px;margin-top: 2px;" type=checkbox onclick="set_incoming_window_alert(this.checked)"> ' +
            '<span>{$lang.no_show_the_message_again}</span>' +
            '</div>',

            function() {
              const href = $('#header__item-phone').attr('href');
              window.open(href, 'popup', 'width=540,height=715,top=150,left=650');
            }
          );
        }
      });

      function set_incoming_window_alert(disabled) {
        $.cookie('incoming_window_alert_disabled', disabled ? 1 : null);
      }
    </script>
  {/if}

  {if !$full_version and $config.type == "SAAS"}
    <!-- Yandex.Metrika counter -->
    <script type="text/javascript">
      (function(d, w, c) {
        (w[c] = w[c] || []).push(function() {
          try {
            w.yaCounter45153261 = new Ya.Metrika({
              id:45153261,
              clickmap:true,
              trackLinks:true,
              accurateTrackBounce:true,
              webvisor:true
            });
          } catch(e) { }
        });

        var n = d.getElementsByTagName("script")[0],
          s = d.createElement("script"),
          f = function () { n.parentNode.insertBefore(s, n); };

        s.type = "text/javascript";
        s.async = true;
        s.src = "https://mc.yandex.ru/metrika/watch.js";

        if (w.opera == "[object Opera]") {
          d.addEventListener("DOMContentLoaded", f, false);
        } else {
          f();
        }
      })(document, window, "yandex_metrika_callbacks");
    </script>
    <noscript><div><img src="https://mc.yandex.ru/watch/45153261" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
    <!-- /Yandex.Metrika counter -->
  {/if}

  {if $mailstableid}
    <script>
      function wrong_mail(){
        jalert('{$lang.no_connect_mailbox}');
      }
    </script>

    {if $window_alert_for_mail}
      <script>
        var password_mail;

        function give_pass_mail() {
          if (!$.cookie('$window_alert_for_mail_disabled')) {
            jconfirm(
              "{$lang.no_connect_mailbox_1} {$window_alert_for_mail_mail} {$lang.no_connect_mailbox_2}:" +
              "<br><br>" +
              "<div style='display:inline-block'>" +
              "<input type='password' name='password_mail' onblur='give_password_for_mail(this.value,1)'  onkeypress='give_password_for_mail(this.value,0)'></div>" +
              "<div style='display:inline-block;margin-left:30px' id='password_for_mail'></div>" +
              "<br><br>" +
              "<input type=checkbox onclick='set_window_alert_for_mail(this.checked)'> " +
              "{$lang.no_show_the_message_again}",

              function() {
                location.reload();
              }
            );

            ok = document.getElementById('jalert_ok');
            ok.setAttribute('disabled', 'disabled');
          }
        }

        function give_password_for_mail(pass,a) {
          var dost = document.getElementById('password_for_mail');
          password_mail = pass;

          $.ajax({
            type: 'get',
            url: 'common.php?mail_box={$window_alert_for_mail}&pass_mail=' + password_mail,
            response: JSON,
            success: function(data) {
              if (data === '1') {
                ok.removeAttribute('disabled');
                dost.innerHTML = '{$lang.password_correct}';
                dost.style.color = 'green';
              } else {
                if (data === '2' && a) {
                  ok.setAttribute('disabled', 'disabled');
                  dost.innerHTML = '{$lang.password_incorrect}';
                  dost.style.color = 'red';
                }
              }
            }
          });
        }

        function set_window_alert_for_mail(disabled) {
          $.cookie('window_alert_for_mail_disabled', disabled ? 1 : null);
        }
      </script>
    {/if}
  {/if}

  {if $die_text}<div class="die_text">{$die_text}</div>{/if}

  <script defer src="{$ul_path}/themes/clientbase/js/index-top.js?{$revision}"></script>

  {if $cur_bp_step.action =='demo' && !$next_bp_step }
    <script>
      $("#body_id").click(function() {
        if (!allow_out_bizproc) allow_out_bizproc = 1;
      });
    </script>
  {/if}

  {if $edit_page}
    <script>
      on_window_resize(); // Выравниваем высоту
    </script>

    <style>
      @-moz-document url-prefix() {
        .telephone_link {
          line-height: 39px !important;
        }
      }
    </style>

    <script>
      $(document).ready(function() {
        $(".wiz_option").each(function (indx, element) {
          if ($(element).children().hasClass('on')) {
            if (indx == 0) {
              $(element).before('<li class="wiz_left_on"></li>');
            } else {
              $(element).prev().removeClass('wiz_arrow').addClass('wiz_arrow_on_left');
            }

            if (indx == $(".wiz_option").length - 1) {
              $(element).after('<li class="wiz_right_on"></li>');
            } else {
              $(element).after('<li class="wiz_arrow_on_right"></li>');
            }
          } else {
            if (indx == 0) {
              $(element).before('<li class="wiz_left"></li>');
            }

            if (indx == $(".wiz_option").length - 1) {
              $(element).after('<li class="wiz_right"></li>');
            } else {
              $(element).after('<li class="wiz_arrow"></li>');
            }
          }
        });
      });
    </script>
  {/if}

  {if $table.auto_save == 1 && $first_rec != $line_id}
    <style>
      .subtable__footer-btn--save {
        display: none;
      }
    </style>
  {/if}

  <script type="text/javascript">
      function getFilterCounts() {
          /// Подсчет количества записей по фильтрам
          jQuery(function ($) {
              var ids = [];
              $("a.header__filter-link.with-counter").each(function (index, a) {
                  ids.push($(a).data("filter-id"));
              });
              $.post({
                  url: "filter_get_count.php",
                  data: {
                      csrf: csrf,
                      ids: ids
                  },
                  success: function (data) {
                      $("a.header__filter-link.with-counter").each(function (index, a) {
                          let link = $(a);
                          let count = data[link.data("filter-id")];
                          let span = link.find("span.filter-counter");
                          if (count !== undefined) {
                              span.text(count);
                          } else {
                              span.text(0);
                          }
                      });
                      // Вызываем функцию ресайза окна, которая перерисовывает flexmenu "Еще" после вставки значений в фильтры
                      resizeTrigger();
                  }
              });
          });
      }

      function resizeTrigger() {
          setTimeout(function() {
              $(window).trigger('resize');
          }, 100);
      };
  </script>

  {* Отображение имени пользователей в модуле ВК *}
  {if $vk_name_setting == 1}
      <style>
          .message_window_vk {
              grid-template-columns: 30% 70%;
          }

          .message_vk-users--list .message_vk-users__name {
              display: block;
          }

          .message_vk-users--list {
              align-items: flex-start;
          }

          .greenOnline {
              left: 25%;
          }
      </style>
  {/if}

  {if $script_name != 'report_external.php'}
    <script type="text/javascript" src="{$ul_path}/include/js/tabs.js?{$revision}"></script><!-- Активность на вкладках и в приложении -->
    <script type="text/javascript" src="{$ul_path}/include/js/event_windows.js?{$revision}"></script>

    <!-- Плавающие окна - видимость, ресайз, перемещение -->
    <script>
      var max_notifications = +('{$config.reduce_notifications}');
    </script>

    <!-- Уведомления -->
    <script type="text/javascript" src="{$ul_path}/include/js/notify.js?{$revision}"></script>
    <!-- Функции напоминаний -->
    <script type="text/javascript" src="{$ul_path}/include/js/tips.js?{$revision}"></script>

    {if $user.acc_messages}
      <!-- Функции отображения пользователей -->
      <script type="text/javascript" src="{$ul_path}/include/js/users.js?{$revision}"></script>
      <!-- Функции сообщений -->
      <script type="text/javascript" src="{$ul_path}/include/js/message.js?{$revision}"></script>
    {/if}

    <!-- Объект данных -->
    <script type="text/javascript" src="{$ul_path}/include/js/storage.js?{$revision}"></script>
    <!-- Подписка на события -->
    <script defer type="text/javascript" src="{$ul_path}/include/js/events.js?{$revision}"></script>
  {/if}

  <!-- Глобальный поиск -->
  <script type="text/javascript" src="{$ul_path}/include/js/global_search.js?{$revision}"></script>
  <!-- End глобальный поиск -->
  {if !$this_is_modal_window}
      {if $user.id > 0 and $script_name neq 'login.php'}
          {if $all_bizprocs or $user.group_id==1 or $user.sub_admin_rights.addit_bizproc}
              <script>
                  var my_bizproc_flag = 0;
                  var click_flag = 0;
                  var my_bizproc_start;
                  function count(obj) {
                      var count = 0;
                      for (var prs in obj) {
                          if (obj.hasOwnProperty(prs)) count++;
                      }
                      return count;
                  }

                  function open_dialog_my(bizproc_id, i) {
                      if (!i) i = 1;
                      my_param_g = 1;
                      my_param_b = 1;

                      $.ajax({
                          url: "bizproc.php",
                          dataType: "json",
                          data: { bizproc_id: bizproc_id, index_top_flag: 1 },
                          success: function (data) {

                              data_count = count(data);
                              start_count = data_count;

                              if (data[i].att_file_name != '') {
                                  document.getElementById('img_id').style.display = 'block';
                                  document.getElementById('img_width').value = data[i].width;

                                  if (data[i].description.length > 800)
                                      document.getElementById('img_height').value = data[i].height + 300;
                                  else
                                      document.getElementById('img_height').value = data[i].height;
                              }

                              if (data[i].att_file_name == '') {
                                  document.getElementById('img_id').style.display = 'none';
                                  if (data[i].description.length > 200)
                                      document.getElementById('img_width').value = 600;
                                  else
                                      document.getElementById('img_width').value = 500;

                                  if (data[i].description.length > 800)
                                      document.getElementById('img_height').value = 600;
                                  else
                                      document.getElementById('img_height').value = data[i].height;
                              }

                              //if ($(".dialog1 ui-dialog-content ui-widget-content"))

                              if ($("#dialog_bizproc").css('display') == 'block') $("#dialog_bizproc").dialog('close');
                              my_bizproc_start = 1;
                              open_my_dialog();

                              var parentElem = document.getElementById('dialog_bizproc_2');
                              for (var iteration = 1; iteration < data_count + 1; iteration++) {
                                  var div = document.createElement('div');
                                  div.className = 'form_switcher';
                                  div.id = 'my_id' + iteration;
                                  if (iteration == 1)
                                      div.style.backgroundPosition = 'left';
                                  div.style.display = 'inline-block';
                                  parentElem.appendChild(div);
                              }

                              //изначально скрываем кнопки
                              document.getElementById('g_button').style.display = 'none';
                              document.getElementById('b_button').style.display = 'none';

                              if (data[i].g_button == '1') {
                                  document.getElementById('g_button').style.display = 'block';
                                  document.getElementById('g_button').innerHTML = data[i]['g_text'];
                              }
                              if (data[i].b_button == '1') {
                                  document.getElementById('b_button').style.display = 'block';
                                  document.getElementById('b_button').innerHTML = data[i]['b_text'];
                              }


                              $('#dialog_bizproc_2').click(function () {
                                  if (click_flag)
                                      return;
                                  data_count -= 1;
                                  i += 1;

                                  //если все шаги прошли, закрываем диалог
                                  if (i > start_count)
                                      remove_page_arrows_my();

                                  //изначально скрываем кнопки
                                  document.getElementById('g_button').style.display = 'none';
                                  document.getElementById('b_button').style.display = 'none';


                                  document.getElementById('my_id' + i).style.backgroundPosition = 'left'

                                  if (data_count > 0) {
                                      //изначально скрываем кнопки
                                      document.getElementById('g_button').style.display = 'none';
                                      document.getElementById('b_button').style.display = 'none';

                                      //задаем размер окна  с учетом картинкой
                                      if (data[i].att_file_name != '') {
                                          document.getElementById('img_id').style.display = 'block';
                                          document.getElementById('img_width').value = data[i].width;

                                          document.getElementById('img_height').value = data[i].height;
                                          document.getElementById('dialog_height').style.height = '';
                                      }

                                      //пытаемся задать размеры окна без картинки
                                      if (data[i].att_file_name == '') {
                                          document.getElementById('img_id').style.display = 'none';

                                          if (data[i].description.length > 200)
                                              document.getElementById('img_height').value = 400;
                                          else
                                              document.getElementById('img_height').value = data[i].height;

                                          if (data[i].description.length > 200)
                                              document.getElementById('img_width').value = 600;
                                          else
                                              document.getElementById('img_width').value = 400;

                                          document.getElementById('dialog_height').style.height = document.getElementById('img_height').value - 70 + 'px';
                                      }


                                      bp_name = data[i].name;
                                      bp_desc = data[i].description;
                                      bp_img = data[i].att_file;

                                      open_my_dialog();

                                      if (data[i].g_button == '1') {
                                          document.getElementById('g_button').style.display = 'block';
                                          document.getElementById('g_button').innerHTML = data[i]['g_text'];
                                          my_param_g = i;
                                      }
                                      if (data[i].b_button == '1') {
                                          document.getElementById('b_button').style.display = 'block';
                                          document.getElementById('b_button').innerHTML = data[i]['b_text'];
                                          my_param_b = i;
                                      }

                                      document.getElementById('bp_header_id').innerHTML = bp_name;
                                      document.getElementById('desc_id').innerHTML = bp_desc;
                                      document.getElementById('img_id').setAttribute('src', bp_img);
                                  }

                              });

                              $('#g_button').click(function () {
                                  if (document.getElementById('g_button').style.display == 'block' && data[i].g_link != '') {
                                      my_bizproc_start = 0;
                                      click_flag = 1;
                                      $("#dialog_bizproc_2").dialog('close');
                                      window.location.href = data[my_param_g].g_link;
                                  }
                              });

                              $('#b_button').click(function () {
                                  if (document.getElementById('b_button').style.display == 'block' && data[i].b_link != '') {
                                      my_bizproc_start = 0;
                                      click_flag = 1;
                                      $("#dialog_bizproc_2").dialog('close');
                                      window.location.href = data[my_param_b].b_link;
                                  }
                              });


                              bp_name = data[i].name;
                              bp_desc = data[i].description;
                              bp_img = data[i].att_file;

                              document.getElementById('bp_header_id').innerHTML = bp_name;
                              document.getElementById('desc_id').innerHTML = bp_desc;
                              document.getElementById('img_id').setAttribute('src', bp_img);
                          }
                      });
                  }

                  function remove_page_arrows_my() {
                      //my_bizproc_flag = 1
                      if ($("#dialog_bizproc").css('display') == 'block') $("#dialog_bizproc").dialog('close');
                      location.reload();
                  }

                  function open_my_dialog() {
                      var obj = {};
                      obj.modal = true;
                      obj.title = '<table cellpadding="0" cellspacing="0"><tr><td height="10"><p id="bp_header_id" style="font-size:16px; font-weight:normal; color:#999; margin-top:3px; padding-left:8px;"></p></td><td></td></tr></table>';

                      if (document.getElementById('img_width').value)
                          obj.width = document.getElementById('img_width').value;
                      obj.height = document.getElementById('img_height').value;

                      //делаем точки в самом низу страницы
                      //document.getElementById('dialog_height').style.height = obj.height -70 + 'px';
                      obj.draggable = false;
                      obj.resizable = false;
                      obj.open = function (event, ui) {
                          $(this).parent().find('.ui-dialog-title').html(obj.title);
                      };
                      $("#dialog_bizproc_2").dialog(obj);
                      $("#dialog_bizproc_2").bind('dialogclose', remove_page_arrows_my);
                      overlayHandler();
                      $(window).on('resize', overlayHandler);
                      $("div.ui-dialog").focus();
                      return false;
                  }

                  function bizproc_view() {
                      if (my_bizproc_start == 1)
                          return;
                      var obj = {};
                      obj.modal = true;
                      obj.title = '<table cellpadding="0" cellspacing="0"><tr><td height="10"><p style="font-size:16px; font-weight:normal; color:#999; margin-top:3px; padding-left:8px;">{$lang.Business_processes}</p></td>{if $user.group_id==1 or $user.sub_admin_rights.addit_bizproc}<td><a style="text-decoration:none; " href="edit_bizproc.php?&back_url={$base64_current_url}"><img alt="" border="0" src="images/settings_a.gif" onmouseover="this.src=\'images/settings_b.gif\';" onmouseout="this.src=\'images/settings_a.gif\';" style="margin-left:10px; margin-top:-7px;"/></a></td>{/if}</tr></table>';
                      obj.width = 350;
                      obj.draggable = false;
                      obj.resizable = false;
                      obj.open = function (event, ui) {
                          $(this).parent().find('.ui-dialog-title').html(obj.title);
                      };
                      $("#dialog_bizproc").dialog(obj);
                      overlayHandler();
                      $("div.ui-dialog").focus();
                      return false;
                  }
              </script>
              <!-- End of business_processes -->
          {/if}
      {/if}
  {/if}

  <script defer>
    $(document).ready(function(){
      NProgress.set(0.99);
      setTimeout(function() { NProgress.done(); $('.fade').removeClass('out'); }, 100);
    });

    {if $config.show_sql_time}
      function viewLoadPageHelp() {
          $('#f_tooltipload__info').show();
      }

      function hideLoadPageHelp() {
          $('#f_tooltipload__info').hide();
      }

      window.onload = () => {
          const pageLoadTimeStart = new Date();
          const pageLoadTime = (pageLoadTimeStart.getTime() - pageLoadTimeStart.getTime()) / 1000;
          const backendTime = '<?= number_format((float)$php_total_time, 2, $lang["float_delimiter"], $lang["space_delimiter"]) ?>';
          const totalPageLoadTime = (pageLoadTime + parseFloat(backendTime.replace(',', '.'))).toString().replace('.', ',');
          const sqlRequestsTime = '<?= $sql_requests_count ?>';
          $('#load__info').prepend('<span id="html_total_time" title="backend: '+ backendTime + lang.Exec_time2 + '\n' +
              'frontend: '+ pageLoadTime.toString().replace('.', ',').substr(0, 4) + lang.Exec_time2 + '\n' +
              'sql: '+ sqlRequestsTime + lang.Exec_time3 + '">'+ totalPageLoadTime.substr(0, 4) + ' ' + lang.Exec_time2.replace(',', '') + '</span>');
      };
    {/if}
  </script>

  {if $config.push_on == 1}
    <script src="{$ul_path}/include/push_notification/firebase-app.js"></script>
    <script src="{$ul_path}/include/push_notification/firebase-messaging.js"></script>
    <script src="{$ul_path}/include/push_notification/firebase-analytics.js"></script>
    <script src="{$ul_path}/include/push_notification/getToken.js"></script>
  {/if}

  <script src="{$ul_path}/themes/clientbase/js/color-format.js?{$revision}"></script>
  <script src="{$ul_path}/themes/clientbase/libs/fixedTable/fixedTable.js?{$revision}"></script>

  <style>
    .ui-dialog-titlebar-close {
      z-index: 2000 !important;
    }
  </style>
</head>

<body>
  <div style="margin: 0 32px;">
    <div id="rapps-root-report-view">{$report.report_data}</div>
  </div>
</body>
</html>
