File: /home/armgroup/public_html/store/js/admin-custom.js
window.addEventListener('showIziToast', event => {
iziToast[event.detail.status]({
message: event.detail.message,
title: event.detail.title,
position: event.detail.position,
});
});
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
function setDefaultChartJsOptions(title = null, beginAtZero = false, displayLegend = true, numberFormat = false, stacked = true, fontFamily = 'Vazir') {
return {
title: {
display: title ? true : false,
text: title,
fontSize: 18,
fontFamily: fontFamily,
},
scales: {
yAxes: [{
stacked: stacked,
ticks: {
beginAtZero: beginAtZero,
fontFamily: fontFamily,
callback: function(value, index, values) {
return numberFormat ? value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : value;
}
}
}],
xAxes: [{
stacked: stacked,
ticks: {
fontFamily: fontFamily
}
}]
},
legend: {
display: displayLegend,
position: 'bottom',
labels: {
fontFamily: fontFamily
}
},
tooltips: {
titleFontFamily: fontFamily,
bodyFontFamily: fontFamily,
footerFontFamily: fontFamily,
callbacks: {
label: function(tooltipItem, data) {
var label = data.datasets[tooltipItem.datasetIndex].label || '';
if (label) {
label += ': ';
}
if(numberFormat)
label += (Math.round(tooltipItem.yLabel * 100) / 100).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
else
label += Math.round(tooltipItem.yLabel * 100) / 100;
return label;
}
}
},
}
}
$(document).on('click', '.toggle-password', function () {
$(this).toggleClass("fa-eye fa-eye-slash");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});