(function(){function a(n,a,i,e){var o=n.find(".modal-body .nav-tabs>li");n.find(".modal-footer").removeClass("hidden");if(e==null)e=[0];o.on("click",function(){var a=o.index(this),i=false;for(var t=0;t<e.length;t++){if(a==e[t]){i=true;break}}if(i){n.find(".modal-footer").removeClass("hidden")}else{n.find(".modal-footer:not(.hidden)").addClass("hidden")}});n.find("table[data-page-size]").each(function(){f($(this),a,i)})}function f(n,e,o){if(!n||n.length<1)return;var d=n.data(),i=null;if(o){if(d.ajaxList&&d.ajaxList in o)o[d.ajaxList](n);if("switchPage"in o)i=o["switchPage"];if("pageData"in o)d=typeof o["pageData"]=="function"?o["pageData"](n):o["pageData"]}App.withPagination(d,null);n.after(d.pagination);if(!i){i=function(a){var i={ajaxList:d.ajaxList,page:a};i=$.extend(i,e||{});var t=typeof d["pageUrl"]!="undefined"?d["pageUrl"]:window.location.href;$.get(t,i,function(a){var i=n.parent();i.html(a);f(i.children("table[data-page-size]"),e,o)},"html")}}var a=n.next("ul.pagination");a.find("li > a[page]").on("click",function(){if($(this).closest("li.disabled").length>0)return;i($(this).attr("page"))});a.on("refresh",function(){var a=1;if($(this).data("page")){a=$(this).data("page");$(this).data("page",false)}else{a=$(this).find("li.active > a[page]").data("page")||1}i(a)})}App.initModalBody=a;App.initModalBodyPagination=f})();