Files
getgreen-backend/public/vendor/pay-uz/js/sb-admin.js

262 lines
6.3 KiB
JavaScript
Executable File

(function($) {
"use strict"; // Start of use strict
// Configure tooltips for collapsed side navigation
$('.navbar-sidenav [data-toggle="tooltip"]').tooltip({
template: '<div class="tooltip navbar-sidenav-tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
})
// Toggle the side navigation
$("#sidenavToggler").click(function(e) {
e.preventDefault();
$("body").toggleClass("sidenav-toggled");
$(".navbar-sidenav .nav-link-collapse").addClass("collapsed");
$(".navbar-sidenav .sidenav-second-level, .navbar-sidenav .sidenav-third-level").removeClass("show");
});
// Force the toggled class to be removed when a collapsible nav link is clicked
$(".navbar-sidenav .nav-link-collapse").click(function(e) {
e.preventDefault();
$("body").removeClass("sidenav-toggled");
});
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
$('body.fixed-nav .navbar-sidenav, body.fixed-nav .sidenav-toggler, body.fixed-nav .navbar-collapse').on('mousewheel DOMMouseScroll', function(e) {
var e0 = e.originalEvent,
delta = e0.wheelDelta || -e0.detail;
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
e.preventDefault();
});
// Scroll to top button appear
$(document).scroll(function() {
var scrollDistance = $(this).scrollTop();
if (scrollDistance > 100) {
$('.scroll-to-top').fadeIn();
} else {
$('.scroll-to-top').fadeOut();
}
});
// Configure tooltips globally
$('[data-toggle="tooltip"]').tooltip()
// Smooth scrolling using jQuery easing
$(document).on('click', 'a.scroll-to-top', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: ($($anchor.attr('href')).offset().top)
}, 1000, 'easeInOutExpo');
event.preventDefault();
});
// Call the dataTables jQuery plugin
$(document).ready(function() {
$('#dataTable').DataTable();
});
})(jQuery); // End of use strict
// Chart.js scripts
// -- Set new default font family and font color to mimic Bootstrap's default styling
Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#292b2c';
var sana = [];
for (i = 0; i < 7; i++) {
var d=new Date();
d.setDate(d.getDate() - i);
var day=d.getDate();
var month=d.getMonth() + 1;
var year=d.getFullYear();
sana[i] = year + "/" + month + "/" + day;
}
// -- Area Chart Example
var ctx = document.getElementById("hisob");
var myLineChart1 = new Chart(ctx, {
type: 'line',
data: {
labels: [
sana[6],
sana[5],
sana[4],
sana[3],
sana[2],
sana[1],
sana[0]],
datasets: [{
label: "Hisob",
lineTension: 0.5,
backgroundColor: "rgba(2,117,216,0.2)",
borderColor: "rgba(2,117,216,1)",
pointRadius: 5,
pointBackgroundColor: "rgba(2,117,216,1)",
pointBorderColor: "rgba(255,255,255,0.8)",
pointHoverRadius: 7,
pointHoverBackgroundColor: "rgba(2,117,216,1)",
pointHitRadius: 20,
pointBorderWidth: 1,
data: [1500, 1693, 1523, 1782, 1900, 1364, 1874],
}],
},
options: {
scales: {
xAxes: [{
time: {
unit: 'date'
},
gridLines: {
display: true
},
ticks: {
maxTicksLimit: 7
}
}],
yAxes: [{
ticks: {
min: 0,
max: 3000,
maxTicksLimit: 10
},
gridLines: {
color: "rgba(0, 0, 0, .125)",
}
}],
},
legend: {
display: false
}
}
});
// Weekly users
var ctx = document.getElementById("users");
var myLineChart2 = new Chart(ctx, {
type: 'line',
data: {
labels: [
sana[6],
sana[5],
sana[4],
sana[3],
sana[2],
sana[1],
sana[0]],
datasets: [{
label: "Userlar",
lineTension: 0.5,
backgroundColor: "rgba(2,117,216,0.2)",
borderColor: "rgba(2,117,216,1)",
pointRadius: 5,
pointBackgroundColor: "rgba(2,117,216,1)",
pointBorderColor: "rgba(255,255,255,0.8)",
pointHoverRadius: 7,
pointHoverBackgroundColor: "rgba(2,117,216,1)",
pointHitRadius: 20,
pointBorderWidth: 1,
data: [1500, 1693, 1523, 1782, 1900, 1364, 1874],
},
{
label: "Mehmonlar",
lineTension: 0.5,
backgroundColor: "rgba(255,30,5,0.2)",
borderColor: "rgba(255,30,5,1)",
pointRadius: 5,
pointBackgroundColor: "rgba(255,30,5,1)",
pointBorderColor: "rgba(255,255,255,0.8)",
pointHoverRadius: 7,
pointHoverBackgroundColor: "rgba(255,30,5,1)",
pointHitRadius: 20,
pointBorderWidth: 1,
data: [1400, 1893, 1623, 2082, 1500, 1764, 1374],
}],
},
options: {
scales: {
xAxes: [{
time: {
unit: 'date'
},
gridLines: {
display: true
},
ticks: {
maxTicksLimit: 7
}
}],
yAxes: [{
ticks: {
min: 0,
max: 3000,
maxTicksLimit: 10
},
gridLines: {
color: "rgba(0, 0, 0, .125)",
}
}],
},
legend: {
display: true
}
}
});
// -- Bar Chart Example
var ctx = document.getElementById("myBarChart");
var myLineChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["January", "February", "March", "April", "May", "June"],
datasets: [{
label: "Revenue",
backgroundColor: "rgba(2,117,216,1)",
borderColor: "rgba(2,117,216,1)",
data: [4215, 5312, 6251, 7841, 9821, 14984],
}],
},
options: {
scales: {
xAxes: [{
time: {
unit: 'month'
},
gridLines: {
display: false
},
ticks: {
maxTicksLimit: 6
}
}],
yAxes: [{
ticks: {
min: 0,
max: 15000,
maxTicksLimit: 5
},
gridLines: {
display: true
}
}],
},
legend: {
display: false
}
}
});
// -- Pie Chart Example
var ctx = document.getElementById("myPieChart");
var myPieChart = new Chart(ctx, {
type: 'pie',
data: {
labels: ["Blue", "Red", "Yellow", "Green"],
datasets: [{
data: [12.21, 15.58, 11.25, 8.32],
backgroundColor: ['#007bff', '#dc3545', '#ffc107', '#28a745'],
}],
},
});