<?php
/* Smarty version 4.5.2, created on 2024-04-15 09:43:06
  from '/Users/nikolaimv/Sites/admin.panel.11.loc/admin/templates/init/echarts-init.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.2',
  'unifunc' => 'content_661cb05a210e03_21266591',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'e203ac7e8d8ed71130267e57b5f02ee5b12b613d' => 
    array (
      0 => '/Users/nikolaimv/Sites/admin.panel.11.loc/admin/templates/init/echarts-init.tpl',
      1 => 1679630384,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_661cb05a210e03_21266591 (Smarty_Internal_Template $_smarty_tpl) {
echo '<script'; ?>
 src="/admin/assets/js/vendor/visualization/echarts/echarts.min.js"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
>

    var EchartsColumnsWaterfalls = function() {

        const _columnsWaterfallsExamples = function() {
            if (typeof echarts == 'undefined') {
                console.warn('Warning - echarts.min.js is not loaded.');
                return;
            }

            const stats_users_element = document.getElementById('stats_users');
            const stats_content_element = document.getElementById('stats_content');

            <?php if ((isset($_smarty_tpl->tpl_vars['days']->value))) {?>

                if (stats_users_element) {
                    var users_element = echarts.init(stats_users_element);
                    users_element.setOption({
                        title: { text: 'Посетители', left: 'left', textStyle: { fontSize: 17, fontWeight: 500 }, subtextStyle: { fontSize: 12 } },
                        // Define colors
                        color: ['#2ec7c9','#b6a2de','#5ab1ef','#ffb980','#d87a80'],
                        // Global text styles
                        textStyle: { fontFamily: 'Roboto, Arial, Verdana, sans-serif', fontSize: 13 },
                        // Chart animation duration
                        animationDuration: 750,
                        // Setup grid
                        grid: { left: 0, right: 25, top: 50, bottom: 0, containLabel: true },
                        // Add legend
                        legend: {
                            data: [ 'Новые посетители', 'Вернувшиеся посетители', 'Всего посетителей' ],
                            itemHeight: 8,
                            itemGap: 20,
                            textStyle: { padding: [0, 5] }
                        },

                        // Add tooltip
                        tooltip: {
                            trigger: 'axis',
                            backgroundColor: 'rgba(0,0,0,0.75)',
                            padding: [10, 15],
                            textStyle: { fontSize: 13, fontFamily: 'Roboto, sans-serif' },
                            axisPointer: {
                                type: 'shadow'
                            }
                        },

                        // Horizontal axis
                        xAxis: [{
                            type: 'category',
                            data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> '<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['date'], ENT_QUOTES, 'UTF-8', true);?>
'<?php if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>,<?php }?> <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                            axisLabel: { color: '#333' },
                            axisLine: { lineStyle: { color: '#999' } },
                        }],

                        // Vertical axis
                        yAxis: [{
                            type: 'value',
                            axisLabel: { color: '#333' },
                            axisLine: { lineStyle: { color: '#999' } },
                            splitLine: { lineStyle: { color: ['#eee'] } },
                            splitArea: { show: true, areaStyle: { color: ['rgba(250,250,250,0.1)', 'rgba(0,0,0,0.01)'] }}
                        }],

                        // Add series
                        series: [
                            {
                                name: 'Новые посетители',
                                type: 'bar',
                                data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['newVisitors'], ENT_QUOTES, 'UTF-8', true);
if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>, <?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                                itemStyle: { normal: { label: { show: true, position: 'top', textStyle: { fontWeight: 500 } } } },
                            },
                            {
                                name: 'Вернувшиеся посетители',
                                type: 'bar',
                                data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['retVisitors'], ENT_QUOTES, 'UTF-8', true);
if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>, <?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                                itemStyle: { normal: { label: { show: true, position: 'top', textStyle: { fontWeight: 500 } } } },
                            },
                            {
                                name: 'Всего посетителей',
                                type: 'bar',
                                data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['newVisitors']+$_smarty_tpl->tpl_vars['day']->value['retVisitors'], ENT_QUOTES, 'UTF-8', true);
if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>, <?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                                itemStyle: { normal: { label: { show: true, position: 'top', textStyle: { fontWeight: 500 } } } },
                            }
                        ]
                    });
                }

                if (stats_content_element) {
                    var content_element = echarts.init(stats_content_element);
                    content_element.setOption({
                        title: { text: 'Просмотры', left: 'left', textStyle: { fontSize: 17, fontWeight: 500 }, subtextStyle: { fontSize: 12 } },
                        // Define colors
                        color: ['#C23431','#2F4554','#61A0A8','#b6a2de','#2ec7c9'],
                        // Global text styles
                        textStyle: { fontFamily: 'Roboto, Arial, Verdana, sans-serif', fontSize: 13 },
                        // Chart animation duration
                        animationDuration: 750,
                        // Setup grid
                        grid: { left: 0, right: 25, top: 50, bottom: 0, containLabel: true },
                        // Add legend
                        legend: {
                            data: [ 'Просмотр страниц', 'Просмотр контента', 'Всего просмотров' ],
                            itemHeight: 8,
                            itemGap: 20,
                            textStyle: { padding: [0, 5] }
                        },
                        // Add tooltip
                        tooltip: {
                            trigger: 'axis',
                            backgroundColor: 'rgba(0,0,0,0.75)',
                            padding: [10, 15],
                            textStyle: { fontSize: 13, fontFamily: 'Roboto, sans-serif' },
                            axisPointer: {
                                type: 'shadow'
                            }
                        },

                        // Horizontal axis
                        xAxis: [{
                            type: 'category',
                            data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> '<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['date'], ENT_QUOTES, 'UTF-8', true);?>
'<?php if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>,<?php }?> <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                            axisLabel: { color: '#333' },
                            axisLine: { lineStyle: { color: '#999' } },
                        }],

                        // Vertical axis
                        yAxis: [{
                            type: 'value',
                            axisLabel: { color: '#333' },
                            axisLine: { lineStyle: { color: '#999' } },
                            splitLine: { lineStyle: { color: ['#eee'] } },
                            splitArea: { show: true, areaStyle: { color: ['rgba(250,250,250,0.1)', 'rgba(0,0,0,0.01)'] }}
                        }],

                        // Add series
                        series: [
                            {
                                name: 'Просмотр страниц',
                                type: 'bar',
                                data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['sectionVisits'], ENT_QUOTES, 'UTF-8', true);
if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>,<?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                                itemStyle: { normal: { label: { show: true, position: 'top', textStyle: { fontWeight: 500 } } } },
                            },
                            {
                                name: 'Просмотр контента',
                                type: 'bar',
                                data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['articleVisits'], ENT_QUOTES, 'UTF-8', true);
if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>,<?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                                itemStyle: { normal: { label: { show: true, position: 'top', textStyle: { fontWeight: 500 } } } },
                            },
                            {
                                name: 'Всего просмотров',
                                type: 'bar',
                                data: [<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['days']->value, 'day', false, NULL, 'days', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['day']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['day']->value) {
$_smarty_tpl->tpl_vars['day']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['total'];
?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['day']->value['articleVisits']+$_smarty_tpl->tpl_vars['day']->value['sectionVisits']+$_smarty_tpl->tpl_vars['day']->value['searchVisits'], ENT_QUOTES, 'UTF-8', true);
if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_days']->value['last'] : null)) {?>,<?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>],
                                itemStyle: { normal: { label: { show: true, position: 'top', textStyle: { fontWeight: 500 } } } },
                            }
                        ]
                    });
                }

            <?php }?>

            // Resize function
            var triggerChartResize = function() {
                stats_users_element && users_element.resize();
                stats_content_element && content_element.resize();
            };

            // On sidebar width change
            $(document).on('click', '.sidebar-control', function() {
                setTimeout(function () {
                    triggerChartResize();
                }, 0);
            });

            // On window resize
            var resizeCharts;
            window.onresize = function () {
                clearTimeout(resizeCharts);
                resizeCharts = setTimeout(function () {
                    triggerChartResize();
                }, 200);
            };
        };

        // Return objects assigned to module
        return {
            init: function() {
                _columnsWaterfallsExamples();
            }
        }
    }();


    // Initialize module
    // ------------------------------

    document.addEventListener('DOMContentLoaded', function() {
        EchartsColumnsWaterfalls.init();
    });

<?php echo '</script'; ?>
><?php }
}
