"undefined"==typeof gj&&(gj={}),gj.widget=function(){var e=this;e.xhr=null,e.generateGUID=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},e.mouseX=function(e){if(e){if(e.pageX)return e.pageX;if(e.clientX)return e.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);if(e.touches&&e.touches.length)return e.touches[0].pageX;if(e.changedTouches&&e.changedTouches.length)return e.changedTouches[0].pageX;if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length)return e.originalEvent.touches[0].pageX;if(e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches.length)return e.originalEvent.touches[0].pageX}return null},e.mouseY=function(e){if(e){if(e.pageY)return e.pageY;if(e.clientY)return e.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);if(e.touches&&e.touches.length)return e.touches[0].pageY;if(e.changedTouches&&e.changedTouches.length)return e.changedTouches[0].pageY;if(e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches.length)return e.originalEvent.touches[0].pageY;if(e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches.length)return e.originalEvent.touches[0].pageY}return null}},gj.widget.prototype.init=function(e,t){var a,i,r;this.attr("data-type",t),i=$.extend(!0,{},this.getHTMLConfig()||{}),$.extend(!0,i,e||{}),r=this.getConfig(i,t),this.attr("data-guid",r.guid),this.data(r);for(a in r)gj[t].events.hasOwnProperty(a)&&(this.on(a,r[a]),delete r[a]);for(plugin in gj[t].plugins)gj[t].plugins.hasOwnProperty(plugin)&&gj[t].plugins[plugin].configure(this,r,i);return this},gj.widget.prototype.getConfig=function(e,t){var a,i,r,n;a=$.extend(!0,{},gj[t].config.base),i=e.hasOwnProperty("uiLibrary")?e.uiLibrary:a.uiLibrary,gj[t].config[i]&&$.extend(!0,a,gj[t].config[i]),r=e.hasOwnProperty("iconsLibrary")?e.iconsLibrary:a.iconsLibrary,gj[t].config[r]&&$.extend(!0,a,gj[t].config[r]);for(n in gj[t].plugins)gj[t].plugins.hasOwnProperty(n)&&($.extend(!0,a,gj[t].plugins[n].config.base),gj[t].plugins[n].config[i]&&$.extend(!0,a,gj[t].plugins[n].config[i]),gj[t].plugins[n].config[r]&&$.extend(!0,a,gj[t].plugins[n].config[r]));return $.extend(!0,a,e),a.guid||(a.guid=this.generateGUID()),a},gj.widget.prototype.getHTMLConfig=function(){var e=this.data(),t=this[0].attributes;return t.width&&(e.width=t.width.value),t.height&&(e.height=t.height.value),t.value&&(e.value=t.value.value),t.align&&(e.align=t.align.value),e&&e.source&&(e.dataSource=e.source,delete e.source),e},gj.widget.prototype.createDoneHandler=function(){var e=this;return function(t){"string"==typeof t&&JSON&&(t=JSON.parse(t)),gj[e.data("type")].methods.render(e,t)}},gj.widget.prototype.createErrorHandler=function(){return function(e){e&&e.statusText&&"abort"!==e.statusText&&alert(e.statusText)}},gj.widget.prototype.reload=function(e){var t,a,i=this.data(),r=this.data("type");return void 0===i.dataSource&&gj[r].methods.useHtmlDataSource(this,i),$.extend(i.params,e),$.isArray(i.dataSource)?(a=gj[r].methods.filter(this),gj[r].methods.render(this,a)):"string"==typeof i.dataSource?(t={url:i.dataSource,data:i.params},this.xhr&&this.xhr.abort(),this.xhr=$.ajax(t).done(this.createDoneHandler()).fail(this.createErrorHandler())):"object"==typeof i.dataSource&&(i.dataSource.data||(i.dataSource.data={}),$.extend(i.dataSource.data,i.params),"json"===(t=$.extend(!0,{},i.dataSource)).dataType&&"object"==typeof t.data&&(t.data=JSON.stringify(t.data)),t.success||(t.success=this.createDoneHandler()),t.error||(t.error=this.createErrorHandler()),this.xhr&&this.xhr.abort(),this.xhr=$.ajax(t)),this},gj.documentManager={events:{},subscribeForEvent:function(e,t,a){if(gj.documentManager.events[e]&&0!==gj.documentManager.events[e].length){if(gj.documentManager.events[e][t])throw"Event "+e+' for widget with guid="'+t+'" is already attached.';gj.documentManager.events[e].push({widgetId:t,callback:a})}else gj.documentManager.events[e]=[{widgetId:t,callback:a}],$(document).on(e,gj.documentManager.executeCallbacks)},executeCallbacks:function(e){var t=gj.documentManager.events[e.type];if(t)for(var a=0;a<t.length;a++)t[a].callback(e)},unsubscribeForEvent:function(e,t){var a=!1,i=gj.documentManager.events[e];if(i)for(var r=0;r<i.length;r++)i[r].widgetId===t&&(i.splice(r,1),a=!0,0===i.length&&($(document).off(e),delete gj.documentManager.events[e]));if(!a)throw'The "'+e+'" for widget with guid="'+t+"\" can't be removed."}},gj.core={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShortNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],parseDate:function(e,t){var a,i,r,n,o,d,s;if(e&&"string"==typeof e){if(/^\d+$/.test(e))s=new Date(e);else if(e.indexOf("/Date(")>-1)s=new Date(parseInt(e.substr(6),10));else if(e){for(o=e.split(/[\s,-\.//\:]+/),d=t.split(/[\s,-\.//\:]+/),a=0;a<d.length;a++)["d","dd"].indexOf(d[a])>-1?i=parseInt(o[a],10):["m","mm"].indexOf(d[a])>-1?r=parseInt(o[a],10)-1:"mmm"===d[a]?r=gj.core.monthShortNames.indexOf(o[a]):"mmmm"===d[a]?r=gj.core.monthNames.indexOf(o[a]):["yy","yyyy"].indexOf(d[a])>-1&&(n=parseInt(o[a],10),"yy"===d[a]&&(n+=2e3));s=new Date(n,r,i)}}else"number"==typeof e?s=new Date(e):e instanceof Date&&(s=e);return s},formatDate:function(e,t){var a,r="",n=t.split(/[\s,-\.//\:]+/),o=t.replace(/[shtdmyHTDMY]/g,""),d=function(e,t){for(e=String(e),t=t||2;e.length<t;)e="0"+e;return e};for(i=0;i<n.length;i++)switch(a=o[i]||"",n[i]){case"s":r+=e.getSeconds()+a;break;case"ss":r+=d(e.getSeconds())+a;break;case"M":r+=e.getMinutes()+a;break;case"MM":r+=d(e.getMinutes())+a;break;case"H":r+=e.getHours()+a;break;case"HH":r+=d(e.getHours())+a;break;case"h":r+=(e.getHours()>12?e.getHours()%12:e.getHours())+a;break;case"hh":r+=d(e.getHours()>12?e.getHours()%12:e.getHours())+a;break;case"tt":r+=(e.getHours()>=12?"pm":"am")+a;break;case"TT":r+=(e.getHours()>=12?"PM":"AM")+a;break;case"d":r+=e.getDate()+a;break;case"dd":r+=d(e.getDate())+a;break;case"m":r+=e.getMonth()+1+a;break;case"mm":r+=d(e.getMonth()+1)+a;break;case"mmm":r+=gj.core.monthShortNames[e.getMonth()]+a;break;case"mmmm":r+=gj.core.monthNames[e.getMonth()]+a;break;case"yy":r+=e.getFullYear().toString().substr(2)+a;break;case"yyyy":r+=e.getFullYear()+a}return r},isIE:function(){return!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g)}},void 0===gj.checkbox&&(gj.checkbox={plugins:{}}),gj.checkbox.config={base:{uiLibrary:"materialdesign",iconsLibrary:"materialicons",style:{wrapperCssClass:"gj-checkbox-md",spanCssClass:void 0}},bootstrap:{style:{wrapperCssClass:"gj-checkbox-bootstrap"},iconsLibrary:"glyphicons"},bootstrap4:{style:{wrapperCssClass:"gj-checkbox-bootstrap"},iconsLibrary:"materialicons"},materialicons:{style:{iconsCssClass:"gj-checkbox-material-icons",spanCssClass:"material-icons"}},glyphicons:{style:{iconsCssClass:"gj-checkbox-glyphicons",spanCssClass:""}},fontawesome:{style:{iconsCssClass:"gj-checkbox-fontawesome",spanCssClass:"fa"}}},gj.checkbox.methods={init:function(e){var t=this;return gj.widget.prototype.init.call(this,e,"checkbox"),t.attr("data-checkbox","true"),gj.checkbox.methods.initialize(t),t},initialize:function(e){var t,a,i=e.data();i.style.wrapperCssClass&&(t=$('<label class="'+i.style.wrapperCssClass+" "+i.style.iconsCssClass+'"></label>'),e.attr("id")&&t.attr("for",e.attr("id")),e.wrap(t),a=$("<span />"),i.style.spanCssClass&&a.addClass(i.style.spanCssClass),e.parent().append(a))},state:function(e,t){return t?("checked"===t?(e.prop("indeterminate",!1),e.prop("checked",!0)):"unchecked"===t?(e.prop("indeterminate",!1),e.prop("checked",!1)):"indeterminate"===t&&(e.prop("checked",!0),e.prop("indeterminate",!0)),gj.checkbox.events.change(e,t),e):t=e.prop("indeterminate")?"indeterminate":e.prop("checked")?"checked":"unchecked"},toggle:function(e){return"checked"==e.state()?e.state("unchecked"):e.state("checked"),e},destroy:function(e){return"true"===e.attr("data-checkbox")&&(e.removeData(),e.removeAttr("data-guid"),e.removeAttr("data-checkbox"),e.off(),e.next("span").remove(),e.unwrap()),e}},gj.checkbox.events={change:function(e,t){return e.triggerHandler("change",[t])}},gj.checkbox.widget=function(e,t){var a=this,i=gj.checkbox.methods;return a.toggle=function(){return i.toggle(this)},a.state=function(e){return i.state(this,e)},a.destroy=function(){return i.destroy(this)},$.extend(e,a),"true"!==e.attr("data-checkbox")&&i.init.call(e,t),e},gj.checkbox.widget.prototype=new gj.widget,gj.checkbox.widget.constructor=gj.checkbox.widget,jQuery.fn.checkbox=function(e){var t;if(this&&this.length){if("object"!=typeof e&&e){if((t=new gj.checkbox.widget(this,null))[e])return t[e].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+e+" does not exist."}return new gj.checkbox.widget(this,e)}},void 0===gj.datepicker&&(gj.datepicker={plugins:{}}),gj.datepicker.config={base:{weekDays:["S","M","T","W","T","F","S"],showOtherMonths:!1,selectOtherMonths:!0,width:void 0,minDate:void 0,maxDate:void 0,format:"mm/dd/yyyy",uiLibrary:"materialdesign",iconsLibrary:"materialicons",value:void 0,weekStartDay:0,disableDates:void 0,disableDaysOfWeek:void 0,calendarWeeks:!1,keyboardNavigation:!0,locale:"en-us",icons:{rightIcon:'<i class="material-icons">event</i>',previousMonth:'<i class="material-icons">keyboard_arrow_left</i>',nextMonth:'<i class="material-icons">keyboard_arrow_right</i>'},fontSize:void 0,style:{wrapper:"gj-datepicker gj-datepicker-md gj-unselectable",input:"gj-textbox-md",calendar:"gj-calendar gj-calendar-md"}},bootstrap:{style:{wrapper:"gj-datepicker gj-datepicker-bootstrap gj-unselectable input-group",input:"form-control",calendar:"gj-calendar gj-calendar-bootstrap"},iconsLibrary:"glyphicons",showOtherMonths:!0},bootstrap4:{style:{wrapper:"gj-datepicker gj-datepicker-bootstrap gj-unselectable input-group",input:"form-control",calendar:"gj-calendar gj-calendar-bootstrap"},showOtherMonths:!0},materialicons:{},fontawesome:{icons:{rightIcon:'<span class="input-group-addon"><i class="fa fa-calendar" aria-hidden="true"></i></span>',previousMonth:'<i class="fa fa-chevron-left" aria-hidden="true"></i>',nextMonth:'<i class="fa fa-chevron-right" aria-hidden="true"></i>'}},glyphicons:{icons:{rightIcon:'<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>',previousMonth:'<span class="glyphicon glyphicon-chevron-left"></span>',nextMonth:'<span class="glyphicon glyphicon-chevron-right"></span>'}}},gj.datepicker.methods={init:function(e){return gj.widget.prototype.init.call(this,e,"datepicker"),this.attr("data-datepicker","true"),gj.datepicker.methods.initialize(this),this},initialize:function(e){var t=e.data(),a=e.parent('div[role="wrapper"]'),i="materialdesign"!==t.uiLibrary&&"materialicons"===t.iconsLibrary?$('<span class="input-group-addon">'+t.icons.rightIcon+"</span>"):$(t.icons.rightIcon);i.attr("role","right-icon"),0===a.length?(a=$('<div role="wrapper" />').addClass(t.style.wrapper),e.wrap(a)):a.addClass(t.style.wrapper),a=e.parent('div[role="wrapper"]'),t.width&&a.css("width",t.width),e.val(t.value).addClass(t.style.input).attr("role","input"),t.fontSize&&e.css("font-size",t.fontSize),i.on("click",function(t){$("body").children('[role="calendar"][guid="'+e.attr("data-guid")+'"]').is(":visible")?gj.datepicker.methods.hide(e):gj.datepicker.methods.show(e)}),e.on("blur",function(){e.timeout=setTimeout(function(){gj.datepicker.methods.hide(e)},500)}),a.append(i),gj.datepicker.methods.createCalendar(e)},createCalendar:function(e){var t,a=e.data(),r=$('<div role="calendar" />').addClass(a.style.calendar).attr("guid",e.attr("data-guid")),n=$("<table/>"),o=$("<thead/>");for(a.fontSize&&r.css("font-size",a.fontSize),!(t=gj.core.parseDate(a.value,a.format))||isNaN(t.getTime())?t=new Date:e.attr("day",t.getFullYear()+"-"+t.getMonth()+"-"+t.getDate()),e.attr("month",t.getMonth()),e.attr("year",t.getFullYear()),$row=$('<tr role="month-manager" />'),$row.append($("<th><div>"+a.icons.previousMonth+"</div></th>").on("click",gj.datepicker.methods.prevMonth(e))),$row.append('<th colspan="5"><div role="month"></div></th>'),$row.append($("<th><div>"+a.icons.nextMonth+"</div></th>").on("click",gj.datepicker.methods.nextMonth(e))),o.append($row),$row=$('<tr role="week-days" />'),i=a.weekStartDay;i<a.weekDays.length;i++)$row.append("<th><div>"+a.weekDays[i]+"</div></th>");for(i=0;i<a.weekStartDay;i++)$row.append("<th><div>"+a.weekDays[i]+"</div></th>");return o.append($row),n.append(o),n.append("<tbody/>"),r.append(n),r.hide(),$("body").append(r),r},renderCalendar:function(e){var t,a,i,r,n,o,d,s,l,g,c,p,u,h,f=e.data(),m=$("body").children('[role="calendar"][guid="'+e.attr("data-guid")+'"]'),v=m.children("table"),b=v.children("tbody");for(clearTimeout(e.timeout),e.attr("day")?(a=e.attr("day").split("-"),a=new Date(a[0],a[1],a[2])):a=new Date(void 0),r=parseInt(e.attr("month"),10),n=parseInt(e.attr("year"),10),v.find('thead [role="month"]').text(gj.core.monthNames[r]+" "+n),o=new Array(31,28,31,30,31,30,31,31,30,31,30,31),n%4==0&&1900!=n&&(o[1]=29),d=o[r],s=(new Date(n,r,1).getDay()+7-f.weekStartDay)%7,b.empty(),t=0,$row=$("<tr />"),c=gj.datepicker.methods.getPrevMonth(r,n),l=1;l<=s;l++)i=o[c.month]-s+l,u=c.year===a.getFullYear()&&c.month===a.getMonth()&&i===a.getDate()?$('<td type="selected" />'):$('<td type="other-month" />'),f.showOtherMonths&&(h=$("<div>"+i+"</div>"),u.append(h),f.selectOtherMonths&&gj.datepicker.methods.isSelectable(f,c.year,c.month,i)?(u.addClass("gj-cursor-pointer"),h.on("click",gj.datepicker.methods.select(e,m,i,c.month,c.year))):u.addClass("disabled")),$row.append(u),t++;for(b.append($row),g=new Date,l=1;l<=d;l++)0==t&&($row=$("<tr>")),u=n===a.getFullYear()&&r===a.getMonth()&&l===a.getDate()?$('<td type="selected" />'):n===g.getFullYear()&&r===g.getMonth()&&l===g.getDate()?$('<td type="today" />'):$('<td type="current-month" />'),h=$("<div>"+l+"</div>"),gj.datepicker.methods.isSelectable(f,n,r,l)?(u.addClass("gj-cursor-pointer"),h.on("click",gj.datepicker.methods.select(e,m,l,r,n))):u.addClass("disabled"),u.append(h),$row.append(u),7==++t&&(b.append($row),t=0);for(p=gj.datepicker.methods.getNextMonth(r,n),l=1;0!=t;l++)u=p.year===a.getFullYear()&&p.month===a.getMonth()&&l===a.getDate()?$('<td type="selected" />'):$('<td type="other-month" />'),f.showOtherMonths&&(h=$("<div>"+l+"</div>"),u.append(h),f.selectOtherMonths&&gj.datepicker.methods.isSelectable(f,p.year,p.month,l)?(u.addClass("gj-cursor-pointer"),h.on("click",gj.datepicker.methods.select(e,m,l,p.month,p.year))):u.addClass("disabled")),$row.append(u),7==++t&&(b.append($row),t=0)},getMinDate:function(e){var t;return e.minDate&&("string"==typeof e.minDate?t=new Date(e.minDate):"function"==typeof e.minDate?t=e.minDate():"function"==typeof e.minDate.getMonth&&(t=e.minDate)),t},getMaxDate:function(e){var t;return e.maxDate&&("string"==typeof e.maxDate?t=new Date(e.maxDate):"function"==typeof e.maxDate?t=e.maxDate():"function"==typeof e.maxDate.getMonth&&(t=e.maxDate)),t},isSelectable:function(e,t,a,i){var r,n=!0,o=new Date(t,a,i),d=gj.datepicker.methods.getMinDate(e),s=gj.datepicker.methods.getMaxDate(e);if(d&&o<d)n=!1;else if(s&&o>s)n=!1;else if(e.disableDates)if($.isArray(e.disableDates))for(r=0;r<e.disableDates.length;r++)e.disableDates[r]instanceof Date&&e.disableDates[r].getTime()===o.getTime()?n=!1:"string"==typeof e.disableDates[r]&&gj.core.parseDate(e.disableDates[r],e.format).getTime()===o.getTime()&&(n=!1);else e.disableDates instanceof Function&&(n=e.disableDates(o));return n},getPrevMonth:function(e,t){return date=new Date(t,e,1),date.setMonth(date.getMonth()-1),{month:date.getMonth(),year:date.getFullYear()}},getNextMonth:function(e,t){return date=new Date(t,e,1),date.setMonth(date.getMonth()+1),{month:date.getMonth(),year:date.getFullYear()}},prevMonth:function(e){return function(){var t,a=parseInt(e.attr("month"),10),i=parseInt(e.attr("year"),10);t=gj.datepicker.methods.getPrevMonth(a,i),e.attr("month",t.month),e.attr("year",t.year),gj.datepicker.methods.renderCalendar(e),e.focus()}},nextMonth:function(e){return function(){var t,a=parseInt(e.attr("month"),10),i=parseInt(e.attr("year"),10);t=gj.datepicker.methods.getNextMonth(a,i),e.attr("month",t.month),e.attr("year",t.year),gj.datepicker.methods.renderCalendar(e),e.focus()}},select:function(e,t,a,i,r){return function(t){var n,o,d=e.data();return n=new Date(r,i,a),o=gj.core.formatDate(n,d.format),e.val(o),gj.datepicker.events.change(e),e.attr("day",r+"-"+i+"-"+a),e.attr("month",i),e.attr("year",r),gj.datepicker.methods.hide(e),e}},show:function(e){e.data();var t=e.offset(),a=$("body").children('[role="calendar"][guid="'+e.attr("data-guid")+'"]');gj.datepicker.methods.renderCalendar(e),a.css("left",t.left).css("top",t.top+e.outerHeight(!0)+3),a.show(),e.focus(),gj.datepicker.events.show(e)},hide:function(e){$("body").children('[role="calendar"][guid="'+e.attr("data-guid")+'"]').hide(),gj.datepicker.events.hide(e)},value:function(e,t){var a,i;return void 0===t?e.val():(i=gj.core.parseDate(t,e.data().format),i?(a=$("body").children('[role="calendar"][guid="'+e.attr("data-guid")+'"]'),gj.datepicker.methods.select(e,a,i.getDate(),i.getMonth(),i.getFullYear())()):e.val(""),e)},destroy:function(e){var t=e.data(),a=e.parent();return t&&(e.off(),$("body").children('[role="calendar"][guid="'+e.attr("data-guid")+'"]').remove(),e.removeData(),e.removeAttr("data-type").removeAttr("data-guid").removeAttr("data-datepicker"),e.removeClass(),a.children('[role="right-icon"]').remove(),e.unwrap()),e}},gj.datepicker.events={change:function(e){return e.triggerHandler("change")},show:function(e){return e.triggerHandler("show")},hide:function(e){return e.triggerHandler("hide")}},gj.datepicker.widget=function(e,t){var a=this,i=gj.datepicker.methods;return a.value=function(e){return i.value(this,e)},a.destroy=function(){return i.destroy(this)},a.show=function(){gj.datepicker.methods.show(this)},a.hide=function(){gj.datepicker.methods.hide(this)},a.disableDates=function(e){},a.disableWeekDay=function(){},a.setMinDate=function(){},a.setMaxDate=function(){},$.extend(e,a),"true"!==e.attr("data-datepicker")&&i.init.call(e,t),e},gj.datepicker.widget.prototype=new gj.widget,gj.datepicker.widget.constructor=gj.datepicker.widget,jQuery.fn.datepicker=function(e){var t;if(this&&this.length){if("object"!=typeof e&&e){if((t=new gj.datepicker.widget(this,null))[e])return t[e].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+e+" does not exist."}return new gj.datepicker.widget(this,e)}},void 0===gj.grid&&(gj.grid={plugins:{},messages:[]}),gj.grid.messages["en-us"]={First:"First",Previous:"Previous",Next:"Next",Last:"Last",Page:"Page",FirstPageTooltip:"First Page",PreviousPageTooltip:"Previous Page",NextPageTooltip:"Next Page",LastPageTooltip:"Last Page",Refresh:"Refresh",Of:"of",DisplayingRecords:"Displaying records",RowsPerPage:"Rows per page:",Edit:"Edit",Delete:"Delete",Update:"Update",Cancel:"Cancel",NoRecordsFound:"No records found.",Loading:"Loading..."},void 0===gj.grid&&(gj.grid={plugins:{}}),gj.grid.config={base:{dataSource:void 0,columns:[],autoGenerateColumns:!1,defaultColumnSettings:{hidden:!1,width:void 0,sortable:!1,type:"text",title:void 0,field:void 0,align:"left",cssClass:void 0,headerCssClass:void 0,tooltip:void 0,icon:void 0,events:void 0,format:"mm/dd/yyyy",decimalDigits:void 0,tmpl:void 0,stopPropagation:!1,renderer:void 0,filter:void 0},mapping:{dataField:"records",totalRecordsField:"total"},params:{},paramNames:{sortBy:"sortBy",direction:"direction"},uiLibrary:"materialdesign",iconsLibrary:"materialicons",selectionType:"single",selectionMethod:"basic",autoLoad:!0,notFoundText:void 0,width:void 0,minWidth:void 0,fontSize:void 0,primaryKey:void 0,locale:"en-us",defaultIconColumnWidth:70,defaultCheckBoxColumnWidth:70,style:{wrapper:"gj-grid-wrapper",table:"gj-grid gj-grid-md",loadingCover:"gj-grid-loading-cover",loadingText:"gj-grid-loading-text",header:{cell:void 0,sortable:"gj-cursor-pointer"},content:{rowHover:void 0,rowSelected:"gj-grid-md-select"}},icons:{asc:"?",desc:"?"}},bootstrap:{style:{wrapper:"gj-grid-wrapper",table:"gj-grid gj-grid-bootstrap gj-grid-bootstrap-3 table table-bordered table-hover",content:{rowHover:void 0,rowSelected:"active"}},iconsLibrary:"glyphicons",defaultIconColumnWidth:34,defaultCheckBoxColumnWidth:36},bootstrap4:{style:{wrapper:"gj-grid-wrapper",table:"gj-grid gj-grid-bootstrap gj-grid-bootstrap-4 table table-bordered table-hover",content:{rowHover:void 0,rowSelected:"active"}},defaultIconColumnWidth:42,defaultCheckBoxColumnWidth:44},materialicons:{icons:{asc:'<i class="material-icons">arrow_upward</i>',desc:'<i class="material-icons">arrow_downward</i>'}},fontawesome:{icons:{asc:'<i class="fa fa-sort-amount-asc" aria-hidden="true"></i>',desc:'<i class="fa fa-sort-amount-desc" aria-hidden="true"></i>'}},glyphicons:{icons:{asc:'<span class="glyphicon glyphicon-sort-by-alphabet" />',desc:'<span class="glyphicon glyphicon-sort-by-alphabet-alt" />'}}},gj.grid.events={beforeEmptyRowInsert:function(e,t){return e.triggerHandler("beforeEmptyRowInsert",[t])},dataBinding:function(e,t){return e.triggerHandler("dataBinding",[t])},dataBound:function(e,t,a){return e.triggerHandler("dataBound",[t,a])},rowDataBound:function(e,t,a,i){return e.triggerHandler("rowDataBound",[t,a,i])},cellDataBound:function(e,t,a,i,r){return e.triggerHandler("cellDataBound",[t,a,i,r])},rowSelect:function(e,t,a,i){return e.triggerHandler("rowSelect",[t,a,i])},rowUnselect:function(e,t,a,i){return e.triggerHandler("rowUnselect",[t,a,i])},rowRemoving:function(e,t,a,i){return e.triggerHandler("rowRemoving",[t,a,i])},destroying:function(e){return e.triggerHandler("destroying")},columnHide:function(e,t){return e.triggerHandler("columnHide",[t])},columnShow:function(e,t){return e.triggerHandler("columnShow",[t])},initialized:function(e){return e.triggerHandler("initialized")},dataFiltered:function(e,t){return e.triggerHandler("dataFiltered",[t])}},gj.grid.methods={init:function(e){return gj.widget.prototype.init.call(this,e,"grid"),gj.grid.methods.initialize(this),this.data("autoLoad")&&this.reload(),this},getConfig:function(e,t){var a=gj.widget.prototype.getConfig.call(this,e,t);return gj.grid.methods.setDefaultColumnConfig(a.columns,a.defaultColumnSettings),a},setDefaultColumnConfig:function(e,t){var a,i;if(e&&e.length)for(i=0;i<e.length;i++)a=$.extend(!0,{},t),$.extend(!0,a,e[i]),e[i]=a},getHTMLConfig:function(){var e=gj.widget.prototype.getHTMLConfig.call(this);return e.columns=[],this.find("thead > tr > th").each(function(){var t=$(this),a=t.text(),i=gj.widget.prototype.getHTMLConfig.call(t);i.title=a,i.field||(i.field=a),i.events&&(i.events=gj.grid.methods.eventsParser(i.events)),e.columns.push(i)}),e},eventsParser:function(events){var result={},list,i,key,func,position;for(list=events.split(","),i=0;i<list.length;i++)(position=list[i].indexOf(":"))>0&&(key=$.trim(list[i].substr(0,position)),func=$.trim(list[i].substr(position+1,list[i].length)),result[key]=eval("window."+func));return result},initialize:function(e){var t=e.data(),a=e.parent('div[data-role="wrapper"]');gj.grid.methods.localization(t),0===a.length?(a=$('<div data-role="wrapper" />').addClass(t.style.wrapper),e.wrap(a)):a.addClass(t.style.wrapper),t.width&&e.parent().css("width",t.width),t.minWidth&&e.css("min-width",t.minWidth),t.fontSize&&e.css("font-size",t.fontSize),e.addClass(t.style.table),"checkbox"===t.selectionMethod&&t.columns.splice(gj.grid.methods.getColumnPositionNotInRole(e),0,{title:"",width:t.defaultCheckBoxColumnWidth,align:"center",type:"checkbox",role:"selectRow",events:{click:function(t){gj.grid.methods.setSelected(e,t.data.id,$(this).closest("tr"))}},headerCssClass:"gj-grid-select-all",stopPropagation:!0}),0===e.children("tbody").length&&e.append($("<tbody/>")),gj.grid.methods.renderHeader(e),gj.grid.methods.appendEmptyRow(e," "),gj.grid.events.initialized(e)},localization:function(e){e.notFoundText||(e.notFoundText=gj.grid.messages[e.locale].NoRecordsFound)},renderHeader:function(e){var t,a,i,r,n,o,d,s,l;for(a=(t=e.data()).columns,i=t.style.header,0===(r=e.children("thead")).length&&(r=$("<thead />"),e.prepend(r)),n=$('<tr data-role="caption" />'),s=0;s<a.length;s+=1)o=$('<th data-field="'+(a[s].field||"")+'" />'),a[s].width?o.attr("width",a[s].width):"checkbox"===a[s].type&&o.attr("width",t.defaultIconColumnWidth),o.addClass(i.cell),a[s].headerCssClass&&o.addClass(a[s].headerCssClass),o.css("text-align",a[s].align||"left"),"checkbox"===t.selectionMethod&&"multiple"===t.selectionType&&"checkbox"===a[s].type&&"selectRow"===a[s].role?(0===(l=o.find('input[data-role="selectAll"]')).length&&(l=$('<input type="checkbox" data-role="selectAll" />'),o.append(l),l.checkbox({uiLibrary:t.uiLibrary})),l.off("click").on("click",function(){this.checked?e.selectAll():e.unSelectAll()})):(d=$('<div data-role="title"/>').html(void 0===a[s].title?a[s].field:a[s].title),o.append(d),a[s].sortable&&(d.addClass(i.sortable),d.on("click",gj.grid.methods.createSortHandler(e,a[s])))),a[s].hidden&&o.hide(),n.append(o);r.empty().append(n)},createSortHandler:function(e,t){return function(){var a,i={};e.count()>0&&(i[(a=e.data()).paramNames.sortBy]=t.field,t.direction="asc"===t.direction?"desc":"asc",i[a.paramNames.direction]=t.direction,e.reload(i))}},updateHeader:function(e){var t,a,i=e.data(),r=i.params[i.paramNames.sortBy],n=i.params[i.paramNames.direction];e.find('thead tr th [data-role="sorticon"]').remove(),r&&(position=gj.grid.methods.getColumnPosition(e.data("columns"),r),position>-1&&(a=e.find("thead tr th:eq("+position+') div[data-role="title"]'),t=$('<div data-role="sorticon" class="gj-unselectable" />').append("desc"===n?i.icons.desc:i.icons.asc),a.after(t)))},useHtmlDataSource:function(e,t){var a,i,r,n,o=[],d=e.find('tbody tr[data-role != "empty"]');for(a=0;a<d.length;a++){for(r=$(d[a]).find("td"),n={},i=0;i<r.length;i++)n[t.columns[i].field]=$(r[i]).html();o.push(n)}t.dataSource=o},startLoading:function(e){var t,a,i,r,n,o,d;gj.grid.methods.stopLoading(e),d=e.data(),0!==e.outerHeight()&&(r=(t=e.children("tbody")).outerWidth(!1),n=t.outerHeight(!1),o=Math.abs(e.parent().offset().top-t.offset().top),a=$('<div data-role="loading-cover" />').addClass(d.style.loadingCover).css({width:r,height:n,top:o}),(i=$('<div data-role="loading-text">'+gj.grid.messages[d.locale].Loading+"</div>").addClass(d.style.loadingText)).insertAfter(e),a.insertAfter(e),i.css({top:o+n/2-i.outerHeight(!1)/2,left:r/2-i.outerWidth(!1)/2}))},stopLoading:function(e){e.parent().find('div[data-role="loading-cover"]').remove(),e.parent().find('div[data-role="loading-text"]').remove()},createAddRowHoverHandler:function(e,t){return function(){e.addClass(t)}},createRemoveRowHoverHandler:function(e,t){return function(){e.removeClass(t)}},appendEmptyRow:function(e,t){var a,i,r,n;a=e.data(),i=$('<tr data-role="empty"/>'),(r=$("<td/>").css({width:"100%","text-align":"center"})).attr("colspan",gj.grid.methods.countVisibleColumns(e)),n=$("<div />").html(t||a.notFoundText),r.append(n),i.append(r),gj.grid.events.beforeEmptyRowInsert(e,i),e.append(i)},autoGenerateColumns:function(e,t){var a,i,r,n,o=e.data();if(o.columns=[],t.length>0){for(a=Object.getOwnPropertyNames(t[0]),n=0;n<a.length;n++)r="text",(i=t[0][a[n]])&&("number"==typeof i?r="number":i.indexOf("/Date(")>-1&&(r="date")),o.columns.push({field:a[n],type:r});gj.grid.methods.setDefaultColumnConfig(o.columns,o.defaultColumnSettings)}gj.grid.methods.renderHeader(e)},loadData:function(e){var t,a,i,r,n,o,d,s;for(t=e.data(),a=e.getAll(),gj.grid.events.dataBinding(e,a),r=a.length,gj.grid.methods.stopLoading(e),t.autoGenerateColumns&&gj.grid.methods.autoGenerateColumns(e,a),o=e.children("tbody"),"checkbox"===t.selectionMethod&&"multiple"===t.selectionType&&e.find('thead input[data-role="selectAll"]').prop("checked",!1),o.children("tr").not('[data-role="row"]').remove(),0===r&&(o.empty(),gj.grid.methods.appendEmptyRow(e)),n=(d=o.children("tr")).length,i=0;i<n;i++){if(!(i<r)){o.find('tr[data-role="row"]:gt('+(i-1)+")").remove();break}s=d.eq(i),gj.grid.methods.renderRow(e,s,a[i],i)}for(i=n;i<r;i++)gj.grid.methods.renderRow(e,null,a[i],i);gj.grid.events.dataBound(e,a,t.totalRecords)},getId:function(e,t,a){return t&&e[t]?e[t]:a},renderRow:function(e,t,a,i){var r,n,o,d,s;for(d=e.data(),t&&0!==t.length?(s="update",t.removeClass(d.style.content.rowSelected).removeAttr("data-selected").off("click")):(s="create",t=$('<tr data-role="row"/>'),e.children("tbody").append(t),t.on("mouseenter",gj.grid.methods.createAddRowHoverHandler(t,d.style.content.rowHover)),t.on("mouseleave",gj.grid.methods.createRemoveRowHoverHandler(t,d.style.content.rowHover))),r=gj.grid.methods.getId(a,d.primaryKey,i+1),t.attr("data-position",i+1),"checkbox"!==d.selectionMethod&&t.on("click",gj.grid.methods.createRowClickHandler(e,r)),o=0;o<d.columns.length;o++)"update"===s?(n=t.find("td:eq("+o+")"),gj.grid.methods.renderCell(e,n,d.columns[o],a,r)):(n=gj.grid.methods.renderCell(e,null,d.columns[o],a,r),t.append(n));gj.grid.events.rowDataBound(e,t,r,a)},renderCell:function(e,t,a,i,r,n){var o,d;if(t&&0!==t.length?(o=t.find('div[data-role="display"]'),n="update"):(t=$("<td/>").css("text-align",a.align||"left"),o=$('<div data-role="display" />'),a.cssClass&&t.addClass(a.cssClass),t.append(o),n="create"),gj.grid.methods.renderDisplayElement(e,o,a,i,r,n),"update"===n&&(t.off(),o.off()),a.events)for(d in a.events)a.events.hasOwnProperty(d)&&t.on(d,{id:r,field:a.field,record:i},gj.grid.methods.createCellEventHandler(a,a.events[d]));return a.hidden&&t.hide(),gj.grid.events.cellDataBound(e,o,r,a,i),t},createCellEventHandler:function(e,t){return function(a){e.stopPropagation&&a.stopPropagation(),t.call(this,a)}},renderDisplayElement:function(e,t,a,i,r,n){var o,d;"checkbox"===a.type&&gj.checkbox?"create"===n?(d=$('<input type="checkbox" />').val(r).prop("checked",!!i[a.field]),a.role&&d.attr("data-role",a.role),t.append(d),d.checkbox({uiLibrary:e.data("uiLibrary")}),"selectRow"===a.role?d.on("click",function(){return!1}):d.prop("disabled",!0)):t.find('input[type="checkbox"]').val(r).prop("checked",!!i[a.field]):"icon"===a.type?"create"===n&&(t.append($("<span/>").addClass("bootstrap"===e.data().uiLibrary?"glyphicon":"ui-icon").addClass(a.icon).css({cursor:"pointer"})),a.stopPropagation=!0):a.tmpl?(o=a.tmpl,a.tmpl.replace(/\{(.+?)\}/g,function(e,t){o=o.replace(e,gj.grid.methods.formatText(i[t],a))}),t.html(o)):a.renderer&&"function"==typeof a.renderer?(o=a.renderer(i[a.field],i,t.parent(),t,r,e))&&t.html(o):(i[a.field]=gj.grid.methods.formatText(i[a.field],a),!a.tooltip&&i[a.field]&&t.attr("title",i[a.field]),t.html(i[a.field])),a.tooltip&&"create"===n&&t.attr("title",a.tooltip)},formatText:function(e,t){return e=e&&"date"===t.type?gj.core.formatDate(gj.core.parseDate(e,t.format),t.format):void 0===e||null===e?"":e.toString(),t.decimalDigits&&e&&(e=parseFloat(e).toFixed(t.decimalDigits)),e},setRecordsData:function(e,t){var a=[],i=0,r=e.data();return $.isArray(t)?(a=t,i=t.length):r&&r.mapping&&$.isArray(t[r.mapping.dataField])&&(a=t[r.mapping.dataField],(i=t[r.mapping.totalRecordsField])&&!isNaN(i)||(i=0)),e.data("records",a),e.data("totalRecords",i),a},createRowClickHandler:function(e,t){return function(){gj.grid.methods.setSelected(e,t,$(this))}},selectRow:function(e,t,a,i){var r;return a.addClass(t.style.content.rowSelected),a.attr("data-selected","true"),"checkbox"===t.selectionMethod&&((r=a.find('input[type="checkbox"][data-role="selectRow"]')).length&&!r.prop("checked")&&r.prop("checked",!0),"multiple"===t.selectionType&&e.getSelections().length===e.count(!1)&&e.find('thead input[data-role="selectAll"]').prop("checked",!0)),gj.grid.events.rowSelect(e,a,i,e.getById(i))},unselectRow:function(e,t,a,i){var r;if("true"===a.attr("data-selected"))return a.removeClass(t.style.content.rowSelected),"checkbox"===t.selectionMethod&&((r=a.find('td input[type="checkbox"][data-role="selectRow"]')).length&&r.prop("checked")&&r.prop("checked",!1),"multiple"===t.selectionType&&e.find('thead input[data-role="selectAll"]').prop("checked",!1)),a.removeAttr("data-selected"),gj.grid.events.rowUnselect(e,a,i,e.getById(i))},setSelected:function(e,t,a){var i=e.data();return a&&a.length||(a=gj.grid.methods.getRowById(e,t)),a&&("true"===a.attr("data-selected")?gj.grid.methods.unselectRow(e,i,a,t):("single"===i.selectionType&&a.siblings('[data-selected="true"]').each(function(){var t=$(this),a=gj.grid.methods.getId(t,i.primaryKey,t.data("position"));gj.grid.methods.unselectRow(e,i,t,a)}),gj.grid.methods.selectRow(e,i,a,t))),e},selectAll:function(e){var t=e.data();return e.find('tbody tr[data-role="row"]').each(function(){var a=$(this),i=a.data("position"),r=e.get(i),n=gj.grid.methods.getId(r,t.primaryKey,i);gj.grid.methods.selectRow(e,t,a,n)}),e.find('thead input[data-role="selectAll"]').prop("checked",!0),e},unSelectAll:function(e){var t=e.data();return e.find("tbody tr").each(function(){var a=$(this),i=a.data("position"),r=e.get(i),n=gj.grid.methods.getId(r,t.primaryKey,i);gj.grid.methods.unselectRow(e,t,a,n),a.find('input[type="checkbox"][data-role="selectRow"]').prop("checked",!1)}),e.find('thead input[data-role="selectAll"]').prop("checked",!1),e},getSelected:function(e){var t,a,i,r=null;return(t=e.find('tbody>tr[data-selected="true"]')).length>0&&(i=$(t[0]).data("position"),a=e.get(i),r=gj.grid.methods.getId(a,e.data().primaryKey,i)),r},getSelectedRows:function(e){e.data();return e.find('tbody>tr[data-selected="true"]')},getSelections:function(e){var t,a,i=[],r=e.data(),n=gj.grid.methods.getSelectedRows(e);return 0<n.length&&n.each(function(){t=$(this).data("position"),a=e.get(t),i.push(gj.grid.methods.getId(a,r.primaryKey,t))}),i},getById:function(e,t){var a,i=null,r=e.data("primaryKey"),n=e.data("records");if(r){for(a=0;a<n.length;a++)if(n[a][r]==t){i=n[a];break}}else i=e.get(t);return i},getRecVPosById:function(e,t){var a,i=t,r=e.data();if(r.primaryKey)for(a=0;a<r.dataSource.length;a++)if(r.dataSource[a][r.primaryKey]==t){i=a;break}return i},getRowById:function(e,t){var a,i,r=e.getAll(!1),n=e.data("primaryKey"),o=void 0;if(n){for(i=0;i<r.length;i++)if(r[i][n]==t){a=i+1;break}}else a=t;return a&&(o=e.find('tbody > tr[data-position="'+a+'"]')),o},getByPosition:function(e,t){return e.getAll(!1)[t-1]},getColumnPosition:function(e,t){var a,i=-1;for(a=0;a<e.length;a++)if(e[a].field===t){i=a;break}return i},getColumnInfo:function(e,t){var a,i={},r=e.data();for(a=0;a<r.columns.length;a+=1)if(r.columns[a].field===t){i=r.columns[a];break}return i},getCell:function(e,t,a){var i,r=null;return(i=gj.grid.methods.getColumnPosition(e.data("columns"),a))>-1&&(r=gj.grid.methods.getRowById(e,t).find("td:eq("+i+') div[data-role="display"]')),r},setCellContent:function(e,t,a,i){var r,n=gj.grid.methods.getCell(e,t,a);n&&(n.empty(),"object"==typeof i?n.append(i):(r=gj.grid.methods.getColumnInfo(e,a),gj.grid.methods.renderDisplayElement(e,n,r,e.getById(t),t,"update")))},clone:function(e){var t=[];return $.each(e,function(){t.push(this.clone())}),t},getAll:function(e){return e.data("records")},countVisibleColumns:function(e){var t,a,i;for(t=e.data().columns,a=0,i=0;i<t.length;i++)!0!==t[i].hidden&&a++;return a},clear:function(e,t){var a=e.data();return e.xhr&&e.xhr.abort(),e.children("tbody").empty(),a.records=[],gj.grid.methods.stopLoading(e),gj.grid.methods.appendEmptyRow(e,t?a.notFoundText:" "),gj.grid.events.dataBound(e,[],0),e},render:function(e,t){return t&&(gj.grid.methods.setRecordsData(e,t),gj.grid.methods.updateHeader(e),gj.grid.methods.loadData(e)),e},filter:function(e){var t,a,i=e.data(),r=i.dataSource.slice();i.params[i.paramNames.sortBy]&&(a=gj.grid.methods.getColumnInfo(e,i.params[i.paramNames.sortBy]),r.sort(a.sortable.sorter?a.sortable.sorter(a.direction,a):gj.grid.methods.createDefaultSorter(a.direction,a.field)));for(t in i.params)i.params[t]&&!i.paramNames[t]&&(a=gj.grid.methods.getColumnInfo(e,t),r=$.grep(r,function(e){var r=e[t]||"",n=i.params[t]||"";return a&&"function"==typeof a.filter?a.filter(r,n):r.toUpperCase().indexOf(n.toUpperCase())>-1}));return gj.grid.events.dataFiltered(e,r),r},createDefaultSorter:function(e,t){return function(a,i){var r=(a[t]||"").toString(),n=(i[t]||"").toString();return"asc"===e?r.localeCompare(n):n.localeCompare(r)}},destroy:function(e,t,a){return e.data()&&(gj.grid.events.destroying(e),gj.grid.methods.stopLoading(e),e.xhr&&e.xhr.abort(),e.off(),!1===a&&e.parent('div[data-role="wrapper"]').length>0&&e.unwrap(),e.removeData(),!1===t?e.remove():e.removeClass().empty(),e.removeAttr("data-type")),e},showColumn:function(e,t){var a,i=e.data(),r=gj.grid.methods.getColumnPosition(i.columns,t);return r>-1&&(e.find("thead>tr").each(function(){$(this).children("th").eq(r).show()}),$.each(e.find("tbody>tr"),function(){$(this).children("td").eq(r).show()}),i.columns[r].hidden=!1,(a=e.find('tbody > tr[data-role="empty"] > td'))&&a.length&&a.attr("colspan",gj.grid.methods.countVisibleColumns(e)),gj.grid.events.columnShow(e,i.columns[r])),e},hideColumn:function(e,t){var a,i=e.data(),r=gj.grid.methods.getColumnPosition(i.columns,t);return r>-1&&(e.find("thead>tr").each(function(){$(this).children("th").eq(r).hide()}),$.each(e.find("tbody>tr"),function(){$(this).children("td").eq(r).hide()}),i.columns[r].hidden=!0,(a=e.find('tbody > tr[data-role="empty"] > td'))&&a.length&&a.attr("colspan",gj.grid.methods.countVisibleColumns(e)),gj.grid.events.columnHide(e,i.columns[r])),e},isLastRecordVisible:function(){return!0},addRow:function(e,t){var a=e.data();return a.totalRecords=e.data("totalRecords")+1,gj.grid.events.dataBinding(e,[t]),a.records.push(t),$.isArray(a.dataSource)&&a.dataSource.push(t),1===a.totalRecords&&e.children("tbody").empty(),gj.grid.methods.isLastRecordVisible(e)&&gj.grid.methods.renderRow(e,null,t,e.count()-1),gj.grid.events.dataBound(e,[t],a.totalRecords),e},updateRow:function(e,t,a){var i,r=gj.grid.methods.getRowById(e,t),n=e.data();return n.records[r.data("position")-1]=a,$.isArray(n.dataSource)&&(i=gj.grid.methods.getRecVPosById(e,t),n.dataSource[i]=a),gj.grid.methods.renderRow(e,r,a,r.index()),e},removeRow:function(e,t){var a,i=e.data(),r=gj.grid.methods.getRowById(e,t);return gj.grid.events.rowRemoving(e,r,t,e.getById(t)),$.isArray(i.dataSource)&&(a=gj.grid.methods.getRecVPosById(e,t),i.dataSource.splice(a,1)),e.reload(),e},count:function(e,t){return t?e.data().totalRecords:e.getAll().length},getColumnPositionByRole:function(e,t){var a,i,r=e.data("columns");for(a=0;a<r.length;a++)if(r[a].role===t){i=a;break}return i},getColumnPositionNotInRole:function(e){var t,a=0,i=e.data("columns");for(t=0;t<i.length;t++)if(!i[t].role){a=t;break}return a}},gj.grid.widget=function(e,t){var a=this,i=gj.grid.methods;return a.reload=function(e){return i.startLoading(this),gj.widget.prototype.reload.call(this,e)},a.clear=function(e){return i.clear(this,e)},a.count=function(e){return i.count(this,e)},a.render=function(t){return i.render(e,t)},a.destroy=function(e,t){return i.destroy(this,e,t)},a.setSelected=function(e){return i.setSelected(this,e)},a.getSelected=function(){return i.getSelected(this)},a.getSelections=function(){return i.getSelections(this)},a.selectAll=function(){return i.selectAll(this)},a.unSelectAll=function(){return i.unSelectAll(this)},a.getById=function(e){return i.getById(this,e)},a.get=function(e){return i.getByPosition(this,e)},a.getAll=function(e){return i.getAll(this,e)},a.showColumn=function(e){return i.showColumn(this,e)},a.hideColumn=function(e){return i.hideColumn(this,e)},a.addRow=function(e){return i.addRow(this,e)},a.updateRow=function(e,t){return i.updateRow(this,e,t)},a.setCellContent=function(e,t,a){i.setCellContent(this,e,t,a)},a.removeRow=function(e){return i.removeRow(this,e)},$.extend(e,a),"grid"!==e.attr("data-type")&&i.init.call(e,t),e},gj.grid.widget.prototype=new gj.widget,gj.grid.widget.constructor=gj.grid.widget,gj.grid.widget.prototype.getConfig=gj.grid.methods.getConfig,gj.grid.widget.prototype.getHTMLConfig=gj.grid.methods.getHTMLConfig,jQuery.fn.grid=function(e){var t;if(this&&this.length){if("object"!=typeof e&&e){if((t=new gj.grid.widget(this,null))[e])return t[e].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+e+" does not exist."}return new gj.grid.widget(this,e)}},gj.grid.plugins.expandCollapseRows={config:{base:{detailTemplate:void 0,keepExpandedRows:!0,icons:{expandRow:'<i class="material-icons">keyboard_arrow_right</i>',collapseRow:'<i class="material-icons">keyboard_arrow_down</i>'}},fontawesome:{icons:{expandRow:'<i class="fa fa-angle-right" aria-hidden="true"></i>',collapseRow:'<i class="fa fa-angle-down" aria-hidden="true"></i>'}},glyphicons:{icons:{expandRow:'<span class="glyphicon glyphicon-chevron-right" />',collapseRow:'<span class="glyphicon glyphicon-chevron-down" />'}}},private:{detailExpand:function(e,t){var a=t.closest("tr"),i=$('<tr data-role="details" />'),r=$('<td colspan="'+gj.grid.methods.countVisibleColumns(e)+'" />'),n=$('<div data-role="display" />'),o=e.data(),d=a.data("position"),s=e.get(d),l=gj.grid.methods.getId(s,o.primaryKey,s);i.append(r.append(n.append(a.data("details")))),i.insertAfter(a),t.children('div[data-role="display"]').empty().append(o.icons.collapseRow),e.updateDetails(a),gj.grid.plugins.expandCollapseRows.events.detailExpand(e,i.find("td>div"),l)},detailCollapse:function(e,t){var a=t.closest("tr"),i=a.next('tr[data-role="details"]'),r=e.data(),n=gj.grid.methods.getId(a,r.primaryKey,a.data("position"));i.remove(),t.children('div[data-role="display"]').empty().append(r.icons.expandRow),gj.grid.plugins.expandCollapseRows.events.detailCollapse(e,i.find("td>div"),n)},keepSelection:function(e,t){var a=e.data();a.keepExpandedRows&&($.isArray(a.expandedRows)?-1==a.expandedRows.indexOf(t)&&a.expandedRows.push(t):a.expandedRows=[t])},removeSelection:function(e,t){var a=e.data();a.keepExpandedRows&&$.isArray(a.expandedRows)&&a.expandedRows.indexOf(t)>-1&&a.expandedRows.splice(a.expandedRows.indexOf(t),1)},updateDetailsColSpan:function(e){var t=e.find('tbody > tr[data-role="details"] > td');t&&t.length&&t.attr("colspan",gj.grid.methods.countVisibleColumns(e))}},public:{collapseAll:function(){var e=this,t=gj.grid.methods.getColumnPositionByRole(e,"expander");e.find('tbody tr[data-role="row"]').each(function(){gj.grid.plugins.expandCollapseRows.private.detailCollapse(e,$(this).find("td:eq("+t+")"))})},expandAll:function(){var e=this,t=gj.grid.methods.getColumnPositionByRole(e,"expander");e.find('tbody tr[data-role="row"]').each(function(){gj.grid.plugins.expandCollapseRows.private.detailExpand(e,$(this).find("td:eq("+t+")"))})},updateDetails:function(e){var t=this,a=e.data("details"),i=a.html(),r=t.get(e.data("position"));r&&i&&(a.html().replace(/\{(.+?)\}/g,function(e,a){var n=gj.grid.methods.getColumnInfo(t,a);i=i.replace(e,gj.grid.methods.formatText(r[a],n))}),a.html(i))}},events:{detailExpand:function(e,t,a){e.triggerHandler("detailExpand",[t,a])},detailCollapse:function(e,t,a){e.triggerHandler("detailCollapse",[t,a])}},configure:function(e){var t,a=e.data();$.extend(!0,e,gj.grid.plugins.expandCollapseRows.public),void 0!==a.detailTemplate&&(t={title:"",width:a.defaultIconColumnWidth,align:"center",stopPropagation:!0,cssClass:"gj-cursor-pointer gj-unselectable",tmpl:a.icons.expandRow,role:"expander",events:{click:function(t){var a=$(this),i=gj.grid.plugins.expandCollapseRows.private;"details"===a.closest("tr").next().attr("data-role")?(i.detailCollapse(e,a),i.removeSelection(e,t.data.id)):(i.detailExpand(e,$(this)),i.keepSelection(e,t.data.id))}}},a.columns=[t].concat(a.columns),e.on("rowDataBound",function(e,t,i,r){t.data("details",$(a.detailTemplate))}),e.on("columnShow",function(t,a){gj.grid.plugins.expandCollapseRows.private.updateDetailsColSpan(e)}),e.on("columnHide",function(t,a){gj.grid.plugins.expandCollapseRows.private.updateDetailsColSpan(e)}),e.on("rowRemoving",function(t,a,i,r){gj.grid.plugins.expandCollapseRows.private.detailCollapse(e,a.children("td").first())}),e.on("dataBinding",function(){e.collapseAll()}),e.on("pageChanging",function(){e.collapseAll()}),e.on("dataBound",function(){var t,a,i,r,n=e.data();if(n.keepExpandedRows&&$.isArray(n.expandedRows))for(t=0;t<n.expandedRows.length;t++)(i=gj.grid.methods.getRowById(e,n.expandedRows[t]))&&i.length&&(r=gj.grid.methods.getColumnPositionByRole(e,"expander"),(a=i.children("td:eq("+r+")"))&&a.length&&gj.grid.plugins.expandCollapseRows.private.detailExpand(e,a))}))}},gj.grid.plugins.inlineEditing={renderers:{editManager:function(e,t,a,i,r,n){var o=n.data(),d=$(o.inlineEditing.editButton).attr("data-key",r),s=$(o.inlineEditing.deleteButton).attr("data-key",r),l=$(o.inlineEditing.updateButton).attr("data-key",r).hide(),g=$(o.inlineEditing.cancelButton).attr("data-key",r).hide();d.on("click",function(e){n.edit($(this).data("key")),d.hide(),s.hide(),l.show(),g.show()}),s.on("click",function(e){n.removeRow($(this).data("key"))}),l.on("click",function(e){n.update($(this).data("key")),d.show(),s.show(),l.hide(),g.hide()}),g.on("click",function(e){n.cancel($(this).data("key")),d.show(),s.show(),l.hide(),g.hide()}),i.empty().append(d).append(s).append(l).append(g)}}},gj.grid.plugins.inlineEditing.config={base:{defaultColumnSettings:{editor:void 0,mode:"readEdit"},inlineEditing:{mode:"click",managementColumn:!0,managementColumnConfig:{width:300,align:"center",renderer:gj.grid.plugins.inlineEditing.renderers.editManager,cssClass:"gj-grid-management-column"}}},bootstrap:{inlineEditing:{managementColumnConfig:{width:200,align:"center",renderer:gj.grid.plugins.inlineEditing.renderers.editManager,cssClass:"gj-grid-management-column"}}},bootstrap4:{inlineEditing:{managementColumnConfig:{width:200,align:"center",renderer:gj.grid.plugins.inlineEditing.renderers.editManager,cssClass:"gj-grid-management-column"}}}},gj.grid.plugins.inlineEditing.private={localization:function(e){"bootstrap"===e.uiLibrary||"bootstrap4"===e.uiLibrary?(e.inlineEditing.editButton='<button type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> '+gj.grid.messages[e.locale].Edit+"</button>",e.inlineEditing.deleteButton='<button type="button" class="btn btn-default btn-sm gj-margin-left-10"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> '+gj.grid.messages[e.locale].Delete+"</button>",e.inlineEditing.updateButton='<button type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> '+gj.grid.messages[e.locale].Update+"</button>",e.inlineEditing.cancelButton='<button type="button" class="btn btn-default btn-sm gj-margin-left-10"><span class="glyphicon glyphicon-ban-circle" aria-hidden="true"></span> '+gj.grid.messages[e.locale].Cancel+"</button>"):(e.inlineEditing.editButton='<button class="gj-button-md"><i class="material-icons">mode_edit</i> '+gj.grid.messages[e.locale].Edit.toUpperCase()+"</button>",e.inlineEditing.deleteButton='<button class="gj-button-md"><i class="material-icons">delete</i> '+gj.grid.messages[e.locale].Delete.toUpperCase()+"</button>",e.inlineEditing.updateButton='<button class="gj-button-md"><i class="material-icons">check_circle</i> '+gj.grid.messages[e.locale].Update.toUpperCase()+"</button>",e.inlineEditing.cancelButton='<button class="gj-button-md"><i class="material-icons">cancel</i> '+gj.grid.messages[e.locale].Cancel.toUpperCase()+"</button>")},editMode:function(e,t,a,i){var r,n,o,d,s,l=e.data();"edit"!==t.attr("data-mode")&&a.editor&&(gj.grid.plugins.inlineEditing.private.updateOtherCells(e,a.mode),r=t.find('div[data-role="display"]').hide(),0===(n=t.find('div[data-role="edit"]').show()).length&&(n=$('<div data-role="edit" />'),t.append(n)),d="checkbox"===a.type?i[a.field]:r.html(),(o=n.find("input, select, textarea").first()).length?"checkbox"===a.type?o.prop("checked",d):o.val(d):("function"==typeof a.editor?a.editor(n,d,i):((s="object"==typeof a.editor?a.editor:{}).uiLibrary=l.uiLibrary,s.fontSize=e.css("font-size"),"checkbox"===a.type&&gj.checkbox?(o=$('<input type="checkbox" />').prop("checked",d),n.append(o),o.checkbox(s)):"date"===a.type&&gj.datepicker?(o=$('<input type="text" width="100%"/>'),n.append(o),(o=o.datepicker(s)).value&&o.value(r.html())):"dropdown"===a.type&&gj.dropdown?(o=$('<select type="text" width="100%"/>'),n.append(o),(o=o.dropdown(s)).value&&o.value(r.html())):(o=$('<input type="text" value="'+d+'" class="gj-width-full"/>'),"materialdesign"===l.uiLibrary&&o.addClass("gj-textbox-md").css("font-size",e.css("font-size")),n.append(o))),"command"!==l.inlineEditing.mode&&"editOnly"!==a.mode&&(o=n.find("input, select, textarea").first()).on("keyup",function(i){13!==i.keyCode&&27!==i.keyCode||gj.grid.plugins.inlineEditing.private.displayMode(e,t,a)})),"INPUT"===o.prop("tagName").toUpperCase()&&"TEXT"===o.prop("type").toUpperCase()?gj.grid.plugins.inlineEditing.private.setCaretAtEnd(o[0]):o.focus(),t.attr("data-mode","edit"))},setCaretAtEnd:function(e){var t;if(e)if(t=e.value.length,document.selection){e.focus();var a=document.selection.createRange();a.moveStart("character",-t),a.moveStart("character",t),a.moveEnd("character",0),a.select()}else(e.selectionStart||"0"==e.selectionStart)&&(e.selectionStart=t,e.selectionEnd=t,e.focus())},displayMode:function(e,t,a,i){var r,n,o,d,s,l,g;"edit"===t.attr("data-mode")&&"editOnly"!==a.mode&&(r=t.find('div[data-role="edit"]'),n=t.find('div[data-role="display"]'),o=r.find("input, select, textarea").first(),d="checkbox"===a.type?o.prop("checked"):o.val(),g=t.parent().data("position"),l=e.get(g),s="checkbox"===a.type?l[a.field]:n.html(),!0!==i&&d!==s&&(l[a.field]="date"===a.type?gj.core.parseDate(d,a.format):d,"editOnly"!==a.mode&&(gj.grid.methods.renderDisplayElement(e,n,a,l,gj.grid.methods.getId(l,e.data("primaryKey"),g),"update"),0===t.find("span.gj-dirty").length&&t.prepend($('<span class="gj-dirty" />'))),gj.grid.plugins.inlineEditing.events.cellDataChanged(e,t,a,l,s,d),gj.grid.plugins.inlineEditing.private.updateChanges(e,a,l,d)),r.hide(),n.show(),t.attr("data-mode","display"))},updateOtherCells:function(e,t){var a=e.data();"command"!==a.inlineEditing.mode&&"editOnly"!==t&&e.find('div[data-role="edit"]:visible').parent("td").each(function(){var t=$(this),i=a.columns[t.index()];gj.grid.plugins.inlineEditing.private.displayMode(e,t,i)})},updateChanges:function(e,t,a,i){var r,n,o,d=e.data();d.guid||(d.guid=gj.grid.plugins.inlineEditing.private.generateGUID()),d.primaryKey&&((r=JSON.parse(sessionStorage.getItem("gj.grid."+d.guid)))?n=r.filter(function(e){return e[d.primaryKey]===a[d.primaryKey]}):r=[],n&&1===n.length?n[0][t.field]=i:((o={})[d.primaryKey]=a[d.primaryKey],d.primaryKey!==t.field&&(o[t.field]=i),r.push(o)),sessionStorage.setItem("gj.grid."+d.guid,JSON.stringify(r)))},generateGUID:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}},gj.grid.plugins.inlineEditing.public={getChanges:function(){return JSON.parse(sessionStorage.getItem("gj.grid."+this.data().guid))},edit:function(e){var t,a=this.getById(e),i=gj.grid.methods.getRowById(this,e).find("td"),r=this.data("columns");for(t=0;t<i.length;t++)gj.grid.plugins.inlineEditing.private.editMode(this,$(i[t]),r[t],a);return this},update:function(e){var t,a=this.getById(e),i=gj.grid.methods.getRowById(this,e).find("td"),r=this.data("columns");for(t=0;t<i.length;t++)gj.grid.plugins.inlineEditing.private.displayMode(this,$(i[t]),r[t],!1);return gj.grid.plugins.inlineEditing.events.rowDataChanged(this,e,a),this},cancel:function(e){this.getById(e);var t,a=gj.grid.methods.getRowById(this,e).find("td"),i=this.data("columns");for(t=0;t<a.length;t++)gj.grid.plugins.inlineEditing.private.displayMode(this,$(a[t]),i[t],!0);return this}},gj.grid.plugins.inlineEditing.events={cellDataChanged:function(e,t,a,i,r,n){e.triggerHandler("cellDataChanged",[t,a,i,r,n])},rowDataChanged:function(e,t,a){e.triggerHandler("rowDataChanged",[t,a])}},gj.grid.plugins.inlineEditing.configure=function(e,t,a){var i=e.data();$.extend(!0,e,gj.grid.plugins.inlineEditing.public),a.inlineEditing&&(e.on("dataBound",function(){e.find("span.gj-dirty").remove()}),e.on("rowDataBound",function(t,a,i,r){e.cancel(i)})),"command"===i.inlineEditing.mode?(gj.grid.plugins.inlineEditing.private.localization(i),t.inlineEditing.managementColumn&&i.columns.push(t.inlineEditing.managementColumnConfig)):e.on("cellDataBound",function(t,a,r,n,o){n.editor&&("editOnly"===n.mode?gj.grid.plugins.inlineEditing.private.editMode(e,a.parent(),n,o):a.parent("td").on("dblclick"===i.inlineEditing.mode?"dblclick":"click",function(){gj.grid.plugins.inlineEditing.private.editMode(e,a.parent(),n,o)}))})},gj.grid.plugins.optimisticPersistence={config:{base:{optimisticPersistence:{localStorage:void 0,sessionStorage:void 0}}},private:{applyParams:function(e){var t,a=e.data(),i={};(t=JSON.parse(sessionStorage.getItem("gj.grid."+a.guid)))&&t.optimisticPersistence&&$.extend(i,t.optimisticPersistence),(t=JSON.parse(localStorage.getItem("gj.grid."+a.guid)))&&t.optimisticPersistence&&$.extend(i,t.optimisticPersistence),$.extend(a.params,i)},saveParams:function(e){var t,a,i=e.data(),r={optimisticPersistence:{}};if(i.optimisticPersistence.sessionStorage){for(t=0;t<i.optimisticPersistence.sessionStorage.length;t++)a=i.optimisticPersistence.sessionStorage[t],r.optimisticPersistence[a]=i.params[a];r=$.extend(!0,JSON.parse(sessionStorage.getItem("gj.grid."+i.guid)),r),sessionStorage.setItem("gj.grid."+i.guid,JSON.stringify(r))}if(i.optimisticPersistence.localStorage){for(r={optimisticPersistence:{}},t=0;t<i.optimisticPersistence.localStorage.length;t++)a=i.optimisticPersistence.localStorage[t],r.optimisticPersistence[a]=i.params[a];r=$.extend(!0,JSON.parse(localStorage.getItem("gj.grid."+i.guid)),r),localStorage.setItem("gj.grid."+i.guid,JSON.stringify(r))}}},configure:function(e,t,a){t.guid&&(t.optimisticPersistence.localStorage||t.optimisticPersistence.sessionStorage)&&(gj.grid.plugins.optimisticPersistence.private.applyParams(e),e.on("dataBound",function(t){gj.grid.plugins.optimisticPersistence.private.saveParams(e)}))}},gj.grid.plugins.pagination={config:{base:{style:{pager:{panel:"",stateDisabled:"",activeButton:""}},paramNames:{page:"page",limit:"limit"},pager:{limit:10,sizes:[5,10,20,100],leftControls:void 0,rightControls:void 0}},bootstrap:{style:{pager:{panel:"",stateDisabled:""}}},bootstrap4:{style:{pager:{panel:"btn-group",stateDisabled:""}}},glyphicons:{icons:{first:'<span class="glyphicon glyphicon-step-backward"></span>',previous:'<span class="glyphicon glyphicon-backward"></span>',next:'<span class="glyphicon glyphicon-forward"></span>',last:'<span class="glyphicon glyphicon-step-forward"></span>',refresh:'<span class="glyphicon glyphicon-refresh"></span>'}},materialicons:{icons:{first:'<i class="material-icons">first_page</i>',previous:'<i class="material-icons">chevron_left</i>',next:'<i class="material-icons">chevron_right</i>',last:'<i class="material-icons">last_page</i>',refresh:'<i class="material-icons">refresh</i>'}},fontawesome:{icons:{first:'<i class="fa fa-fast-backward" aria-hidden="true"></i>',previous:'<i class="fa fa-backward" aria-hidden="true"></i>',next:'<i class="fa fa-forward" aria-hidden="true"></i>',last:'<i class="fa fa-fast-forward" aria-hidden="true"></i>',refresh:'<i class="fa fa-refresh" aria-hidden="true"></i>'}}},private:{init:function(e){var t,a,i,r,n,o,d,s,l,g;if((i=e.data()).pager)for(i.params[i.paramNames.page]||(i.params[i.paramNames.page]=1),i.params[i.paramNames.limit]||(i.params[i.paramNames.limit]=i.pager.limit),gj.grid.plugins.pagination.private.localization(i),t=$('<tr data-role="pager"/>'),a=$("<th/>"),t.append(a),n=$('<div data-role="display" />').addClass(i.style.pager.panel).css({float:"left"}),o=$('<div data-role="display" />').addClass(i.style.pager.panel).css({float:"right"}),a.append(n).append(o),d=$("<tfoot />").append(t),e.append(d),gj.grid.plugins.pagination.private.updatePagerColSpan(e),s=gj.grid.methods.clone(i.pager.leftControls),$.each(s,function(){n.append(this)}),l=gj.grid.methods.clone(i.pager.rightControls),$.each(l,function(){o.append(this)}),r=e.find("tfoot [data-role]"),g=0;g<r.length;g++)gj.grid.plugins.pagination.private.initPagerControl($(r[g]),e)},localization:function(e){"bootstrap"===e.uiLibrary?gj.grid.plugins.pagination.private.localizationBootstrap(e):"bootstrap4"===e.uiLibrary?gj.grid.plugins.pagination.private.localizationBootstrap4(e):gj.grid.plugins.pagination.private.localizationMaterialDesign(e)},localizationBootstrap:function(e){var t=gj.grid.messages[e.locale];void 0===e.pager.leftControls&&(e.pager.leftControls=[$('<button type="button" class="btn btn-default btn-sm">'+(e.icons.first||t.First)+"</button>").attr("title",t.FirstPageTooltip).attr("data-role","page-first"),$('<button type="button" class="btn btn-default btn-sm">'+(e.icons.previous||t.Previous)+"</button>").attr("title",t.PreviousPageTooltip).attr("data-role","page-previous"),$("<div>"+t.Page+"</div>"),$('<input data-role="page-number" class="form-control input-sm" type="text" value="0">'),$("<div>"+t.Of+"</div>"),$('<div data-role="page-label-last">0</div>'),$('<button type="button" class="btn btn-default btn-sm">'+(e.icons.next||t.Next)+"</button>").attr("title",t.NextPageTooltip).attr("data-role","page-next"),$('<button type="button" class="btn btn-default btn-sm">'+(e.icons.last||t.Last)+"</button>").attr("title",t.LastPageTooltip).attr("data-role","page-last"),$('<button type="button" class="btn btn-default btn-sm">'+(e.icons.refresh||t.Refresh)+"</button>").attr("title",t.Refresh).attr("data-role","page-refresh"),$('<select data-role="page-size" class="form-control input-sm" width="60"></select>')]),void 0===e.pager.rightControls&&(e.pager.rightControls=[$("<div>"+t.DisplayingRecords+"</div>"),$('<div data-role="record-first">0</div>'),$("<div>-</div>"),$('<div data-role="record-last">0</div>'),$("<div>"+t.Of+"</div>"),$('<div data-role="record-total">0</div>')])},localizationBootstrap4:function(e){var t=gj.grid.messages[e.locale];void 0===e.pager.leftControls&&(e.pager.leftControls=[$('<a class="btn btn-default btn-sm gj-cursor-pointer">'+(e.icons.first||t.First)+"</button>").attr("title",t.FirstPageTooltip).attr("data-role","page-first"),$('<a class="btn btn-default btn-sm gj-cursor-pointer">'+(e.icons.previous||t.Previous)+"</button>").attr("title",t.PreviousPageTooltip).attr("data-role","page-previous"),$("<div>"+t.Page+"</div>"),$('<div><input data-role="page-number" class="form-control form-control-sm" type="text" value="0" style="width: 40px; padding: 0; height: 30px; padding-left: 5px;"></div>'),$("<div>"+t.Of+"</div>"),$('<div data-role="page-label-last">0</div>'),$('<a class="btn btn-default btn-sm gj-cursor-pointer">'+(e.icons.next||t.Next)+"</button>").attr("title",t.NextPageTooltip).attr("data-role","page-next"),$('<a class="btn btn-default btn-sm gj-cursor-pointer">'+(e.icons.last||t.Last)+"</button>").attr("title",t.LastPageTooltip).attr("data-role","page-last"),$('<a class="btn btn-default btn-sm gj-cursor-pointer">'+(e.icons.refresh||t.Refresh)+"</button>").attr("title",t.Refresh).attr("data-role","page-refresh"),$('<select data-role="page-size" class="form-control input-sm" style="width: 60px; padding: 0; height: 30px; padding-left: 5px;"></select>')]),void 0===e.pager.rightControls&&(e.pager.rightControls=[$("<div>"+t.DisplayingRecords+" </div>"),$('<div data-role="record-first">0</div>'),$("<div>-</div>"),$('<div data-role="record-last">0</div>'),$("<div>"+t.Of+"</div>"),$('<div data-role="record-total">0</div>')])},localizationMaterialDesign:function(e){var t=gj.grid.messages[e.locale];void 0===e.pager.leftControls&&(e.pager.leftControls=[]),void 0===e.pager.rightControls&&(e.pager.rightControls=[$('<span class="">'+t.RowsPerPage+"</span>"),$('<select data-role="page-size" class="gj-grid-md-limit-select" width="52"></select></div>'),$('<span class="gj-md-spacer-32"> </span>'),$('<span data-role="record-first" class="">0</span>'),$('<span class="">-</span>'),$('<span data-role="record-last" class="">0</span>'),$('<span class="gj-grid-mdl-pager-label">'+t.Of+"</span>"),$('<span data-role="record-total" class="">0</span>'),$('<span class="gj-md-spacer-32"> </span>'),$('<button class="gj-button-md">'+(e.icons.previous||t.Previous)+"</button>").attr("title",t.PreviousPageTooltip).attr("data-role","page-previous").addClass(e.icons.first?"gj-button-md-icon":""),$('<span class="gj-md-spacer-24"> </span>'),$('<button class="gj-button-md">'+(e.icons.next||t.Next)+"</button>").attr("title",t.NextPageTooltip).attr("data-role","page-next").addClass(e.icons.first?"gj-button-md-icon":"")])},initPagerControl:function(e,t){var a=t.data();switch(e.data("role")){case"page-size":a.pager.sizes&&0<a.pager.sizes.length?(e.show(),$.each(a.pager.sizes,function(){e.append($("<option/>").attr("value",this.toString()).text(this.toString()))}),e.change(function(){var e=parseInt(this.value,10);a.params[a.paramNames.limit]=e,gj.grid.plugins.pagination.private.changePage(t,1),gj.grid.plugins.pagination.events.pageSizeChange(t,e)}),e.val(a.params[a.paramNames.limit]),gj.dropdown&&e.dropdown({uiLibrary:a.uiLibrary,iconsLibrary:a.iconsLibrary,fontSize:e.css("font-size"),style:{presenter:"btn btn-default btn-sm"}})):e.hide();break;case"page-refresh":e.on("click",function(){t.reload()})}},reloadPager:function(e,t){var a,i,r,n,o,d,s,l;if((d=e.data()).pager){for(a=0===t?0:parseInt(d.params[d.paramNames.page],10),i=parseInt(d.params[d.paramNames.limit],10),r=Math.ceil(t/i),o=(n=0===a?0:i*(a-1)+1)+i>t?t:n+i-1,s=e.find("TFOOT [data-role]"),l=0;l<s.length;l++)gj.grid.plugins.pagination.private.reloadPagerControl($(s[l]),e,a,r,n,o,t);gj.grid.plugins.pagination.private.updatePagerColSpan(e)}},reloadPagerControl:function(e,t,a,i,r,n,o){var d;switch(e.data("role")){case"page-first":gj.grid.plugins.pagination.private.assignPageHandler(t,e,1,a<2);break;case"page-previous":gj.grid.plugins.pagination.private.assignPageHandler(t,e,a-1,a<2);break;case"page-number":e.val(a).off("change").on("change",gj.grid.plugins.pagination.private.createChangePageHandler(t,a));break;case"page-label-last":e.text(i);break;case"page-next":gj.grid.plugins.pagination.private.assignPageHandler(t,e,a+1,i===a);break;case"page-last":gj.grid.plugins.pagination.private.assignPageHandler(t,e,i,i===a);break;case"page-button-one":d=1===a?1:a==i?a-2:a-1,gj.grid.plugins.pagination.private.assignButtonHandler(t,e,a,d,i);break;case"page-button-two":d=1===a?2:a==i?i-1:a,gj.grid.plugins.pagination.private.assignButtonHandler(t,e,a,d,i);break;case"page-button-three":d=1===a?a+2:a==i?a:a+1,gj.grid.plugins.pagination.private.assignButtonHandler(t,e,a,d,i);break;case"record-first":e.text(r);break;case"record-last":e.text(n);break;case"record-total":e.text(o)}},assignPageHandler:function(e,t,a,i){var r=e.data().style.pager;i?t.addClass(r.stateDisabled).prop("disabled",!0).off("click"):t.removeClass(r.stateDisabled).prop("disabled",!1).off("click").on("click",function(){gj.grid.plugins.pagination.private.changePage(e,a)})},assignButtonHandler:function(e,t,a,i,r){var n=e.data().style.pager;i<1||i>r?t.hide():(t.show().off("click").text(i),i===a?t.addClass(n.activeButton):t.removeClass(n.activeButton).on("click",function(){gj.grid.plugins.pagination.private.changePage(e,i)}))},createChangePageHandler:function(e,t){return function(){e.data();var t=parseInt(this.value,10);gj.grid.plugins.pagination.private.changePage(e,t)}},changePage:function(e,t){var a=e.data();!1===gj.grid.plugins.pagination.events.pageChanging(e,t)||isNaN(t)||(e.find('TFOOT [data-role="page-number"]').val(t),a.params[a.paramNames.page]=t),e.reload()},updatePagerColSpan:function(e){var t=e.find('tfoot > tr[data-role="pager"] > th');t&&t.length&&t.attr("colspan",gj.grid.methods.countVisibleColumns(e))},isLastRecordVisible:function(e){var t=!0,a=e.data(),i=parseInt(a.params[a.paramNames.limit],10),r=parseInt(a.params[a.paramNames.page],10),n=e.count();return i&&r&&(t=(r-1)*i+n===a.totalRecords),t}},public:{getAll:function(e){var t,a,i,r=this.data();return $.isArray(r.dataSource)?e?r.dataSource:r.params[r.paramNames.limit]&&r.params[r.paramNames.page]?(t=parseInt(r.params[r.paramNames.limit],10),a=parseInt(r.params[r.paramNames.page],10),i=(a-1)*t,r.records.slice(i,i+t)):r.records:r.records}},events:{pageSizeChange:function(e,t){e.triggerHandler("pageSizeChange",[t])},pageChanging:function(e,t){e.triggerHandler("pageChanging",[t])}},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.pagination.public);e.data();a.pager&&(gj.grid.methods.isLastRecordVisible=gj.grid.plugins.pagination.private.isLastRecordVisible,e.on("initialized",function(){gj.grid.plugins.pagination.private.init(e)}),e.on("dataBound",function(t,a,i){gj.grid.plugins.pagination.private.reloadPager(e,i)}),e.on("columnShow",function(){gj.grid.plugins.pagination.private.updatePagerColSpan(e)}),e.on("columnHide",function(){gj.grid.plugins.pagination.private.updatePagerColSpan(e)}))}},gj.grid.plugins.responsiveDesign={config:{base:{resizeCheckInterval:500,responsive:!1,showHiddenColumnsAsDetails:!1,defaultColumn:{priority:void 0,minWidth:250},style:{rowDetailItem:""}},bootstrap:{style:{rowDetailItem:"col-lg-4"}}},private:{orderColumns:function(e){var t=[];if(e.columns&&e.columns.length){for(i=0;i<e.columns.length;i++)t.push({position:i,field:e.columns[i].field,minWidth:e.columns[i].width||e.columns[i].minWidth||e.defaultColumn.minWidth,priority:e.columns[i].priority||0});t.sort(function(e,t){var a=0;return e.priority<t.priority?a=-1:e.priority>t.priority&&(a=1),a})}return t},updateDetails:function(e){var t,a,i,r,n,o,d,s,l;for(t=e.find('tbody > tr[data-role="row"]'),a=e.data(),i=0;i<t.length;i++){for(o=(n=$(t[i])).data("details"),r=0;r<a.columns.length;r++)s=a.columns[r],d=o&&o.find('div[data-id="'+s.field+'"]'),a.columns[r].hidden?(l="<b>"+(s.title||s.field)+"</b>: {"+s.field+"}",d&&d.length?d.empty().html(l):((d=$('<div data-id="'+s.field+'"/>').html(l)).addClass(a.style.rowDetailItem),o&&o.length||(o=$('<div class="row"/>')),o.append(d))):d&&d.length&&d.remove();e.updateDetails(n)}}},public:{oldWidth:void 0,resizeCheckIntervalId:void 0,makeResponsive:function(){var e,t,a=0,i=this.data(),r=gj.grid.plugins.responsiveDesign.private.orderColumns(i);for(e=0;e<r.length;e++)(t=this.find("thead>tr>th:eq("+r[e].position+")")).is(":visible")&&r[e].minWidth<t.width()&&(a+=t.width()-r[e].minWidth);if(a)for(e=0;e<r.length;e++)!(t=this.find("thead>tr>th:eq("+r[e].position+")")).is(":visible")&&r[e].minWidth<=a&&(this.showColumn(r[e].field),a-=t.width());for(e=r.length-1;e>=0;e--)(t=this.find("thead>tr>th:eq("+r[e].position+")")).is(":visible")&&r[e].priority&&r[e].minWidth>t.outerWidth()&&this.hideColumn(r[e].field)}},events:{resize:function(e,t,a){e.triggerHandler("resize",[t,a])}},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.responsiveDesign.public),t.responsive&&(e.on("initialized",function(){e.makeResponsive(),e.oldWidth=e.width(),e.resizeCheckIntervalId=setInterval(function(){var t=e.width();t!==e.oldWidth&&gj.grid.plugins.responsiveDesign.events.resize(e,t,e.oldWidth),e.oldWidth=t},t.resizeCheckInterval)}),e.on("destroy",function(){e.resizeCheckIntervalId&&clearInterval(e.resizeCheckIntervalId)}),e.on("resize",function(){e.makeResponsive()})),t.showHiddenColumnsAsDetails&&gj.grid.plugins.expandCollapseRows&&(e.on("dataBound",function(){gj.grid.plugins.responsiveDesign.private.updateDetails(e)}),e.on("columnHide",function(){gj.grid.plugins.responsiveDesign.private.updateDetails(e)}),e.on("columnShow",function(){gj.grid.plugins.responsiveDesign.private.updateDetails(e)}),e.on("rowDataBound",function(){gj.grid.plugins.responsiveDesign.private.updateDetails(e)}))}},gj.grid.plugins.toolbar={config:{base:{toolbarTemplate:void 0,title:void 0,style:{toolbar:"gj-grid-md-toolbar"}},bootstrap:{style:{toolbar:"gj-grid-bootstrap-toolbar"}},bootstrap4:{style:{toolbar:"gj-grid-bootstrap-4-toolbar"}}},private:{init:function(e){var t,a,i;t=e.data(),a=e.prev('div[data-role="toolbar"]'),(void 0!==t.toolbarTemplate||void 0!==t.title||a.length>0)&&(0===a.length&&(a=$('<div data-role="toolbar"></div>'),e.before(a)),a.addClass(t.style.toolbar),0===a.children().length&&t.toolbarTemplate&&a.append(t.toolbarTemplate),0===(i=a.find('[data-role="title"]')).length&&(i=$('<div data-role="title"/>'),a.prepend(i)),t.title&&i.text(t.title),t.minWidth&&a.css("min-width",t.minWidth))}},public:{title:function(e){var t=this.parent().find('div[data-role="toolbar"] [data-role="title"]');return void 0!==e?(t.text(e),this):t.text()}},configure:function(e){$.extend(!0,e,gj.grid.plugins.toolbar.public),e.on("initialized",function(){gj.grid.plugins.toolbar.private.init(e)}),e.on("destroying",function(){e.prev('[data-role="toolbar"]').remove()})}},gj.grid.plugins.resizableColumns={config:{base:{resizableColumns:!1}},private:{init:function(e,t){var a,i,r,n,o,d;if((a=e.find('thead tr[data-role="caption"] th')).length)for(r=0;r<a.length-1;r++)i=$(a[r]),n=$('<div class="gj-grid-column-resizer-wrapper" />'),d=parseInt(i.css("padding-right"),10)+3,(o=$('<span class="gj-grid-column-resizer" />').css("margin-right","-"+d+"px")).draggable({start:function(){e.addClass("gj-unselectable"),e.addClass("gj-grid-resize-cursor")},stop:function(){e.removeClass("gj-unselectable"),e.removeClass("gj-grid-resize-cursor"),this.style.removeProperty("top"),this.style.removeProperty("left"),this.style.removeProperty("position")},drag:gj.grid.plugins.resizableColumns.private.createResizeHandle(e,i,t.columns[r])}),i.append(n.append(o))},createResizeHandle:function(e,t,a){return function(e,i){var r,n=parseInt(t.attr("width"),10);n||(n=t.outerWidth()),i&&i.left&&(r=n+i.left,a.width=r,t.attr("width",r))}}},public:{},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.resizableColumns.public),t.resizableColumns&&gj.draggable&&e.on("initialized",function(){gj.grid.plugins.resizableColumns.private.init(e,t)})}},gj.grid.plugins.rowReorder={config:{base:{rowReorder:!1,rowReorderColumn:void 0,orderNumberField:void 0,style:{targetRowIndicatorTop:"gj-grid-row-reorder-indicator-top",targetRowIndicatorBottom:"gj-grid-row-reorder-indicator-bottom"}}},private:{init:function(e){var t,a,i,r=e.find('tbody tr[data-role="row"]');for(e.data("rowReorderColumn")&&(a=gj.grid.methods.getColumnPosition(e.data("columns"),e.data("rowReorderColumn"))),t=0;t<r.length;t++)i=$(r[t]),void 0!==a?i.find("td:eq("+a+")").on("mousedown",gj.grid.plugins.rowReorder.private.createRowMouseDownHandler(e,i)):i.on("mousedown",gj.grid.plugins.rowReorder.private.createRowMouseDownHandler(e,i))},createRowMouseDownHandler:function(e,t){return function(a){var i,r,n=e.clone(),o=e.data("columns");for(e.addClass("gj-unselectable"),$("body").append(n),n.attr("data-role","draggable-clone").css("cursor","move"),n.children("thead").remove().children("tfoot").remove(),n.find('tbody tr:not([data-position="'+t.data("position")+'"])').remove(),r=n.find("tbody tr td"),i=0;i<r.length;i++)o[i].width&&r[i].setAttribute("width",o[i].width);n.draggable({stop:gj.grid.plugins.rowReorder.private.createDragStopHandler(e,t)}),n.css({position:"absolute",top:t.offset().top,left:t.offset().left,width:t.width(),zIndex:1}),"true"===t.attr("data-droppable")&&t.droppable("destroy"),t.siblings('tr[data-role="row"]').each(function(){var e=$(this);"true"===e.attr("data-droppable")&&e.droppable("destroy"),e.droppable({over:gj.grid.plugins.rowReorder.private.createDroppableOverHandler(t),out:gj.grid.plugins.rowReorder.private.droppableOut})}),n.trigger("mousedown")}},createDragStopHandler:function(e,t){return function(a,i){$('table[data-role="draggable-clone"]').draggable("destroy").remove(),e.removeClass("gj-unselectable"),t.siblings('tr[data-role="row"]').each(function(){var a,r,n,o,d,s=$(this),l=s.data("position"),g=t.data("position"),c=e.data();if(s.droppable("isOver",i)){for(l<g?s.before(t):s.after(t),c.records.splice(l-1,0,c.records.splice(g-1,1)[0]),a=s.parent().find('tr[data-role="row"]'),n=0;n<a.length;n++)$(a[n]).attr("data-position",n+1);if(c.orderNumberField){for(n=0;n<c.records.length;n++)c.records[n][c.orderNumberField]=n+1;for(n=0;n<a.length;n++)r=$(a[n]),d=gj.grid.methods.getId(r,c.primaryKey,r.attr("data-position")),o=gj.grid.methods.getByPosition(e,r.attr("data-position")),e.setCellContent(d,c.orderNumberField,o[c.orderNumberField])}}s.removeClass("gj-grid-top-border"),s.removeClass("gj-grid-bottom-border"),s.droppable("destroy")})}},createDroppableOverHandler:function(e){return function(t){var a=$(this);a.data("position")<e.data("position")?a.addClass("gj-grid-top-border"):a.addClass("gj-grid-bottom-border")}},droppableOut:function(){$(this).removeClass("gj-grid-top-border"),$(this).removeClass("gj-grid-bottom-border")}},public:{},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.rowReorder.public),t.rowReorder&&gj.draggable&&gj.droppable&&e.on("dataBound",function(){gj.grid.plugins.rowReorder.private.init(e)})}},gj.grid.plugins.columnReorder={config:{base:{columnReorder:!1,style:{targetRowIndicatorTop:"gj-grid-row-reorder-indicator-top",targetRowIndicatorBottom:"gj-grid-row-reorder-indicator-bottom"}}},private:{init:function(e){var t,a,i=e.find("thead tr th");for(t=0;t<i.length;t++)(a=$(i[t])).on("mousedown",gj.grid.plugins.columnReorder.private.createMouseDownHandler(e,a))},createMouseDownHandler:function(e,t){return function(a){var i=e.clone(),r=t.index();e.addClass("gj-unselectable"),$("body").append(i),i.attr("data-role","draggable-clone").css("cursor","move"),i.find("thead tr th:eq("+r+")").siblings().remove(),i.find('tbody tr[data-role != "row"]').remove(),i.find("tbody tr td:nth-child("+(r+1)+")").siblings().remove(),i.find("tfoot").remove(),i.draggable({stop:gj.grid.plugins.columnReorder.private.createDragStopHandler(e,t)}),i.css({position:"absolute",top:t.offset().top,left:t.offset().left,width:t.width(),zIndex:1}),"true"===t.attr("data-droppable")&&t.droppable("destroy"),t.siblings("th").each(function(){var a=$(this);"true"===a.attr("data-droppable")&&a.droppable("destroy"),a.droppable({over:gj.grid.plugins.columnReorder.private.createDroppableOverHandler(e,t),out:gj.grid.plugins.columnReorder.private.droppableOut})}),i.trigger("mousedown")}},createDragStopHandler:function(e,t){return function(a,i){$('table[data-role="draggable-clone"]').draggable("destroy").remove(),e.removeClass("gj-unselectable"),t.siblings("th").each(function(){var a=$(this),r=e.data(),n=gj.grid.methods.getColumnPosition(r.columns,a.data("field")),o=gj.grid.methods.getColumnPosition(r.columns,t.data("field"));a.removeClass("gj-grid-left-border").removeClass("gj-grid-right-border"),a.closest("table").find('tbody tr[data-role="row"] td:nth-child('+(a.index()+1)+")").removeClass("gj-grid-left-border").removeClass("gj-grid-right-border"),a.droppable("isOver",i)&&(n<o?a.before(t):a.after(t),gj.grid.plugins.columnReorder.private.moveRowCells(e,o,n),r.columns.splice(n,0,r.columns.splice(o,1)[0])),a.droppable("destroy")})}},moveRowCells:function(e,t,a){var i,r,n=e.find('tbody tr[data-role="row"]');for(i=0;i<n.length;i++)r=$(n[i]),a<t?r.find("td:eq("+a+")").before(r.find("td:eq("+t+")")):r.find("td:eq("+a+")").after(r.find("td:eq("+t+")"))},createDroppableOverHandler:function(e,t){return function(a){var i=$(this),r=e.data();gj.grid.methods.getColumnPosition(r.columns,i.data("field"))<gj.grid.methods.getColumnPosition(r.columns,t.data("field"))?(i.addClass("gj-grid-left-border"),e.find('tbody tr[data-role="row"] td:nth-child('+(i.index()+1)+")").addClass("gj-grid-left-border")):(i.addClass("gj-grid-right-border"),e.find('tbody tr[data-role="row"] td:nth-child('+(i.index()+1)+")").addClass("gj-grid-right-border"))}},droppableOut:function(){var e=$(this);e.removeClass("gj-grid-left-border").removeClass("gj-grid-right-border"),e.closest("table").find('tbody tr[data-role="row"] td:nth-child('+(e.index()+1)+")").removeClass("gj-grid-left-border").removeClass("gj-grid-right-border")}},public:{},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.columnReorder.public),t.columnReorder&&e.on("initialized",function(){gj.grid.plugins.columnReorder.private.init(e)})}},gj.grid.plugins.headerFilter={config:{base:{defaultColumnSettings:{filterable:!0},headerFilter:{type:"onenterkeypress"}}},private:{init:function(e){var t,a,i,r=e.data(),n=$('<tr data-role="filter"/>');for(t=0;t<r.columns.length;t++)a=$("<th/>"),r.columns[t].filterable&&(i=$('<input data-field="'+r.columns[t].field+'" class="gj-width-full" />'),"onchange"===r.headerFilter.type?i.on("input propertychange",function(t){gj.grid.plugins.headerFilter.private.reload(e,$(this))}):(i.on("keypress",function(t){13==t.which&&gj.grid.plugins.headerFilter.private.reload(e,$(this))}),i.on("blur",function(t){gj.grid.plugins.headerFilter.private.reload(e,$(this))})),a.append(i)),r.columns[t].hidden&&a.hide(),n.append(a);e.children("thead").append(n)},reload:function(e,t){var a={};a[t.data("field")]=t.val(),e.reload(a)}},public:{},events:{},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.headerFilter.public);e.data();a.headerFilter&&e.on("initialized",function(){gj.grid.plugins.headerFilter.private.init(e)})}},gj.grid.plugins.grouping={config:{base:{paramNames:{groupBy:"groupBy",groupByDirection:"groupByDirection"},grouping:{groupBy:void 0,direction:"asc"},icons:{expandGroup:'<i class="material-icons">add</i>',collapseGroup:'<i class="material-icons">remove</i>'}},fontawesome:{icons:{expandGroup:'<i class="fa fa-plus" aria-hidden="true"></i>',collapseGroup:'<i class="fa fa-minus" aria-hidden="true"></i>'}},glyphicons:{icons:{expandGroup:'<span class="glyphicon glyphicon-plus" />',collapseGroup:'<span class="glyphicon glyphicon-minus" />'}}},private:{init:function(e){var t,a=e.data();t=void 0,e.on("rowDataBound",function(i,r,n,o){if(t!==o[a.grouping.groupBy]){var d=gj.grid.methods.countVisibleColumns(e)-1,s=$('<tr data-role="group" />'),l=$('<td class="gj-text-align-center gj-unselectable gj-cursor-pointer" />');l.append('<div data-role="display">'+a.icons.collapseGroup+"</div>"),l.on("click",gj.grid.plugins.grouping.private.createExpandCollapseHandler(a)),s.append(l),s.append('<td colspan="'+d+'"><div data-role="display">'+a.grouping.groupBy+": "+o[a.grouping.groupBy]+"</div></td>"),s.insertBefore(r),t=o[a.grouping.groupBy]}r.show()}),a.params[a.paramNames.groupBy]=a.grouping.groupBy,a.params[a.paramNames.groupByDirection]=a.grouping.direction},grouping:function(e,t){var a=e.data();t.sort(gj.grid.methods.createDefaultSorter(a.grouping.direction,a.grouping.groupBy))},createExpandCollapseHandler:function(e){return function(t){var a=$(this),i=a.children('div[data-role="display"]'),r=a.closest("tr");"row"===r.next(":visible").data("role")?(r.nextUntil('[data-role="group"]').hide(),i.empty().append(e.icons.expandGroup)):(r.nextUntil('[data-role="group"]').show(),i.empty().append(e.icons.collapseGroup))}}},public:{},configure:function(e){var t,a=e.data();$.extend(!0,e,gj.grid.plugins.grouping.public),a.grouping&&a.grouping.groupBy&&(t={title:"",width:a.defaultIconColumnWidth,align:"center",stopPropagation:!0,cssClass:"gj-cursor-pointer gj-unselectable"},a.columns=[t].concat(a.columns),e.on("initialized",function(){gj.grid.plugins.grouping.private.init(e)}),e.on("dataFiltered",function(t,a){gj.grid.plugins.grouping.private.grouping(e,a)}))}},gj.grid.plugins.fixedHeader={config:{base:{fixedHeader:!1,height:300}},private:{init:function(e){var t=e.data(),a=e.children("tbody"),i=e.children("thead"),r=t.height-i.outerHeight()-(e.children("tfoot").outerHeight()||0);e.addClass("gj-grid-scrollable"),a.css("width",i.outerWidth()),a.height(r)},refresh:function(e){e.data();var t,a,i=e.children("tbody"),r=e.children("thead"),n=e.find('tbody tr[data-role="row"] td'),o=e.find('thead tr[data-role="caption"] th');for(e.children("tbody").height()<gj.grid.plugins.fixedHeader.private.getRowsHeight(e)?i.css("width",r.outerWidth()+gj.grid.plugins.fixedHeader.private.getScrollBarWidth()+(navigator.userAgent.toLowerCase().indexOf("firefox")>-1?1:0)):i.css("width",r.outerWidth()),t=0;t<o.length;t++)a=$(o[t]).outerWidth(),0===t&&gj.core.isIE()&&(a-=1),$(n[t]).attr("width",a)},getRowsHeight:function(e){var t=0;return e.find("tbody tr").each(function(){t+=$(this).height()}),t},getScrollBarWidth:function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var a=e.offsetWidth;t.style.overflow="scroll";var i=e.offsetWidth;return a==i&&(i=t.clientWidth),document.body.removeChild(t),a-i}},public:{},events:{},configure:function(e,t,a){$.extend(!0,e,gj.grid.plugins.fixedHeader.public);e.data();a.fixedHeader&&(e.on("initialized",function(){gj.grid.plugins.fixedHeader.private.init(e)}),e.on("dataBound",function(){gj.grid.plugins.fixedHeader.private.refresh(e)}),e.on("resize",function(){gj.grid.plugins.fixedHeader.private.refresh(e)}))}},gj.grid.messages["bg-bg"]={First:"?????",Previous:"????????",Next:"????????",Last:"????????",Page:"????????",FirstPageTooltip:"????? ????????",PreviousPageTooltip:"???????? ????????",NextPageTooltip:"???????? ????????",LastPageTooltip:"???????? ????????",Refresh:"????????????",Of:"??",DisplayingRecords:"???????? ??????",RowsPerPage:"?????? ?? ????????:",Edit:"???????????",Delete:"?????????",Update:"????????????",Cancel:"?????",NoRecordsFound:"???? ???????? ??????.",Loading:"?????????..."},gj.grid.messages["fr-fr"]={First:"Premier",Previous:"Précédent",Next:"Prochain",Last:"Dernier",Page:"Page",FirstPageTooltip:"Première page",PreviousPageTooltip:"Page précédente",NextPageTooltip:"Page suivante",LastPageTooltip:"Dernière page",Refresh:"Rafraîchir",Of:"de",DisplayingRecords:"Résultats",RowsPerPage:"Lignes par page:",Edit:"Modifier",Delete:"Effacer",Update:"Mettre à jour",Cancel:"Annuler",NoRecordsFound:"Aucun enregistrement trouvé.",Loading:"Chargement..."},gj.grid.messages["de-de"]={First:"Erste",Previous:"Vorherige",Next:"Nächste",Last:"Letzte",Page:"Seite",FirstPageTooltip:"Erste Seite",PreviousPageTooltip:"Vorherige Seite",NextPageTooltip:"Nächste Seite",LastPageTooltip:"Letzte Seite",Refresh:"Aktualisieren",Of:"von",DisplayingRecords:"Zeige Datensätze",RowsPerPage:"Zeilen pro Seite:",Edit:"Editieren",Delete:"Löschen",Update:"Aktualisieren",Cancel:"Abbrechen",NoRecordsFound:"Es wurden keine Datensätze gefunden.",Loading:"Laden..."},gj.grid.messages["pt-br"]={First:"Primeiro",Previous:"Anterior",Next:"Próximo",Last:"Último",Page:"Página",FirstPageTooltip:"Primeira página",PreviousPageTooltip:"Página anterior",NextPageTooltip:"Próxima página",LastPageTooltip:"Última Página",Refresh:"Atualizar",Of:"de",DisplayingRecords:"Mostrando registros",RowsPerPage:"Linhas por página:",Edit:"Editar",Delete:"Excluir",Update:"Alterar",Cancel:"Cancelar",NoRecordsFound:"Nenhum registro encontrado.",Loading:"Carregando..."},void 0===gj.gjtree&&(gj.gjtree={plugins:{}}),gj.gjtree.config={base:{params:{},autoLoad:!0,selectionType:"single",cascadeSelection:!1,dataSource:void 0,primaryKey:void 0,textField:"text",childrenField:"children",hasChildrenField:"hasChildren",imageCssClassField:"imageCssClass",imageUrlField:"imageUrl",imageHtmlField:"imageHtml",disabledField:"disabled",width:void 0,border:!1,uiLibrary:"materialdesign",iconsLibrary:"materialicons",autoGenId:1,indentation:24,style:{wrapper:"gj-unselectable",list:"gj-list gj-list-md",item:void 0,active:"gj-list-md-active",leafIcon:void 0,border:"gj-gjtree-md-border"},icons:{expand:'<i class="material-icons">keyboard_arrow_right</i>',collapse:'<i class="material-icons">keyboard_arrow_down</i>'}},bootstrap:{style:{wrapper:"gj-unselectable gj-gjtree-bootstrap-3",list:"gj-list gj-list-bootstrap list-group",item:"list-group-item",active:"active",border:"gj-gjtree-bootstrap-border"},iconsLibrary:"glyphicons"},bootstrap4:{style:{wrapper:"gj-unselectable gj-gjtree-bootstrap-4",list:"gj-list gj-list-bootstrap",item:"list-group-item",active:"active",border:"gj-gjtree-bootstrap-border"}},materialicons:{style:{expander:"gj-gjtree-material-icons-expander"}},fontawesome:{style:{expander:"gj-gjtree-font-awesome-expander"},icons:{expand:'<i class="fa fa-plus" aria-hidden="true"></i>',collapse:'<i class="fa fa-minus" aria-hidden="true"></i>'}},glyphicons:{style:{expander:"gj-gjtree-glyphicons-expander"},icons:{expand:'<span class="glyphicon glyphicon-plus" />',collapse:'<span class="glyphicon glyphicon-minus" />'}}},gj.gjtree.events={initialized:function(e){e.triggerHandler("initialized")},dataBinding:function(e){e.triggerHandler("dataBinding")},dataBound:function(e){e.triggerHandler("dataBound")},select:function(e,t,a){return e.triggerHandler("select",[t,a])},unselect:function(e,t,a){return e.triggerHandler("unselect",[t,a])},expand:function(e,t,a){return e.triggerHandler("expand",[t,a])},collapse:function(e,t,a){return e.triggerHandler("collapse",[t,a])},enable:function(e,t){return e.triggerHandler("enable",[t])},disable:function(e,t){return e.triggerHandler("disable",[t])},destroying:function(e){return e.triggerHandler("destroying")},nodeDataBound:function(e,t,a,i){return e.triggerHandler("nodeDataBound",[t,a,i])}},gj.gjtree.methods={init:function(e){return gj.widget.prototype.init.call(this,e,"gjtree"),gj.gjtree.methods.initialize.call(this),this.data("autoLoad")&&this.reload(),this},initialize:function(){var e=this.data(),t=$('<ul class="'+e.style.list+'"/>');this.empty().addClass(e.style.wrapper).append(t),e.width&&this.width(e.width),e.border&&this.addClass(e.style.border),gj.gjtree.events.initialized(this)},useHtmlDataSource:function(e,t){t.dataSource=[]},render:function(e,t){return t&&("string"==typeof t&&JSON&&(t=JSON.parse(t)),e.data("records",gj.gjtree.methods.getRecords(e,t)),gj.gjtree.methods.loadData(e)),e},filter:function(e){return e.data().dataSource},getRecords:function(e,t){var a,i,r=[],n=e.data();for(a=0;a<t.length;a++)i={id:n.primaryKey?t[a][n.primaryKey]:n.autoGenId++,data:t[a]},t[a][n.childrenField]&&t[a][n.childrenField].length?(i.children=gj.gjtree.methods.getRecords(e,t[a][n.childrenField]),delete t[a][n.childrenField]):i.children=[],r.push(i);return r},loadData:function(e){var t,a=e.data("records"),i=e.children("ul");for(gj.gjtree.events.dataBinding(e),i.off().empty(),t=0;t<a.length;t++)gj.gjtree.methods.appendNode(e,i,a[t],1);gj.gjtree.events.dataBound(e)},appendNode:function(e,t,a,i,r){var n,o,d,s,l=e.data(),g=$('<li data-id="'+a.id+'" data-role="node" />').addClass(l.style.item),c=$('<div data-role="wrapper" />'),p=$('<span data-role="expander" data-mode="close"></span>').addClass(l.style.expander),u=$('<span data-role="display">'+a.data[l.textField]+"</span>"),h=void 0!==a.data[l.hasChildrenField]&&"true"===a.data[l.hasChildrenField].toString().toLowerCase(),f=void 0!==a.data[l.disabledField]&&"true"===a.data[l.disabledField].toString().toLowerCase();if(l.indentation&&c.append('<span data-role="spacer" style="width: '+l.indentation*(i-1)+'px;"></span>'),f?gj.gjtree.methods.disableNode(e,g):(p.on("click",gj.gjtree.methods.expanderClickHandler(e)),u.on("click",gj.gjtree.methods.displayClickHandler(e))),c.append(p),c.append(u),g.append(c),r?t.find("li:eq("+(r-1)+")").before(g):t.append(g),a.children.length||h)for(p.empty().append(l.icons.expand),o=$("<ul />").addClass(l.style.list).addClass("gj-hidden"),g.append(o),n=0;n<a.children.length;n++)gj.gjtree.methods.appendNode(e,o,a.children[n],i+1);else l.style.leafIcon?p.addClass(l.style.leafIcon):p.html(" ");l.imageCssClassField&&a.data[l.imageCssClassField]?$('<span data-role="image"><span class="'+a.data[l.imageCssClassField]+'"></span></span>').insertBefore(u):l.imageUrlField&&a.data[l.imageUrlField]?((d=$('<span data-role="image"></span>')).insertBefore(u),(s=$('<img src="'+a.data[l.imageUrlField]+'"></img>')).attr("width",d.width()).attr("height",d.height()),d.append(s)):l.imageHtmlField&&a.data[l.imageHtmlField]&&(d=$('<span data-role="image">'+a.data[l.imageHtmlField]+"</span>")).insertBefore(u),gj.gjtree.events.nodeDataBound(e,g,a.id,a.data)},expanderClickHandler:function(e){return function(t){var a=$(this),i=a.closest("li");"close"===a.attr("data-mode")?e.expand(i):e.collapse(i)}},expand:function(e,t,a){var i,r,n=t.find('>[data-role="wrapper"]>[data-role="expander"]'),o=e.data(),d=t.attr("data-id"),s=t.children("ul");if(!1!==gj.gjtree.events.expand(e,t,d)&&s&&s.length&&(s.show(),n.attr("data-mode","open"),n.empty().append(o.icons.collapse),a))for(i=t.find("ul>li"),r=0;r<i.length;r++)gj.gjtree.methods.expand(e,$(i[r]),a);return e},collapse:function(e,t,a){var i,r,n=t.find('>[data-role="wrapper"]>[data-role="expander"]'),o=e.data(),d=t.attr("data-id"),s=t.children("ul");if(!1!==gj.gjtree.events.collapse(e,t,d)&&s&&s.length&&(s.hide(),n.attr("data-mode","close"),n.empty().append(o.icons.expand),a))for(i=t.find("ul>li"),r=0;r<i.length;r++)gj.gjtree.methods.collapse(e,$(i[r]),a);return e},expandAll:function(e){var t,a=e.find("ul>li");for(t=0;t<a.length;t++)gj.gjtree.methods.expand(e,$(a[t]),!0);return e},collapseAll:function(e){var t,a=e.find("ul>li");for(t=0;t<a.length;t++)gj.gjtree.methods.collapse(e,$(a[t]),!0);return e},displayClickHandler:function(e){return function(t){var a=$(this).closest("li"),i=e.data().cascadeSelection;"true"===a.attr("data-selected")?gj.gjtree.methods.unselect(e,a,i):("single"===e.data("selectionType")&&gj.gjtree.methods.unselectAll(e),gj.gjtree.methods.select(e,a,i))}},selectAll:function(e){var t,a=e.find("ul>li");for(t=0;t<a.length;t++)gj.gjtree.methods.select(e,$(a[t]),!0);return e},select:function(e,t,a){var i,r,n=e.data();if("true"!==t.attr("data-selected")&&!1!==gj.gjtree.events.select(e,t,t.attr("data-id"))&&(t.addClass(n.style.active).attr("data-selected","true"),a))for(r=t.find("ul>li"),i=0;i<r.length;i++)gj.gjtree.methods.select(e,$(r[i]),a)},unselectAll:function(e){var t,a=e.find("ul>li");for(t=0;t<a.length;t++)gj.gjtree.methods.unselect(e,$(a[t]),!0);return e},unselect:function(e,t,a){var i,r;e.data();if("true"===t.attr("data-selected")&&!1!==gj.gjtree.events.unselect(e,t,t.attr("data-id"))&&(t.removeClass(e.data().style.active).removeAttr("data-selected"),a))for(r=t.find("ul>li"),i=0;i<r.length;i++)gj.gjtree.methods.unselect(e,$(r[i]),a)},getSelections:function(e){var t,a,i,r=[],n=e.children("li");if(n&&n.length)for(t=0;t<n.length;t++)"true"===(a=$(n[t])).attr("data-selected")?r.push(a.attr("data-id")):a.has("ul")&&(i=gj.gjtree.methods.getSelections(a.children("ul"))).length&&(r=r.concat(i));return r},getById:function(e,t,a){var i,r=void 0;for(i=0;i<a.length;i++){if(t==a[i].id){r=a[i];break}if(a[i].children&&a[i].children.length&&(r=gj.gjtree.methods.getById(e,t,a[i].children)))break}return r},getDataById:function(e,t,a){var i=gj.gjtree.methods.getById(e,t,a);return i?i.data:i},getDataByText:function(e,t,a){var i,r=void 0,n=e.data();for(i=0;i<a.length;i++){if(t===a[i].data[n.textField]){r=a[i].data;break}if(a[i].children&&a[i].children.length&&(r=gj.gjtree.methods.getDataByText(e,t,a[i].children)))break}return r},getNodeById:function(e,t){var a,i,r=void 0,n=e.children("li");if(n&&n.length)for(a=0;a<n.length;a++){if(i=$(n[a]),t==i.attr("data-id")){r=i;break}if(i.has("ul")&&(r=gj.gjtree.methods.getNodeById(i.children("ul"),t)))break}return r},getNodeByText:function(e,t){var a,i,r=void 0,n=e.children("li");if(n&&n.length)for(a=0;a<n.length;a++){if(i=$(n[a]),t===i.find('>[data-role="wrapper"]>[data-role="display"]').text()){r=i;break}if(i.has("ul")&&(r=gj.gjtree.methods.getNodeByText(i.children("ul"),t)))break}return r},addNode:function(e,t,a,i){var r,n=gj.gjtree.methods.getRecords(e,[t])[0];return a&&a.length?("li"===a[0].tagName.toLowerCase()&&(a=a.children("ul")),gj.gjtree.methods.getById(e,a.parent().data("id"),e.data("records")).children.push(n)):(a=e.children("ul"),e.data("records").push(n)),r=a.parentsUntil('[data-type="gjtree"]',"ul").length+1,gj.gjtree.methods.appendNode(e,a,n,r,i),e},remove:function(e,t){return gj.gjtree.methods.removeDataById(e,t.attr("data-id"),e.data("records")),t.remove(),e},removeDataById:function(e,t,a){var i;for(i=0;i<a.length;i++){if(t==a[i].id){a.splice(i,1);break}a[i].children&&a[i].children.length&&gj.gjtree.methods.removeDataById(e,t,a[i].children)}},getChildren:function(e,t,a){var i,r,n=[];for(r=(a=void 0===a||a)?t.find("ul li"):t.find(">ul>li"),i=0;i<r.length;i++)n.push($(r[i]).data("id"));return n},enableAll:function(e){var t,a=e.find("ul>li");for(t=0;t<a.length;t++)gj.gjtree.methods.enableNode(e,$(a[t]),!0);return e},enableNode:function(e,t,a){var i,r,n=t.find('>[data-role="wrapper"]>[data-role="expander"]'),o=t.find('>[data-role="wrapper"]>[data-role="display"]'),a=void 0===a||a;if(t.removeClass("disabled"),n.on("click",gj.gjtree.methods.expanderClickHandler(e)),o.on("click",gj.gjtree.methods.displayClickHandler(e)),gj.gjtree.events.enable(e,t),a)for(r=t.find("ul>li"),i=0;i<r.length;i++)gj.gjtree.methods.enableNode(e,$(r[i]),a)},disableAll:function(e){var t,a=e.find("ul>li");for(t=0;t<a.length;t++)gj.gjtree.methods.disableNode(e,$(a[t]),!0);return e},disableNode:function(e,t,a){var i,r,n=t.find('>[data-role="wrapper"]>[data-role="expander"]'),o=t.find('>[data-role="wrapper"]>[data-role="display"]'),a=void 0===a||a;if(t.addClass("disabled"),n.off("click"),o.off("click"),gj.gjtree.events.disable(e,t),a)for(r=t.find("ul>li"),i=0;i<r.length;i++)gj.gjtree.methods.disableNode(e,$(r[i]),a)},destroy:function(e){return e.data()&&(gj.gjtree.events.destroying(e),e.xhr&&e.xhr.abort(),e.off(),e.removeData(),e.removeAttr("data-type"),e.removeClass().empty()),e}},gj.gjtree.widget=function(e,t){var a=this,i=gj.gjtree.methods;return a.reload=function(e){return gj.widget.prototype.reload.call(this,e)},a.render=function(e){return i.render(this,e)},a.addNode=function(e,t,a){return i.addNode(this,e,t,a)},a.removeNode=function(e){return i.remove(this,e)},a.destroy=function(){return i.destroy(this)},a.expand=function(e,t){return i.expand(this,e,t)},a.collapse=function(e,t){return i.collapse(this,e,t)},a.expandAll=function(){return i.expandAll(this)},a.collapseAll=function(){return i.collapseAll(this)},a.getDataById=function(e){return i.getDataById(this,e,this.data("records"))},a.getDataByText=function(e){return i.getDataByText(this,e,this.data("records"))},a.getNodeById=function(e){return i.getNodeById(this.children("ul"),e)},a.getNodeByText=function(e){return i.getNodeByText(this.children("ul"),e)},a.select=function(e){return i.select(this,e)},a.unselect=function(e){return i.unselect(this,e)},a.selectAll=function(){return i.selectAll(this)},a.unselectAll=function(){return i.unselectAll(this)},a.getSelections=function(){return i.getSelections(this.children("ul"))},a.getChildren=function(e,t){return i.getChildren(this,e,t)},a.enable=function(e,t){return i.enableNode(this,e,t)},a.enableAll=function(){return i.enableAll(this)},a.disable=function(e,t){return i.disableNode(this,e,t)},a.disableAll=function(){return i.disableAll(this)},$.extend(e,a),"gjtree"!==e.attr("data-type")&&i.init.call(e,t),e},gj.gjtree.widget.prototype=new gj.widget,gj.gjtree.widget.constructor=gj.gjtree.widget,jQuery.fn.gjtree=function(e){var t;if(this&&this.length){if("object"!=typeof e&&e){if((t=new gj.gjtree.widget(this,null))[e])return t[e].apply(this,Array.prototype.slice.call(arguments,1));throw"Method "+e+" does not exist."}return new gj.gjtree.widget(this,e)}},gj.gjtree.plugins.checkboxes={config:{base:{checkboxes:void 0,checkedField:"checked",cascadeCheck:!0}},private:{dataBound:function(e){var t=e.find('li[data-role="node"]');$.each(t,function(){var e=$(this),t=e.find('[data-role="checkbox"] input[type="checkbox"]').checkbox("state");"checked"===t&&(gj.gjtree.plugins.checkboxes.private.updateChildrenState(e,t),gj.gjtree.plugins.checkboxes.private.updateParentState(e,t))})},nodeDataBound:function(e,t,a,i){var r=e.data(),n=t.find('> [data-role="wrapper"] > [data-role="expander"]'),o=$('<input type="checkbox"/>'),d=$('<span data-role="checkbox"></span>').append(o),s=void 0!==i[r.disabledField]&&"true"===i[r.disabledField].toString().toLowerCase();o=o.checkbox({uiLibrary:r.uiLibrary,iconsLibrary:r.iconsLibrary,change:function(a,r){gj.gjtree.plugins.checkboxes.events.checkboxChange(e,t,i,o.state())}}),s&&o.prop("disabled",!0),i[r.checkedField]&&o.state("checked"),o.on("click",function(e){var t=o.closest("li"),a=o.state();r.cascadeCheck&&(gj.gjtree.plugins.checkboxes.private.updateChildrenState(t,a),gj.gjtree.plugins.checkboxes.private.updateParentState(t,a))}),n.after(d)},updateParentState:function(e,t){var a,i,r,n,o,d;1===(a=e.parent("ul").parent("li")).length&&(i=e.parent("ul").parent("li").find('> [data-role="wrapper"] > [data-role="checkbox"] input[type="checkbox"]'),r=e.siblings().find('> [data-role="wrapper"] > span[data-role="checkbox"] input[type="checkbox"]'),n="checked"===t,o="unchecked"===t,d="indeterminate",$.each(r,function(){var e=$(this).checkbox("state");n&&"checked"!==e&&(n=!1),o&&"unchecked"!==e&&(o=!1)}),n&&!o&&(d="checked"),!n&&o&&(d="unchecked"),i.checkbox("state",d),gj.gjtree.plugins.checkboxes.private.updateParentState(a,i.checkbox("state")))},updateChildrenState:function(e,t){var a=e.find('ul li [data-role="wrapper"] [data-role="checkbox"] input[type="checkbox"]');a.length>0&&$.each(a,function(){$(this).checkbox("state",t)})},update:function(e,t,a){var i=t.find('[data-role="checkbox"] input[type="checkbox"]').first();$(i).checkbox("state",a),e.data().cascadeCheck&&(gj.gjtree.plugins.checkboxes.private.updateChildrenState(t,a),gj.gjtree.plugins.checkboxes.private.updateParentState(t,a))}},public:{getCheckedNodes:function(){var e=[],t=this.find('li [data-role="checkbox"] input[type="checkbox"]');return $.each(t,function(){var t=$(this);"checked"===t.checkbox("state")&&e.push(t.closest("li").data("id"))}),e},checkAll:function(){var e=this.find('li [data-role="checkbox"] input[type="checkbox"]');return $.each(e,function(){$(this).checkbox("state","checked")}),this},uncheckAll:function(){var e=this.find('li [data-role="checkbox"] input[type="checkbox"]');return $.each(e,function(){$(this).checkbox("state","unchecked")}),this},check:function(e){return gj.gjtree.plugins.checkboxes.private.update(this,e,"checked"),this},uncheck:function(e){return gj.gjtree.plugins.checkboxes.private.update(this,e,"unchecked"),this}},events:{checkboxChange:function(e,t,a,i){return e.triggerHandler("checkboxChange",[t,a,i])}},configure:function(e){e.data("checkboxes")&&gj.checkbox&&($.extend(!0,e,gj.gjtree.plugins.checkboxes.public),e.on("nodeDataBound",function(t,a,i,r){gj.gjtree.plugins.checkboxes.private.nodeDataBound(e,a,i,r)}),e.on("dataBound",function(){gj.gjtree.plugins.checkboxes.private.dataBound(e)}),e.on("enable",function(e,t){t.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop("disabled",!1)}),e.on("disable",function(e,t){t.find('>[data-role="wrapper"]>[data-role="checkbox"] input[type="checkbox"]').prop("disabled",!0)}))}},gj.gjtree.plugins.dragAndDrop={config:{base:{dragAndDrop:void 0,style:{dragEl:"gj-gjtree-drag-el gj-gjtree-mdl-drag-el",dropAsChildIcon:"material-icons gj-cursor-pointer gj-mdl-icon-plus",dropAbove:"gj-gjtree-drop-above",dropBelow:"gj-gjtree-drop-below"}},bootstrap:{style:{dragEl:"gj-gjtree-drag-el gj-gjtree-bootstrap-drag-el",dropAsChildIcon:"glyphicon glyphicon-plus",dropAbove:"gj-gjtree-drop-above",dropBelow:"gj-gjtree-drop-below"}}},private:{nodeDataBound:function(e,t){var a=t.children('[data-role="wrapper"]'),i=t.find('>[data-role="wrapper"]>[data-role="display"]');a.length&&i.length&&i.on("mousedown",gj.gjtree.plugins.dragAndDrop.private.createNodeMouseDownHandler(e,t,i))},createNodeMouseDownHandler:function(e,t,a){return function(i){var r,n,o,d,s=e.data();r=a.clone().wrap('<div data-role="wrapper"/>').closest("div").wrap('<li class="'+s.style.item+'" />').closest("li").wrap('<ul class="'+s.style.list+'" />').closest("ul"),$("body").append(r),r.attr("data-role","draggable-clone").addClass("gj-unselectable").addClass(s.style.dragEl),r.find('[data-role="wrapper"]').prepend('<span data-role="indicator" />'),r.draggable({drag:gj.gjtree.plugins.dragAndDrop.private.createDragHandler(e,t,a),stop:gj.gjtree.plugins.dragAndDrop.private.createDragStopHandler(e,t,a)}),n=a.parent(),o=a.offset().top,o-=parseInt(n.css("border-top-width"))+parseInt(n.css("margin-top"))+parseInt(n.css("padding-top")),d=a.offset().left,d-=parseInt(n.css("border-left-width"))+parseInt(n.css("margin-left"))+parseInt(n.css("padding-left")),d-=r.find('[data-role="indicator"]').outerWidth(!0),r.css({position:"absolute",top:o,left:d,width:a.outerWidth(!0)}),"true"===a.attr("data-droppable")&&a.droppable("destroy"),gj.gjtree.plugins.dragAndDrop.private.getTargetDisplays(e,t,a).each(function(){var e=$(this);"true"===e.attr("data-droppable")&&e.droppable("destroy"),e.droppable()}),gj.gjtree.plugins.dragAndDrop.private.getTargetDisplays(e,t).each(function(){var e=$(this);"true"===e.attr("data-droppable")&&e.droppable("destroy"),e.droppable()}),r.trigger("mousedown")}},getTargetDisplays:function(e,t,a){return e.find('[data-role="display"]').not(a).not(t.find('[data-role="display"]'))},getTargetWrappers:function(e,t){return e.find('[data-role="wrapper"]').not(t.find('[data-role="wrapper"]'))},createDragHandler:function(e,t,a){var i=gj.gjtree.plugins.dragAndDrop.private.getTargetDisplays(e,t,a),r=gj.gjtree.plugins.dragAndDrop.private.getTargetWrappers(e,t),n=e.data();return function(e,t,a){var o=$(this),d=!1;i.each(function(){var e;if($(this).droppable("isOver",a))return e=o.find('[data-role="indicator"]'),n.style.dropAsChildIcon?e.addClass(n.style.dropAsChildIcon):e.text("+"),d=!0,!1;o.find('[data-role="indicator"]').removeClass(n.style.dropAsChildIcon).empty()}),r.each(function(){var e,t=$(this);!d&&t.droppable("isOver",a)?(e=t.position().top+t.outerHeight()/2,a.top<e?t.addClass(n.style.dropAbove).removeClass(n.style.dropBelow):t.addClass(n.style.dropBelow).removeClass(n.style.dropAbove)):t.removeClass(n.style.dropAbove).removeClass(n.style.dropBelow)})}},createDragStopHandler:function(e,t,a){var i=gj.gjtree.plugins.dragAndDrop.private.getTargetDisplays(e,t,a),r=gj.gjtree.plugins.dragAndDrop.private.getTargetWrappers(e,t),n=e.data();return function(a,o){var d=!1;$(this).draggable("destroy").remove(),i.each(function(){var a,i,r,s=$(this);if(s.droppable("isOver",o))return a=s.closest("li"),i=t.parent("ul").parent("li"),0===(r=a.children("ul")).length&&(r=$("<ul />").addClass(n.style.list),a.append(r)),!1!==gj.gjtree.plugins.dragAndDrop.events.nodeDrop(e,t.data("id"),a.data("id"),r.children("li").length+1)&&(r.append(t),gj.gjtree.plugins.dragAndDrop.private.refresh(e,t,a,i)),d=!0,!1;s.droppable("destroy")}),d||r.each(function(){var a,i,r,n,d,s=$(this);if(s.droppable("isOver",o))return a=s.closest("li"),i=t.parent("ul").parent("li"),r=o.top<s.position().top+s.outerHeight()/2,d=t.data("id"),n=a.prev('li:not([data-id="'+d+'"])').length+(r?1:2),!1!==gj.gjtree.plugins.dragAndDrop.events.nodeDrop(e,d,a.parent("ul").parent("li").data("id"),n)&&(r?t.insertBefore(a):t.insertAfter(a),gj.gjtree.plugins.dragAndDrop.private.refresh(e,t,a,i)),!1;s.droppable("destroy")})}},refresh:function(e,t,a,i){var r=e.data();gj.gjtree.plugins.dragAndDrop.private.refreshNode(e,a),gj.gjtree.plugins.dragAndDrop.private.refreshNode(e,i),gj.gjtree.plugins.dragAndDrop.private.refreshNode(e,t),t.find('li[data-role="node"]').each(function(){gj.gjtree.plugins.dragAndDrop.private.refreshNode(e,$(this))}),a.children('[data-role="wrapper"]').removeClass(r.style.dropAbove).removeClass(r.style.dropBelow)},refreshNode:function(e,t){var a=t.children('[data-role="wrapper"]'),i=a.children('[data-role="expander"]'),r=a.children('[data-role="spacer"]'),n=t.children("ul"),o=e.data(),d=t.parentsUntil('[data-type="gjtree"]',"ul").length;n.length&&n.children().length?n.is(":visible")?i.empty().append(o.icons.collapse):i.empty().append(o.icons.expand):i.empty(),a.removeClass(o.style.dropAbove).removeClass(o.style.dropBelow),r.css("width",o.indentation*(d-1))}},public:{},events:{nodeDrop:function(e,t,a,i){return e.triggerHandler("nodeDrop",[t,a,i])}},configure:function(e){$.extend(!0,e,gj.gjtree.plugins.dragAndDrop.public),e.data("dragAndDrop")&&gj.draggable&&gj.droppable&&e.on("nodeDataBound",function(t,a){gj.gjtree.plugins.dragAndDrop.private.nodeDataBound(e,a)})}},gj.gjtree.plugins.lazyLoading={config:{base:{paramNames:{parentId:"parentId"},lazyLoading:!1}},private:{nodeDataBound:function(e,t,a,i){var r=e.data(),n=t.find('> [data-role="wrapper"] > [data-role="expander"]');i.hasChildren&&n.empty().append(r.icons.expand)},createDoneHandler:function(e,t){return function(a){var i,r,n,o=e.data();if("string"==typeof a&&JSON&&(a=JSON.parse(a)),a&&a.length){for(n=$("<ul />").addClass(o.style.list),t.append(n),i=0;i<a.length;i++)e.addNode(a[i],n);(r=t.find('>[data-role="wrapper"]>[data-role="expander"]')).attr("data-mode","open"),r.empty().append(o.icons.collapse)}}},expand:function(e,t,a){var i,r=e.data(),n={},o=t.children("ul");o&&o.length||"string"==typeof r.dataSource&&(n[r.paramNames.parentId]=a,i={url:r.dataSource,data:n},e.xhr&&e.xhr.abort(),e.xhr=$.ajax(i).done(gj.gjtree.plugins.lazyLoading.private.createDoneHandler(e,t)).fail(e.createErrorHandler()))}},public:{},events:{},configure:function(e,t,a){a.lazyLoading&&(e.on("nodeDataBound",function(t,a,i,r){gj.gjtree.plugins.lazyLoading.private.nodeDataBound(e,a,i,r)}),e.on("expand",function(t,a,i){gj.gjtree.plugins.lazyLoading.private.expand(e,a,i)}))}};
|