").on("hidden.bs.modal",function(e){$(this).remove()});myModal.appendTo("body");myModal.find(".modal-body").html(content);var modalFooter=myModal.find(".modal-footer");if(addButtons!=null&&typeof addButtons=="object"&&addButtons.length>0){$.each(addButtons,function(key,val){modalFooter.append(val)})}else if(addButtons!=null){modalFooter.append(addButtons)}myModal.modal("show");return myModal};$.fn.quickCKeditor=function(){$(this).each(function(){var $myTextArea=$(this);CKEDITOR.replace($myTextArea.attr("id"),{on:{instanceReady:function(evt){$($myTextArea.attr("data-loading")).remove()}},toolbar:[{name:"document",items:["Source"]},["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo","Underline","Strike"],{name:"basicstyles",items:["Bold","Italic"]},{name:"links",items:["Link"]}]})})};$.fn.checkEditorLoad=function(){if(typeof CKEDITOR!=="undefined"){$(this).find(".ckeditor").each(function(){var $myTextArea=$(this);if(CKEDITOR.instances[$myTextArea.attr("id")]){$($myTextArea.attr("data-loading")).remove();return}CKEDITOR.replace($myTextArea.attr("id"),{on:{instanceReady:function(evt){$($myTextArea.attr("data-loading")).remove()}}})});$(this).find(".ckeditor-quick").quickCKeditor()}else if($(this).find(".ckeditor,.ckeditor-quick").length>0){$(this).find(".ckeditor").each(function(){$(this).removeClass("ckeditor")});$(this).find(".ckeditor-quick").each(function(){$(this).removeClass("ckeditor-quick")});alert("common.js: Load the ckeditor.js file is required to use this form.")}return $(this)};$.loadInModal=function(url,addon_class,success_func){var myModal=$('
");window.location=result.url;return}if(typeof result.data!=="undefined"&&typeof result.data.success!=="undefined"){eval(result.data.success)}myModal.modal("hide")}else{toastr.error(result.error,translate("Error"))}},error:function(xhr,status,error){console.log(xhr.responseText);toastr.error(translate("Send form with ajax failed!"),translate("Error"))}})})}}else myModal.find(".modal-body").html('
"+xhr.responseText)}})};$.fn.ajaxRefreshActionButton=function(url,success){var the_element=$(this);$.ajax({url:url,dataType:"json",beforeSend:function(){the_element.addClass("disabled");the_element.find("i.fa-refresh").addClass("fa-pulse")},complete:function(){the_element.removeClass("disabled");the_element.find("i.fa-refresh").removeClass("fa-pulse")},success:function(result){if(result.status=="success"){success(result.data)}else{toastr.error(result.error,"Error")}},error:function(){toastr.error("Send form with ajax failed!","Error")}})};$.fn.ajaxAppendLastRow=function(url){var the_element=$(this);var $loading=$("
");$.ajax({url:url,dataType:"json",beforeSend:function(){the_element.append($loading)},complete:function(){the_element.find(".loading").remove()},success:function(result){if(result.status=="success"){the_element.append(result.data)}else{toastr.error(result.error,"Error")}},error:function(){toastr.error("Send form with ajax failed!","Error")}})};$.fn.insertHTMLAtTexteditor=function(areaId){var html_code=$(this).find("textarea").val();CKEDITOR.instances[areaId].insertHtml(html_code,"html")};$.fn.highlight_selected_menu=function(){var item=$(this);if(item.length==0)return;var myParent=item.parent("ul");if(myParent.hasClass("sub-menu")){item.addClass("active");if(item.find("sub-menu").length>0){$("#"+item.attr("id")+" > a:first-child .arrow").addClass("open")}myParent.parent("li").highlight_selected_menu()}else{item.addClass("active star open");if(item.find("sub-menu").length>0){}$("#"+item.attr("id")+" > a:first-child").append($('')).find(".arrow").addClass("open")}};var currencyFormatSettings={};$.setCurrencyFormatSettings=function(options){var default_settings={before_sign:"",after_sign:"",currency_code:"",number_format:"1,234.56"};currencyFormatSettings=$.extend(default_settings,options)};$.currencyFormat=function(value){var default_settings={before_sign:"",after_sign:"",currency_code:"",number_format:"1,234.56"};var settings=typeof currencyFormatSettings!="undefined"?$.extend(default_settings,currencyFormatSettings):default_settings;function formatMoney(n,c,d,t){var c=isNaN(c=Math.abs(c))?2:c,d=d==undefined?".":d,t=t==undefined?",":t,s=n<0?"-":"",i=String(parseInt(n=Math.abs(Number(n)||0).toFixed(c))),j=(j=i.length)>3?j%3:0;return settings.before_sign+s+(j?i.substr(0,j)+t:"")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):"")+settings.after_sign}if(settings.number_format="1.234,56"){return formatMoney(value,2,".",",")}else if(settings.number_format="1,234.56"){return formatMoney(value,2,",",".")}else if(value="1.234"){return formatMoney(value,0,".","")}else if(value="1,234"){return formatMoney(value,0,",","")}else{alert("The format of currency is unknown.")}};$.fn.handleAutomatics=function(){var the_parent=$(this);the_parent.find(".input-select2").each(function(){$(this).select2({allowClear:true,width:null})});the_parent.find(".load-ajax-content").each(function(){$(this).loadIn($(this).data("load"))});the_parent.find('div[data-role="auto-load"]').each(function(){var e404=typeof $(this).data("empty")!="undefined"&&$(this).data("empty")==1;$(this).loadIn($(this).data("url"),e404)});the_parent.find(".load-ajax-content-btn").click(function(){$($(this).data("target")).html('
'+' Loading...'+"
");$($(this).data("target")).loadIn($(this).data("load"))});the_parent.find('a[data-role="auto-load-tab"]').click(function(){var $tab_button=$(this),$tab_box=$($tab_button.attr("href"));$tab_box.html(' '+translate("Loading")+"");$tab_box.loadIn($tab_button.data("url"))});the_parent.find('.active > a[data-role="auto-load-tab"]').each(function(){$(this).trigger("click")});the_parent.find('input[type="radio"][data-role="toggle-hidden"]').change(function(){$('input[type="radio"][data-role="toggle-hidden"][name="'+$(this).attr("name")+'"]').not(this).each(function(){$($(this).data("target")).addClass("hidden")});$($('input[type="radio"][data-role="toggle-hidden"][name="'+$(this).attr("name")+'"]:checked').data("target")).removeClass("hidden")});the_parent.find('input[type="radio"][data-role="toggle-disabled"]').change(function(){$('input[type="radio"][data-role="toggle-disabled"][name="'+$(this).attr("name")+'"]').not(this).each(function(){$($(this).data("target")).attr("disabled","disabled")});$($(this).data("target")).removeAttr("disabled")});the_parent.find("select").each(function(){if(typeof $(this).data("default")!="undefined"&&$(this).find('option[value="'+$(this).data("default")+'"]').length>0){$(this).val($(this).data("default"))}});the_parent.find('input[type="checkbox"][data-role="toggle-hidden"]').click(function(){if($(this).is(":checked"))$($(this).data("target")).removeClass("d-none");else $($(this).data("target")).addClass("d-none")})}})(jQuery);$(function(){$("body").checkEditorLoad().handleAutomatics();$("a.btn-spinner").makeSpinnerBtn();var handleGoTop=function(){var offset=300;var duration=500;if(navigator.userAgent.match(/iPhone|iPad|iPod/i)){$(window).bind("touchend touchcancel touchleave",function(e){if($(this).scrollTop()>offset){$(".scroll-to-top").fadeIn(duration)}else{$(".scroll-to-top").fadeOut(duration)}})}else{$(window).scroll(function(){if($(this).scrollTop()>offset){$(".scroll-to-top").fadeIn(duration)}else{$(".scroll-to-top").fadeOut(duration)}})}$(".scroll-to-top").click(function(e){e.preventDefault();$("html, body").animate({scrollTop:0},duration);return false})};handleGoTop()});
\ No newline at end of file
+window.CKEDITOR_BASEPATH=$("body").attr("data-base-url")+"assets/plugins/ckeditor/";function translate(value){if(typeof SITE_TRANSLATE!="undefined"&&typeof SITE_TRANSLATE[value]!="undefined")return SITE_TRANSLATE[value];return value}(function($){let $originAjax=$.ajax;$.ajax=function(url,options){if(typeof url==="object"){options=url;url=undefined}options=options||{};if(options.hasOwnProperty("method")&&options.method!==null&&options.method.toLowerCase()==="post"||options.hasOwnProperty("type")&&options.type!==null&&options.type.toLowerCase()==="post"){let m=document.getElementById("csrf_meta");if(m!==null){if(!options.hasOwnProperty("headers"))options["headers"]={};if(!options.headers.hasOwnProperty(m.getAttribute("name"))){options.headers[m.getAttribute("name")]=m.getAttribute("content")}}}return $originAjax(url,options)};$.dataListSearch=function(){var query_string="?";$(".data-list-search-input").each(function(){if($("#language_select").val()!=0&&$("#language_select").val()!=null){query_string+="language="+$("#language_select").val()+"&"}if($("#filters").val()!=0&&$("#filters").val()!=null){query_string+="filters="+$("#filters").val()+"&"}});return query_string};$.showInModal=function(title,content,addButtons,modal_class){var myModal=$('
'+'
'+'
'+'
'+'
'+title+"
"+''+"
"+'
'+"
"+'"+"
"+"
"+"
").on("hidden.bs.modal",function(e){$(this).remove()});myModal.appendTo("body");myModal.find(".modal-body").html(content);var modalFooter=myModal.find(".modal-footer");if(addButtons!=null&&typeof addButtons=="object"&&addButtons.length>0){$.each(addButtons,function(key,val){modalFooter.append(val)})}else if(addButtons!=null){modalFooter.append(addButtons)}myModal.modal("show");return myModal};$.fn.quickCKeditor=function(){$(this).each(function(){var $myTextArea=$(this);CKEDITOR.replace($myTextArea.attr("id"),{on:{instanceReady:function(evt){$($myTextArea.attr("data-loading")).remove()}},toolbar:[{name:"document",items:["Source"]},["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo","Underline","Strike"],{name:"basicstyles",items:["Bold","Italic"]},{name:"links",items:["Link"]}]})})};$.fn.checkEditorLoad=function(){if(typeof CKEDITOR!=="undefined"){$(this).find(".ckeditor").each(function(){var $myTextArea=$(this);if(CKEDITOR.instances[$myTextArea.attr("id")]){$($myTextArea.attr("data-loading")).remove();return}CKEDITOR.replace($myTextArea.attr("id"),{on:{instanceReady:function(evt){$($myTextArea.attr("data-loading")).remove()}}})});$(this).find(".ckeditor-quick").quickCKeditor()}else if($(this).find(".ckeditor,.ckeditor-quick").length>0){$(this).find(".ckeditor").each(function(){$(this).removeClass("ckeditor")});$(this).find(".ckeditor-quick").each(function(){$(this).removeClass("ckeditor-quick")});alert("common.js: Load the ckeditor.js file is required to use this form.")}return $(this)};$.loadInModal=function(url,addon_class,success_func){var myModal=$('
");window.location=result.url;return}if(typeof result.data!=="undefined"&&typeof result.data.success!=="undefined"){eval(result.data.success)}myModal.modal("hide")}else{toastr.error(result.error,translate("Error"))}},error:function(xhr,status,error){console.log(xhr.responseText);toastr.error(translate("Send form with ajax failed!"),translate("Error"))}})})}}else myModal.find(".modal-body").html('
"+xhr.responseText)}})};$.fn.ajaxRefreshActionButton=function(url,success){var the_element=$(this);$.ajax({url:url,dataType:"json",beforeSend:function(){the_element.addClass("disabled");the_element.find("i.fa-refresh").addClass("fa-pulse")},complete:function(){the_element.removeClass("disabled");the_element.find("i.fa-refresh").removeClass("fa-pulse")},success:function(result){if(result.status=="success"){success(result.data)}else{toastr.error(result.error,"Error")}},error:function(){toastr.error("Send form with ajax failed!","Error")}})};$.fn.ajaxAppendLastRow=function(url){var the_element=$(this);var $loading=$("
");$.ajax({url:url,dataType:"json",beforeSend:function(){the_element.append($loading)},complete:function(){the_element.find(".loading").remove()},success:function(result){if(result.status=="success"){the_element.append(result.data)}else{toastr.error(result.error,"Error")}},error:function(){toastr.error("Send form with ajax failed!","Error")}})};$.fn.insertHTMLAtTexteditor=function(areaId){var html_code=$(this).find("textarea").val();CKEDITOR.instances[areaId].insertHtml(html_code,"html")};$.fn.highlight_selected_menu=function(){var item=$(this);if(item.length==0)return;var myParent=item.parent("ul");if(myParent.hasClass("sub-menu")){item.addClass("active");if(item.find("sub-menu").length>0){$("#"+item.attr("id")+" > a:first-child .arrow").addClass("open")}myParent.parent("li").highlight_selected_menu()}else{item.addClass("active star open");if(item.find("sub-menu").length>0){}$("#"+item.attr("id")+" > a:first-child").append($('')).find(".arrow").addClass("open")}};var currencyFormatSettings={};$.setCurrencyFormatSettings=function(options){var default_settings={before_sign:"",after_sign:"",currency_code:"",number_format:"1,234.56"};currencyFormatSettings=$.extend(default_settings,options)};$.currencyFormat=function(value){var default_settings={before_sign:"",after_sign:"",currency_code:"",number_format:"1,234.56"};var settings=typeof currencyFormatSettings!="undefined"?$.extend(default_settings,currencyFormatSettings):default_settings;function formatMoney(n,c,d,t){var c=isNaN(c=Math.abs(c))?2:c,d=d==undefined?".":d,t=t==undefined?",":t,s=n<0?"-":"",i=String(parseInt(n=Math.abs(Number(n)||0).toFixed(c))),j=(j=i.length)>3?j%3:0;return settings.before_sign+s+(j?i.substr(0,j)+t:"")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):"")+settings.after_sign}if(settings.number_format="1.234,56"){return formatMoney(value,2,".",",")}else if(settings.number_format="1,234.56"){return formatMoney(value,2,",",".")}else if(value="1.234"){return formatMoney(value,0,".","")}else if(value="1,234"){return formatMoney(value,0,",","")}else{alert("The format of currency is unknown.")}};$.fn.handleAutomatics=function(){var the_parent=$(this);the_parent.find(".input-select2").each(function(){$(this).select2({allowClear:true,width:null})});the_parent.find(".load-ajax-content").each(function(){$(this).loadIn($(this).data("load"))});the_parent.find('div[data-role="auto-load"]').each(function(){var e404=typeof $(this).data("empty")!="undefined"&&$(this).data("empty")==1;$(this).loadIn($(this).data("url"),e404)});the_parent.find(".load-ajax-content-btn").click(function(){$($(this).data("target")).html('
'+' Loading...'+"
");$($(this).data("target")).loadIn($(this).data("load"))});the_parent.find('a[data-role="auto-load-tab"]').click(function(){var $tab_button=$(this),$tab_box=$($tab_button.attr("href"));$tab_box.html(' '+translate("Loading")+"");$tab_box.loadIn($tab_button.data("url"))});the_parent.find('.active > a[data-role="auto-load-tab"]').each(function(){$(this).trigger("click")});the_parent.find('input[type="radio"][data-role="toggle-hidden"]').change(function(){$('input[type="radio"][data-role="toggle-hidden"][name="'+$(this).attr("name")+'"]').not(this).each(function(){$($(this).data("target")).addClass("hidden")});$($('input[type="radio"][data-role="toggle-hidden"][name="'+$(this).attr("name")+'"]:checked').data("target")).removeClass("hidden")});the_parent.find('input[type="radio"][data-role="toggle-disabled"]').change(function(){$('input[type="radio"][data-role="toggle-disabled"][name="'+$(this).attr("name")+'"]').not(this).each(function(){$($(this).data("target")).attr("disabled","disabled")});$($(this).data("target")).removeAttr("disabled")});the_parent.find("select").each(function(){if(typeof $(this).data("default")!="undefined"&&$(this).find('option[value="'+$(this).data("default")+'"]').length>0){$(this).val($(this).data("default"))}});the_parent.find('input[type="checkbox"][data-role="toggle-hidden"]').click(function(){if($(this).is(":checked"))$($(this).data("target")).removeClass("d-none");else $($(this).data("target")).addClass("d-none")})}})(jQuery);$(function(){$("body").checkEditorLoad().handleAutomatics();$("a.btn-spinner").makeSpinnerBtn();var handleGoTop=function(){var offset=300;var duration=500;if(navigator.userAgent.match(/iPhone|iPad|iPod/i)){$(window).bind("touchend touchcancel touchleave",function(e){if($(this).scrollTop()>offset){$(".scroll-to-top").fadeIn(duration)}else{$(".scroll-to-top").fadeOut(duration)}})}else{$(window).scroll(function(){if($(this).scrollTop()>offset){$(".scroll-to-top").fadeIn(duration)}else{$(".scroll-to-top").fadeOut(duration)}})}$(".scroll-to-top").click(function(e){e.preventDefault();$("html, body").animate({scrollTop:0},duration);return false})};handleGoTop()});
\ No newline at end of file