text: $(function () {
      'use strict'
  
      var ticksStyle = {
          fontColor: '#495057',
          fontStyle: 'bold'
      }
  
      var mode = 'index'
      var intersect = true
  
      var currentYearSales, lastYearSales;
      $.get("/admin/ajax/load-graph-data/sales", function (data) {
          currentYearSales = data.currentYear;
          lastYearSales = data.lastYear;
  
          var percent = data.percentChange.toFixed(2);
  
          if (percent < 0) {
              $('#sales_percent_change_arrow').removeClass('fa-arrow-up').addClass('fa-arrow-down');
              $('#sales_percent_change_block').removeClass('text-success').addClass('text-danger');
          }
  
          $('#sales_percent_change').text(percent);
          $('#total_sales').text(data.totalSales + ' руб.');
  
          var $salesChart = $('#sales-chart')
          var salesChart = new Chart($salesChart, {
              type: 'bar',
              data: {
                  labels: ['Янв', 'Фев', 'Март', 'Апр', 'Май', 'Июнь', 'Июль', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'],
                  datasets: [
                      {
                          backgroundColor: '#007bff',
                          borderColor: '#007bff',
                          data: currentYearSales
                      },
                      {
                          backgroundColor: '#ced4da',
                          borderColor: '#ced4da',
                          data: lastYearSales
                      }
                  ]
              },
              options: {
                  maintainAspectRatio: false,
                  tooltips: {
                      mode: mode,
                      intersect: intersect
                  },
                  hover: {
                      mode: mode,
                      intersect: intersect
                  },
                  legend: {
                      display: false
                  },
                  scales: {
                      yAxes: [{
                          // display: false,
                          gridLines: {
                              display: true,
                              lineWidth: '4px',
                              color: 'rgba(0, 0, 0, .2)',
                              zeroLineColor: 'transparent'
                          },
                          ticks: $.extend({
                              beginAtZero: true,
  
                              // Include a dollar sign in the ticks
                              callback: function (value, index, values) {
                                  if (value >= 1000) {
                                      value /= 1000
                                      value += 'k'
                                  }
                                  return value + ' руб.'
                              }
                          }, ticksStyle)
                      }],
                      xAxes: [{
                          display: true,
                          gridLines: {
                              display: false
                          },
                          ticks: ticksStyle
                      }]
                  }
              }
          })
      });
  
  
  
      var visitorLabels = [], currentWeekData = [], lastWeekData = [], percentChange = 0;
      $.get("/admin/ajax/load-graph-data", function (data) {
          data.currentWeek.forEach(function (item) {
              currentWeekData.push(item.visitors);
          })
  
          data.lastWeek.forEach(function (item) {
              lastWeekData.push(item.visitors);
          })
  
          visitorLabels = data.days;
  
          var percent = data.changes.toFixed(2);
  
          if (percent < 0) {
              $('#visitors_percent_change_arrow').removeClass('fa-arrow-up').addClass('fa-arrow-down');
              $('#visitors_percent_change_block').removeClass('text-success').addClass('text-danger');
          }
  
          $('#visitors_percent_change').text(percent);
          $('#current_week_visitors_count').text(data.currentWeekVisitors);
  
          var $visitorsChart = $('#visitors-chart')
          var visitorsChart = new Chart($visitorsChart, {
              data: {
                  labels: visitorLabels,
                  datasets: [{
                      type: 'line',
                      data: currentWeekData,
                      backgroundColor: 'transparent',
                      borderColor: '#007bff',
                      pointBorderColor: '#007bff',
                      pointBackgroundColor: '#007bff',
                      fill: false
                      // pointHoverBackgroundColor: '#007bff',
                      // pointHoverBorderColor    : '#007bff'
                  },
                  {
                      type: 'line',
                      data: lastWeekData,
                      backgroundColor: 'tansparent',
                      borderColor: '#ced4da',
                      pointBorderColor: '#ced4da',
                      pointBackgroundColor: '#ced4da',
                      fill: false
                      // pointHoverBackgroundColor: '#ced4da',
                      // pointHoverBorderColor    : '#ced4da'
                  }]
              },
              options: {
                  maintainAspectRatio: false,
                  tooltips: {
                      mode: mode,
                      intersect: intersect
                  },
                  hover: {
                      mode: mode,
                      intersect: intersect
                  },
                  legend: {
                      display: false
                  },
                  scales: {
                      yAxes: [{
                          // display: false,
                          gridLines: {
                              display: true,
                              lineWidth: '4px',
                              color: 'rgba(0, 0, 0, .2)',
                              zeroLineColor: 'transparent'
                          },
                          ticks: $.extend({
                              beginAtZero: true,
                              suggestedMax: 200
                          }, ticksStyle)
                      }],
                      xAxes: [{
                          display: true,
                          gridLines: {
                              display: false
                          },
                          ticks: ticksStyle
                      }]
                  }
              }
          })
      });
  
  
  })
  