12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040 |
- /*!
- =========================================================
- * Argon Dashboard - v1.2.0
- =========================================================
- * Product Page: https://www.creative-tim.com/product/argon-dashboard
- * Copyright 2020 Creative Tim (https://www.creative-tim.com)
- * Licensed under MIT (https://github.com/creativetimofficial/argon-dashboard/blob/master/LICENSE.md)
- * Coded by www.creative-tim.com
- =========================================================
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- */
- //
- // Layout
- //
- 'use strict';
- var Layout = (function() {
- function pinSidenav() {
- $('.sidenav-toggler').addClass('active');
- $('.sidenav-toggler').data('action', 'sidenav-unpin');
- $('body').removeClass('g-sidenav-hidden').addClass('g-sidenav-show g-sidenav-pinned');
- $('body').append('<div class="backdrop d-xl-none" data-action="sidenav-unpin" data-target='+$('#sidenav-main').data('target')+' />');
- // Store the sidenav state in a cookie session
- Cookies.set('sidenav-state', 'pinned');
- }
- function unpinSidenav() {
- $('.sidenav-toggler').removeClass('active');
- $('.sidenav-toggler').data('action', 'sidenav-pin');
- $('body').removeClass('g-sidenav-pinned').addClass('g-sidenav-hidden');
- $('body').find('.backdrop').remove();
- // Store the sidenav state in a cookie session
- Cookies.set('sidenav-state', 'unpinned');
- }
- // Set sidenav state from cookie
- var $sidenavState = Cookies.get('sidenav-state') ? Cookies.get('sidenav-state') : 'pinned';
- if($(window).width() > 1200) {
- if($sidenavState == 'pinned') {
- pinSidenav()
- }
- if(Cookies.get('sidenav-state') == 'unpinned') {
- unpinSidenav()
- }
- $(window).resize(function() {
- if( $('body').hasClass('g-sidenav-show') && !$('body').hasClass('g-sidenav-pinned')) {
- $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hidden');
- }
- })
- }
- if($(window).width() < 1200){
- $('body').removeClass('g-sidenav-hide').addClass('g-sidenav-hidden');
- $('body').removeClass('g-sidenav-show');
- $(window).resize(function() {
- if( $('body').hasClass('g-sidenav-show') && !$('body').hasClass('g-sidenav-pinned')) {
- $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hidden');
- }
- })
- }
- $("body").on("click", "[data-action]", function(e) {
- e.preventDefault();
- var $this = $(this);
- var action = $this.data('action');
- var target = $this.data('target');
- // Manage actions
- switch (action) {
- case 'sidenav-pin':
- pinSidenav();
- break;
- case 'sidenav-unpin':
- unpinSidenav();
- break;
- case 'search-show':
- target = $this.data('target');
- $('body').removeClass('g-navbar-search-show').addClass('g-navbar-search-showing');
- setTimeout(function() {
- $('body').removeClass('g-navbar-search-showing').addClass('g-navbar-search-show');
- }, 150);
- setTimeout(function() {
- $('body').addClass('g-navbar-search-shown');
- }, 300)
- break;
- case 'search-close':
- target = $this.data('target');
- $('body').removeClass('g-navbar-search-shown');
- setTimeout(function() {
- $('body').removeClass('g-navbar-search-show').addClass('g-navbar-search-hiding');
- }, 150);
- setTimeout(function() {
- $('body').removeClass('g-navbar-search-hiding').addClass('g-navbar-search-hidden');
- }, 300);
- setTimeout(function() {
- $('body').removeClass('g-navbar-search-hidden');
- }, 500);
- break;
- }
- })
- // Add sidenav modifier classes on mouse events
- $('.sidenav').on('mouseenter', function() {
- if(! $('body').hasClass('g-sidenav-pinned')) {
- $('body').removeClass('g-sidenav-hide').removeClass('g-sidenav-hidden').addClass('g-sidenav-show');
- }
- })
- $('.sidenav').on('mouseleave', function() {
- if(! $('body').hasClass('g-sidenav-pinned')) {
- $('body').removeClass('g-sidenav-show').addClass('g-sidenav-hide');
- setTimeout(function() {
- $('body').removeClass('g-sidenav-hide').addClass('g-sidenav-hidden');
- }, 300);
- }
- })
- // Make the body full screen size if it has not enough content inside
- $(window).on('load resize', function() {
- if($('body').height() < 800) {
- $('body').css('min-height', '100vh');
- $('#footer-main').addClass('footer-auto-bottom')
- }
- })
- })();
- //
- // Charts
- //
- 'use strict';
- var Charts = (function() {
- // Variable
- var $toggle = $('[data-toggle="chart"]');
- var mode = 'light';//(themeMode) ? themeMode : 'light';
- var fonts = {
- base: 'Open Sans'
- }
- // Colors
- var colors = {
- gray: {
- 100: '#f6f9fc',
- 200: '#e9ecef',
- 300: '#dee2e6',
- 400: '#ced4da',
- 500: '#adb5bd',
- 600: '#8898aa',
- 700: '#525f7f',
- 800: '#32325d',
- 900: '#212529'
- },
- theme: {
- 'default': '#172b4d',
- 'primary': '#5e72e4',
- 'secondary': '#f4f5f7',
- 'info': '#11cdef',
- 'success': '#2dce89',
- 'danger': '#f5365c',
- 'warning': '#fb6340'
- },
- black: '#12263F',
- white: '#FFFFFF',
- transparent: 'transparent',
- };
- // Methods
- // Chart.js global options
- function chartOptions() {
- // Options
- var options = {
- defaults: {
- global: {
- responsive: true,
- maintainAspectRatio: false,
- defaultColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600],
- defaultFontColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600],
- defaultFontFamily: fonts.base,
- defaultFontSize: 13,
- layout: {
- padding: 0
- },
- legend: {
- display: false,
- position: 'bottom',
- labels: {
- usePointStyle: true,
- padding: 16
- }
- },
- elements: {
- point: {
- radius: 0,
- backgroundColor: colors.theme['primary']
- },
- line: {
- tension: .4,
- borderWidth: 4,
- borderColor: colors.theme['primary'],
- backgroundColor: colors.transparent,
- borderCapStyle: 'rounded'
- },
- rectangle: {
- backgroundColor: colors.theme['warning']
- },
- arc: {
- backgroundColor: colors.theme['primary'],
- borderColor: (mode == 'dark') ? colors.gray[800] : colors.white,
- borderWidth: 4
- }
- },
- tooltips: {
- enabled: true,
- mode: 'index',
- intersect: false,
- }
- },
- doughnut: {
- cutoutPercentage: 83,
- legendCallback: function(chart) {
- var data = chart.data;
- var content = '';
- data.labels.forEach(function(label, index) {
- var bgColor = data.datasets[0].backgroundColor[index];
- content += '<span class="chart-legend-item">';
- content += '<i class="chart-legend-indicator" style="background-color: ' + bgColor + '"></i>';
- content += label;
- content += '</span>';
- });
- return content;
- }
- }
- }
- }
- // yAxes
- Chart.scaleService.updateScaleDefaults('linear', {
- gridLines: {
- borderDash: [2],
- borderDashOffset: [2],
- color: (mode == 'dark') ? colors.gray[900] : colors.gray[300],
- drawBorder: false,
- drawTicks: false,
- drawOnChartArea: true,
- zeroLineWidth: 0,
- zeroLineColor: 'rgba(0,0,0,0)',
- zeroLineBorderDash: [2],
- zeroLineBorderDashOffset: [2]
- },
- ticks: {
- beginAtZero: true,
- padding: 10,
- callback: function(value) {
- if (!(value % 10)) {
- return value
- }
- }
- }
- });
- // xAxes
- Chart.scaleService.updateScaleDefaults('category', {
- gridLines: {
- drawBorder: false,
- drawOnChartArea: false,
- drawTicks: false
- },
- ticks: {
- padding: 20
- },
- maxBarThickness: 10
- });
- return options;
- }
- // Parse global options
- function parseOptions(parent, options) {
- for (var item in options) {
- if (typeof options[item] !== 'object') {
- parent[item] = options[item];
- } else {
- parseOptions(parent[item], options[item]);
- }
- }
- }
- // Push options
- function pushOptions(parent, options) {
- for (var item in options) {
- if (Array.isArray(options[item])) {
- options[item].forEach(function(data) {
- parent[item].push(data);
- });
- } else {
- pushOptions(parent[item], options[item]);
- }
- }
- }
- // Pop options
- function popOptions(parent, options) {
- for (var item in options) {
- if (Array.isArray(options[item])) {
- options[item].forEach(function(data) {
- parent[item].pop();
- });
- } else {
- popOptions(parent[item], options[item]);
- }
- }
- }
- // Toggle options
- function toggleOptions(elem) {
- var options = elem.data('add');
- var $target = $(elem.data('target'));
- var $chart = $target.data('chart');
- if (elem.is(':checked')) {
- // Add options
- pushOptions($chart, options);
- // Update chart
- $chart.update();
- } else {
- // Remove options
- popOptions($chart, options);
- // Update chart
- $chart.update();
- }
- }
- // Update options
- function updateOptions(elem) {
- var options = elem.data('update');
- var $target = $(elem.data('target'));
- var $chart = $target.data('chart');
- // Parse options
- parseOptions($chart, options);
- // Toggle ticks
- toggleTicks(elem, $chart);
- // Update chart
- $chart.update();
- }
- // Toggle ticks
- function toggleTicks(elem, $chart) {
- if (elem.data('prefix') !== undefined || elem.data('prefix') !== undefined) {
- var prefix = elem.data('prefix') ? elem.data('prefix') : '';
- var suffix = elem.data('suffix') ? elem.data('suffix') : '';
- // Update ticks
- $chart.options.scales.yAxes[0].ticks.callback = function(value) {
- if (!(value % 10)) {
- return prefix + value + suffix;
- }
- }
- // Update tooltips
- $chart.options.tooltips.callbacks.label = function(item, data) {
- var label = data.datasets[item.datasetIndex].label || '';
- var yLabel = item.yLabel;
- var content = '';
- if (data.datasets.length > 1) {
- content += '<span class="popover-body-label mr-auto">' + label + '</span>';
- }
- content += '<span class="popover-body-value">' + prefix + yLabel + suffix + '</span>';
- return content;
- }
- }
- }
- // Events
- // Parse global options
- if (window.Chart) {
- parseOptions(Chart, chartOptions());
- }
- // Toggle options
- $toggle.on({
- 'change': function() {
- var $this = $(this);
- if ($this.is('[data-add]')) {
- toggleOptions($this);
- }
- },
- 'click': function() {
- var $this = $(this);
- if ($this.is('[data-update]')) {
- updateOptions($this);
- }
- }
- });
- // Return
- return {
- colors: colors,
- fonts: fonts,
- mode: mode
- };
- })();
- //
- // Icon code copy/paste
- //
- 'use strict';
- var CopyIcon = (function() {
- // Variables
- var $element = '.btn-icon-clipboard',
- $btn = $($element);
- // Methods
- function init($this) {
- $this.tooltip().on('mouseleave', function() {
- // Explicitly hide tooltip, since after clicking it remains
- // focused (as it's a button), so tooltip would otherwise
- // remain visible until focus is moved away
- $this.tooltip('hide');
- });
- var clipboard = new ClipboardJS($element);
- clipboard.on('success', function(e) {
- $(e.trigger)
- .attr('title', 'Copied!')
- .tooltip('_fixTitle')
- .tooltip('show')
- .attr('title', 'Copy to clipboard')
- .tooltip('_fixTitle')
- e.clearSelection()
- });
- }
- // Events
- if ($btn.length) {
- init($btn);
- }
- })();
- //
- // Navbar
- //
- 'use strict';
- var Navbar = (function() {
- // Variables
- var $nav = $('.navbar-nav, .navbar-nav .nav');
- var $collapse = $('.navbar .collapse');
- var $dropdown = $('.navbar .dropdown');
- // Methods
- function accordion($this) {
- $this.closest($nav).find($collapse).not($this).collapse('hide');
- }
- function closeDropdown($this) {
- var $dropdownMenu = $this.find('.dropdown-menu');
- $dropdownMenu.addClass('close');
- setTimeout(function() {
- $dropdownMenu.removeClass('close');
- }, 200);
- }
- // Events
- $collapse.on({
- 'show.bs.collapse': function() {
- accordion($(this));
- }
- })
- $dropdown.on({
- 'hide.bs.dropdown': function() {
- closeDropdown($(this));
- }
- })
- })();
- //
- // Navbar collapse
- //
- var NavbarCollapse = (function() {
- // Variables
- var $nav = $('.navbar-nav'),
- $collapse = $('.navbar .navbar-custom-collapse');
- // Methods
- function hideNavbarCollapse($this) {
- $this.addClass('collapsing-out');
- }
- function hiddenNavbarCollapse($this) {
- $this.removeClass('collapsing-out');
- }
- // Events
- if ($collapse.length) {
- $collapse.on({
- 'hide.bs.collapse': function() {
- hideNavbarCollapse($collapse);
- }
- })
- $collapse.on({
- 'hidden.bs.collapse': function() {
- hiddenNavbarCollapse($collapse);
- }
- })
- }
- var navbar_menu_visible = 0;
- $( ".sidenav-toggler" ).click(function() {
- if(navbar_menu_visible == 1){
- $('body').removeClass('nav-open');
- navbar_menu_visible = 0;
- $('.bodyClick').remove();
- } else {
- var div = '<div class="bodyClick"></div>';
- $(div).appendTo('body').click(function() {
- $('body').removeClass('nav-open');
- navbar_menu_visible = 0;
- $('.bodyClick').remove();
- });
- $('body').addClass('nav-open');
- navbar_menu_visible = 1;
- }
- });
- })();
- //
- // Popover
- //
- 'use strict';
- var Popover = (function() {
- // Variables
- var $popover = $('[data-toggle="popover"]'),
- $popoverClass = '';
- // Methods
- function init($this) {
- if ($this.data('color')) {
- $popoverClass = 'popover-' + $this.data('color');
- }
- var options = {
- trigger: 'focus',
- template: '<div class="popover ' + $popoverClass + '" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'
- };
- $this.popover(options);
- }
- // Events
- if ($popover.length) {
- $popover.each(function() {
- init($(this));
- });
- }
- })();
- //
- // Scroll to (anchor links)
- //
- 'use strict';
- var ScrollTo = (function() {
- //
- // Variables
- //
- var $scrollTo = $('.scroll-me, [data-scroll-to], .toc-entry a');
- //
- // Methods
- //
- function scrollTo($this) {
- var $el = $this.attr('href');
- var offset = $this.data('scroll-to-offset') ? $this.data('scroll-to-offset') : 0;
- var options = {
- scrollTop: $($el).offset().top - offset
- };
- // Animate scroll to the selected section
- $('html, body').stop(true, true).animate(options, 600);
- event.preventDefault();
- }
- //
- // Events
- //
- if ($scrollTo.length) {
- $scrollTo.on('click', function(event) {
- scrollTo($(this));
- });
- }
- })();
- //
- // Tooltip
- //
- 'use strict';
- var Tooltip = (function() {
- // Variables
- var $tooltip = $('[data-toggle="tooltip"]');
- // Methods
- function init() {
- $tooltip.tooltip();
- }
- // Events
- if ($tooltip.length) {
- init();
- }
- })();
- //
- // Form control
- //
- 'use strict';
- var FormControl = (function() {
- // Variables
- var $input = $('.form-control');
- // Methods
- function init($this) {
- $this.on('focus blur', function(e) {
- $(this).parents('.form-group').toggleClass('focused', (e.type === 'focus'));
- }).trigger('blur');
- }
- // Events
- if ($input.length) {
- init($input);
- }
- })();
- //
- // Bars chart
- //
- var BarsChart = (function() {
- //
- // Variables
- //
- var $chart = $('#chart-bars');
- //
- // Methods
- //
- // Init chart
- function initChart($chart) {
- // Create chart
- var ordersChart = new Chart($chart, {
- type: 'bar',
- data: {
- labels: ['Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- datasets: [{
- label: 'Sales',
- data: [25, 20, 30, 22, 17, 29]
- }]
- }
- });
- // Save to jQuery object
- $chart.data('chart', ordersChart);
- }
- // Init chart
- if ($chart.length) {
- initChart($chart);
- }
- })();
- 'use strict';
- //
- // Sales chart
- //
- var UsersChart = (function() {
- // Variables
- var $chart = $('#c1-dark');
- // Methods
- function init($chart) {
- var usersChart = new Chart($chart, {
- type: 'line',
- options: {
- scales: {
- yAxes: [{
- gridLines: {
- lineWidth: 1,
- color: Charts.colors.gray[900],
- zeroLineColor: Charts.colors.gray[900]
- },
- ticks: {
- callback: function(value) {
- if (!(value % 10)) {
- return value;
- }
- }
- }
- }]
- },
- tooltips: {
- callbacks: {
- label: function(item, data) {
- var label = data.datasets[item.datasetIndex].label || '';
- var yLabel = item.yLabel;
- var content = '';
- if (data.datasets.length > 1) {
- content += label;
- }
- content += yLabel + ' posts';
- return content;
- }
- }
- }
- },
- data: {
- labels: ['7', '6', '5', '4', '3', '2', '1'],
- datasets: [{
- label: '',
- data: $('.posts-this-week').data('update').data.datasets[0].data
- }]
- }
- });
- // Save to jQuery object
- $chart.data('chart', usersChart);
- };
- // Events
- if ($chart.length) {
- init($chart);
- }
- })();
- //
- // Bootstrap Datepicker
- //
- 'use strict';
- var Datepicker = (function() {
- // Variables
- var $datepicker = $('.datepicker');
- // Methods
- function init($this) {
- var options = {
- disableTouchKeyboard: true,
- autoclose: false
- };
- $this.datepicker(options);
- }
- // Events
- if ($datepicker.length) {
- $datepicker.each(function() {
- init($(this));
- });
- }
- })();
- //
- // Form control
- //
- 'use strict';
- var noUiSlider = (function() {
- // Variables
- // var $sliderContainer = $('.input-slider-container'),
- // $slider = $('.input-slider'),
- // $sliderId = $slider.attr('id'),
- // $sliderMinValue = $slider.data('range-value-min');
- // $sliderMaxValue = $slider.data('range-value-max');;
- // // Methods
- //
- // function init($this) {
- // $this.on('focus blur', function(e) {
- // $this.parents('.form-group').toggleClass('focused', (e.type === 'focus' || this.value.length > 0));
- // }).trigger('blur');
- // }
- //
- //
- // // Events
- //
- // if ($input.length) {
- // init($input);
- // }
- if ($(".input-slider-container")[0]) {
- $('.input-slider-container').each(function() {
- var slider = $(this).find('.input-slider');
- var sliderId = slider.attr('id');
- var minValue = slider.data('range-value-min');
- var maxValue = slider.data('range-value-max');
- var sliderValue = $(this).find('.range-slider-value');
- var sliderValueId = sliderValue.attr('id');
- var startValue = sliderValue.data('range-value-low');
- var c = document.getElementById(sliderId),
- d = document.getElementById(sliderValueId);
- noUiSlider.create(c, {
- start: [parseInt(startValue)],
- connect: [true, false],
- //step: 1000,
- range: {
- 'min': [parseInt(minValue)],
- 'max': [parseInt(maxValue)]
- }
- });
- c.noUiSlider.on('update', function(a, b) {
- d.textContent = a[b];
- });
- })
- }
- if ($("#input-slider-range")[0]) {
- var c = document.getElementById("input-slider-range"),
- d = document.getElementById("input-slider-range-value-low"),
- e = document.getElementById("input-slider-range-value-high"),
- f = [d, e];
- noUiSlider.create(c, {
- start: [parseInt(d.getAttribute('data-range-value-low')), parseInt(e.getAttribute('data-range-value-high'))],
- connect: !0,
- range: {
- min: parseInt(c.getAttribute('data-range-value-min')),
- max: parseInt(c.getAttribute('data-range-value-max'))
- }
- }), c.noUiSlider.on("update", function(a, b) {
- f[b].textContent = a[b]
- })
- }
- })();
- //
- // Scrollbar
- //
- 'use strict';
- var Scrollbar = (function() {
- // Variables
- var $scrollbar = $('.scrollbar-inner');
- // Methods
- function init() {
- $scrollbar.scrollbar().scrollLock()
- }
- // Events
- if ($scrollbar.length) {
- init();
- }
- })();
|