"use strict";var NetCms=NetCms||{};NetCms.MvcPagers=[];NetCms.MvcPagers.getById=function(n){for(var t=0;t<=this.length;t++)if(typeof this[t]!="undefined"&&this[t].id===n)return this[t];return null};NetCms.__ajaxPages={};NetCms.MvcPager=function(n){this.wrapper=n};NetCms.MvcPager.prototype={wrapper:null,id:null,urlFormat:null,pageIndexName:null,updateTarget:null,onBegin:null,onComplete:null,onFailure:null,onSuccess:null,httpMethod:null,confirm:null,loadingElementId:null,loadingDuration:0,partialLoading:null,currentPageIndex:null,dataFormId:null,allowCache:!0,enableHistorySupport:null,searchCriteria:null,pageCount:null,invalidPageErrMsg:null,outOfRangeErrMsg:null,firstPageUrl:null,pageIndexBox:null,goToButton:null,maxPageIndexItems:20,isAjaxPager:null,onError:null,isFirstLoading:!0,allowReload:!1,init:function(){var t=$(this.wrapper),r=1,f,n,u,e,i,o;if(this.id=t.attr("id"),this.isAjaxPager=t.data("ajax")||!1,this.pageCount=t.data("pagecount"),this.invalidPageErrMsg=t.data("invalidpageerrmsg"),this.outOfRangeErrMsg=t.data("outrangeerrmsg"),this.firstPageUrl=t.data("firstpage"),this.urlFormat=t.data("urlformat"),this.pageIndexName=t.data("pageparameter"),this.currentPageIndex=t.data("currentpage")||1,this.pageIndexBox=t.data("pageindexbox"),this.goToButton=t.data("gotobutton"),this.maxPageIndexItems=t.data("maxitems")||20,this.onError=t.data("onerror")||"alert(errMsg)",n=this,this.isAjaxPager){this.updateTarget=t.data("ajax-update");this.onBegin=t.data("ajax-begin");this.onComplete=t.data("ajax-complete");this.onFailure=t.data("ajax-failure");this.onSuccess=t.data("ajax-success");this.confirm=t.data("ajax-confirm")||undefined;this.httpMethod=t.data("ajax-method")||"GET";this.loadingElementId=t.data("ajax-loading")||undefined;this.dataFormId=t.data("ajax-dataformid")||undefined;this.allowCache=t.data("ajax-allowcache")||!0;u=t.data("ajax-enablehistorysupport");this.enableHistorySupport=typeof u=="undefined"?!0:u;this.loadingDuration=t.data("ajax-loading-duration")||0;this.partialLoading=t.data("ajax-partialloading")||!1;f=this.currentPageIndex;e="[data-pagerid='NetCms.MvcPager']";i=this.__getPageIndex(this.pageIndexName);i!==this.currentPageIndex&&i>0&&this.__ajax(i,{type:this.httpMethod,data:[]});typeof this.dataFormId!="undefined"&&(o=$(n.dataFormId).data("ajax")||!1,$(n.dataFormId).submit(function(t){n.searchCriteria=$(n.dataFormId).serializeArray();o?n.currentPageIndex!==1?(n.currentPageIndex=1,n.enableHistorySupport?(n.__setPageIndex(n.pageIndexName,-1),n.allowReload=!0):n.__ajax(1,{type:n.httpMethod,data:[]})):typeof NetCms.__ajaxPages[n.pageIndexName]=="undefined"&&(n.allowReload=!0):(typeof NetCms.__ajaxPages[n.pageIndexName]=="undefined"&&(n.allowReload=!0),n.currentPageIndex===1?n.__ajax(1,{type:n.httpMethod,data:[]}):(n.enableHistorySupport?n.__setPageIndex(n.pageIndexName,1):n.__ajax(1,{type:n.httpMethod,data:[]}),n.currentPageIndex=1),n.allowReload=!0,t.preventDefault())}));this.enableHistorySupport&&this.__initHashChange(f);$(this.updateTarget).on("click",e+" a[data-pageindex]",function(t){r=$(this).data("pageindex");t.preventDefault();n.enableHistorySupport?n.__setPageIndex(n.pageIndexName,r):n.__ajax(r,{type:n.httpMethod,data:[]})})}return this.__bindPageIndexBox(),this},__bindPageIndexBox:function(){var n=this;if(n.isAjaxPager){if($.trim(n.pageIndexBox)!=="")if($(n.updateTarget).find(n.pageIndexBox).length>0){if(n.__fillPageIndexBox(),$(n.pageIndexBox).is("input:text")){$(n.pageIndexBox).val(n.currentPageIndex);$(n.updateTarget).on("keydown",n.pageIndexBox,function(){n.__validateInput(event)})}if($.trim(n.goToButton)!=="")$(n.updateTarget).on("click",n.goToButton,function(){var t=$(n.pageIndexBox).val();n.goToPage(t)});else $(n.updateTarget).on("change",n.pageIndexBox,function(){var t=$(n.pageIndexBox).val();n.goToPage(t)})}else n.__bindBoxEvents()}else $.trim(n.pageIndexBox)!==""&&n.__bindBoxEvents()},__bindBoxEvents:function(){var n=this;n.__fillPageIndexBox();$(n.pageIndexBox).is("input:text")&&($(n.pageIndexBox).val(n.currentPageIndex),$(n.pageIndexBox).keydown(function(){n.__validateInput(event)}));$.trim(n.goToButton)!==""?$(n.goToButton).click(function(){var t=$(n.pageIndexBox).val();n.goToPage(t)}):$(n.pageIndexBox).change(function(){var t=$(n.pageIndexBox).val();n.goToPage(t)})},__fillPageIndexBox:function(){var i=$(this.pageIndexBox),n,r,t;if(i.prop("type")==="select-one")for(i.empty(),n=this.currentPageIndex-this.maxPageIndexItems/2,n+this.maxPageIndexItems>this.pageCount&&(n=this.pageCount+1-this.maxPageIndexItems),n<1&&(n=1),r=n+this.maxPageIndexItems-1,r>this.pageCount&&(r=this.pageCount),t=n;t<=r;t++)i.append('