2016-04-08 12:39:32 +00:00
|
|
|
/**
|
2015-05-19 06:25:00 +00:00
|
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
|
|
* To change this template file, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
|
2018-02-13 09:22:21 +00:00
|
|
|
var CURRENT_URL = window.location.href,
|
2016-04-20 11:33:21 +00:00
|
|
|
$BODY = $('body'),
|
|
|
|
$MENU_TOGGLE = $('#menu_toggle'),
|
|
|
|
$SIDEBAR_MENU = $('#sidebar-menu'),
|
|
|
|
$SIDEBAR_FOOTER = $('.sidebar-footer'),
|
|
|
|
$LEFT_COL = $('.left_col'),
|
|
|
|
$RIGHT_COL = $('.right_col'),
|
|
|
|
$NAV_MENU = $('.nav_menu'),
|
|
|
|
$FOOTER = $('footer');
|
|
|
|
|
2016-04-08 12:39:32 +00:00
|
|
|
// Sidebar
|
2016-04-24 14:26:11 +00:00
|
|
|
$(document).ready(function() {
|
2016-04-22 17:23:40 +00:00
|
|
|
// TODO: This is some kind of easy fix, maybe we can improve this
|
|
|
|
var setContentHeight = function () {
|
|
|
|
// reset height
|
|
|
|
$RIGHT_COL.css('min-height', $(window).height());
|
|
|
|
|
2016-05-22 13:44:51 +00:00
|
|
|
var bodyHeight = $BODY.outerHeight(),
|
2016-07-10 15:13:28 +00:00
|
|
|
footerHeight = $BODY.hasClass('footer_fixed') ? -10 : $FOOTER.height(),
|
2016-04-22 17:23:40 +00:00
|
|
|
leftColHeight = $LEFT_COL.eq(1).height() + $SIDEBAR_FOOTER.height(),
|
|
|
|
contentHeight = bodyHeight < leftColHeight ? leftColHeight : bodyHeight;
|
|
|
|
|
|
|
|
// normalize content
|
2016-05-22 13:44:51 +00:00
|
|
|
contentHeight -= $NAV_MENU.height() + footerHeight;
|
2016-04-22 17:23:40 +00:00
|
|
|
|
|
|
|
$RIGHT_COL.css('min-height', contentHeight);
|
|
|
|
};
|
|
|
|
|
|
|
|
$SIDEBAR_MENU.find('a').on('click', function(ev) {
|
|
|
|
var $li = $(this).parent();
|
|
|
|
|
|
|
|
if ($li.is('.active')) {
|
2016-05-28 15:06:35 +00:00
|
|
|
$li.removeClass('active active-sm');
|
2016-04-22 17:23:40 +00:00
|
|
|
$('ul:first', $li).slideUp(function() {
|
|
|
|
setContentHeight();
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// prevent closing menu if we are on child menu
|
|
|
|
if (!$li.parent().is('.child_menu')) {
|
2016-05-28 15:06:35 +00:00
|
|
|
$SIDEBAR_MENU.find('li').removeClass('active active-sm');
|
2016-04-14 05:29:37 +00:00
|
|
|
$SIDEBAR_MENU.find('li ul').slideUp();
|
2015-11-18 09:26:41 +00:00
|
|
|
}
|
2018-02-13 09:22:21 +00:00
|
|
|
|
2016-04-22 17:23:40 +00:00
|
|
|
$li.addClass('active');
|
|
|
|
|
|
|
|
$('ul:first', $li).slideDown(function() {
|
|
|
|
setContentHeight();
|
|
|
|
});
|
2015-05-19 06:25:00 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-22 17:23:40 +00:00
|
|
|
// toggle small or large menu
|
2016-04-14 05:29:37 +00:00
|
|
|
$MENU_TOGGLE.on('click', function() {
|
|
|
|
if ($BODY.hasClass('nav-md')) {
|
2016-05-28 15:06:35 +00:00
|
|
|
$SIDEBAR_MENU.find('li.active ul').hide();
|
|
|
|
$SIDEBAR_MENU.find('li.active').addClass('active-sm').removeClass('active');
|
2015-05-19 06:25:00 +00:00
|
|
|
} else {
|
2016-05-28 15:06:35 +00:00
|
|
|
$SIDEBAR_MENU.find('li.active-sm ul').show();
|
|
|
|
$SIDEBAR_MENU.find('li.active-sm').addClass('active').removeClass('active-sm');
|
2015-05-19 06:25:00 +00:00
|
|
|
}
|
2016-04-22 17:23:40 +00:00
|
|
|
|
2016-05-28 15:06:35 +00:00
|
|
|
$BODY.toggleClass('nav-md nav-sm');
|
|
|
|
|
2016-04-22 17:23:40 +00:00
|
|
|
setContentHeight();
|
2017-03-30 13:58:45 +00:00
|
|
|
|
|
|
|
$('.dataTable').each ( function () { $(this).dataTable().fnDraw(); });
|
2015-05-19 06:25:00 +00:00
|
|
|
});
|
|
|
|
|
2016-04-14 05:29:37 +00:00
|
|
|
// check active menu
|
2016-05-11 16:10:31 +00:00
|
|
|
$SIDEBAR_MENU.find('a[href="' + CURRENT_URL + '"]').parent('li').addClass('current-page');
|
2016-04-14 05:29:37 +00:00
|
|
|
|
|
|
|
$SIDEBAR_MENU.find('a').filter(function () {
|
2016-05-11 16:10:31 +00:00
|
|
|
return this.href == CURRENT_URL;
|
2016-04-22 17:23:40 +00:00
|
|
|
}).parent('li').addClass('current-page').parents('ul').slideDown(function() {
|
2016-04-20 12:20:50 +00:00
|
|
|
setContentHeight();
|
|
|
|
}).parent().addClass('active');
|
|
|
|
|
|
|
|
// recompute content when resizing
|
2018-02-13 09:22:21 +00:00
|
|
|
$(window).smartresize(function(){
|
2016-04-20 12:20:50 +00:00
|
|
|
setContentHeight();
|
|
|
|
});
|
2016-05-10 16:24:48 +00:00
|
|
|
|
2016-05-28 15:14:45 +00:00
|
|
|
setContentHeight();
|
|
|
|
|
2016-05-10 16:24:48 +00:00
|
|
|
// fixed sidebar
|
|
|
|
if ($.fn.mCustomScrollbar) {
|
|
|
|
$('.menu_fixed').mCustomScrollbar({
|
|
|
|
autoHideScrollbar: true,
|
|
|
|
theme: 'minimal',
|
|
|
|
mouseWheel:{ preventDefault: true }
|
|
|
|
});
|
|
|
|
}
|
2015-05-19 06:25:00 +00:00
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
// /Sidebar
|
2015-05-19 06:25:00 +00:00
|
|
|
|
2016-04-15 12:44:39 +00:00
|
|
|
// Panel toolbox
|
2016-04-24 14:26:11 +00:00
|
|
|
$(document).ready(function() {
|
2016-04-15 12:44:39 +00:00
|
|
|
$('.collapse-link').on('click', function() {
|
|
|
|
var $BOX_PANEL = $(this).closest('.x_panel'),
|
|
|
|
$ICON = $(this).find('i'),
|
|
|
|
$BOX_CONTENT = $BOX_PANEL.find('.x_content');
|
2018-02-13 09:22:21 +00:00
|
|
|
|
2016-04-15 12:44:39 +00:00
|
|
|
// fix for some div with hardcoded fix class
|
|
|
|
if ($BOX_PANEL.attr('style')) {
|
|
|
|
$BOX_CONTENT.slideToggle(200, function(){
|
|
|
|
$BOX_PANEL.removeAttr('style');
|
|
|
|
});
|
|
|
|
} else {
|
2018-02-13 09:22:21 +00:00
|
|
|
$BOX_CONTENT.slideToggle(200);
|
|
|
|
$BOX_PANEL.css('height', 'auto');
|
2016-04-15 12:44:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$ICON.toggleClass('fa-chevron-up fa-chevron-down');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.close-link').click(function () {
|
|
|
|
var $BOX_PANEL = $(this).closest('.x_panel');
|
|
|
|
|
|
|
|
$BOX_PANEL.remove();
|
|
|
|
});
|
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
// /Panel toolbox
|
2016-04-15 12:44:39 +00:00
|
|
|
|
2016-04-08 12:39:32 +00:00
|
|
|
// Tooltip
|
2016-04-24 14:26:11 +00:00
|
|
|
$(document).ready(function() {
|
2016-05-07 13:07:36 +00:00
|
|
|
$('[data-toggle="tooltip"]').tooltip({
|
|
|
|
container: 'body'
|
|
|
|
});
|
2016-04-08 12:39:32 +00:00
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
// /Tooltip
|
2016-04-08 12:39:32 +00:00
|
|
|
|
|
|
|
// Progressbar
|
2017-06-19 18:08:53 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
if ($(".progress .progress-bar")[0]) {
|
|
|
|
$('.progress .progress-bar').progressbar();
|
|
|
|
}
|
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
// /Progressbar
|
2016-04-08 12:39:32 +00:00
|
|
|
|
|
|
|
// Switchery
|
2016-04-24 14:26:11 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
if ($(".js-switch")[0]) {
|
|
|
|
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
|
|
|
|
elems.forEach(function (html) {
|
|
|
|
var switchery = new Switchery(html, {
|
|
|
|
color: '#26B99A'
|
|
|
|
});
|
2015-05-19 06:25:00 +00:00
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
// /Switchery
|
2016-04-08 12:39:32 +00:00
|
|
|
|
|
|
|
// iCheck
|
2016-04-24 14:26:11 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
if ($("input.flat")[0]) {
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('input.flat').iCheck({
|
|
|
|
checkboxClass: 'icheckbox_flat-green',
|
|
|
|
radioClass: 'iradio_flat-green'
|
2015-05-19 06:25:00 +00:00
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
});
|
|
|
|
}
|
2015-05-19 06:25:00 +00:00
|
|
|
});
|
2016-04-24 14:26:11 +00:00
|
|
|
// /iCheck
|
2016-04-08 12:39:32 +00:00
|
|
|
|
|
|
|
// Table
|
2015-05-19 06:25:00 +00:00
|
|
|
$('table input').on('ifChecked', function () {
|
2016-04-24 14:26:11 +00:00
|
|
|
checkState = '';
|
2015-05-19 06:25:00 +00:00
|
|
|
$(this).parent().parent().parent().addClass('selected');
|
|
|
|
countChecked();
|
|
|
|
});
|
|
|
|
$('table input').on('ifUnchecked', function () {
|
2016-04-24 14:26:11 +00:00
|
|
|
checkState = '';
|
2015-05-19 06:25:00 +00:00
|
|
|
$(this).parent().parent().parent().removeClass('selected');
|
|
|
|
countChecked();
|
|
|
|
});
|
|
|
|
|
2016-04-24 14:26:11 +00:00
|
|
|
var checkState = '';
|
|
|
|
|
2015-05-19 06:25:00 +00:00
|
|
|
$('.bulk_action input').on('ifChecked', function () {
|
2016-04-24 14:26:11 +00:00
|
|
|
checkState = '';
|
2015-05-19 06:25:00 +00:00
|
|
|
$(this).parent().parent().parent().addClass('selected');
|
|
|
|
countChecked();
|
|
|
|
});
|
|
|
|
$('.bulk_action input').on('ifUnchecked', function () {
|
2016-04-24 14:26:11 +00:00
|
|
|
checkState = '';
|
2015-05-19 06:25:00 +00:00
|
|
|
$(this).parent().parent().parent().removeClass('selected');
|
|
|
|
countChecked();
|
|
|
|
});
|
|
|
|
$('.bulk_action input#check-all').on('ifChecked', function () {
|
2016-04-24 14:26:11 +00:00
|
|
|
checkState = 'all';
|
2015-05-19 06:25:00 +00:00
|
|
|
countChecked();
|
|
|
|
});
|
|
|
|
$('.bulk_action input#check-all').on('ifUnchecked', function () {
|
2016-04-24 14:26:11 +00:00
|
|
|
checkState = 'none';
|
2015-05-19 06:25:00 +00:00
|
|
|
countChecked();
|
|
|
|
});
|
|
|
|
|
|
|
|
function countChecked() {
|
2016-04-24 14:26:11 +00:00
|
|
|
if (checkState === 'all') {
|
2015-10-19 06:09:21 +00:00
|
|
|
$(".bulk_action input[name='table_records']").iCheck('check');
|
|
|
|
}
|
2016-04-24 14:26:11 +00:00
|
|
|
if (checkState === 'none') {
|
2015-10-19 06:09:21 +00:00
|
|
|
$(".bulk_action input[name='table_records']").iCheck('uncheck');
|
2015-05-19 06:25:00 +00:00
|
|
|
}
|
2016-04-24 14:26:11 +00:00
|
|
|
|
|
|
|
var checkCount = $(".bulk_action input[name='table_records']:checked").length;
|
|
|
|
|
|
|
|
if (checkCount) {
|
2015-10-19 06:09:21 +00:00
|
|
|
$('.column-title').hide();
|
|
|
|
$('.bulk-actions').show();
|
2016-04-24 14:26:11 +00:00
|
|
|
$('.action-cnt').html(checkCount + ' Records Selected');
|
2015-10-19 06:09:21 +00:00
|
|
|
} else {
|
|
|
|
$('.column-title').show();
|
|
|
|
$('.bulk-actions').hide();
|
|
|
|
}
|
|
|
|
}
|
2015-05-19 06:25:00 +00:00
|
|
|
|
2016-04-08 12:39:32 +00:00
|
|
|
// Accordion
|
2016-04-24 14:26:11 +00:00
|
|
|
$(document).ready(function() {
|
2015-05-19 06:25:00 +00:00
|
|
|
$(".expand").on("click", function () {
|
|
|
|
$(this).next().slideToggle(200);
|
|
|
|
$expand = $(this).find(">:first-child");
|
|
|
|
|
|
|
|
if ($expand.text() == "+") {
|
|
|
|
$expand.text("-");
|
|
|
|
} else {
|
|
|
|
$expand.text("+");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-04-08 12:39:32 +00:00
|
|
|
// NProgress
|
2015-11-18 10:14:11 +00:00
|
|
|
if (typeof NProgress != 'undefined') {
|
|
|
|
$(document).ready(function () {
|
|
|
|
NProgress.start();
|
|
|
|
});
|
|
|
|
|
2017-06-19 18:25:31 +00:00
|
|
|
$(window).on('load', function() {
|
2015-11-18 10:14:11 +00:00
|
|
|
NProgress.done();
|
|
|
|
});
|
2016-08-10 19:59:25 +00:00
|
|
|
}
|