!function(t,e,i){"use strict";i.extend(t.site,{init:function(){void 0!==site.menubar&&void 0!==site.navbar&&(site.navbar.init(),site.menubar.init(),i(e).on("click",".hamburger",function(t){i(this).toggleClass("is-active")}),i(e).on("click",'[data-toggle="menubar"]',function(t){site.menubar.toggle()}),i(e).on("click",".submenu-toggle",function(t){site.menubar.menu.toggleOnClick(i(this)),t.preventDefault()}),i(e).on("click",'[data-toggle="collapse"]',function(t){var e=i(t.target);e.is('[data-toggle="collapse"]')||(e=e.parents('[data-toggle="collapse"]')),"site-navbar-collapse"===i(e.attr("data-target")).attr("id")&&i("body").toggleClass("navbar-collapse-in"),t.preventDefault()}),i(e).on("click",'[data-toggle="navbar-search"]',function(t){i(".navbar-search").toggleClass("show"),t.preventDefault()}),Breakpoints.on("change",function(){site.navbar.change(),site.menubar.change(),i('[data-toggle="menubar"]').toggleClass("is-active",site.menubar.opened)})),void 0!==i.settings&&void 0!==i.customizer&&(i.settings.extend({navbar:{type:"light",skin:"bg-white"},menubar:{top:!0,type:"light",skin:"bg-white"}}),i.settings.init(),i.customizer.init(),i(e).on("change, click",'[data-toggle="theme"]',function(t){i.customizer.setTheme(this)}),i(e).on("click","#customizerSaveButton",function(){var t=i(this);i.customizer.save(),t.closest("section").append('
Your Settings Saved!
'),setTimeout(function(){t.closest("section").find("div.flash-msg").fadeOut()},2e3)}),i(e).on("click","#customizerResetButton",function(){i.customizer.reset()})),!/xs|sm/.test(Breakpoints.current().name)&&i(".scroll-container").perfectScrollbar(),this.initHeaderCharts(),this.initPlugins()}})}(window,document,jQuery),$(function(){site.init()}); function ajaxRequest(url, method, type, data, callback) { jQuery.ajax({ url: baseURL + url, type: method, dataType: type, data: data, }).done(function (html) { callback(html); }) .fail(function(response){ var response = JSON.parse(response.responseText); var errorString = ''; //console.log(errorString); showMsg("error", errorString); }) .always(function () { }); } function showMsg(type, msg) { if (type == "add") { swal("Added!", msg, "success"); } else if (type == "update") { swal("Updated!", msg, "success"); } else if (type == "deleted") { swal("Deleted!", msg, "success"); }else if(type == "success"){ swal({ title:"Success!", text: msg, html: true, type: "success" }); }else{ swal({ title:"Error!", text: msg, html: true, type: "error" }); } } function getDetailsByAttr(obj, key, val) { var objects = []; for (var i in obj) { if (!obj.hasOwnProperty(i)) continue; if (typeof obj[i] == 'object') { objects = objects.concat(getDetailsByAttr(obj[i], key, val)); } else if (i == key && obj[key] == val) { objects.push(obj); } } return objects; } function make_editable_by_type(element, input_type){ if(element.tagName == "input"){ $("." + input_type).editable({ type: 'text', success: function(response, newValue) { if (response) { showMsg("success", "Form Data saved successfully!"); } }, error: function(response, newValue) { if (!response){ showMsg("error" , "Error in saving Form Data"); } } }); } else if(element.tagName == "select"){ var i; arrayObj = element.options; for(i = 0; i < arrayObj.length; i++){ arrayObj[i].text = arrayObj[i]['label']; delete arrayObj[i].label; } $("." + input_type).editable({ source: arrayObj, type: 'select', success: function(response, newValue) { if (response) { showMsg("success", "Form Data saved successfully!"); } }, error: function(response, newValue) { if (!response){ showMsg("error" , "Error in saving Form Data"); } } }); } }