diff --git a/views/assets/javascripts/qor.js b/views/assets/javascripts/qor.js old mode 100755 new mode 100644 index 149dd7b5..8683a185 --- a/views/assets/javascripts/qor.js +++ b/views/assets/javascripts/qor.js @@ -1 +1 @@ -"use strict";function getSelect2Header(){var t=$("body").data().selectAjaxHeader,e=window.getSelect2HeaderFunction,i={};return t&&e&&$.isFunction(e)?(i[t]=e(),i):{}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}$.fn.qorSliderAfterShow=$.fn.qorSliderAfterShow||{},window.QOR={$formLoading:'
'},String.prototype.escapeSymbol=function(){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return this.replace(/[&<>"']/g,function(t){return e[t]||t})},window.Mustache&&(window.Mustache.tags=["[[","]]"]),$(document).ajaxComplete(function(t,e,i){"POST"!=i.type&&"PUT"!=i.type||$.fn.qorSlideoutBeforeHide&&($.fn.qorSlideoutBeforeHide=null,window.onbeforeunload=null)}),$.fn.select2.ajaxCommonOptions=function(t){var i=t.remoteDataPrimaryKey;return{dataType:"json",headers:getSelect2Header(t),cache:!0,delay:250,data:function(t){return{keyword:t.term,page:t.page,per_page:20}},processResults:function(t,e){e.page=e.page||1;t=$.map(t,function(t){return t.id=t[i]||t.primaryKey||t.Id||t.ID,t});return{results:t,pagination:{more:20<=t.length}}}}},$.fn.select2.ajaxFormatResult=function(t,e,i){var n="";if(t.loading)return t.text;if(console.log("select2.ajaxFormatResult: Data"),console.log(t),console.log("select2.ajaxFormatResult: has remote image"),console.log(i),i){var o=t.text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],i=t.Image,n=i?'
'+o+"
":'
'+o+"
";return $(n)}return n=0|<\/.+>)/.test(n)?$(n):n},$(function(){var r=window._,o=window.QOR,s=window.QOR_Translations,t='"),a=$(t).appendTo("body");$(document).on("keyup.qor.confirm",function(t){a.is(":visible")&&(27===t.which&&setTimeout(function(){a.hide(),o.qorConfirmCallback=void 0},100),13===t.which&&setTimeout(function(){$('.dialog-button[data-type="confirm"]').click()},100))}).on("click.qor.confirm",".dialog-button",function(){var t=$(this).data("type"),e=o.qorConfirmCallback;return $.isFunction(e)&&e(t),a.hide(),o.qorConfirmCallback=void 0,!1}),o.qorConfirm=function(t,e){var i=a.find(".dialog-ok"),n=a.find(".dialog-cancel");return r.isString(t)?(a.find(".dialog-message").text(t),i.text(s.okButton),n.text(s.cancelButton)):r.isObject(t)&&(t.confirmOk&&t.confirmCancel?(i.text(t.confirmOk),n.text(t.confirmCancel)):(i.text(s.okButton),n.text(s.cancelButton)),t.icon&&a.find("i.material-icons").addClass(t.icon).html(t.icon),a.find(".dialog-message").text(t.confirm)),a.show(),o.qorConfirmCallback=e,!1};function l(t,e){var i,n,o=e||new FormData;for(n in t)t.hasOwnProperty(n)&&t[n]&&(i=n),t[n]instanceof Date?o.append(i,t[n].toISOString()):"object"!==_typeof(t[n])||t[n]instanceof File?o.append(i,t[n]):l(t[n],o);return o}o.qorAjaxHandleFile=function(t,i,n,e){var o=new XMLHttpRequest;o.responseType="arraybuffer",o.open("POST",t,!0),o.onload=function(){var t,e;200===this.status?(e=new Blob([this.response],{type:i}),t=window.URL.createObjectURL(e),e=document.createElement("a"),document.body.appendChild(e),e.href=t,e.download=n||"download-"+$.now(),e.click()):window.alert(s.serverError)},r.isObject(e)&&("[object FormData]"!=Object.prototype.toString.call(e)&&(e=l(e)),o.send(e))};t=function(){var t=$(".qor-linkify-object"),e=/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi;t.length&&t.each(function(){var t=$(this).data("video-link");t.match(e)&&$(this).html(''))})};($.fn.qorSliderAfterShow.converVideoLinks=t)(),o.handleAjaxError=function(t){var e=$("body"),i=t.responseJSON,n=t.responseText,o=$('');if(e.find(".qor-alert").remove(),422===t.status)if(i){var r=i.errors,s="";if($.isArray(r))for(var a=0;a\n error\n '.concat(r[a],"\n ");else s='
  • \n error\n '.concat(r,"\n
  • ");o.append(s)}else o=$(n).find(".qor-error");else o.append('
  • \n error\n '.concat(t.statusText,"\n
  • "));o.prependTo(e),setTimeout(function(){o.addClass("qor-alert__active")},50),setTimeout(function(){$('.qor-alert[data-dismissible="true"]').removeClass("qor-alert__active"),$("#qor-submit-loading").remove()},6e3)}}),function(t){"function"==typeof define&&define.amd?define("datepicker",["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(C){var t=C(window),o=window.document,h=C(o),r=window.Number,a="datepicker",i="click."+a,n="keyup."+a,s="focus."+a,e="resize."+a,l="show."+a,d="hide."+a,c="pick."+a,u=/(y|m|d)+/g,f=/\d+/g,p=/^\d{2,4}$/,m=a+"-top-left",y=a+"-bottom-left",g=[m,a+"-top-right",y,a+"-bottom-right"].join(" "),b=a+"-hide",v=Math.min,_=Object.prototype.toString;function q(t){return"string"==typeof t}function w(t){return"number"==typeof t&&!isNaN(t)}function S(t){return void 0===t}function $(t){return"date"===(t=t,_.call(t).slice(8,-1).toLowerCase())}function k(t,e){var i=[];return Array.from?Array.from(t).slice(e||0):(w(e)&&i.push(e),i.slice.apply(t,i))}function x(t,e){var i=k(arguments,2);return function(){return t.apply(e,i.concat(k(arguments)))}}function T(t,e){return[31,(t=t)%4==0&&t%100!=0||t%400==0?29:28,31,30,31,30,31,31,30,31,30,31][e]}function D(t,e){(e=C.isPlainObject(e)?e:{}).language&&(e=C.extend({},D.LANGUAGES[e.language],e)),this.$element=C(t),this.options=C.extend({},D.DEFAULTS,e),this.isBuilt=!1,this.isShown=!1,this.isInput=!1,this.isInline=!1,this.initialValue="",this.initialDate=null,this.startDate=null,this.endDate=null,this.init()}D.prototype={constructor:D,init:function(){var t=this.options,e=this.$element,i=t.startDate,n=t.endDate,o=t.date;this.$trigger=C(t.trigger||e),this.isInput=e.is("input")||e.is("textarea"),this.isInline=t.inline&&(t.container||!this.isInput),this.format=function(t){var e,i,n=String(t).toLowerCase(),o=n.match(u);if(!o||0===o.length)throw new Error("Invalid date format.");for(t={source:n,parts:o},e=o.length,i=0;in.getTime()&&(o=new Date(n)),this.endDate=n),this.date=o,this.viewDate=new Date(o),this.initialDate=new Date(this.date),this.bind(),(t.autoshow||this.isInline)&&this.show(),t.autopick&&this.pick()},build:function(){var t,e=this.options,i=this.$element;this.isBuilt||(this.isBuilt=!0,this.$picker=t=C(e.template),this.$week=t.find('[data-view="week"]'),this.$yearsPicker=t.find('[data-view="years picker"]'),this.$yearsPrev=t.find('[data-view="years prev"]'),this.$yearsNext=t.find('[data-view="years next"]'),this.$yearsCurrent=t.find('[data-view="years current"]'),this.$years=t.find('[data-view="years"]'),this.$monthsPicker=t.find('[data-view="months picker"]'),this.$yearPrev=t.find('[data-view="year prev"]'),this.$yearNext=t.find('[data-view="year next"]'),this.$yearCurrent=t.find('[data-view="year current"]'),this.$months=t.find('[data-view="months"]'),this.$daysPicker=t.find('[data-view="days picker"]'),this.$monthPrev=t.find('[data-view="month prev"]'),this.$monthNext=t.find('[data-view="month next"]'),this.$monthCurrent=t.find('[data-view="month current"]'),this.$days=t.find('[data-view="days"]'),this.isInline?C(e.container||i).append(t.addClass("datepicker-inline")):(C(o.body).append(t.addClass("datepicker-dropdown")),t.addClass(b)),this.fillWeek())},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.$picker.remove())},bind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.on(l,t.show),C.isFunction(t.hide)&&e.on(d,t.hide),C.isFunction(t.pick)&&e.on(c,t.pick),this.isInput&&(e.on(n,C.proxy(this.keyup,this)),t.trigger||e.on(s,C.proxy(this.show,this))),this.$trigger.on(i,C.proxy(this.show,this))},unbind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.off(l,t.show),C.isFunction(t.hide)&&e.off(d,t.hide),C.isFunction(t.pick)&&e.off(c,t.pick),this.isInput&&(e.off(n,this.keyup),t.trigger||e.off(s,this.show)),this.$trigger.off(i,this.show)},showView:function(t){var e=this.$yearsPicker,i=this.$monthsPicker,n=this.$daysPicker,o=this.format;if(o.hasYear||o.hasMonth||o.hasDay)switch(r(t)){case 2:case"years":i.addClass(b),n.addClass(b),o.hasYear?(this.fillYears(),e.removeClass(b)):this.showView(0);break;case 1:case"months":e.addClass(b),n.addClass(b),o.hasMonth?(this.fillMonths(),i.removeClass(b)):this.showView(2);break;default:e.addClass(b),i.addClass(b),o.hasDay?(this.fillDays(),n.removeClass(b)):this.showView(1)}},hideView:function(){this.options.autohide&&this.hide()},place:function(){var t=this.options,e=this.$element,i=this.$picker,n=h.outerWidth(),o=h.outerHeight(),r=e.outerWidth(),s=e.outerHeight(),a=i.width(),l=i.height(),d=e.offset(),c=d.left,u=d.top,e=parseFloat(t.offset)||10,d=m;l"+n.text+""},fillAll:function(){this.fillYears(),this.fillMonths(),this.fillDays()},fillWeek:function(){for(var t=this.options,e=parseInt(t.weekStart,10)%7,i=t.daysMin,n="",i=C.merge(i.slice(e),i.slice(0,e)),o=0;o<=6;o++)n+=this.createItem({text:i[o]});this.$week.html(n)},fillYears:function(){for(var t,e,i=this.options,n=i.disabledClass||"",o=i.yearSuffix||"",r=C.isFunction(i.filter)&&i.filter,s=this.startDate,a=this.endDate,i=this.viewDate,l=i.getFullYear(),d=i.getMonth(),c=i.getDate(),u=this.date,h=u.getFullYear(),f=!1,p=!1,m=!1,y="",g=-5;g<=6;g++)u=new Date(l+g,d,c),e=-5===g||6===g,t=l+g===h,m=!1,s&&(m=u.getFullYear()a.getFullYear(),6===g&&(p=m)),!m&&r&&(m=!1===r.call(this.$element,u)),y+=this.createItem({text:l+g,view:m?"year disabled":t?"year picked":"year",muted:e,picked:t,disabled:m});this.$yearsPrev.toggleClass(n,f),this.$yearsNext.toggleClass(n,p),this.$yearsCurrent.toggleClass(n,!0).html(l+-5+o+" - "+(l+6)+o),this.$years.html(y)},fillMonths:function(){for(var t,e=this.options,i=e.disabledClass||"",n=e.monthsShort,o=C.isFunction(e.filter)&&e.filter,r=this.startDate,s=this.endDate,a=this.viewDate,l=a.getFullYear(),d=a.getDate(),c=this.date,u=c.getFullYear(),h=c.getMonth(),f=!1,p=!1,m=!1,y="",g=0;g<=11;g++)c=new Date(l,g,d),t=l===u&&g===h,m=!1,r&&(m=(f=c.getFullYear()===r.getFullYear())&&c.getMonth()s.getMonth()),!m&&o&&(m=!1===o.call(this.$element,c)),y+=this.createItem({index:g,text:n[g],view:m?"month disabled":t?"month picked":"month",picked:t,disabled:m});this.$yearPrev.toggleClass(i,f),this.$yearNext.toggleClass(i,p),this.$yearCurrent.toggleClass(i,f&&p).html(l+e.yearSuffix||""),this.$months.html(y)},fillDays:function(){var t,e,i,n,o=this.options,r=o.disabledClass||"",s=o.yearSuffix||"",a=o.monthsShort,l=parseInt(o.weekStart,10)%7,d=C.isFunction(o.filter)&&o.filter,c=this.startDate,u=this.endDate,h=this.viewDate,f=h.getFullYear(),p=h.getMonth(),m=f,y=p,g=f,b=p,v=this.date,_=v.getFullYear(),q=v.getMonth(),w=v.getDate(),S=!1,h=!1,$=!1,k=[],x=[],D=[];for(0===p?(--m,y=11):--y,e=T(m,y),(n=(v=new Date(f,p,1)).getDay()-l)<=0&&(n+=7),c&&(S=v.getTime()<=c.getTime()),i=e-(n-1);i<=e;i++)v=new Date(m,y,i),$=!1,c&&($=v.getTime()=u.getTime()),i=1;i<=n;i++)v=new Date(g,b,i),$=!1,u&&($=v.getTime()>u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),x.push(this.createItem({text:i,view:"day next",muted:!0,disabled:$}));for(i=1;i<=e;i++)v=new Date(f,p,i),t=f===_&&p===q&&i===w,$=!1,c&&($=v.getTime()u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),D.push(this.createItem({text:i,view:$?"day disabled":t?"day picked":"day",picked:t,disabled:$}));this.$monthPrev.toggleClass(r,S),this.$monthNext.toggleClass(r,h),this.$monthCurrent.toggleClass(r,S&&h).html(o.yearFirst?f+s+" "+a[p]:a[p]+" "+f+s),this.$days.html(k.join("")+D.join(" ")+x.join(""))},click:function(t){var e,i,n,o,r,s,a=C(t.target),l=this.viewDate;if(t.stopPropagation(),t.preventDefault(),!a.hasClass("disabled"))switch(e=l.getFullYear(),i=l.getMonth(),n=l.getDate(),s=a.data("view")){case"years prev":case"years next":e="years prev"===s?e-10:e+10,r=a.text(),(o=p.test(r))&&(e=parseInt(r,10),this.date=new Date(e,i,v(n,28))),this.viewDate=new Date(e,i,v(n,28)),this.fillYears(),o&&(this.showView(1),this.pick("year"));break;case"year prev":case"year next":e="year prev"===s?e-1:e+1,this.viewDate=new Date(e,i,v(n,28)),this.fillMonths();break;case"year current":this.format.hasYear&&this.showView(2);break;case"year picked":this.format.hasMonth?this.showView(1):this.hideView();break;case"year":e=parseInt(a.text(),10),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasMonth?this.showView(1):this.hideView(),this.pick("year");break;case"month prev":case"month next":i="month prev"===s?i-1:"month next"===s?i+1:i,this.viewDate=new Date(e,i,v(n,28)),this.fillDays();break;case"month current":this.format.hasMonth&&this.showView(1);break;case"month picked":this.format.hasDay?this.showView(0):this.hideView();break;case"month":i=C.inArray(a.text(),this.options.monthsShort),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasDay?this.showView(0):this.hideView(),this.pick("month");break;case"day prev":case"day next":case"day":i="day prev"===s?i-1:"day next"===s?i+1:i,n=parseInt(a.text(),10),this.date=new Date(e,i,n),this.viewDate=new Date(e,i,n),this.fillDays(),"day"===s&&this.hideView(),this.pick("day");break;case"day picked":this.hideView(),this.pick("day")}},clickDoc:function(t){for(var e,i=t.target,n=this.$trigger[0];i!==o;){if(i===n){e=!0;break}i=i.parentNode}e||this.hide()},keyup:function(){this.update()},getValue:function(){var t=this.$element,e="";return this.isInput?e=t.val():this.isInline&&!this.options.container||(e=t.text()),e},setValue:function(t){var e=this.$element;t=q(t)?t:"",this.isInput?e.val(t):this.isInline&&!this.options.container||e.text(t)},show:function(){this.isBuilt||this.build(),this.isShown||this.trigger(l).isDefaultPrevented()||(this.isShown=!0,this.$picker.removeClass(b).on(i,C.proxy(this.click,this)),this.showView(this.options.startView),this.isInline||(t.on(e,this._place=x(this.place,this)),h.on(i,this._clickDoc=x(this.clickDoc,this)),this.place()))},hide:function(){this.isShown&&(this.trigger(d).isDefaultPrevented()||(this.isShown=!1,this.$picker.addClass(b).off(i,this.click),this.isInline||(t.off(e,this._place),h.off(i,this._clickDoc))))},update:function(){this.setDate(this.getValue(),!0)},pick:function(t){var e=this.$element,i=this.date;this.trigger(c,{view:t||"",date:i}).isDefaultPrevented()||(this.setValue(this.formatDate(this.date)),this.isInput&&e.trigger("change"))},reset:function(){this.setDate(this.initialDate,!0),this.setValue(this.initialValue),this.isShown&&this.showView(this.options.startView)},getMonthName:function(t,e){var i=this.options,n=i.months;return C.isNumeric(t)?t=r(t):S(e)&&(e=t),!0===e&&(n=i.monthsShort),n[w(t)?t:this.date.getMonth()]},getDayName:function(t,e,i){var n=this.options,o=n.days;return C.isNumeric(t)?t=r(t):(S(i)&&(i=e),S(e)&&(e=t)),(o=!0===i?n.daysMin:!0===e?n.daysShort:o)[w(t)?t:this.date.getDay()]},getDate:function(t){var e=this.date;return t?this.formatDate(e):new Date(e)},setDate:function(t,e){var i=this.options.filter;($(t)||q(t))&&(t=this.parseDate(t),C.isFunction(i)&&!1===i.call(this.$element,t)||(this.date=t,this.viewDate=new Date(t),e||this.pick(),this.isBuilt&&this.fillAll()))},setStartDate:function(t){($(t)||q(t))&&(this.startDate=this.parseDate(t),this.isBuilt&&this.fillAll())},setEndDate:function(t){($(t)||q(t))&&(this.endDate=this.parseDate(t),this.isBuilt&&this.fillAll())},parseDate:function(t){var e,i,n,o,r,s,a=this.format,l=[];if($(t))return new Date(t.getFullYear(),t.getMonth(),t.getDate());if(q(t)&&(l=t.match(f)||[]),i=(t=new Date).getFullYear(),n=t.getDate(),o=t.getMonth(),e=a.parts.length,l.length===e)for(s=0;s
            ',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},D.setDefaults=function(t){C.extend(D.DEFAULTS,C.isPlainObject(t)&&t)},D.other=C.fn.qorDatepicker,C.fn.qorDatepicker=function(o){var r,s=k(arguments,1);return this.each(function(){var t,e,i=C(this),n=i.data(a);if(!n){if(/destroy/.test(o))return;t=C.extend({},i.data(),C.isPlainObject(o)&&o),i.data(a,n=new D(this,t))}q(o)&&C.isFunction(e=n[o])&&(r=e.apply(n,s))}),S(r)?this:r},C.fn.qorDatepicker.Constructor=D,C.fn.qorDatepicker.languages=D.LANGUAGES,C.fn.qorDatepicker.setDefaults=D.setDefaults,C.fn.qorDatepicker.noConflict=function(){return C.fn.qorDatepicker=D.other,this}}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(h){var i=window.Mustache,f=window.QOR,o="qor.action",t="enable."+o,n="click."+o,r='[data-ajax-form="true"][data-method]',e=".qor-action-bulk-buttons",s=".qor-page .qor-table-container",a=".qor-table--bulking",l=".qor-table--bulking tbody tr",p="is_undo",d="mdl-data-table--selectable",c="primary_values[]",m=".qor-body__loading";function u(t,e){this.$element=h(t),this.options=h.extend({},u.DEFAULTS,h.isPlainObject(e)&&e),this.ajaxForm={},this.init()}return u.prototype={constructor:u,init:function(){this.bind(),this.initActions()},bind:function(){this.$element.on(n,".qor-action--bulk",this.renderBulkTable.bind(this)).on(n,".qor-action--exit-bulk",this.removeBulkTable.bind(this)),h(document).on(n,l,this.handleBulkTableClick.bind(this)).on(n,r,this.clickAjaxButton.bind(this))},unbind:function(){this.$element.off(n),h(document).off(n,l,this.handleBulkTableClick).off(n,r,this.clickAjaxButton)},initActions:function(){h(s).find("table").length||(h(e).hide(),h(".qor-page__header a.qor-action--button").hide())},collectFormData:function(){var e,t=h(a).find(".mdl-checkbox__input:checked"),i=[],n=[];return t.length&&t.each(function(){var t=h(this).closest("tr").data("primary-key");e={},t&&(i.push({name:c,value:t.toString()}),e[c]=t.toString(),n.push(e))}),this.ajaxForm.formData=i,this.ajaxForm.normalFormData=n,this.ajaxForm},actionSubmit:function(t){return this.submit(t),!1},handleBulkTableClick:function(t){var e=h(t.target).closest("tr"),i=e.find("td").first(),t=i.find(".mdl-js-checkbox");return t.toggleClass("is-checked"),e.toggleClass("is-selected"),i.find("input").prop("checked",t.hasClass("is-checked")),!1},adjustPageBodyStyle:function(t){var e=h(".qor-page > .qor-page__header"),i=h(".qor-page > .qor-page__body"),n=e.find(".qor-page-subnav__header").length?96:48;t?e.height()>n&&i.css("padding-top",e.height()):parseInt(i.css("padding-top"))>n&&i.css("padding-top","")},renderBulkTable:function(){var t=h("body");t.hasClass("qor-slideout-open")&&t.data("qor.slideout").hide(),h(".qor-table__inner-list").remove(),this.toggleBulkButtons(),this.enableTableMDL(),this.adjustPageBodyStyle(!0)},removeBulkTable:function(){this.toggleBulkButtons(),this.disableTableMDL(),this.adjustPageBodyStyle()},enableTableMDL:function(){h(s).find("table").removeAttr("data-upgraded").addClass(d).trigger("enable")},disableTableMDL:function(){h(s).find("table").removeClass(d).find("tr").removeClass("is-selected").find("td:first,th:first").remove()},toggleBulkButtons:function(){this.$element.find(".qor-action-forms").toggle(),h(e).find("button").toggleClass("hidden"),h(s).toggleClass("qor-table--bulking").find(".qor-table__actions").toggle(),h(".qor-page__header .qor-actions, .qor-page__header .qor-search-container").toggle()},clickAjaxButton:function(t){t=h(t.target);return this.collectFormData(),this.ajaxForm.properties=t.data(),this.submit(t),!1},renderFlashMessage:function(t){var e=u.FLASHMESSAGETMPL;return i.parse(e),i.render(e,t)},addLoading:function(){h(m).remove(),h(u.TEMPLATE_LOADING).appendTo(h("body")).trigger("enable.qor.material")},submit:function(e){var i=this,n=this.ajaxForm||{},t=n.properties||e.data();if(e.hasClass("qor-action-disabled"))return!1;!t.fromIndex||n.formData&&n.formData.length?t.confirm?f.qorConfirm(t,function(t){t&&i.handleAjaxSubmit(n,e)}):this.handleAjaxSubmit(n,e):f.qorConfirm(n.properties.errorNoItem)},handleAjaxSubmit:function(o,r){var s=this,a=this.$element,l=r.closest(".qor-action-forms"),d=o.properties||r.data(),c=d.url,u=d.undoUrl,e=r.hasClass(p),t=r.closest(".qor-slideout").length,i=a.length&&!t;e&&(c=u),this.addLoading(),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).addClass("qor-action-disabled"),h.ajax(c,{method:d.method,data:o.formData,dataType:d.datatype||"json",beforeSend:function(){u?r.prop("disabled",!0):i&&s.switchButtons(a,1)},success:function(t){if(u)return a.trigger("undo.qor.action",[r,e,t]),e?r.removeClass(p):r.addClass(p),void r.prop("disabled",!1);window.location.reload()},error:function(t){200!=t.status&&(u?r.prop("disabled",!1):i&&s.switchButtons(a),f.handleAjaxError(t))},complete:function(t){var e,i=t.getResponseHeader("content-type"),n=t.getResponseHeader("Content-Disposition");h(m).remove(),r.prop("disabled",!1),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).removeClass("qor-action-disabled"),n&&-1!==n.indexOf("attachment")&&(e={},t="",null!=(n=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(n))&&n[1]&&(t=n[1].replace(/['"]/g,"")),d.method&&(e=h.extend({},o.normalFormData,{_method:d.method})),f.qorAjaxHandleFile(c,i,t,e),u?r.prop("disabled",!1):s.switchButtons(a))}})},switchButtons:function(t,e){e=!!e;t.find(".qor-action-button").prop("disabled",e)},destroy:function(){this.unbind(),this.$element.removeData(o)}},u.DEFAULTS={},u.TEMPLATE_LOADING='
            \n
            \n
            \n
            ',h.fn.qorSliderAfterShow.qorInsertActionData=function(t,e){var i=h(e).find('[data-toggle="qor-action-slideout"]'),n=i.find("form"),e=h(a).find(".mdl-checkbox__input:checked");i.length&&e.length&&e.each(function(){var t=h(this).closest("tr").data("primary-key");t&&n.prepend('')})},u.plugin=function(n){return this.each(function(){var t,e=h(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&h.isFunction(t=i[n])&&t.call(i)})},h(function(){var e={},i='[data-toggle="qor.action.bulk"]';h(i).length||h(document).on(n,r,function(t){return(new u).actionSubmit(h(t.target)),!1}),h(document).on("disable.qor.action",function(t){u.plugin.call(h(i,t.target),"destroy")}).on(t,function(t){u.plugin.call(h(i,t.target),e)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(a){var l=window.location,r=window.QOR,o="qor.advancedsearch",t="enable."+o,e="click."+o;function s(t,e){this.$element=a(t),this.options=a.extend({},s.DEFAULTS,a.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){this.$form=this.$element.find("form"),this.$modal=a(s.MODAL).appendTo("body"),this.bind()},bind:function(){this.$element.on("submit.qor.advancedsearch","form",this.submit.bind(this)).on(e,".qor-advanced-filter__save",this.showSaveFilter.bind(this)).on(e,".qor-advanced-filter__toggle",this.toggleFilterContent).on(e,".qor-advanced-filter__close",this.closeFilter).on(e,".qor-advanced-filter__delete",this.deleteSavedFilter),this.$modal.on("shown.qor.modal",this.start.bind(this))},closeFilter:function(){a(".qor-advanced-filter__dropdown").hide()},toggleFilterContent:function(t){a(t.target).closest(".qor-advanced-filter__toggle").parent().find(">[advanced-search-toggle]").toggle()},showSaveFilter:function(){this.$modal.qorModal("show")},deleteSavedFilter:function(t){var e=a(t.target).closest(".qor-advanced-filter__delete"),i=e.closest(".qor-advanced-filter__savedfilter"),n=e.data("filter-name"),o=l.pathname;return r.qorConfirm({confirm:"Are you sure you want to delete this saved filter?"},function(t){t&&a.get(o,a.param({delete_saved_filter:n})).done(function(){e.closest("li").remove(),0===i.find("li").length&&i.remove()}).fail(function(){r.qorConfirm("Server error, please try again!")})}),!1},start:function(){this.$modal.trigger("enable.qor.material").on(e,".qor-advanced-filter__savefilter",this.saveFilter.bind(this))},saveFilter:function(){var t=this.$modal.find("#qor-advanced-filter__savename").val();t&&this.$form.prepend('')).submit()},submit:function(){var t,e=this.$form,i=e.find("input[name],select[name]"),n=[],o=e.closest(".qor-bottomsheets"),r=e.serialize();if(i.each(function(){n.push(a(this).attr("name"))}),t=function(t){var e,i,n=decodeURIComponent(l.search.substr(1)).split("&"),o={};if(1==n.length&&""==n[0])return!1;for(i in n)""!==n[i]&&(e=n[i].split("="),o[e[0]]=e[1]);return t.forEach(function(t){delete o[t]}),o}(n),!a.isEmptyObject(t))for(var s in t)t.hasOwnProperty(s)&&e.prepend('\n
            \n
            \n

            Save advanced filter

            \n
            \n
            \n \n
            \n \n \n
            \n\n
            \n \n
            \n \n
            \n
            \n ',s.plugin=function(n){return this.each(function(){var t,e=a(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new s(this,n))}"string"==typeof n&&a.isFunction(t=i[n])&&t.apply(i)})},a(function(){var e='[data-toggle="qor.advancedsearch"]';a(document).on("disable.qor.advancedsearch",function(t){s.plugin.call(a(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(a(e,t.target),void 0)}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var r="qor.autoheight",t="enable."+r;function s(t,e){this.$element=o(t),this.options=o.extend({},s.DEFAULTS,o.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){var t=this.$element;this.paddingTop=parseInt(t.css("padding-top"),10),this.paddingBottom=parseInt(t.css("padding-bottom"),10),this.resize(),this.bind()},bind:function(){this.$element.on("input",o.proxy(this.resize,this))},unbind:function(){this.$element.off("input",this.resize)},resize:function(){var t=this.$element,e=t.prop("scrollHeight");e?t.height("auto").height(e-this.paddingTop-this.paddingBottom):t.height("40px")},destroy:function(){this.unbind(),this.$element.removeData(r)}},s.DEFAULTS={},s.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new s(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e="textarea.qor-js-autoheight";o(document).on("disable.qor.autoheight",function(t){s.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(o(e,t.target))}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(b){var o=window._,n=window.FormData,i=window.QOR_Translations,r="qor.bottomsheets",t="click."+r,e="submit."+r,v="qor-bottomsheets-open",_=".mdl-layout__content.qor-page",s=".qor-page__body",q=".qor-page__header",a=".qor-bottomsheets__search-input";function l(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(b(this).attr(n))}),o.uniq(i)}function d(t,e,i){for(var n=0,o=0,r=t.length;o')},filterChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},selectorChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},keyup:function(t){var e=this.$bottomsheets.find(a);13===t.which&&e.length&&e.is(":focus")&&this.search()},search:function(){var t=this.$bottomsheets,e=t.data().url,i=b.trim(t.find(a).val()),t=e+"?keyword="+i;/\?/g.test(e)&&(t=e+"&keyword="+i),this.reload(t)},pagination:function(t){t=b(t.target).closest("a").prop("href");return t&&this.reload(t),!1},reload:function(t){var e=this.$bottomsheets.find(s);this.addLoading(e),this.fetchPage(t)},reloadFromUrl:function(t,e){this.reload(e)},fetchPage:function(i){var n=this.$bottomsheets,o=this;b.get(i,function(t){var e=b(t).find(_),t=e.find(q),e=e.find(s);e.length?(n.find(s).html(e.html()),t.length&&(o.$body.find(q).html(t.html()).trigger("enable"),o.addHeaderClass()),n.trigger("reload.qor.bottomsheets")):o.reload(i)}).fail(function(){window.alert("server error, please try again later!")})},constructloadURL:function(t,e){var i,n,o=this.filterURL,r=this.$bottomsheets.data().url;if(!o){if(!r)return;o=r}return i=new URL("http://www.getqor.com/"+t),n=e,r=i.search,n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=null===(r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(decodeURIComponent(r)))?"":r[1].replace(/\+/g," "),o=this.filterURL=(i=e,n=t,r=o,e=String(i).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),t=new RegExp("([?&])"+e+"=.*?(&|$)","i"),e=-1!==r.indexOf("?")?"&":"?",r.match(t)?n?r.replace(t,"$1"+i+"="+n+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?r.replace(t,"$1"):r.replace(t,""):n?r+e+i+"="+n:void 0)},addHeaderClass:function(){this.$body.find(q).hide(),this.$bottomsheets.find(q).children(".qor-bottomsheet__filter").length&&this.$body.addClass("has-header").find(q).show()},addLoading:function(t){t.html(""),b(w.TEMPLATE_LOADING).appendTo(t).trigger("enable.qor.material")},loadExtraResource:function(t){var e,i,n=(e=t.$links,i=b("link"),e=l(e),i=l(i),o.difference(e,i)),i=(e=t.$scripts,i=b("script"),e=l(e,!0),i=l(i,!0),o.difference(e,i));n.length&&function t(e){var i=document.createElement("link"),n=e.shift();i.type="text/css",i.rel="stylesheet",i.onload=function(){e.length&&t(e)},i.href=n,document.getElementsByTagName("head")[0].appendChild(i)}(n),i.length&&d(i,t)},loadMedialibraryJS:function(t){var e,t=t.filter("script"),i=/theme=media_library/g,n=this;t.each(function(){var t;e=b(this).prop("src"),i.test(e)&&((t=document.createElement("script")).src=e,document.body.appendChild(t),n.mediaScriptAdded=!0)})},submit:function(t){var r,e=t.target,s=b(e),a=this,l=s.prop("action"),d=s.closest(".qor-bottomsheets"),c=d.data(),i=c.ajaxType,u=s.find(":submit");c.ingoreSubmit||s.data().normalSubmit||(b(document).trigger("bottomsheetBeforeSend.qor.bottomsheets"),t.preventDefault(),r=new n(e),b.ajax(l,{method:s.prop("method"),data:r,dataType:i||"html",processData:!1,contentType:!1,beforeSend:function(){u.prop("disabled",!0)},success:function(t,e,i){if(c.ajaxMute)d.remove();else if(c.ajaxTakeover)c.$target.parent().trigger("ajaxSuccessed.qor.bottomsheets",[t,d]);else{t=i.getResponseHeader("Content-Disposition");if(t&&-1!==t.indexOf("attachment")){var t=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t),n=i.getResponseHeader("Content-Type"),o="";return null!=t&&t[1]&&(o=t[1].replace(/['"]/g,"")),window.QOR.qorAjaxHandleFile(l,n,o,r),void u.prop("disabled",!1)}b(".qor-error").remove();n=s.data("returnUrl"),o=s.data("refreshUrl");o?window.location.href=o:"refresh"!=n?(n&&"refresh"!=n?a.load(n):a.refresh(),b(document).trigger("bottomsheetSubmitComplete.qor.bottomsheets")):a.refresh()}},error:function(t){window.QOR.handleAjaxError(t)},complete:function(){u.prop("disabled",!1)}}))},load:function(s,a,l){var d,t,e,c=this.options,u=a.actionData,h=this.resourseData,f=h.selectModal,p=h.ingoreSubmit,m=this.$bottomsheets,y=this.$header,g=this.$body;s&&(this.show(),this.addLoading(g),this.filterURL=s,g.removeClass("has-header has-hint"),a=b.isPlainObject(a)?a:{},d=a.method||"GET",t=a.datatype||"html",e=b.proxy(function(){b.ajax(s,{method:d,dataType:t,success:b.proxy(function(t){var e,i,n,o,r;"GET"===d?(i={$scripts:(e=b(t)).filter("script"),$links:e.filter("link"),url:s,response:t},n=f&&e.find(".qor-search-container").length,o=t.match(/<\s*body.*>[\s\S]*<\s*\/body\s*>/gi),r=e.find(_),o&&(o=o.join("").replace(/<\s*body/gi,"').concat(a.selectBacktolistTitle,"")),f&&(g.find(".qor-button--new").data("ingoreSubmit",!0).data("selectId",h.selectId).data("loadInline",!0),"one"==f||a.selectNohint||void 0!==h.maxItem&&"1"==h.maxItem||g.addClass("has-hint"),"mediabox"!=f||this.mediaScriptAdded||this.loadMedialibraryJS(e)),y.find(".qor-button--new").remove(),this.$title.after(g.find(".qor-button--new")),n&&(m.addClass("has-search"),y.find(".qor-bottomsheets__search").remove(),y.prepend(w.TEMPLATE_SEARCH)),u&&u.length&&this.bindActionData(u),h.bottomsheetClassname&&m.addClass(h.bottomsheetClassname),m.trigger("enable"),m.one("hidden.qor.bottomsheets",function(){b(this).trigger("disable")}),this.addHeaderClass(),m.data(a),l&&b.isFunction(l)&&l(this.$bottomsheets),m.trigger("bottomsheetLoaded.qor.bottomsheets",[s,t]))):a.returnUrl?this.load(a.returnUrl):this.refresh()},this),error:b.proxy(function(){var t;this.$bottomsheets.remove(),b(".qor-bottomsheets").is(":visible")||b("body").removeClass(v),t=0=u&&c&&v.isFunction(c)&&c()}).attr("src",t).data("originalUrl",t),p.show()},start:function(){var o=this.options,r=this.$modal,t=this.$target,e=t.data(),s=e.sizeName||"original",i=e.sizeResolution,n=e&&e.originalUrl&&t.attr("data-original-url")?/\.original\./.test(e.originalUrl)?e.originalUrl:/\.original\./.test(t.attr("data-original-url"))?t.attr("data-original-url"):t.attr("data-original-url").replace(/file\./,"file.original."):t.attr("src"),a=v("")),l=this.data||{},d=this,t=NaN,n=e.sizeResolutionWidth,e=e.sizeResolutionHeight;i&&(n||e||(n=q(i,"width"),e=q(i,"height")),t=n/e),l[o.key]||(l[o.key]={}),r.trigger("enable.qor.material").find(u).html(a),(e=this.getList(t))&&r.find(h).show().append(e),a.cropper({aspectRatio:t,data:function(t){var e,i={};if(v.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(i[String(e).toLowerCase()]=t[e]);return i}(l[o.key][s]),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,autoCropArea:1,ready:function(){r.find(".qor-cropper__options-toggle").on(c,function(){r.find(".qor-cropper__options-input").prop("checked",v(this).prop("checked"))}).prop("checked",!0),r.find(".qor-cropper__save").one(c,function(){var t,e=a.cropper("getData",!0),i=a.cropper("getCroppedCanvas"),n=[];if(l.Crop=!0,l[o.key][s]=e,d.imageData=a.cropper("getImageData"),d.cropData=e,i)try{t=i.toDataURL()}catch(t){console.log(t),console.log("Please check image Cross-origin setting")}r.find(h+" input").each(function(){var t=v(this);t.prop("checked")&&n.push(t.attr("name"))}),d.output(t,n),r.qorModal("hide")})}})},stop:function(){this.$modal.trigger("disable.qor.material").find(u+" > img").cropper("destroy").remove().end().find(h).hide().find("ul").remove()},getList:function(o){var r=[];return this.$list.find("img").not(this.$target).each(function(){var t=v(this).data(),e=t.sizeResolution,i=t.sizeName,n=t.sizeResolutionWidth,t=t.sizeResolutionHeight;e&&(n||t||(n=q(e,"width"),t=q(e,"height")),n/t===o&&r.push('"))}),r.length?"
            • "+r.join("
            • ")+"
            ":""},output:function(t,e){var i=this.$target;t?this.center(i.attr("src",t),!0):this.preview(i),v.isArray(e)&&e.length&&this.autoCrop(t,e),this.$output.val(JSON.stringify(this.data)).trigger(o),this.$formCropInput.val(JSON.stringify(this.data))},preview:function(t,e,i){var n=t.parent().parent(),o=n.width(),r=n.height(),s=e||this.imageData,n=v.extend({},i||this.cropData),e=n.width/n.height,i=o;0!=i&&0!=s.naturalWidth&&0!=s.naturalHeight&&(r*e<=o&&(i=r*e),i=n.width/i,t.css({maxWidth:s.naturalWidth/i,maxHeight:s.naturalHeight/i}),this.center(t))},center:function(t,o){t.each(function(){var t=v(this),i=t.parent(),n=i.parent();function e(){var t=n.height(),e=i.height(),e=eclear'))},show:function(){this.$element.find(l).toggle()},close:function(t){var e=s(t.target),i=s(l),n=i.is(":visible"),o=e.closest(l).length,r=e.closest(".qor-filter-toggle").length,t=e.closest(".qor-modal").length,e=e.closest(".ui-timepicker-wrapper").length;n&&(o||r||t||e)||i.hide()},setFilterTime:function(t){var e,i,n=s(t.target),o=n.data(),t=o.filterRange;if(!t)return!1;if(s(this.options.label).removeClass(d),n.addClass(d),"events"==t)return this.$timeStart.val(o.scheduleStartAt||""),this.$timeEnd.val(o.scheduleEndAt||""),this.$searchButton.click(),!1;switch(t){case"today":e=i=new Date;break;case"week":e=this.startWeekDate,i=this.endWeekDate;break;case"month":e=this.startMonthDate,i=this.endMonthDate}if(!e||!i)return!1;o=this.getTime(e)+" 00:00",t=this.getTime(i)+" 23:59",this.$timeStart.val(o),this.$timeEnd.val(t),this.$searchButton.click()},getTime:function(t){var e=(e=t.getMonth()+1)<10?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i;return t.getFullYear()+"-"+e+"-"+i},clear:function(){var t=s(this.options.trigger),e=t.find(".qor-selector-label");return t.removeClass("active clearable"),e.html(e.data("label")),this.$timeStart.val(""),this.$timeEnd.val(""),this.$searchButton.click(),!1},getUrlParameter:function(t){var e=decodeURIComponent(a.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===e?"":e[1].replace(/\+/g," ")},updateQueryStringParameter:function(t,e,i){var n=i||a.href,o=n.match(/#\S*$/)||"",r=String(t).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),i=new RegExp("([?&])"+r+"=.*?(&|$)","i"),r=-1!==n.indexOf("?")?"&":"?";return o&&(o=o[0],n=n.replace(o,"")),n.match(i)?n=e?n.replace(i,"$1"+t+"="+e+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?n.replace(i,"$1"):n.replace(i,""):e&&(n=n+r+t+"="+e),n+o},search:function(){var t=this.$searchParam,i=a.href,n=this;t.length&&(t.each(function(){var t=s(this),e=t.data().searchParam,t=t.val();i=n.updateQueryStringParameter(e,t,i)}),this.$element.closest(r).length?s(r).trigger("filterChanged.qor.filter",[i,"qor.filter.time"]):a.href=i)},destroy:function(){this.unbind(),this.$element.removeData(o)}},c.DEFAULTS={label:!1,trigger:!1,button:!1,clear:!1},c.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new c(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.filter.time"]',i={label:".qor-filter__block-buttons button",trigger:"a.qor-filter-toggle",button:".qor-filter__button-search",clear:".qor-selector-clear"};s(document).on("disable.qor.filter",function(t){c.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){c.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),c}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(d){var c=window.location,o="qor.filter",t="enable."+o,e="click."+o,i="change."+o,u=".qor-bottomsheets";function h(t,i){var n,e=c.search,o=c.search.match(/per_page=\d+/),e=e.replace(/per_page=\d+/g,"").replace(/page=\d+/,"page=1");return o&&o.length&&(e=e+"&"+o[0]),d.isArray(t)&&(n=f(e),d.each(t,function(t,e){-1===(t=d.inArray(e,n))?n.push(e):i&&n.splice(t,1)}),e="?"+n.join("&")),e}function f(t){var e=[];return t&&-1 thead"),this.$tbody=e.find("> tbody"),this.$header=s(t.header),this.$subHeader=s(t.subHeader),this.$content=s(t.content),this.marginBottomPX=parseInt(this.$subHeader.css("marginBottom")),this.paddingHeight=t.paddingHeight,this.resize(),this.bind())},bind:function(){this.$content.on(i,this.toggle.bind(this)),t.on(e,this.resize.bind(this))},unbind:function(){this.$content.off(i,this.toggle).off(e,this.resize)},isNeedBuild:function(){var t=this.$element;return!!(1 tr:visible").length<=1||t.data("disable-fixer"))},build:function(){var e=[];this.$tbody.find("> tr:first").children().each(function(){var t=s(this).outerWidth();s(this).outerWidth(t),e.push(t)}),this.$thead.find(">tr").children().each(function(t){s(this).outerWidth(e[t])})},toggle:function(){var t,e,i,n,o,r;this.$content.length&&(t=this.$element,e=this.$thead,i=this.$content.scrollTop(),n=this.$subHeader.outerHeight()+this.paddingHeight+this.marginBottomPX,o=s(".qor-page__header").outerHeight(),r=this.$content.offset().top+s(".qor-page__header").height(),n-o\n \n \n "),this.bind()},bind:function(){this.$element.on(i,l,this.showEditButton).on(n,l,this.hideEditButton).on(e,".qor-inlineedit__cancel",this.hideEdit).on(e,".qor-inlineedit__save",this.saveEdit).on(e,r,this.showEdit.bind(this))},unbind:function(){this.$element.off(i).off(n).off(e)},showEditButton:function(t){var e=s(u.TEMPLATE_EDIT);if(s(t.target).closest(a).find("input:disabled, textarea:disabled,select:disabled").length)return!1;e.appendTo(s(this))},hideEditButton:function(){s(".qor-inlineedit__edit").remove()},showEdit:function(t){t=s(t.target).closest(r).hide().closest(a).addClass(c);s(this.TEMPLATE_SAVE).appendTo(t)},hideEdit:function(){s(this).closest(a).removeClass(c).find(d).remove()},saveEdit:function(){var n=s(this),o=n.closest(a),t=n.closest("form"),e=o.closest(".qor-fieldset").find('input.qor-hidden__primary_key[type="hidden"]'),i=o.find('input[name*="QorResource"],textarea[name*="QorResource"],select[name*="QorResource"]'),r=i.length&&i.prop("name").match(/\.\w+/g),i=i.serialize();e.length&&(i="".concat(i,"&").concat(e.serialize())),r.length&&s.ajax(t.prop("action"),{method:t.prop("method"),data:i,dataType:"json",beforeSend:function(){n.prop("disabled",!0)},success:function(t){var e=function(t,e){var i,n=e[t[0].slice(1)];if(1mode_edit',u.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.inlineEdit"]',i={};s(document).on("disable.qor.inlineEdit",function(t){u.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){u.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(e){var i=window.componentHandler,n='[class*="mdl-js"],[class*="mdl-tooltip"]';function o(t){i&&(e(t).is(n)?i.upgradeElements(t):i.upgradeElements(e(n,t).toArray()))}function r(t){i&&(e(t).is(n)?i.downgradeElements(t):i.downgradeElements(e(n,t).toArray()))}e(function(){e(document).on("enable.qor.material",function(t){o(t.target)}).on("disable.qor.material",function(t){r(t.target)}).on("update.qor.material",function(t){r(t.target),o(t.target)})})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var n=o(document),r="qor.modal",t="click."+r,e="keyup."+r,s="transitionend",a="qor-modal-open",l="in",i="aria-hidden";function d(t,e){this.$element=o(t),this.options=o.extend({},d.DEFAULTS,o.isPlainObject(e)&&e),this.transitioning=!1,this.fadable=!1,this.init()}return d.prototype={constructor:d,init:function(){this.fadable=this.$element.hasClass("fade"),this.options.show?this.show():this.toggle()},bind:function(){this.$element.on(t,o.proxy(this.click,this)),this.options.keyboard&&n.on(e,o.proxy(this.keyup,this))},unbind:function(){this.$element.off(t,this.click),this.options.keyboard&&n.off(e,this.keyup)},click:function(t){var e=this.$element[0],i=t.target;if(i===e&&this.options.backdrop)this.hide();else for(;i!==e;){if("modal"===o(i).data("dismiss")){this.hide();break}i=i.parentNode}},keyup:function(t){27===t.which&&this.hide()},show:function(t){var e,i=this.$element;if(!this.transitioning&&!i.hasClass(l)&&(e=o.Event("show.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").addClass(a),i.addClass("shown").scrollTop(0).get(0).offsetHeight,this.transitioning=!0,t||!this.fadable)return i.addClass(l),void this.shown();i.one(s,o.proxy(this.shown,this)),i.addClass(l)}},shown:function(){this.transitioning=!1,this.bind(),this.$element.attr(i,!1).trigger("shown.qor.modal").focus()},hide:function(t){var e,i=this.$element;if(!this.transitioning&&i.hasClass(l)&&(e=o.Event("hide.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").removeClass(a),this.transitioning=!0,t||!this.fadable)return i.removeClass(l),void this.hidden();i.one(s,o.proxy(this.hidden,this)),i.removeClass(l)}},hidden:function(){this.transitioning=!1,this.unbind(),this.$element.removeClass("shown").attr(i,!0).trigger("hidden.qor.modal")},toggle:function(){this.$element.hasClass(l)?this.hide():this.show()},destroy:function(){this.$element.removeData(r)}},d.DEFAULTS={backdrop:!1,keyboard:!0,show:!0},d.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new d(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o.fn.qorModal=d.plugin,o(function(){var e=".qor-modal";o(document).on(t,'[data-toggle="qor.modal"]',function(){var t=o(this),e=t.data(),t=o(e.target||t.attr("href"));d.plugin.call(t,t.data(r)?"toggle":e)}).on("disable.qor.modal",function(t){d.plugin.call(o(e,t.target),"destroy")}).on("enable.qor.modal",function(t){d.plugin.call(o(e,t.target))})}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var o="qor.tabbar.radio",t="enable."+o,e="click."+o,s="[data-tab-target]",a="is-active";function l(t,e){this.$element=r(t),this.options=r.extend({},l.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return l.prototype={constructor:l,init:function(){this.bind()},bind:function(){this.$element.on(e,s,this.switchTab.bind(this))},unbind:function(){this.$element.off(e,s,this.switchTab)},switchTab:function(t){var e=r(t.target),i=this.$element,n=i.find(s),o=i.find("[data-tab-source]"),t=e.data().tabTarget;e.hasClass(a)||(n.removeClass(a),e.addClass(a),o.hide().filter('[data-tab-source="'+t+'"]').show(),i.trigger("switched.qor.tabbar.radio",[i,t]))},destroy:function(){this.unbind()}},l.DEFAULTS={},l.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new l(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.tab.radio"]';r(document).on("disable.qor.tabbar.radio",function(t){l.plugin.call(r(e,t.target),"destroy")}).on(t,function(t){l.plugin.call(r(e,t.target))}).triggerHandler(t)}),l}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(c){var r="qor.redactor",t="enable."+r,l="click."+r,e="addCrop."+r,i="removeCrop."+r,s="scroll."+r,n=".qor-cropper__toggle--redactor";function u(t,e){this.$element=c(t),this.options=c.extend(!0,{},u.DEFAULTS,c.isPlainObject(e)&&e),this.init()}return u.prototype={constructor:u,init:function(){var i,t=this.options,e=this.$element,n=e.closest(t.parent);n.length||(n=e.parent()),this.$parent=n,this.$button=c(u.BUTTON),this.$modal=c((i=u.MODAL,t=t.text,"string"==typeof i&&"object"===_typeof(t)&&c.each(t,function(t,e){i=i.replace("$["+String(t).toLowerCase()+"]",e)}),i)).appendTo("body"),this.bind()},bind:function(){this.$element.on(e,c.proxy(this.addButton,this)).on(i,c.proxy(this.removeButton,this))},unbind:function(){this.$element.off(e).off(i).off(s)},addButton:function(t,e){var i=c(e);this.$button.css("left",c(e).width()/2).prependTo(i.parent()).find(n).one(l,c.proxy(this.crop,this,i))},removeButton:function(){this.$button.find(n).off(l),this.$button.detach()},crop:function(n){var o,r=this.options,s=n.attr("src"),t=s,a=this.$modal;c.isFunction(r.replace)&&(t=r.replace(t)),o=c("")),a.one("shown.qor.modal",function(){var t,e;o.cropper({data:(t=n.attr("data-crop-options"),e=t&&t.split(","),t=null,e&&4===e.length&&(t={x:Number(e[0]),y:Number(e[1]),width:Number(e[2]),height:Number(e[3])}),t),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,checkImageOrigin:!1,ready:function(){a.find(".qor-cropper__save").one(l,function(){var i=o.cropper("getData",!0);c.ajax(r.remote,{type:"POST",contentType:"application/json",data:JSON.stringify({Url:s,CropOptions:{original:function(t){var e,i,n={};if(c.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(n["string"==typeof(i=e)&&(i=i.charAt(0).toUpperCase()+i.substr(1)),i]=t[e]);return n}(i)},Crop:!0}),dataType:"json",success:function(t){var e;c.isPlainObject(t)&&t.url&&(n.attr("src",t.url).attr("data-crop-options",(t=i,e=[],c.isPlainObject(t)&&c.each(t,function(){e.push(arguments[1])}),e.join())).removeAttr("style").removeAttr("rel"),c.isFunction(r.complete)&&r.complete(),a.qorModal("hide"))}})})}})}).one("hidden.qor.modal",function(){o.cropper("destroy").remove()}).qorModal("show").find(".qor-cropper__wrapper").append(o)},destroy:function(){this.unbind(),this.$modal.qorModal("hide").remove(),this.$element.removeData(r)}},u.DEFAULTS={remote:!1,parent:!1,toggle:!1,replace:null,complete:null,text:{title:"Crop the image",ok:"OK",cancel:"Cancel"}},u.BUTTON='
            \n Edit\n Crop\n
            ',u.MODAL='',u.plugin=function(o){return this.each(function(){var t,i=c(this),n=i.data(r);if(n)/destroy/.test(o)&&window.$R(this,"destroy");else{if(!window.$R)return;if(/destroy/.test(o))return;i.data(r,n={});var e={imageUpload:i.data("uploadUrl"),fileUpload:i.data("uploadUrl"),buttons:["html","format","bold","italic","deleted","lists","image","file","link"],linkNewTab:!0,linkTitle:!1,autoparsePaste:!1,autoparseLinks:!1,multipleUpload:!1,toolbarFixedTarget:!i.closest(".qor-slideout").length&&!i.closest(".qor-bottomsheets").length&&c("main.mdl-layout__content").length?"main.mdl-layout__content":document,callbacks:{started:function(){var t,a=c(this.container.$container.nodes[0]),l=c(this.toolbar.$toolbar.nodes[0]),e=c(".qor-slideout").is(":visible"),d=64;e?d=0!=i.closest(".qor-bottomsheets").length?(t=i.closest(".qor-page__body"),i.closest(".qor-page__body").offset().top):(t=".qor-slideout__body",c(".qor-slideout__header").height()):d+=c(t=".qor-layout main.qor-page").find(".qor-page__header").height(),c(t).on(s,function(){var t,e,i,n,o,r,s;t=l,i=d,n=(e=a).offset().top,o=e.outerHeight(),r={position:"relative",top:"auto",width:"auto"},s={position:"fixed",top:i,width:e.width(),boxShadow:"none"},n .qor-field__block > .qor-fieldset--new");this.singlePage=!(t.closest(".qor-slideout").length&&t.closest(".qor-bottomsheets").length),this.maxitems=t.data("maxItem"),this.isSortable=t.hasClass("qor-fieldset-sortable"),e.length&&!t.closest(".qor-fieldset--new").length&&(e.trigger("disable"),e.find("select[data-toggle]").removeAttr("data-select2-id"),this.isMultipleTemplate=t.data("isMultiple"),this.isMultipleTemplate?(this.fieldsetName=[],this.template={},this.index=[],e.each(function(t,e){(i=c(e).data("fieldsetName"))&&(n.template[i]=c(e).prop("outerHTML"),n.fieldsetName.push(i))}),this.parseMultiple()):this.parse(e.prop("outerHTML")),e.hide(),this.bind(),this.resetButton(),this.resetPositionButton())},resetPositionButton:function(){var t=this.$element.find("> .qor-sortable__button");this.isSortable&&(1 .qor-field__block > .qor-fieldset").not(".qor-fieldset--new,.is-deleted").length},toggleButton:function(t){var e=this.$element.find("> .qor-field__block > .qor-fieldset__add");t?e.hide():e.show()},resetButton:function(){this.maxitems<=this.getCurrentItems()?this.toggleButton(!0):this.toggleButton()},parse:function(t){t&&(t=this.initTemplate(t),this.template=t.template,this.index=t.index)},parseMultiple:function(){for(var t,e,i=this.fieldsetName,n=0,o=i.length;n .qor-field__block > .qor-sortable__item").not(".qor-fieldset--new").length,e.attr("order-index",t).attr("order-item","item_".concat(t)).css("order",t)),e.data("itemIndex",this.index).removeClass("qor-fieldset--new"),e}},del:function(t){var e,i=this.options,n=c(t.target).closest(i.itemClass),o=this,t={confirm:c(t.target).closest(i.delClass).data("confirm")||"Are you sure?"};s.qorConfirm(t,function(t){t&&(n.addClass("is-deleted").children(":visible").addClass("hidden").hide(),(e=c(i.alertTemplate.replace("{{name}}",o.parseName(n)))).find(i.undoClass).one(a,function(){if(o.maxitems<=o.getCurrentItems())return window.QOR.qorConfirm(o.$element.data("maxItemHint")),!1;n.find("> .qor-fieldset__alert").remove(),n.removeClass("is-deleted").children(".hidden").removeClass("hidden").show(),o.resetButton(),o.resetPositionButton()}.bind(this)),o.resetButton(),o.resetPositionButton(),n.append(e))})},parseName:function(t){t=t.find("input[name]").attr("name")||t.find("textarea[name]").attr("name");if(t)return t.replace(/[^\[\]]+$/,"")},destroy:function(){this.unbind(),this.$element.removeData(o)}},d.DEFAULTS={itemClass:".qor-fieldset",newClass:".qor-fieldset--new",addClass:".qor-fieldset__add",delClass:".qor-fieldset__delete",childrenClass:".qor-field__block",undoClass:".qor-fieldset__undo",alertTemplate:'
            '},d.plugin=function(n){return this.each(function(){var t,e=c(this),i=e.data(o);i||e.data(o,i=new d(this,n)),"string"==typeof n&&c.isFunction(t=i[n])&&t.call(i)})},c(function(){var e=l,i={};c(document).on("disable.qor.replicator",function(t){d.plugin.call(c(e,t.target),"destroy")}).on(t,function(t){d.plugin.call(c(e,t.target),i)}).triggerHandler(t)}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var a=window.location,o=window.componentHandler,l=window.history,r="qor.globalSearch",t="enable."+r,e="click."+r,d=".qor-global-search--resource",c=".qor-global-search--results",u="is-active";function h(t,e){this.$element=s(t),this.options=s.extend({},h.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return h.prototype={constructor:h,init:function(){this.bind(),this.initTab()},bind:function(){this.$element.on(e,s.proxy(this.click,this))},unbind:function(){this.$element.off(e,this.check)},initTab:function(){var t=a.search;/resource_name/.test(t)&&(t=t.match(/resource_name=\w+/g).toString().split("=")[1],s(d).removeClass(u),s('[data-resource="'+t+'"]').addClass(u))},click:function(t){var e,i,n,o=s(t.target),r=o.data();o.is(d)&&(n=a.href.replace(/#/g,""),e=r.resource,i=/resource_name/.test(n),t="resource_name="+e,r=/keyword/.test(n)?"&":"?keyword=&",n=e?i?n.replace(/resource_name=\w+/g,t):n+r+t:n.replace(/&resource_name=\w+/g,""),l.pushState?this.fetchSearch(n,o):a.href=n)},fetchSearch:function(e,i){var n=document.title;s.ajax(e,{method:"GET",dataType:"html",beforeSend:function(){s(".mdl-spinner").remove(),s(c).prepend('
            ').find(".qor-section").hide(),o.upgradeElement(document.querySelector(".mdl-spinner"))},success:function(t){t=s(t).find(c).html();s(d).removeClass(u),i.addClass(u),l.pushState({Page:e,Title:n},n,e),s(".mdl-spinner").remove(),s(c).removeClass("loading").html(t),o.upgradeElements(document.querySelectorAll(".qor-table"))},error:function(t,e,i){s(c).find(".qor-section").show(),s(".mdl-spinner").remove(),window.alert([e,i].join(": "))}})},destroy:function(){this.unbind(),this.$element.removeData(r)}},h.DEFAULTS={},h.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(r);i||e.data(r,i=new h(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.global.search"]',i={};s(document).on("disable.qor.globalSearch",function(t){h.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){h.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),h}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var d=window.FormData,c=window.QOR,o="qor.selectcore",s="afterSelected."+o,t="click."+o,e="submit."+o,i="table.qor-js-table tr";function r(t,e){this.$element=l(t),this.options=l.extend({},r.DEFAULTS,l.isPlainObject(e)&&e),this.init()}return r.prototype={constructor:r,init:function(){this.bind()},bind:function(){this.$element.on(t,i,this.processingData.bind(this)).on(e,"form",this.submit.bind(this))},unbind:function(){this.$element.off(t,i).off(e,"form")},processingData:function(e){var t=l(e.target).closest("tr"),i=t.closest(".qor-bottomsheets"),n={},o=this.options,r=o.onSelect,o=o.loading;return(n=l.extend({},n,t.data())).$clickElement=t,t=n.mediaLibraryUrl||n.url,o&&l.isFunction(o)&&o(i),t?l.getJSON(t,function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),n=l.extend({},t,n),r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s))}).always(function(){i.find(".qor-media-loading").remove()}):r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s)),!1},submit:function(e){var i,t=e.target,n=l(t),o=this,r=n.find(":submit"),s=l(c.$formLoading),a=this.options.onSubmit;l(document).trigger("selectcoreBeforeSend.qor.selectcore"),n.find(".qor-fieldset--new").remove(),d&&(e.preventDefault(),l.ajax(n.prop("action"),{method:n.prop("method"),data:new d(t),dataType:"json",processData:!1,contentType:!1,beforeSend:function(){l(".qor-submit-loading").remove(),s.appendTo(r.prop("disabled",!0).closest(".qor-form__actions")).trigger("enable.qor.material")},success:function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),(i=t).primaryKey=i.ID,l(".qor-error").remove(),a&&l.isFunction(a)?(a(i,e),l(document).trigger("afterSubmitted.qor.selectcore")):o.refresh()},error:function(t){c.handleAjaxError(t)},complete:function(){r.prop("disabled",!1)}}))},refresh:function(){setTimeout(function(){window.location.reload()},350)},destroy:function(){this.unbind()}},r.plugin=function(n){return this.each(function(){var t,e=l(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new r(this,n))}"string"==typeof n&&l.isFunction(t=i[n])&&t.apply(i)})},l.fn.qorSelectCore=r.plugin,r}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var i=s("body"),t=s(document),a=window.Mustache,o="qor.selectone",n="click."+o,r="enable."+o,e="reload.qor.bottomsheets",l=".qor-selected-many__remove",d=".qor-selected-many__undo",c="qor-selected-many__deleted",u=".qor-field__selectmany",h="is_selected",f="qor-bottomsheets__select-many";function p(t,e){this.$element=s(t),this.options=s.extend({},p.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return p.prototype={constructor:p,init:function(){this.bind()},bind:function(){t.on(e,".".concat(f),this.reloadData.bind(this)),this.$element.on(n,l,this.clearSelect.bind(this)).on(n,'[data-select-modal="many"]',this.openBottomSheets.bind(this)).on(n,d,this.undoDelete.bind(this))},unbind:function(){t.off(n,'[data-select-modal="many"]').off(e,".".concat(f)),this.$element.off(n,l).off(n,d)},clearSelect:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").addClass(c),this.updateSelectInputData(t),!1},undoDelete:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").removeClass(c),this.updateSelectInputData(t),!1},openBottomSheets:function(t){var e=s(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.bottomsheetsData=t,this.$selector=t.selectId?s(t.selectId):e.closest(u).find("select"),this.$selectFeild=this.$selector.closest(u).find(".qor-field__selected-many"),this.SELECT_MANY_SELECTED_ICON=s('[name="select-many-selected-icon"]').html(),this.SELECT_MANY_UNSELECTED_ICON=s('[name="select-many-unselected-icon"]').html(),this.SELECT_MANY_HINT=s('[name="select-many-hint"]').html(),this.SELECT_MANY_TEMPLATE=s('[name="select-many-template"]').html(),t.url=t.selectListingUrl,t.selectDefaultCreating&&(t.url=t.selectCreatingUrl),this.BottomSheets.open(t,this.handleSelectMany.bind(this))},reloadData:function(){this.initItems()},renderSelectMany:function(t){return a.render(this.SELECT_MANY_TEMPLATE,t)},renderHint:function(t){return a.render(this.SELECT_MANY_HINT,t)},initItems:function(){var i,t=this.$bottomsheets.find("tbody tr"),n=this.SELECT_MANY_SELECTED_ICON,o=this.SELECT_MANY_UNSELECTED_ICON,r=[];this.$selectFeild.find("[data-primary-key]").not("."+c).each(function(){r.push(s(this).data().primaryKey)}),t.each(function(){var t=s(this),e=t.find("td:first");i=t.data().primaryKey,"-1"!=r.indexOf(i)?(t.addClass(h),e.append(n)):e.append(o)}),this.updateHint(this.getSelectedItemData())},getSelectedItemData:function(){return{selectedNum:this.$selectFeild.find("[data-primary-key]").not("."+c).length}},updateHint:function(t){s.extend(t,this.bottomsheetsData),t=this.renderHint(t),this.$bottomsheets.find(".qor-selectmany__hint").remove(),this.$bottomsheets.find(".qor-page__body").before(t)},updateSelectInputData:function(t){var e,i,n=(t||this.$selectFeild).find("[data-primary-key]").not("."+c),o=t?t.find(".qor-field__selectmany-input"):this.$selector,r=o.find("option");r.prop("selected",!1),n.each(function(){i=s(this).data().primaryKey,(e=r.filter('[value="'+i+'"]')).length||(i={primaryKey:i,displayName:""},e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,i)),o.append(e)),e.prop("selected",!0)})},changeIcon:function(t,e){t.find(".qor-select__select-icon").remove(),t.find("td:first").prepend(e)},removeItem:function(t){var e=t.primaryKey;this.$selectFeild.find('[data-primary-key="'+e+'"]').find(l).click(),this.changeIcon(t.$clickElement,this.SELECT_MANY_UNSELECTED_ICON)},addItem:function(t,e){var i=this.renderSelectMany(t),n=this.$selectFeild.find('[data-primary-key="'+t.primaryKey+'"]');return n.length?n.hasClass(c)?(n.removeClass(c),this.updateSelectInputData(),void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON)):void 0:(this.$selectFeild.append(i),e?((e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,t))).appendTo(this.$selector),e.prop("selected",!0),this.$bottomsheets.remove(),void(s(".qor-bottomsheets").is(":visible")||s("body").removeClass("qor-bottomsheets-open"))):void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON))},handleSelectMany:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(f),t.on(n,".qor-selectmany__selectall",this.handleSelectAll.bind(this)),this.$bottomsheets=t,this.initItems()},handleSelectAll:function(){var t=this.$bottomsheets.find(".qor-table tbody tr"),e=t.not(".is_selected");(e.length?e:t).click()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t,e){t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.displayName=t.displayName.escapeSymbol(),e?this.addItem(t,!0):((e=t.$clickElement).toggleClass(h),e.hasClass(h)?this.addItem(t):this.removeItem(t),this.updateHint(this.getSelectedItemData()),this.updateSelectInputData())},destroy:function(){this.unbind(),this.$element.removeData(o)}},p.SELECT_MANY_OPTION_TEMPLATE='',p.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new p(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.selectmany"]';s(document).on("disable.qor.selectone",function(t){p.plugin.call(s(e,t.target),"destroy")}).on(r,function(t){p.plugin.call(s(e,t.target))}).triggerHandler(r)}),p}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var i=r("body"),t=r(document),s=window.Mustache,o="qor.selectone",e="click."+o,n="enable."+o,a="reload.qor.bottomsheets",l=".qor-selected__remove",d=".qor-selected__change",c=".qor-field__selected",u=".qor-field__selectone-input",h=".qor-field__selectone-trigger",f=".qor-field__selectone",p="qor-bottomsheets__select-one";function m(t,e){this.$element=r(t),this.options=r.extend({},m.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return m.prototype={constructor:m,init:function(){this.bind()},bind:function(){t.on(a,".".concat(p),this.reloadData.bind(this)),this.$element.on(e,l,this.clearSelect.bind(this)).on(e,"[data-selectone-url]",this.openBottomSheets.bind(this)).on(e,d,this.changeSelect)},unbind:function(){t.off(e,"[data-selectone-url]").off(a,".".concat(p)),this.$element.off(e,l).off(e,d)},clearSelect:function(t){t=r(t.target).closest(f);return t.find(c).remove(),t.find(u).html(""),t.find(u)[0].value="",t.find(h).show(),t.trigger("qor.selectone.unselected"),!1},changeSelect:function(){r(this).closest(f).find(h).trigger("click")},openBottomSheets:function(t){var e=r(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.$parent=e.closest(f),t.url=t.selectoneUrl,this.SELECT_ONE_SELECTED_ICON=r('[name="select-one-selected-icon"]').html(),this.BottomSheets.open(t,this.handleSelectOne.bind(this))},initItem:function(){var t,e=this.$parent.find(c);e.length&&(t=e.data().primaryKey)&&this.$bottomsheets.find('tr[data-primary-key="'+t+'"]').addClass("is_selected").find("td:first").append(this.SELECT_ONE_SELECTED_ICON)},reloadData:function(){this.initItem()},renderSelectOne:function(t){return s.render(r('[name="select-one-selected-template"]').html(),t)},handleSelectOne:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(p),this.$bottomsheets=t,this.initItem()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t){var e,i=this.$parent,n=i.find("select"),o=i.find(c);t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.selectoneValue=t.primaryKey||t.ID,t.displayName=t.displayName.escapeSymbol(),n.length&&(e=this.renderSelectOne(t),o.length&&o.remove(),i.prepend(e),i.find(h).hide(),n.html(s.render(m.SELECT_ONE_OPTION_TEMPLATE,t)),n[0].value=t.primaryKey||t.ID,i.trigger("qor.selectone.selected",[t]),this.$bottomsheets.qorSelectCore("destroy").remove(),r(".qor-bottomsheets").is(":visible")||r("body").removeClass("qor-bottomsheets-open"))},destroy:function(){this.unbind(),this.$element.removeData(o)}},m.SELECT_ONE_OPTION_TEMPLATE='',m.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new m(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.selectone"]';r(document).on("disable.qor.selectone",function(t){m.plugin.call(r(e,t.target),"destroy")}).on(n,function(t){m.plugin.call(r(e,t.target))}).triggerHandler(n)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var t=l(document),r="qor.selector",i="enable."+r,e="click."+r,d="selected",c="disabled",s="clearable",a="."+d,u=".qor-selector-toggle",h=".qor-selector-label",f=".qor-selector-menu",p=".qor-bottomsheets";function m(t,e){this.options=e,this.$element=l(t),this.init()}return m.prototype={constructor:m,init:function(){var t=this.$element;this.placeholder=t.attr("placeholder")||t.attr("name")||"Select",this.build()},build:function(){var t=this.$element,e=l(m.TEMPLATE),i=this.options.aligned+"-aligned",s={},n=t.data(),o=n.hover,a=t.attr("name");this.isBottom="bottom"==n.position,o&&e.addClass("hover"),e.addClass(i).find(f).html(function(){var r=[];return t.children().each(function(){var t=l(this),e=t.attr("selected"),i=t.attr("disabled"),n=t.attr("value"),o=t.text(),t=[];e&&(t.push(d),s.value=n,s.label=o,s.paramName=a),i&&t.push(c),r.push("'+o+"")}),r.join("")}),this.$selector=e,t.hide().after(e),e.find(u).data("paramName",a),this.pick(s,!0),this.bind()},unbuild:function(){this.unbind(),this.$selector.remove(),this.$element.show()},bind:function(){this.$selector.on(e,l.proxy(this.click,this)),t.on(e,l.proxy(this.close,this))},unbind:function(){this.$selector.off(e,this.click)},click:function(t){var e=l(t.target);t.stopPropagation(),e.is(".qor-selector-clear")?this.clear():e.is("li")?(e.hasClass(d)||e.hasClass(c)||this.pick(e.data()),this.close()):e.closest(u).length&&this.open()},pick:function(t,e){var i=this.$selector,n=!!t.value,o=this.$element;i.find(u).toggleClass("active",n).toggleClass(s,n&&this.options.clearable).find(h).text(t.label||this.placeholder),e||(i.find(f).children('[data-value="'+t.value+'"]').addClass(d).siblings(a).removeClass(d),o.val(t.value),o.closest(p).length&&!o.closest('[data-toggle="qor.filter"]').length?l(p).trigger("selectorChanged.qor.selector",[t.value,t.paramName]):o.trigger("change"))},clear:function(){var t=this.$element;this.$selector.find(u).removeClass("active").removeClass(s).find(h).text(this.placeholder).end().end().find(f).children(a).removeClass(d),t.val("").trigger("change")},open:function(){t.triggerHandler(e),l(".qor-filter__dropdown").hide(),this.$selector.addClass("open"),this.isBottom&&this.$selector.addClass("bottom")},close:function(){this.$selector.removeClass("open"),this.isBottom&&this.$selector.removeClass("bottom")},destroy:function(){this.unbuild(),this.$element.removeData(r)}},m.DEFAULTS={aligned:"left",clearable:!1},m.TEMPLATE='',m.plugin=function(o){return this.each(function(){var t,e,i=l(this),n=i.data(r);if(!n){if(/destroy/.test(o))return;t=l.extend({},m.DEFAULTS,i.data(),"object"===_typeof(o)&&o),i.data(r,n=new m(this,t))}"string"==typeof o&&l.isFunction(e=n[o])&&e.apply(n)})},l(function(){var e='[data-toggle="qor.selector"]';l(document).on("disable.qor.selector",function(t){m.plugin.call(l(e,t.target),"destroy")}).on(i,function(t){m.plugin.call(l(e,t.target))}).triggerHandler(i)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(p){var t=p(document),l=window.FormData,m=window.QOR_Translations,o=window._,d=window.QOR,r="qor.slideout",e="keyup."+r,i="click."+r,n="submit."+r,y="shown."+r,g="hidden."+r,s="transitionend",a="qor-slideout-open",c="qor-slideout-mini",u="is-shown",h="is-slided",b=".qor-body__loading";function f(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(p(this).attr(n))}),o.uniq(i)}function v(t,e,i){for(var n=0,o=0,r=t.length;o\s]+))?)+\s*|\s*)>/g))for(var r=0;r[\s\S]*<\s*\/body\s*>/gi);r&&(r=r.join("").replace(/<\s*body/gi," thead > tr > th",o.proxy(this.sort,this))},unbind:function(){this.$element.off(e,this.sort)},sort:function(t){var e=o(t.currentTarget).data("orderBy"),t=n.search,i="order_by="+e;e&&(/order_by/.test(t)?t=t.replace(/order_by(=\w+)?/,function(){return i}):t+=-1this.slideoutWidth&&this.$element.find(d).append(f.ARROW_RIGHT)},scrollTabLeft:function(t){t.stopPropagation();var e=o(d),i=e.scrollLeft(),t=i-this.slideoutWidth;0=i&&o(c).hide()}),o(u).length||this.$element.find(d).prepend(f.ARROW_LEFT))},switchTab:function(t){var e=o(t.target),i=this.$element,t=e.data(),n=r.data().tabScopeActive;if(o(".qor-slideout").is(":visible"))return e.hasClass(h)||(i.find(a).removeClass(h),e.addClass(h),o.ajax(t.tabUrl,{method:"GET",dataType:"html",processData:!1,contentType:!1,beforeSend:function(){o(".qor-layout__tab-spinner").remove();o(l).hide().before('
            '),window.componentHandler.upgradeElement(o(".qor-layout__tab-spinner")[0])},success:function(t){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",e.data("name"));t=o(t).find(l).html();o(l).show().html(t).trigger("enable")},error:function(){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",n)}})),!1},destroy:function(){this.unbind(),r.removeData("tabScopeActive")}},f.ARROW_RIGHT='',f.ARROW_LEFT='',f.DEFAULTS={},f.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(s);if(!i){if(/destroy/.test(n))return;e.data(s,i=new f(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e='[data-toggle="qor.tab"]';o(document).on("disable.qor.tabbar",function(t){f.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){f.plugin.call(o(e,t.target))}).triggerHandler(t)}),f}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var s="qor.timepicker",t="enable."+s,e="click."+s,i="focus."+s,n="keydown."+s,o="blur."+s,a="selectTime."+s,l="[data-picker-type]";function d(t,e){this.$element=r(t),this.options=r.extend(!0,{},d.DEFAULTS,r.isPlainObject(e)&&e),this.formatDate=null,this.pickerData=this.$element.data(),this.parent=this.$element.closest(l),this.isDateTimePicker="datetime"==this.parent.data("picker-type"),this.$targetInput=this.parent.find(this.pickerData.targetInput||(this.isDateTimePicker?".qor-datetimepicker__input":".qor-datepicker__input")),this.init()}return d.prototype={init:function(){var t,e,i;this.$targetInput.is(":disabled")?this.$element.remove():(this.bind(),this.oldValue=this.$targetInput.val(),e=(e=(t=new Date).getMonth()+1)<8?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i,this.dateValueNow=t.getFullYear()+"-"+e+"-"+i)},bind:function(){this.isDateTimePicker&&this.$targetInput.qorTimepicker({timeFormat:"H:i",showOn:null,wrapHours:!1,scrollDefault:"now"}).on(a,r.proxy(this.changeTime,this)).on(o,r.proxy(this.blur,this)).on(i,r.proxy(this.focus,this)).on(n,r.proxy(this.keydown,this)),this.$element.on(e,r.proxy(this.show,this))},unbind:function(){this.$element.off(e,this.show),this.isDateTimePicker&&this.$targetInput.off(a,this.changeTime).off(o,this.blur).off(i,this.focus).off(n,this.keydown)},focus:function(){},blur:function(){var t,e,i,n,o,r,s=this.$targetInput.val(),a=s.split(" "),l=a.length,d=/\d{1,2}:\d{1,2}/,c=/^\d{4}-\d{1,2}-\d{1,2}/;if(s){if(1==l)c.test(a[0])&&(e=a[0],i="00:00"),d.test(a[0])&&(e=this.dateValueNow,i=a[0]);else for(var u=0;u
            '},String.prototype.escapeSymbol=function(){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return this.replace(/[&<>"']/g,function(t){return e[t]||t})},window.Mustache&&(window.Mustache.tags=["[[","]]"]),$(document).ajaxComplete(function(t,e,i){"POST"!=i.type&&"PUT"!=i.type||$.fn.qorSlideoutBeforeHide&&($.fn.qorSlideoutBeforeHide=null,window.onbeforeunload=null)}),$.fn.select2.ajaxCommonOptions=function(t){var i=t.remoteDataPrimaryKey;return{dataType:"json",headers:getSelect2Header(t),cache:!0,delay:250,data:function(t){return{keyword:t.term,page:t.page,per_page:20}},processResults:function(t,e){e.page=e.page||1;t=$.map(t,function(t){return t.id=t[i]||t.primaryKey||t.Id||t.ID,t});return{results:t,pagination:{more:20<=t.length}}}}},$.fn.select2.ajaxFormatResult=function(t,e,i){var n="";if(t.loading)return t.text;if(console.log("select2.ajaxFormatResult: Data"),console.log(t),console.log("select2.ajaxFormatResult: has remote image"),console.log(i),i){var o=t.text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],i=t.Image,n=i?'
            '+o+"
            ":'
            '+o+"
            ";return $(n)}return n=0|<\/.+>)/.test(n)?$(n):n},$(function(){var r=window._,o=window.QOR,s=window.QOR_Translations,t='"),a=$(t).appendTo("body");$(document).on("keyup.qor.confirm",function(t){a.is(":visible")&&(27===t.which&&setTimeout(function(){a.hide(),o.qorConfirmCallback=void 0},100),13===t.which&&setTimeout(function(){$('.dialog-button[data-type="confirm"]').click()},100))}).on("click.qor.confirm",".dialog-button",function(){var t=$(this).data("type"),e=o.qorConfirmCallback;return $.isFunction(e)&&e(t),a.hide(),o.qorConfirmCallback=void 0,!1}),o.qorConfirm=function(t,e){var i=a.find(".dialog-ok"),n=a.find(".dialog-cancel");return r.isString(t)?(a.find(".dialog-message").text(t),i.text(s.okButton),n.text(s.cancelButton)):r.isObject(t)&&(t.confirmOk&&t.confirmCancel?(i.text(t.confirmOk),n.text(t.confirmCancel)):(i.text(s.okButton),n.text(s.cancelButton)),t.icon&&a.find("i.material-icons").addClass(t.icon).html(t.icon),a.find(".dialog-message").text(t.confirm)),a.show(),o.qorConfirmCallback=e,!1};function l(t,e){var i,n,o=e||new FormData;for(n in t)t.hasOwnProperty(n)&&t[n]&&(i=n),t[n]instanceof Date?o.append(i,t[n].toISOString()):"object"!==_typeof(t[n])||t[n]instanceof File?o.append(i,t[n]):l(t[n],o);return o}o.qorAjaxHandleFile=function(t,i,n,e){var o=new XMLHttpRequest;o.responseType="arraybuffer",o.open("POST",t,!0),o.onload=function(){var t,e;200===this.status?(e=new Blob([this.response],{type:i}),t=window.URL.createObjectURL(e),e=document.createElement("a"),document.body.appendChild(e),e.href=t,e.download=n||"download-"+$.now(),e.click()):window.alert(s.serverError)},r.isObject(e)&&("[object FormData]"!=Object.prototype.toString.call(e)&&(e=l(e)),o.send(e))};t=function(){var t=$(".qor-linkify-object"),e=/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi;t.length&&t.each(function(){var t=$(this).data("video-link");t.match(e)&&$(this).html(''))})};($.fn.qorSliderAfterShow.converVideoLinks=t)(),o.handleAjaxError=function(t){var e=$("body"),i=t.responseJSON,n=t.responseText,o=$('
            ');if(e.find(".qor-alert").remove(),422===t.status)if(i){var r=i.errors,s="";if($.isArray(r))for(var a=0;a\n error\n '.concat(r[a],"\n ");else s='
          • \n error\n '.concat(r,"\n
          • ");o.append(s)}else o=$(n).find(".qor-error");else o.append('
          • \n error\n '.concat(t.statusText,"\n
          • "));o.prependTo(e),setTimeout(function(){o.addClass("qor-alert__active")},50),setTimeout(function(){$('.qor-alert[data-dismissible="true"]').removeClass("qor-alert__active"),$("#qor-submit-loading").remove()},6e3)}}),function(t){"function"==typeof define&&define.amd?define("datepicker",["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(C){var t=C(window),o=window.document,h=C(o),r=window.Number,a="datepicker",i="click."+a,n="keyup."+a,s="focus."+a,e="resize."+a,l="show."+a,d="hide."+a,c="pick."+a,u=/(y|m|d)+/g,f=/\d+/g,p=/^\d{2,4}$/,m=a+"-top-left",y=a+"-bottom-left",g=[m,a+"-top-right",y,a+"-bottom-right"].join(" "),b=a+"-hide",v=Math.min,_=Object.prototype.toString;function q(t){return"string"==typeof t}function w(t){return"number"==typeof t&&!isNaN(t)}function S(t){return void 0===t}function $(t){return"date"===(t=t,_.call(t).slice(8,-1).toLowerCase())}function k(t,e){var i=[];return Array.from?Array.from(t).slice(e||0):(w(e)&&i.push(e),i.slice.apply(t,i))}function x(t,e){var i=k(arguments,2);return function(){return t.apply(e,i.concat(k(arguments)))}}function T(t,e){return[31,(t=t)%4==0&&t%100!=0||t%400==0?29:28,31,30,31,30,31,31,30,31,30,31][e]}function D(t,e){(e=C.isPlainObject(e)?e:{}).language&&(e=C.extend({},D.LANGUAGES[e.language],e)),this.$element=C(t),this.options=C.extend({},D.DEFAULTS,e),this.isBuilt=!1,this.isShown=!1,this.isInput=!1,this.isInline=!1,this.initialValue="",this.initialDate=null,this.startDate=null,this.endDate=null,this.init()}D.prototype={constructor:D,init:function(){var t=this.options,e=this.$element,i=t.startDate,n=t.endDate,o=t.date;this.$trigger=C(t.trigger||e),this.isInput=e.is("input")||e.is("textarea"),this.isInline=t.inline&&(t.container||!this.isInput),this.format=function(t){var e,i,n=String(t).toLowerCase(),o=n.match(u);if(!o||0===o.length)throw new Error("Invalid date format.");for(t={source:n,parts:o},e=o.length,i=0;in.getTime()&&(o=new Date(n)),this.endDate=n),this.date=o,this.viewDate=new Date(o),this.initialDate=new Date(this.date),this.bind(),(t.autoshow||this.isInline)&&this.show(),t.autopick&&this.pick()},build:function(){var t,e=this.options,i=this.$element;this.isBuilt||(this.isBuilt=!0,this.$picker=t=C(e.template),this.$week=t.find('[data-view="week"]'),this.$yearsPicker=t.find('[data-view="years picker"]'),this.$yearsPrev=t.find('[data-view="years prev"]'),this.$yearsNext=t.find('[data-view="years next"]'),this.$yearsCurrent=t.find('[data-view="years current"]'),this.$years=t.find('[data-view="years"]'),this.$monthsPicker=t.find('[data-view="months picker"]'),this.$yearPrev=t.find('[data-view="year prev"]'),this.$yearNext=t.find('[data-view="year next"]'),this.$yearCurrent=t.find('[data-view="year current"]'),this.$months=t.find('[data-view="months"]'),this.$daysPicker=t.find('[data-view="days picker"]'),this.$monthPrev=t.find('[data-view="month prev"]'),this.$monthNext=t.find('[data-view="month next"]'),this.$monthCurrent=t.find('[data-view="month current"]'),this.$days=t.find('[data-view="days"]'),this.isInline?C(e.container||i).append(t.addClass("datepicker-inline")):(C(o.body).append(t.addClass("datepicker-dropdown")),t.addClass(b)),this.fillWeek())},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.$picker.remove())},bind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.on(l,t.show),C.isFunction(t.hide)&&e.on(d,t.hide),C.isFunction(t.pick)&&e.on(c,t.pick),this.isInput&&(e.on(n,C.proxy(this.keyup,this)),t.trigger||e.on(s,C.proxy(this.show,this))),this.$trigger.on(i,C.proxy(this.show,this))},unbind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.off(l,t.show),C.isFunction(t.hide)&&e.off(d,t.hide),C.isFunction(t.pick)&&e.off(c,t.pick),this.isInput&&(e.off(n,this.keyup),t.trigger||e.off(s,this.show)),this.$trigger.off(i,this.show)},showView:function(t){var e=this.$yearsPicker,i=this.$monthsPicker,n=this.$daysPicker,o=this.format;if(o.hasYear||o.hasMonth||o.hasDay)switch(r(t)){case 2:case"years":i.addClass(b),n.addClass(b),o.hasYear?(this.fillYears(),e.removeClass(b)):this.showView(0);break;case 1:case"months":e.addClass(b),n.addClass(b),o.hasMonth?(this.fillMonths(),i.removeClass(b)):this.showView(2);break;default:e.addClass(b),i.addClass(b),o.hasDay?(this.fillDays(),n.removeClass(b)):this.showView(1)}},hideView:function(){this.options.autohide&&this.hide()},place:function(){var t=this.options,e=this.$element,i=this.$picker,n=h.outerWidth(),o=h.outerHeight(),r=e.outerWidth(),s=e.outerHeight(),a=i.width(),l=i.height(),d=e.offset(),c=d.left,u=d.top,e=parseFloat(t.offset)||10,d=m;l"+n.text+""},fillAll:function(){this.fillYears(),this.fillMonths(),this.fillDays()},fillWeek:function(){for(var t=this.options,e=parseInt(t.weekStart,10)%7,i=t.daysMin,n="",i=C.merge(i.slice(e),i.slice(0,e)),o=0;o<=6;o++)n+=this.createItem({text:i[o]});this.$week.html(n)},fillYears:function(){for(var t,e,i=this.options,n=i.disabledClass||"",o=i.yearSuffix||"",r=C.isFunction(i.filter)&&i.filter,s=this.startDate,a=this.endDate,i=this.viewDate,l=i.getFullYear(),d=i.getMonth(),c=i.getDate(),u=this.date,h=u.getFullYear(),f=!1,p=!1,m=!1,y="",g=-5;g<=6;g++)u=new Date(l+g,d,c),e=-5===g||6===g,t=l+g===h,m=!1,s&&(m=u.getFullYear()a.getFullYear(),6===g&&(p=m)),!m&&r&&(m=!1===r.call(this.$element,u)),y+=this.createItem({text:l+g,view:m?"year disabled":t?"year picked":"year",muted:e,picked:t,disabled:m});this.$yearsPrev.toggleClass(n,f),this.$yearsNext.toggleClass(n,p),this.$yearsCurrent.toggleClass(n,!0).html(l+-5+o+" - "+(l+6)+o),this.$years.html(y)},fillMonths:function(){for(var t,e=this.options,i=e.disabledClass||"",n=e.monthsShort,o=C.isFunction(e.filter)&&e.filter,r=this.startDate,s=this.endDate,a=this.viewDate,l=a.getFullYear(),d=a.getDate(),c=this.date,u=c.getFullYear(),h=c.getMonth(),f=!1,p=!1,m=!1,y="",g=0;g<=11;g++)c=new Date(l,g,d),t=l===u&&g===h,m=!1,r&&(m=(f=c.getFullYear()===r.getFullYear())&&c.getMonth()s.getMonth()),!m&&o&&(m=!1===o.call(this.$element,c)),y+=this.createItem({index:g,text:n[g],view:m?"month disabled":t?"month picked":"month",picked:t,disabled:m});this.$yearPrev.toggleClass(i,f),this.$yearNext.toggleClass(i,p),this.$yearCurrent.toggleClass(i,f&&p).html(l+e.yearSuffix||""),this.$months.html(y)},fillDays:function(){var t,e,i,n,o=this.options,r=o.disabledClass||"",s=o.yearSuffix||"",a=o.monthsShort,l=parseInt(o.weekStart,10)%7,d=C.isFunction(o.filter)&&o.filter,c=this.startDate,u=this.endDate,h=this.viewDate,f=h.getFullYear(),p=h.getMonth(),m=f,y=p,g=f,b=p,v=this.date,_=v.getFullYear(),q=v.getMonth(),w=v.getDate(),S=!1,h=!1,$=!1,k=[],x=[],D=[];for(0===p?(--m,y=11):--y,e=T(m,y),(n=(v=new Date(f,p,1)).getDay()-l)<=0&&(n+=7),c&&(S=v.getTime()<=c.getTime()),i=e-(n-1);i<=e;i++)v=new Date(m,y,i),$=!1,c&&($=v.getTime()=u.getTime()),i=1;i<=n;i++)v=new Date(g,b,i),$=!1,u&&($=v.getTime()>u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),x.push(this.createItem({text:i,view:"day next",muted:!0,disabled:$}));for(i=1;i<=e;i++)v=new Date(f,p,i),t=f===_&&p===q&&i===w,$=!1,c&&($=v.getTime()u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),D.push(this.createItem({text:i,view:$?"day disabled":t?"day picked":"day",picked:t,disabled:$}));this.$monthPrev.toggleClass(r,S),this.$monthNext.toggleClass(r,h),this.$monthCurrent.toggleClass(r,S&&h).html(o.yearFirst?f+s+" "+a[p]:a[p]+" "+f+s),this.$days.html(k.join("")+D.join(" ")+x.join(""))},click:function(t){var e,i,n,o,r,s,a=C(t.target),l=this.viewDate;if(t.stopPropagation(),t.preventDefault(),!a.hasClass("disabled"))switch(e=l.getFullYear(),i=l.getMonth(),n=l.getDate(),s=a.data("view")){case"years prev":case"years next":e="years prev"===s?e-10:e+10,r=a.text(),(o=p.test(r))&&(e=parseInt(r,10),this.date=new Date(e,i,v(n,28))),this.viewDate=new Date(e,i,v(n,28)),this.fillYears(),o&&(this.showView(1),this.pick("year"));break;case"year prev":case"year next":e="year prev"===s?e-1:e+1,this.viewDate=new Date(e,i,v(n,28)),this.fillMonths();break;case"year current":this.format.hasYear&&this.showView(2);break;case"year picked":this.format.hasMonth?this.showView(1):this.hideView();break;case"year":e=parseInt(a.text(),10),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasMonth?this.showView(1):this.hideView(),this.pick("year");break;case"month prev":case"month next":i="month prev"===s?i-1:"month next"===s?i+1:i,this.viewDate=new Date(e,i,v(n,28)),this.fillDays();break;case"month current":this.format.hasMonth&&this.showView(1);break;case"month picked":this.format.hasDay?this.showView(0):this.hideView();break;case"month":i=C.inArray(a.text(),this.options.monthsShort),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasDay?this.showView(0):this.hideView(),this.pick("month");break;case"day prev":case"day next":case"day":i="day prev"===s?i-1:"day next"===s?i+1:i,n=parseInt(a.text(),10),this.date=new Date(e,i,n),this.viewDate=new Date(e,i,n),this.fillDays(),"day"===s&&this.hideView(),this.pick("day");break;case"day picked":this.hideView(),this.pick("day")}},clickDoc:function(t){for(var e,i=t.target,n=this.$trigger[0];i!==o;){if(i===n){e=!0;break}i=i.parentNode}e||this.hide()},keyup:function(){this.update()},getValue:function(){var t=this.$element,e="";return this.isInput?e=t.val():this.isInline&&!this.options.container||(e=t.text()),e},setValue:function(t){var e=this.$element;t=q(t)?t:"",this.isInput?e.val(t):this.isInline&&!this.options.container||e.text(t)},show:function(){this.isBuilt||this.build(),this.isShown||this.trigger(l).isDefaultPrevented()||(this.isShown=!0,this.$picker.removeClass(b).on(i,C.proxy(this.click,this)),this.showView(this.options.startView),this.isInline||(t.on(e,this._place=x(this.place,this)),h.on(i,this._clickDoc=x(this.clickDoc,this)),this.place()))},hide:function(){this.isShown&&(this.trigger(d).isDefaultPrevented()||(this.isShown=!1,this.$picker.addClass(b).off(i,this.click),this.isInline||(t.off(e,this._place),h.off(i,this._clickDoc))))},update:function(){this.setDate(this.getValue(),!0)},pick:function(t){var e=this.$element,i=this.date;this.trigger(c,{view:t||"",date:i}).isDefaultPrevented()||(this.setValue(this.formatDate(this.date)),this.isInput&&e.trigger("change"))},reset:function(){this.setDate(this.initialDate,!0),this.setValue(this.initialValue),this.isShown&&this.showView(this.options.startView)},getMonthName:function(t,e){var i=this.options,n=i.months;return C.isNumeric(t)?t=r(t):S(e)&&(e=t),!0===e&&(n=i.monthsShort),n[w(t)?t:this.date.getMonth()]},getDayName:function(t,e,i){var n=this.options,o=n.days;return C.isNumeric(t)?t=r(t):(S(i)&&(i=e),S(e)&&(e=t)),(o=!0===i?n.daysMin:!0===e?n.daysShort:o)[w(t)?t:this.date.getDay()]},getDate:function(t){var e=this.date;return t?this.formatDate(e):new Date(e)},setDate:function(t,e){var i=this.options.filter;($(t)||q(t))&&(t=this.parseDate(t),C.isFunction(i)&&!1===i.call(this.$element,t)||(this.date=t,this.viewDate=new Date(t),e||this.pick(),this.isBuilt&&this.fillAll()))},setStartDate:function(t){($(t)||q(t))&&(this.startDate=this.parseDate(t),this.isBuilt&&this.fillAll())},setEndDate:function(t){($(t)||q(t))&&(this.endDate=this.parseDate(t),this.isBuilt&&this.fillAll())},parseDate:function(t){var e,i,n,o,r,s,a=this.format,l=[];if($(t))return new Date(t.getFullYear(),t.getMonth(),t.getDate());if(q(t)&&(l=t.match(f)||[]),i=(t=new Date).getFullYear(),n=t.getDate(),o=t.getMonth(),e=a.parts.length,l.length===e)for(s=0;s
                    ',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},D.setDefaults=function(t){C.extend(D.DEFAULTS,C.isPlainObject(t)&&t)},D.other=C.fn.qorDatepicker,C.fn.qorDatepicker=function(o){var r,s=k(arguments,1);return this.each(function(){var t,e,i=C(this),n=i.data(a);if(!n){if(/destroy/.test(o))return;t=C.extend({},i.data(),C.isPlainObject(o)&&o),i.data(a,n=new D(this,t))}q(o)&&C.isFunction(e=n[o])&&(r=e.apply(n,s))}),S(r)?this:r},C.fn.qorDatepicker.Constructor=D,C.fn.qorDatepicker.languages=D.LANGUAGES,C.fn.qorDatepicker.setDefaults=D.setDefaults,C.fn.qorDatepicker.noConflict=function(){return C.fn.qorDatepicker=D.other,this}}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(h){var i=window.Mustache,f=window.QOR,o="qor.action",t="enable."+o,n="click."+o,r='[data-ajax-form="true"][data-method]',e=".qor-action-bulk-buttons",s=".qor-page .qor-table-container",a=".qor-table--bulking",l=".qor-table--bulking tbody tr",p="is_undo",d="mdl-data-table--selectable",c="primary_values[]",m=".qor-body__loading";function u(t,e){this.$element=h(t),this.options=h.extend({},u.DEFAULTS,h.isPlainObject(e)&&e),this.ajaxForm={},this.init()}return u.prototype={constructor:u,init:function(){this.bind(),this.initActions()},bind:function(){this.$element.on(n,".qor-action--bulk",this.renderBulkTable.bind(this)).on(n,".qor-action--exit-bulk",this.removeBulkTable.bind(this)),h(document).on(n,l,this.handleBulkTableClick.bind(this)).on(n,r,this.clickAjaxButton.bind(this))},unbind:function(){this.$element.off(n),h(document).off(n,l,this.handleBulkTableClick).off(n,r,this.clickAjaxButton)},initActions:function(){h(s).find("table").length||(h(e).hide(),h(".qor-page__header a.qor-action--button").hide())},collectFormData:function(){var e,t=h(a).find(".mdl-checkbox__input:checked"),i=[],n=[];return t.length&&t.each(function(){var t=h(this).closest("tr").data("primary-key");e={},t&&(i.push({name:c,value:t.toString()}),e[c]=t.toString(),n.push(e))}),this.ajaxForm.formData=i,this.ajaxForm.normalFormData=n,this.ajaxForm},actionSubmit:function(t){return this.submit(t),!1},handleBulkTableClick:function(t){var e=h(t.target).closest("tr"),i=e.find("td").first(),t=i.find(".mdl-js-checkbox");return t.toggleClass("is-checked"),e.toggleClass("is-selected"),i.find("input").prop("checked",t.hasClass("is-checked")),!1},adjustPageBodyStyle:function(t){var e=h(".qor-page > .qor-page__header"),i=h(".qor-page > .qor-page__body"),n=e.find(".qor-page-subnav__header").length?96:48;t?e.height()>n&&i.css("padding-top",e.height()):parseInt(i.css("padding-top"))>n&&i.css("padding-top","")},renderBulkTable:function(){var t=h("body");t.hasClass("qor-slideout-open")&&t.data("qor.slideout").hide(),h(".qor-table__inner-list").remove(),this.toggleBulkButtons(),this.enableTableMDL(),this.adjustPageBodyStyle(!0)},removeBulkTable:function(){this.toggleBulkButtons(),this.disableTableMDL(),this.adjustPageBodyStyle()},enableTableMDL:function(){h(s).find("table").removeAttr("data-upgraded").addClass(d).trigger("enable")},disableTableMDL:function(){h(s).find("table").removeClass(d).find("tr").removeClass("is-selected").find("td:first,th:first").remove()},toggleBulkButtons:function(){this.$element.find(".qor-action-forms").toggle(),h(e).find("button").toggleClass("hidden"),h(s).toggleClass("qor-table--bulking").find(".qor-table__actions").toggle(),h(".qor-page__header .qor-actions, .qor-page__header .qor-search-container").toggle()},clickAjaxButton:function(t){t=h(t.target);return this.collectFormData(),this.ajaxForm.properties=t.data(),this.submit(t),!1},renderFlashMessage:function(t){var e=u.FLASHMESSAGETMPL;return i.parse(e),i.render(e,t)},addLoading:function(){h(m).remove(),h(u.TEMPLATE_LOADING).appendTo(h("body")).trigger("enable.qor.material")},submit:function(e){var i=this,n=this.ajaxForm||{},t=n.properties||e.data();if(e.hasClass("qor-action-disabled"))return!1;!t.fromIndex||n.formData&&n.formData.length?t.confirm?f.qorConfirm(t,function(t){t&&i.handleAjaxSubmit(n,e)}):this.handleAjaxSubmit(n,e):f.qorConfirm(n.properties.errorNoItem)},handleAjaxSubmit:function(o,r){var s=this,a=this.$element,l=r.closest(".qor-action-forms"),d=o.properties||r.data(),c=d.url,u=d.undoUrl,e=r.hasClass(p),t=r.closest(".qor-slideout").length,i=a.length&&!t;e&&(c=u),this.addLoading(),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).addClass("qor-action-disabled"),h.ajax(c,{method:d.method,data:o.formData,dataType:d.datatype||"json",beforeSend:function(){u?r.prop("disabled",!0):i&&s.switchButtons(a,1)},success:function(t){if(u)return a.trigger("undo.qor.action",[r,e,t]),e?r.removeClass(p):r.addClass(p),void r.prop("disabled",!1);window.location.reload()},error:function(t){200!=t.status&&(u?r.prop("disabled",!1):i&&s.switchButtons(a),f.handleAjaxError(t))},complete:function(t){var e,i=t.getResponseHeader("content-type"),n=t.getResponseHeader("Content-Disposition");h(m).remove(),r.prop("disabled",!1),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).removeClass("qor-action-disabled"),n&&-1!==n.indexOf("attachment")&&(e={},t="",null!=(n=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(n))&&n[1]&&(t=n[1].replace(/['"]/g,"")),d.method&&(e=h.extend({},o.normalFormData,{_method:d.method})),f.qorAjaxHandleFile(c,i,t,e),u?r.prop("disabled",!1):s.switchButtons(a))}})},switchButtons:function(t,e){e=!!e;t.find(".qor-action-button").prop("disabled",e)},destroy:function(){this.unbind(),this.$element.removeData(o)}},u.DEFAULTS={},u.TEMPLATE_LOADING='
                    \n
                    \n
                    \n
                    ',h.fn.qorSliderAfterShow.qorInsertActionData=function(t,e){var i=h(e).find('[data-toggle="qor-action-slideout"]'),n=i.find("form"),e=h(a).find(".mdl-checkbox__input:checked");i.length&&e.length&&e.each(function(){var t=h(this).closest("tr").data("primary-key");t&&n.prepend('')})},u.plugin=function(n){return this.each(function(){var t,e=h(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&h.isFunction(t=i[n])&&t.call(i)})},h(function(){var e={},i='[data-toggle="qor.action.bulk"]';h(i).length||h(document).on(n,r,function(t){return(new u).actionSubmit(h(t.target)),!1}),h(document).on("disable.qor.action",function(t){u.plugin.call(h(i,t.target),"destroy")}).on(t,function(t){u.plugin.call(h(i,t.target),e)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(a){var l=window.location,r=window.QOR,o="qor.advancedsearch",t="enable."+o,e="click."+o;function s(t,e){this.$element=a(t),this.options=a.extend({},s.DEFAULTS,a.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){this.$form=this.$element.find("form"),this.$modal=a(s.MODAL).appendTo("body"),this.bind()},bind:function(){this.$element.on("submit.qor.advancedsearch","form",this.submit.bind(this)).on(e,".qor-advanced-filter__save",this.showSaveFilter.bind(this)).on(e,".qor-advanced-filter__toggle",this.toggleFilterContent).on(e,".qor-advanced-filter__close",this.closeFilter).on(e,".qor-advanced-filter__delete",this.deleteSavedFilter),this.$modal.on("shown.qor.modal",this.start.bind(this))},closeFilter:function(){a(".qor-advanced-filter__dropdown").hide()},toggleFilterContent:function(t){a(t.target).closest(".qor-advanced-filter__toggle").parent().find(">[advanced-search-toggle]").toggle()},showSaveFilter:function(){this.$modal.qorModal("show")},deleteSavedFilter:function(t){var e=a(t.target).closest(".qor-advanced-filter__delete"),i=e.closest(".qor-advanced-filter__savedfilter"),n=e.data("filter-name"),o=l.pathname;return r.qorConfirm({confirm:"Are you sure you want to delete this saved filter?"},function(t){t&&a.get(o,a.param({delete_saved_filter:n})).done(function(){e.closest("li").remove(),0===i.find("li").length&&i.remove()}).fail(function(){r.qorConfirm("Server error, please try again!")})}),!1},start:function(){this.$modal.trigger("enable.qor.material").on(e,".qor-advanced-filter__savefilter",this.saveFilter.bind(this))},saveFilter:function(){var t=this.$modal.find("#qor-advanced-filter__savename").val();t&&this.$form.prepend('')).submit()},submit:function(){var t,e=this.$form,i=e.find("input[name],select[name]"),n=[],o=e.closest(".qor-bottomsheets"),r=e.serialize();if(i.each(function(){n.push(a(this).attr("name"))}),t=function(t){var e,i,n=decodeURIComponent(l.search.replace(/page=\d+/,"page=1").substr(1)).split("&"),o={};if(1==n.length&&""==n[0])return!1;for(i in n)""!==n[i]&&(e=n[i].split("="),o[e[0]]=e[1]);return t.forEach(function(t){delete o[t]}),o}(n),!a.isEmptyObject(t))for(var s in t)t.hasOwnProperty(s)&&e.prepend('\n
                    \n
                    \n

                    Save advanced filter

                    \n
                    \n
                    \n \n
                    \n \n \n
                    \n\n
                    \n \n
                    \n \n
                    \n
                    \n ',s.plugin=function(n){return this.each(function(){var t,e=a(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new s(this,n))}"string"==typeof n&&a.isFunction(t=i[n])&&t.apply(i)})},a(function(){var e='[data-toggle="qor.advancedsearch"]';a(document).on("disable.qor.advancedsearch",function(t){s.plugin.call(a(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(a(e,t.target),void 0)}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var r="qor.autoheight",t="enable."+r;function s(t,e){this.$element=o(t),this.options=o.extend({},s.DEFAULTS,o.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){var t=this.$element;this.paddingTop=parseInt(t.css("padding-top"),10),this.paddingBottom=parseInt(t.css("padding-bottom"),10),this.resize(),this.bind()},bind:function(){this.$element.on("input",o.proxy(this.resize,this))},unbind:function(){this.$element.off("input",this.resize)},resize:function(){var t=this.$element,e=t.prop("scrollHeight");e?t.height("auto").height(e-this.paddingTop-this.paddingBottom):t.height("40px")},destroy:function(){this.unbind(),this.$element.removeData(r)}},s.DEFAULTS={},s.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new s(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e="textarea.qor-js-autoheight";o(document).on("disable.qor.autoheight",function(t){s.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(o(e,t.target))}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(b){var o=window._,n=window.FormData,i=window.QOR_Translations,r="qor.bottomsheets",t="click."+r,e="submit."+r,v="qor-bottomsheets-open",_=".mdl-layout__content.qor-page",s=".qor-page__body",q=".qor-page__header",a=".qor-bottomsheets__search-input";function l(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(b(this).attr(n))}),o.uniq(i)}function d(t,e,i){for(var n=0,o=0,r=t.length;o')},filterChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},selectorChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},keyup:function(t){var e=this.$bottomsheets.find(a);13===t.which&&e.length&&e.is(":focus")&&this.search()},search:function(){var t=this.$bottomsheets,e=t.data().url,i=b.trim(t.find(a).val()),t=e+"?keyword="+i;/\?/g.test(e)&&(t=e+"&keyword="+i),this.reload(t)},pagination:function(t){t=b(t.target).closest("a").prop("href");return t&&this.reload(t),!1},reload:function(t){var e=this.$bottomsheets.find(s);this.addLoading(e),this.fetchPage(t)},reloadFromUrl:function(t,e){this.reload(e)},fetchPage:function(i){var n=this.$bottomsheets,o=this;b.get(i,function(t){var e=b(t).find(_),t=e.find(q),e=e.find(s);e.length?(n.find(s).html(e.html()),t.length&&(o.$body.find(q).html(t.html()).trigger("enable"),o.addHeaderClass()),n.trigger("reload.qor.bottomsheets")):o.reload(i)}).fail(function(){window.alert("server error, please try again later!")})},constructloadURL:function(t,e){var i,n,o=this.filterURL,r=this.$bottomsheets.data().url;if(!o){if(!r)return;o=r}return i=new URL("http://www.getqor.com/"+t),n=e,r=i.search,n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=null===(r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(decodeURIComponent(r)))?"":r[1].replace(/\+/g," "),o=this.filterURL=(i=e,n=t,r=o,e=String(i).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),t=new RegExp("([?&])"+e+"=.*?(&|$)","i"),e=-1!==r.indexOf("?")?"&":"?",r.match(t)?n?r.replace(t,"$1"+i+"="+n+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?r.replace(t,"$1"):r.replace(t,""):n?r+e+i+"="+n:void 0)},addHeaderClass:function(){this.$body.find(q).hide(),this.$bottomsheets.find(q).children(".qor-bottomsheet__filter").length&&this.$body.addClass("has-header").find(q).show()},addLoading:function(t){t.html(""),b(w.TEMPLATE_LOADING).appendTo(t).trigger("enable.qor.material")},loadExtraResource:function(t){var e,i,n=(e=t.$links,i=b("link"),e=l(e),i=l(i),o.difference(e,i)),i=(e=t.$scripts,i=b("script"),e=l(e,!0),i=l(i,!0),o.difference(e,i));n.length&&function t(e){var i=document.createElement("link"),n=e.shift();i.type="text/css",i.rel="stylesheet",i.onload=function(){e.length&&t(e)},i.href=n,document.getElementsByTagName("head")[0].appendChild(i)}(n),i.length&&d(i,t)},loadMedialibraryJS:function(t){var e,t=t.filter("script"),i=/theme=media_library/g,n=this;t.each(function(){var t;e=b(this).prop("src"),i.test(e)&&((t=document.createElement("script")).src=e,document.body.appendChild(t),n.mediaScriptAdded=!0)})},submit:function(t){var r,e=t.target,s=b(e),a=this,l=s.prop("action"),d=s.closest(".qor-bottomsheets"),c=d.data(),i=c.ajaxType,u=s.find(":submit");c.ingoreSubmit||s.data().normalSubmit||(b(document).trigger("bottomsheetBeforeSend.qor.bottomsheets"),t.preventDefault(),r=new n(e),b.ajax(l,{method:s.prop("method"),data:r,dataType:i||"html",processData:!1,contentType:!1,beforeSend:function(){u.prop("disabled",!0)},success:function(t,e,i){if(c.ajaxMute)d.remove();else if(c.ajaxTakeover)c.$target.parent().trigger("ajaxSuccessed.qor.bottomsheets",[t,d]);else{t=i.getResponseHeader("Content-Disposition");if(t&&-1!==t.indexOf("attachment")){var t=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t),n=i.getResponseHeader("Content-Type"),o="";return null!=t&&t[1]&&(o=t[1].replace(/['"]/g,"")),window.QOR.qorAjaxHandleFile(l,n,o,r),void u.prop("disabled",!1)}b(".qor-error").remove();n=s.data("returnUrl"),o=s.data("refreshUrl");o?window.location.href=o:"refresh"!=n?(n&&"refresh"!=n?a.load(n):a.refresh(),b(document).trigger("bottomsheetSubmitComplete.qor.bottomsheets")):a.refresh()}},error:function(t){window.QOR.handleAjaxError(t)},complete:function(){u.prop("disabled",!1)}}))},load:function(s,a,l){var d,t,e,c=this.options,u=a.actionData,h=this.resourseData,f=h.selectModal,p=h.ingoreSubmit,m=this.$bottomsheets,y=this.$header,g=this.$body;s&&(this.show(),this.addLoading(g),this.filterURL=s,g.removeClass("has-header has-hint"),a=b.isPlainObject(a)?a:{},d=a.method||"GET",t=a.datatype||"html",e=b.proxy(function(){b.ajax(s,{method:d,dataType:t,success:b.proxy(function(t){var e,i,n,o,r;"GET"===d?(i={$scripts:(e=b(t)).filter("script"),$links:e.filter("link"),url:s,response:t},n=f&&e.find(".qor-search-container").length,o=t.match(/<\s*body.*>[\s\S]*<\s*\/body\s*>/gi),r=e.find(_),o&&(o=o.join("").replace(/<\s*body/gi,"').concat(a.selectBacktolistTitle,"")),f&&(g.find(".qor-button--new").data("ingoreSubmit",!0).data("selectId",h.selectId).data("loadInline",!0),"one"==f||a.selectNohint||void 0!==h.maxItem&&"1"==h.maxItem||g.addClass("has-hint"),"mediabox"!=f||this.mediaScriptAdded||this.loadMedialibraryJS(e)),y.find(".qor-button--new").remove(),this.$title.after(g.find(".qor-button--new")),n&&(m.addClass("has-search"),y.find(".qor-bottomsheets__search").remove(),y.prepend(w.TEMPLATE_SEARCH)),u&&u.length&&this.bindActionData(u),h.bottomsheetClassname&&m.addClass(h.bottomsheetClassname),m.trigger("enable"),m.one("hidden.qor.bottomsheets",function(){b(this).trigger("disable")}),this.addHeaderClass(),m.data(a),l&&b.isFunction(l)&&l(this.$bottomsheets),m.trigger("bottomsheetLoaded.qor.bottomsheets",[s,t]))):a.returnUrl?this.load(a.returnUrl):this.refresh()},this),error:b.proxy(function(){var t;this.$bottomsheets.remove(),b(".qor-bottomsheets").is(":visible")||b("body").removeClass(v),t=0=u&&c&&v.isFunction(c)&&c()}).attr("src",t).data("originalUrl",t),p.show()},start:function(){var o=this.options,r=this.$modal,t=this.$target,e=t.data(),s=e.sizeName||"original",i=e.sizeResolution,n=e&&e.originalUrl&&t.attr("data-original-url")?/\.original\./.test(e.originalUrl)?e.originalUrl:/\.original\./.test(t.attr("data-original-url"))?t.attr("data-original-url"):t.attr("data-original-url").replace(/file\./,"file.original."):t.attr("src"),a=v("")),l=this.data||{},d=this,t=NaN,n=e.sizeResolutionWidth,e=e.sizeResolutionHeight;i&&(n||e||(n=q(i,"width"),e=q(i,"height")),t=n/e),l[o.key]||(l[o.key]={}),r.trigger("enable.qor.material").find(u).html(a),(e=this.getList(t))&&r.find(h).show().append(e),a.cropper({aspectRatio:t,data:function(t){var e,i={};if(v.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(i[String(e).toLowerCase()]=t[e]);return i}(l[o.key][s]),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,autoCropArea:1,ready:function(){r.find(".qor-cropper__options-toggle").on(c,function(){r.find(".qor-cropper__options-input").prop("checked",v(this).prop("checked"))}).prop("checked",!0),r.find(".qor-cropper__save").one(c,function(){var t,e=a.cropper("getData",!0),i=a.cropper("getCroppedCanvas"),n=[];if(l.Crop=!0,l[o.key][s]=e,d.imageData=a.cropper("getImageData"),d.cropData=e,i)try{t=i.toDataURL()}catch(t){console.log(t),console.log("Please check image Cross-origin setting")}r.find(h+" input").each(function(){var t=v(this);t.prop("checked")&&n.push(t.attr("name"))}),d.output(t,n),r.qorModal("hide")})}})},stop:function(){this.$modal.trigger("disable.qor.material").find(u+" > img").cropper("destroy").remove().end().find(h).hide().find("ul").remove()},getList:function(o){var r=[];return this.$list.find("img").not(this.$target).each(function(){var t=v(this).data(),e=t.sizeResolution,i=t.sizeName,n=t.sizeResolutionWidth,t=t.sizeResolutionHeight;e&&(n||t||(n=q(e,"width"),t=q(e,"height")),n/t===o&&r.push('"))}),r.length?"
                    • "+r.join("
                    • ")+"
                    ":""},output:function(t,e){var i=this.$target;t?this.center(i.attr("src",t),!0):this.preview(i),v.isArray(e)&&e.length&&this.autoCrop(t,e),this.$output.val(JSON.stringify(this.data)).trigger(o),this.$formCropInput.val(JSON.stringify(this.data))},preview:function(t,e,i){var n=t.parent().parent(),o=n.width(),r=n.height(),s=e||this.imageData,n=v.extend({},i||this.cropData),e=n.width/n.height,i=o;0!=i&&0!=s.naturalWidth&&0!=s.naturalHeight&&(r*e<=o&&(i=r*e),i=n.width/i,t.css({maxWidth:s.naturalWidth/i,maxHeight:s.naturalHeight/i}),this.center(t))},center:function(t,o){t.each(function(){var t=v(this),i=t.parent(),n=i.parent();function e(){var t=n.height(),e=i.height(),e=eclear'))},show:function(){this.$element.find(l).toggle()},close:function(t){var e=s(t.target),i=s(l),n=i.is(":visible"),o=e.closest(l).length,r=e.closest(".qor-filter-toggle").length,t=e.closest(".qor-modal").length,e=e.closest(".ui-timepicker-wrapper").length;n&&(o||r||t||e)||i.hide()},setFilterTime:function(t){var e,i,n=s(t.target),o=n.data(),t=o.filterRange;if(!t)return!1;if(s(this.options.label).removeClass(d),n.addClass(d),"events"==t)return this.$timeStart.val(o.scheduleStartAt||""),this.$timeEnd.val(o.scheduleEndAt||""),this.$searchButton.click(),!1;switch(t){case"today":e=i=new Date;break;case"week":e=this.startWeekDate,i=this.endWeekDate;break;case"month":e=this.startMonthDate,i=this.endMonthDate}if(!e||!i)return!1;o=this.getTime(e)+" 00:00",t=this.getTime(i)+" 23:59",this.$timeStart.val(o),this.$timeEnd.val(t),this.$searchButton.click()},getTime:function(t){var e=(e=t.getMonth()+1)<10?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i;return t.getFullYear()+"-"+e+"-"+i},clear:function(){var t=s(this.options.trigger),e=t.find(".qor-selector-label");return t.removeClass("active clearable"),e.html(e.data("label")),this.$timeStart.val(""),this.$timeEnd.val(""),this.$searchButton.click(),!1},getUrlParameter:function(t){var e=decodeURIComponent(a.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===e?"":e[1].replace(/\+/g," ")},updateQueryStringParameter:function(t,e,i){var n=i||a.href,o=n.match(/#\S*$/)||"",r=String(t).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),i=new RegExp("([?&])"+r+"=.*?(&|$)","i"),r=-1!==n.indexOf("?")?"&":"?";return o&&(o=o[0],n=n.replace(o,"")),n.match(i)?n=e?n.replace(i,"$1"+t+"="+e+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?n.replace(i,"$1"):n.replace(i,""):e&&(n=n+r+t+"="+e),n+o},search:function(){var t=this.$searchParam,i=a.href.replace(/page=\d+/,"page=1"),n=this;t.length&&(t.each(function(){var t=s(this),e=t.data().searchParam,t=t.val();i=n.updateQueryStringParameter(e,t,i)}),this.$element.closest(r).length?s(r).trigger("filterChanged.qor.filter",[i,"qor.filter.time"]):a.href=i)},destroy:function(){this.unbind(),this.$element.removeData(o)}},c.DEFAULTS={label:!1,trigger:!1,button:!1,clear:!1},c.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new c(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.filter.time"]',i={label:".qor-filter__block-buttons button",trigger:"a.qor-filter-toggle",button:".qor-filter__button-search",clear:".qor-selector-clear"};s(document).on("disable.qor.filter",function(t){c.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){c.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),c}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(d){var c=window.location,o="qor.filter",t="enable."+o,e="click."+o,i="change."+o,u=".qor-bottomsheets";function h(t,i){var n,e=c.search,o=c.search.match(/per_page=\d+/),e=e.replace(/per_page=\d+/g,"").replace(/page=\d+/,"page=1");return o&&o.length&&(e=e+"&"+o[0]),d.isArray(t)&&(n=f(e),d.each(t,function(t,e){-1===(t=d.inArray(e,n))?n.push(e):i&&n.splice(t,1)}),e="?"+n.join("&")),e}function f(t){var e=[];return t&&-1 thead"),this.$tbody=e.find("> tbody"),this.$header=s(t.header),this.$subHeader=s(t.subHeader),this.$content=s(t.content),this.marginBottomPX=parseInt(this.$subHeader.css("marginBottom")),this.paddingHeight=t.paddingHeight,this.resize(),this.bind())},bind:function(){this.$content.on(i,this.toggle.bind(this)),t.on(e,this.resize.bind(this))},unbind:function(){this.$content.off(i,this.toggle).off(e,this.resize)},isNeedBuild:function(){var t=this.$element;return!!(1 tr:visible").length<=1||t.data("disable-fixer"))},build:function(){var e=[];this.$tbody.find("> tr:first").children().each(function(){var t=s(this).outerWidth();s(this).outerWidth(t),e.push(t)}),this.$thead.find(">tr").children().each(function(t){s(this).outerWidth(e[t])})},toggle:function(){var t,e,i,n,o,r;this.$content.length&&(t=this.$element,e=this.$thead,i=this.$content.scrollTop(),n=this.$subHeader.outerHeight()+this.paddingHeight+this.marginBottomPX,o=s(".qor-page__header").outerHeight(),r=this.$content.offset().top+s(".qor-page__header").height(),n-o\n \n \n "),this.bind()},bind:function(){this.$element.on(i,l,this.showEditButton).on(n,l,this.hideEditButton).on(e,".qor-inlineedit__cancel",this.hideEdit).on(e,".qor-inlineedit__save",this.saveEdit).on(e,r,this.showEdit.bind(this))},unbind:function(){this.$element.off(i).off(n).off(e)},showEditButton:function(t){var e=s(u.TEMPLATE_EDIT);if(s(t.target).closest(a).find("input:disabled, textarea:disabled,select:disabled").length)return!1;e.appendTo(s(this))},hideEditButton:function(){s(".qor-inlineedit__edit").remove()},showEdit:function(t){t=s(t.target).closest(r).hide().closest(a).addClass(c);s(this.TEMPLATE_SAVE).appendTo(t)},hideEdit:function(){s(this).closest(a).removeClass(c).find(d).remove()},saveEdit:function(){var n=s(this),o=n.closest(a),t=n.closest("form"),e=o.closest(".qor-fieldset").find('input.qor-hidden__primary_key[type="hidden"]'),i=o.find('input[name*="QorResource"],textarea[name*="QorResource"],select[name*="QorResource"]'),r=i.length&&i.prop("name").match(/\.\w+/g),i=i.serialize();e.length&&(i="".concat(i,"&").concat(e.serialize())),r.length&&s.ajax(t.prop("action"),{method:t.prop("method"),data:i,dataType:"json",beforeSend:function(){n.prop("disabled",!0)},success:function(t){var e=function(t,e){var i,n=e[t[0].slice(1)];if(1mode_edit',u.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.inlineEdit"]',i={};s(document).on("disable.qor.inlineEdit",function(t){u.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){u.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(e){var i=window.componentHandler,n='[class*="mdl-js"],[class*="mdl-tooltip"]';function o(t){i&&(e(t).is(n)?i.upgradeElements(t):i.upgradeElements(e(n,t).toArray()))}function r(t){i&&(e(t).is(n)?i.downgradeElements(t):i.downgradeElements(e(n,t).toArray()))}e(function(){e(document).on("enable.qor.material",function(t){o(t.target)}).on("disable.qor.material",function(t){r(t.target)}).on("update.qor.material",function(t){r(t.target),o(t.target)})})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var n=o(document),r="qor.modal",t="click."+r,e="keyup."+r,s="transitionend",a="qor-modal-open",l="in",i="aria-hidden";function d(t,e){this.$element=o(t),this.options=o.extend({},d.DEFAULTS,o.isPlainObject(e)&&e),this.transitioning=!1,this.fadable=!1,this.init()}return d.prototype={constructor:d,init:function(){this.fadable=this.$element.hasClass("fade"),this.options.show?this.show():this.toggle()},bind:function(){this.$element.on(t,o.proxy(this.click,this)),this.options.keyboard&&n.on(e,o.proxy(this.keyup,this))},unbind:function(){this.$element.off(t,this.click),this.options.keyboard&&n.off(e,this.keyup)},click:function(t){var e=this.$element[0],i=t.target;if(i===e&&this.options.backdrop)this.hide();else for(;i!==e;){if("modal"===o(i).data("dismiss")){this.hide();break}i=i.parentNode}},keyup:function(t){27===t.which&&this.hide()},show:function(t){var e,i=this.$element;if(!this.transitioning&&!i.hasClass(l)&&(e=o.Event("show.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").addClass(a),i.addClass("shown").scrollTop(0).get(0).offsetHeight,this.transitioning=!0,t||!this.fadable)return i.addClass(l),void this.shown();i.one(s,o.proxy(this.shown,this)),i.addClass(l)}},shown:function(){this.transitioning=!1,this.bind(),this.$element.attr(i,!1).trigger("shown.qor.modal").focus()},hide:function(t){var e,i=this.$element;if(!this.transitioning&&i.hasClass(l)&&(e=o.Event("hide.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").removeClass(a),this.transitioning=!0,t||!this.fadable)return i.removeClass(l),void this.hidden();i.one(s,o.proxy(this.hidden,this)),i.removeClass(l)}},hidden:function(){this.transitioning=!1,this.unbind(),this.$element.removeClass("shown").attr(i,!0).trigger("hidden.qor.modal")},toggle:function(){this.$element.hasClass(l)?this.hide():this.show()},destroy:function(){this.$element.removeData(r)}},d.DEFAULTS={backdrop:!1,keyboard:!0,show:!0},d.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new d(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o.fn.qorModal=d.plugin,o(function(){var e=".qor-modal";o(document).on(t,'[data-toggle="qor.modal"]',function(){var t=o(this),e=t.data(),t=o(e.target||t.attr("href"));d.plugin.call(t,t.data(r)?"toggle":e)}).on("disable.qor.modal",function(t){d.plugin.call(o(e,t.target),"destroy")}).on("enable.qor.modal",function(t){d.plugin.call(o(e,t.target))})}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var o="qor.tabbar.radio",t="enable."+o,e="click."+o,s="[data-tab-target]",a="is-active";function l(t,e){this.$element=r(t),this.options=r.extend({},l.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return l.prototype={constructor:l,init:function(){this.bind()},bind:function(){this.$element.on(e,s,this.switchTab.bind(this))},unbind:function(){this.$element.off(e,s,this.switchTab)},switchTab:function(t){var e=r(t.target),i=this.$element,n=i.find(s),o=i.find("[data-tab-source]"),t=e.data().tabTarget;e.hasClass(a)||(n.removeClass(a),e.addClass(a),o.hide().filter('[data-tab-source="'+t+'"]').show(),i.trigger("switched.qor.tabbar.radio",[i,t]))},destroy:function(){this.unbind()}},l.DEFAULTS={},l.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new l(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.tab.radio"]';r(document).on("disable.qor.tabbar.radio",function(t){l.plugin.call(r(e,t.target),"destroy")}).on(t,function(t){l.plugin.call(r(e,t.target))}).triggerHandler(t)}),l}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(c){var r="qor.redactor",t="enable."+r,l="click."+r,e="addCrop."+r,i="removeCrop."+r,s="scroll."+r,n=".qor-cropper__toggle--redactor";function u(t,e){this.$element=c(t),this.options=c.extend(!0,{},u.DEFAULTS,c.isPlainObject(e)&&e),this.init()}return u.prototype={constructor:u,init:function(){var i,t=this.options,e=this.$element,n=e.closest(t.parent);n.length||(n=e.parent()),this.$parent=n,this.$button=c(u.BUTTON),this.$modal=c((i=u.MODAL,t=t.text,"string"==typeof i&&"object"===_typeof(t)&&c.each(t,function(t,e){i=i.replace("$["+String(t).toLowerCase()+"]",e)}),i)).appendTo("body"),this.bind()},bind:function(){this.$element.on(e,c.proxy(this.addButton,this)).on(i,c.proxy(this.removeButton,this))},unbind:function(){this.$element.off(e).off(i).off(s)},addButton:function(t,e){var i=c(e);this.$button.css("left",c(e).width()/2).prependTo(i.parent()).find(n).one(l,c.proxy(this.crop,this,i))},removeButton:function(){this.$button.find(n).off(l),this.$button.detach()},crop:function(n){var o,r=this.options,s=n.attr("src"),t=s,a=this.$modal;c.isFunction(r.replace)&&(t=r.replace(t)),o=c("")),a.one("shown.qor.modal",function(){var t,e;o.cropper({data:(t=n.attr("data-crop-options"),e=t&&t.split(","),t=null,e&&4===e.length&&(t={x:Number(e[0]),y:Number(e[1]),width:Number(e[2]),height:Number(e[3])}),t),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,checkImageOrigin:!1,ready:function(){a.find(".qor-cropper__save").one(l,function(){var i=o.cropper("getData",!0);c.ajax(r.remote,{type:"POST",contentType:"application/json",data:JSON.stringify({Url:s,CropOptions:{original:function(t){var e,i,n={};if(c.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(n["string"==typeof(i=e)&&(i=i.charAt(0).toUpperCase()+i.substr(1)),i]=t[e]);return n}(i)},Crop:!0}),dataType:"json",success:function(t){var e;c.isPlainObject(t)&&t.url&&(n.attr("src",t.url).attr("data-crop-options",(t=i,e=[],c.isPlainObject(t)&&c.each(t,function(){e.push(arguments[1])}),e.join())).removeAttr("style").removeAttr("rel"),c.isFunction(r.complete)&&r.complete(),a.qorModal("hide"))}})})}})}).one("hidden.qor.modal",function(){o.cropper("destroy").remove()}).qorModal("show").find(".qor-cropper__wrapper").append(o)},destroy:function(){this.unbind(),this.$modal.qorModal("hide").remove(),this.$element.removeData(r)}},u.DEFAULTS={remote:!1,parent:!1,toggle:!1,replace:null,complete:null,text:{title:"Crop the image",ok:"OK",cancel:"Cancel"}},u.BUTTON='
                    \n Edit\n Crop\n
                    ',u.MODAL='',u.plugin=function(o){return this.each(function(){var t,i=c(this),n=i.data(r);if(n)/destroy/.test(o)&&window.$R(this,"destroy");else{if(!window.$R)return;if(/destroy/.test(o))return;i.data(r,n={});var e={imageUpload:i.data("uploadUrl"),fileUpload:i.data("uploadUrl"),buttons:["html","format","bold","italic","deleted","lists","image","file","link"],linkNewTab:!0,linkTitle:!1,autoparsePaste:!1,autoparseLinks:!1,multipleUpload:!1,toolbarFixedTarget:!i.closest(".qor-slideout").length&&!i.closest(".qor-bottomsheets").length&&c("main.mdl-layout__content").length?"main.mdl-layout__content":document,callbacks:{started:function(){var t,a=c(this.container.$container.nodes[0]),l=c(this.toolbar.$toolbar.nodes[0]),e=c(".qor-slideout").is(":visible"),d=64;e?d=0!=i.closest(".qor-bottomsheets").length?(t=i.closest(".qor-page__body"),i.closest(".qor-page__body").offset().top):(t=".qor-slideout__body",c(".qor-slideout__header").height()):d+=c(t=".qor-layout main.qor-page").find(".qor-page__header").height(),c(t).on(s,function(){var t,e,i,n,o,r,s;t=l,i=d,n=(e=a).offset().top,o=e.outerHeight(),r={position:"relative",top:"auto",width:"auto"},s={position:"fixed",top:i,width:e.width(),boxShadow:"none"},n .qor-field__block > .qor-fieldset--new");this.singlePage=!(t.closest(".qor-slideout").length&&t.closest(".qor-bottomsheets").length),this.maxitems=t.data("maxItem"),this.isSortable=t.hasClass("qor-fieldset-sortable"),e.length&&!t.closest(".qor-fieldset--new").length&&(e.trigger("disable"),e.find("select[data-toggle]").removeAttr("data-select2-id"),this.isMultipleTemplate=t.data("isMultiple"),this.isMultipleTemplate?(this.fieldsetName=[],this.template={},this.index=[],e.each(function(t,e){(i=c(e).data("fieldsetName"))&&(n.template[i]=c(e).prop("outerHTML"),n.fieldsetName.push(i))}),this.parseMultiple()):this.parse(e.prop("outerHTML")),e.hide(),this.bind(),this.resetButton(),this.resetPositionButton())},resetPositionButton:function(){var t=this.$element.find("> .qor-sortable__button");this.isSortable&&(1 .qor-field__block > .qor-fieldset").not(".qor-fieldset--new,.is-deleted").length},toggleButton:function(t){var e=this.$element.find("> .qor-field__block > .qor-fieldset__add");t?e.hide():e.show()},resetButton:function(){this.maxitems<=this.getCurrentItems()?this.toggleButton(!0):this.toggleButton()},parse:function(t){t&&(t=this.initTemplate(t),this.template=t.template,this.index=t.index)},parseMultiple:function(){for(var t,e,i=this.fieldsetName,n=0,o=i.length;n .qor-field__block > .qor-sortable__item").not(".qor-fieldset--new").length,e.attr("order-index",t).attr("order-item","item_".concat(t)).css("order",t)),e.data("itemIndex",this.index).removeClass("qor-fieldset--new"),e}},del:function(t){var e,i=this.options,n=c(t.target).closest(i.itemClass),o=this,t={confirm:c(t.target).closest(i.delClass).data("confirm")||"Are you sure?"};s.qorConfirm(t,function(t){t&&(n.addClass("is-deleted").children(":visible").addClass("hidden").hide(),(e=c(i.alertTemplate.replace("{{name}}",o.parseName(n)))).find(i.undoClass).one(a,function(){if(o.maxitems<=o.getCurrentItems())return window.QOR.qorConfirm(o.$element.data("maxItemHint")),!1;n.find("> .qor-fieldset__alert").remove(),n.removeClass("is-deleted").children(".hidden").removeClass("hidden").show(),o.resetButton(),o.resetPositionButton()}.bind(this)),o.resetButton(),o.resetPositionButton(),n.append(e))})},parseName:function(t){t=t.find("input[name]").attr("name")||t.find("textarea[name]").attr("name");if(t)return t.replace(/[^\[\]]+$/,"")},destroy:function(){this.unbind(),this.$element.removeData(o)}},d.DEFAULTS={itemClass:".qor-fieldset",newClass:".qor-fieldset--new",addClass:".qor-fieldset__add",delClass:".qor-fieldset__delete",childrenClass:".qor-field__block",undoClass:".qor-fieldset__undo",alertTemplate:'
                    '},d.plugin=function(n){return this.each(function(){var t,e=c(this),i=e.data(o);i||e.data(o,i=new d(this,n)),"string"==typeof n&&c.isFunction(t=i[n])&&t.call(i)})},c(function(){var e=l,i={};c(document).on("disable.qor.replicator",function(t){d.plugin.call(c(e,t.target),"destroy")}).on(t,function(t){d.plugin.call(c(e,t.target),i)}).triggerHandler(t)}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var a=window.location,o=window.componentHandler,l=window.history,r="qor.globalSearch",t="enable."+r,e="click."+r,d=".qor-global-search--resource",c=".qor-global-search--results",u="is-active";function h(t,e){this.$element=s(t),this.options=s.extend({},h.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return h.prototype={constructor:h,init:function(){this.bind(),this.initTab()},bind:function(){this.$element.on(e,s.proxy(this.click,this))},unbind:function(){this.$element.off(e,this.check)},initTab:function(){var t=a.search;/resource_name/.test(t)&&(t=t.match(/resource_name=\w+/g).toString().split("=")[1],s(d).removeClass(u),s('[data-resource="'+t+'"]').addClass(u))},click:function(t){var e,i,n,o=s(t.target),r=o.data();o.is(d)&&(n=a.href.replace(/#/g,""),e=r.resource,i=/resource_name/.test(n),t="resource_name="+e,r=/keyword/.test(n)?"&":"?keyword=&",n=e?i?n.replace(/resource_name=\w+/g,t):n+r+t:n.replace(/&resource_name=\w+/g,""),l.pushState?this.fetchSearch(n,o):a.href=n)},fetchSearch:function(e,i){var n=document.title;s.ajax(e,{method:"GET",dataType:"html",beforeSend:function(){s(".mdl-spinner").remove(),s(c).prepend('
                    ').find(".qor-section").hide(),o.upgradeElement(document.querySelector(".mdl-spinner"))},success:function(t){t=s(t).find(c).html();s(d).removeClass(u),i.addClass(u),l.pushState({Page:e,Title:n},n,e),s(".mdl-spinner").remove(),s(c).removeClass("loading").html(t),o.upgradeElements(document.querySelectorAll(".qor-table"))},error:function(t,e,i){s(c).find(".qor-section").show(),s(".mdl-spinner").remove(),window.alert([e,i].join(": "))}})},destroy:function(){this.unbind(),this.$element.removeData(r)}},h.DEFAULTS={},h.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(r);i||e.data(r,i=new h(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.global.search"]',i={};s(document).on("disable.qor.globalSearch",function(t){h.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){h.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),h}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var d=window.FormData,c=window.QOR,o="qor.selectcore",s="afterSelected."+o,t="click."+o,e="submit."+o,i="table.qor-js-table tr";function r(t,e){this.$element=l(t),this.options=l.extend({},r.DEFAULTS,l.isPlainObject(e)&&e),this.init()}return r.prototype={constructor:r,init:function(){this.bind()},bind:function(){this.$element.on(t,i,this.processingData.bind(this)).on(e,"form",this.submit.bind(this))},unbind:function(){this.$element.off(t,i).off(e,"form")},processingData:function(e){var t=l(e.target).closest("tr"),i=t.closest(".qor-bottomsheets"),n={},o=this.options,r=o.onSelect,o=o.loading;return(n=l.extend({},n,t.data())).$clickElement=t,t=n.mediaLibraryUrl||n.url,o&&l.isFunction(o)&&o(i),t?l.getJSON(t,function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),n=l.extend({},t,n),r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s))}).always(function(){i.find(".qor-media-loading").remove()}):r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s)),!1},submit:function(e){var i,t=e.target,n=l(t),o=this,r=n.find(":submit"),s=l(c.$formLoading),a=this.options.onSubmit;l(document).trigger("selectcoreBeforeSend.qor.selectcore"),n.find(".qor-fieldset--new").remove(),d&&(e.preventDefault(),l.ajax(n.prop("action"),{method:n.prop("method"),data:new d(t),dataType:"json",processData:!1,contentType:!1,beforeSend:function(){l(".qor-submit-loading").remove(),s.appendTo(r.prop("disabled",!0).closest(".qor-form__actions")).trigger("enable.qor.material")},success:function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),(i=t).primaryKey=i.ID,l(".qor-error").remove(),a&&l.isFunction(a)?(a(i,e),l(document).trigger("afterSubmitted.qor.selectcore")):o.refresh()},error:function(t){c.handleAjaxError(t)},complete:function(){r.prop("disabled",!1)}}))},refresh:function(){setTimeout(function(){window.location.reload()},350)},destroy:function(){this.unbind()}},r.plugin=function(n){return this.each(function(){var t,e=l(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new r(this,n))}"string"==typeof n&&l.isFunction(t=i[n])&&t.apply(i)})},l.fn.qorSelectCore=r.plugin,r}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var i=s("body"),t=s(document),a=window.Mustache,o="qor.selectone",n="click."+o,r="enable."+o,e="reload.qor.bottomsheets",l=".qor-selected-many__remove",d=".qor-selected-many__undo",c="qor-selected-many__deleted",u=".qor-field__selectmany",h="is_selected",f="qor-bottomsheets__select-many";function p(t,e){this.$element=s(t),this.options=s.extend({},p.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return p.prototype={constructor:p,init:function(){this.bind()},bind:function(){t.on(e,".".concat(f),this.reloadData.bind(this)),this.$element.on(n,l,this.clearSelect.bind(this)).on(n,'[data-select-modal="many"]',this.openBottomSheets.bind(this)).on(n,d,this.undoDelete.bind(this))},unbind:function(){t.off(n,'[data-select-modal="many"]').off(e,".".concat(f)),this.$element.off(n,l).off(n,d)},clearSelect:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").addClass(c),this.updateSelectInputData(t),!1},undoDelete:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").removeClass(c),this.updateSelectInputData(t),!1},openBottomSheets:function(t){var e=s(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.bottomsheetsData=t,this.$selector=t.selectId?s(t.selectId):e.closest(u).find("select"),this.$selectFeild=this.$selector.closest(u).find(".qor-field__selected-many"),this.SELECT_MANY_SELECTED_ICON=s('[name="select-many-selected-icon"]').html(),this.SELECT_MANY_UNSELECTED_ICON=s('[name="select-many-unselected-icon"]').html(),this.SELECT_MANY_HINT=s('[name="select-many-hint"]').html(),this.SELECT_MANY_TEMPLATE=s('[name="select-many-template"]').html(),t.url=t.selectListingUrl,t.selectDefaultCreating&&(t.url=t.selectCreatingUrl),this.BottomSheets.open(t,this.handleSelectMany.bind(this))},reloadData:function(){this.initItems()},renderSelectMany:function(t){return a.render(this.SELECT_MANY_TEMPLATE,t)},renderHint:function(t){return a.render(this.SELECT_MANY_HINT,t)},initItems:function(){var i,t=this.$bottomsheets.find("tbody tr"),n=this.SELECT_MANY_SELECTED_ICON,o=this.SELECT_MANY_UNSELECTED_ICON,r=[];this.$selectFeild.find("[data-primary-key]").not("."+c).each(function(){r.push(s(this).data().primaryKey)}),t.each(function(){var t=s(this),e=t.find("td:first");i=t.data().primaryKey,"-1"!=r.indexOf(i)?(t.addClass(h),e.append(n)):e.append(o)}),this.updateHint(this.getSelectedItemData())},getSelectedItemData:function(){return{selectedNum:this.$selectFeild.find("[data-primary-key]").not("."+c).length}},updateHint:function(t){s.extend(t,this.bottomsheetsData),t=this.renderHint(t),this.$bottomsheets.find(".qor-selectmany__hint").remove(),this.$bottomsheets.find(".qor-page__body").before(t)},updateSelectInputData:function(t){var e,i,n=(t||this.$selectFeild).find("[data-primary-key]").not("."+c),o=t?t.find(".qor-field__selectmany-input"):this.$selector,r=o.find("option");r.prop("selected",!1),n.each(function(){i=s(this).data().primaryKey,(e=r.filter('[value="'+i+'"]')).length||(i={primaryKey:i,displayName:""},e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,i)),o.append(e)),e.prop("selected",!0)})},changeIcon:function(t,e){t.find(".qor-select__select-icon").remove(),t.find("td:first").prepend(e)},removeItem:function(t){var e=t.primaryKey;this.$selectFeild.find('[data-primary-key="'+e+'"]').find(l).click(),this.changeIcon(t.$clickElement,this.SELECT_MANY_UNSELECTED_ICON)},addItem:function(t,e){var i=this.renderSelectMany(t),n=this.$selectFeild.find('[data-primary-key="'+t.primaryKey+'"]');return n.length?n.hasClass(c)?(n.removeClass(c),this.updateSelectInputData(),void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON)):void 0:(this.$selectFeild.append(i),e?((e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,t))).appendTo(this.$selector),e.prop("selected",!0),this.$bottomsheets.remove(),void(s(".qor-bottomsheets").is(":visible")||s("body").removeClass("qor-bottomsheets-open"))):void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON))},handleSelectMany:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(f),t.on(n,".qor-selectmany__selectall",this.handleSelectAll.bind(this)),this.$bottomsheets=t,this.initItems()},handleSelectAll:function(){var t=this.$bottomsheets.find(".qor-table tbody tr"),e=t.not(".is_selected");(e.length?e:t).click()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t,e){t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.displayName=t.displayName.escapeSymbol(),e?this.addItem(t,!0):((e=t.$clickElement).toggleClass(h),e.hasClass(h)?this.addItem(t):this.removeItem(t),this.updateHint(this.getSelectedItemData()),this.updateSelectInputData())},destroy:function(){this.unbind(),this.$element.removeData(o)}},p.SELECT_MANY_OPTION_TEMPLATE='',p.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new p(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.selectmany"]';s(document).on("disable.qor.selectone",function(t){p.plugin.call(s(e,t.target),"destroy")}).on(r,function(t){p.plugin.call(s(e,t.target))}).triggerHandler(r)}),p}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var i=r("body"),t=r(document),s=window.Mustache,o="qor.selectone",e="click."+o,n="enable."+o,a="reload.qor.bottomsheets",l=".qor-selected__remove",d=".qor-selected__change",c=".qor-field__selected",u=".qor-field__selectone-input",h=".qor-field__selectone-trigger",f=".qor-field__selectone",p="qor-bottomsheets__select-one";function m(t,e){this.$element=r(t),this.options=r.extend({},m.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return m.prototype={constructor:m,init:function(){this.bind()},bind:function(){t.on(a,".".concat(p),this.reloadData.bind(this)),this.$element.on(e,l,this.clearSelect.bind(this)).on(e,"[data-selectone-url]",this.openBottomSheets.bind(this)).on(e,d,this.changeSelect)},unbind:function(){t.off(e,"[data-selectone-url]").off(a,".".concat(p)),this.$element.off(e,l).off(e,d)},clearSelect:function(t){t=r(t.target).closest(f);return t.find(c).remove(),t.find(u).html(""),t.find(u)[0].value="",t.find(h).show(),t.trigger("qor.selectone.unselected"),!1},changeSelect:function(){r(this).closest(f).find(h).trigger("click")},openBottomSheets:function(t){var e=r(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.$parent=e.closest(f),t.url=t.selectoneUrl,this.SELECT_ONE_SELECTED_ICON=r('[name="select-one-selected-icon"]').html(),this.BottomSheets.open(t,this.handleSelectOne.bind(this))},initItem:function(){var t,e=this.$parent.find(c);e.length&&(t=e.data().primaryKey)&&this.$bottomsheets.find('tr[data-primary-key="'+t+'"]').addClass("is_selected").find("td:first").append(this.SELECT_ONE_SELECTED_ICON)},reloadData:function(){this.initItem()},renderSelectOne:function(t){return s.render(r('[name="select-one-selected-template"]').html(),t)},handleSelectOne:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(p),this.$bottomsheets=t,this.initItem()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t){var e,i=this.$parent,n=i.find("select"),o=i.find(c);t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.selectoneValue=t.primaryKey||t.ID,t.displayName=t.displayName.escapeSymbol(),n.length&&(e=this.renderSelectOne(t),o.length&&o.remove(),i.prepend(e),i.find(h).hide(),n.html(s.render(m.SELECT_ONE_OPTION_TEMPLATE,t)),n[0].value=t.primaryKey||t.ID,i.trigger("qor.selectone.selected",[t]),this.$bottomsheets.qorSelectCore("destroy").remove(),r(".qor-bottomsheets").is(":visible")||r("body").removeClass("qor-bottomsheets-open"))},destroy:function(){this.unbind(),this.$element.removeData(o)}},m.SELECT_ONE_OPTION_TEMPLATE='',m.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new m(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.selectone"]';r(document).on("disable.qor.selectone",function(t){m.plugin.call(r(e,t.target),"destroy")}).on(n,function(t){m.plugin.call(r(e,t.target))}).triggerHandler(n)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var t=l(document),r="qor.selector",i="enable."+r,e="click."+r,d="selected",c="disabled",s="clearable",a="."+d,u=".qor-selector-toggle",h=".qor-selector-label",f=".qor-selector-menu",p=".qor-bottomsheets";function m(t,e){this.options=e,this.$element=l(t),this.init()}return m.prototype={constructor:m,init:function(){var t=this.$element;this.placeholder=t.attr("placeholder")||t.attr("name")||"Select",this.build()},build:function(){var t=this.$element,e=l(m.TEMPLATE),i=this.options.aligned+"-aligned",s={},n=t.data(),o=n.hover,a=t.attr("name");this.isBottom="bottom"==n.position,o&&e.addClass("hover"),e.addClass(i).find(f).html(function(){var r=[];return t.children().each(function(){var t=l(this),e=t.attr("selected"),i=t.attr("disabled"),n=t.attr("value"),o=t.text(),t=[];e&&(t.push(d),s.value=n,s.label=o,s.paramName=a),i&&t.push(c),r.push("'+o+"")}),r.join("")}),this.$selector=e,t.hide().after(e),e.find(u).data("paramName",a),this.pick(s,!0),this.bind()},unbuild:function(){this.unbind(),this.$selector.remove(),this.$element.show()},bind:function(){this.$selector.on(e,l.proxy(this.click,this)),t.on(e,l.proxy(this.close,this))},unbind:function(){this.$selector.off(e,this.click)},click:function(t){var e=l(t.target);t.stopPropagation(),e.is(".qor-selector-clear")?this.clear():e.is("li")?(e.hasClass(d)||e.hasClass(c)||this.pick(e.data()),this.close()):e.closest(u).length&&this.open()},pick:function(t,e){var i=this.$selector,n=!!t.value,o=this.$element;i.find(u).toggleClass("active",n).toggleClass(s,n&&this.options.clearable).find(h).text(t.label||this.placeholder),e||(i.find(f).children('[data-value="'+t.value+'"]').addClass(d).siblings(a).removeClass(d),o.val(t.value),o.closest(p).length&&!o.closest('[data-toggle="qor.filter"]').length?l(p).trigger("selectorChanged.qor.selector",[t.value,t.paramName]):o.trigger("change"))},clear:function(){var t=this.$element;this.$selector.find(u).removeClass("active").removeClass(s).find(h).text(this.placeholder).end().end().find(f).children(a).removeClass(d),t.val("").trigger("change")},open:function(){t.triggerHandler(e),l(".qor-filter__dropdown").hide(),this.$selector.addClass("open"),this.isBottom&&this.$selector.addClass("bottom")},close:function(){this.$selector.removeClass("open"),this.isBottom&&this.$selector.removeClass("bottom")},destroy:function(){this.unbuild(),this.$element.removeData(r)}},m.DEFAULTS={aligned:"left",clearable:!1},m.TEMPLATE='',m.plugin=function(o){return this.each(function(){var t,e,i=l(this),n=i.data(r);if(!n){if(/destroy/.test(o))return;t=l.extend({},m.DEFAULTS,i.data(),"object"===_typeof(o)&&o),i.data(r,n=new m(this,t))}"string"==typeof o&&l.isFunction(e=n[o])&&e.apply(n)})},l(function(){var e='[data-toggle="qor.selector"]';l(document).on("disable.qor.selector",function(t){m.plugin.call(l(e,t.target),"destroy")}).on(i,function(t){m.plugin.call(l(e,t.target))}).triggerHandler(i)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(p){var t=p(document),l=window.FormData,m=window.QOR_Translations,o=window._,d=window.QOR,r="qor.slideout",e="keyup."+r,i="click."+r,n="submit."+r,y="shown."+r,g="hidden."+r,s="transitionend",a="qor-slideout-open",c="qor-slideout-mini",u="is-shown",h="is-slided",b=".qor-body__loading";function f(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(p(this).attr(n))}),o.uniq(i)}function v(t,e,i){for(var n=0,o=0,r=t.length;o\s]+))?)+\s*|\s*)>/g))for(var r=0;r[\s\S]*<\s*\/body\s*>/gi);r&&(r=r.join("").replace(/<\s*body/gi," thead > tr > th",o.proxy(this.sort,this))},unbind:function(){this.$element.off(e,this.sort)},sort:function(t){var e=o(t.currentTarget).data("orderBy"),t=n.search,i="order_by="+e;e&&(/order_by/.test(t)?t=t.replace(/order_by(=\w+)?/,function(){return i}):t+=-1this.slideoutWidth&&this.$element.find(d).append(f.ARROW_RIGHT)},scrollTabLeft:function(t){t.stopPropagation();var e=o(d),i=e.scrollLeft(),t=i-this.slideoutWidth;0=i&&o(c).hide()}),o(u).length||this.$element.find(d).prepend(f.ARROW_LEFT))},switchTab:function(t){var e=o(t.target),i=this.$element,t=e.data(),n=r.data().tabScopeActive;if(o(".qor-slideout").is(":visible"))return e.hasClass(h)||(i.find(a).removeClass(h),e.addClass(h),o.ajax(t.tabUrl,{method:"GET",dataType:"html",processData:!1,contentType:!1,beforeSend:function(){o(".qor-layout__tab-spinner").remove();o(l).hide().before('
                    '),window.componentHandler.upgradeElement(o(".qor-layout__tab-spinner")[0])},success:function(t){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",e.data("name"));t=o(t).find(l).html();o(l).show().html(t).trigger("enable")},error:function(){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",n)}})),!1},destroy:function(){this.unbind(),r.removeData("tabScopeActive")}},f.ARROW_RIGHT='',f.ARROW_LEFT='',f.DEFAULTS={},f.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(s);if(!i){if(/destroy/.test(n))return;e.data(s,i=new f(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e='[data-toggle="qor.tab"]';o(document).on("disable.qor.tabbar",function(t){f.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){f.plugin.call(o(e,t.target))}).triggerHandler(t)}),f}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var s="qor.timepicker",t="enable."+s,e="click."+s,i="focus."+s,n="keydown."+s,o="blur."+s,a="selectTime."+s,l="[data-picker-type]";function d(t,e){this.$element=r(t),this.options=r.extend(!0,{},d.DEFAULTS,r.isPlainObject(e)&&e),this.formatDate=null,this.pickerData=this.$element.data(),this.parent=this.$element.closest(l),this.isDateTimePicker="datetime"==this.parent.data("picker-type"),this.$targetInput=this.parent.find(this.pickerData.targetInput||(this.isDateTimePicker?".qor-datetimepicker__input":".qor-datepicker__input")),this.init()}return d.prototype={init:function(){var t,e,i;this.$targetInput.is(":disabled")?this.$element.remove():(this.bind(),this.oldValue=this.$targetInput.val(),e=(e=(t=new Date).getMonth()+1)<8?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i,this.dateValueNow=t.getFullYear()+"-"+e+"-"+i)},bind:function(){this.isDateTimePicker&&this.$targetInput.qorTimepicker({timeFormat:"H:i",showOn:null,wrapHours:!1,scrollDefault:"now"}).on(a,r.proxy(this.changeTime,this)).on(o,r.proxy(this.blur,this)).on(i,r.proxy(this.focus,this)).on(n,r.proxy(this.keydown,this)),this.$element.on(e,r.proxy(this.show,this))},unbind:function(){this.$element.off(e,this.show),this.isDateTimePicker&&this.$targetInput.off(a,this.changeTime).off(o,this.blur).off(i,this.focus).off(n,this.keydown)},focus:function(){},blur:function(){var t,e,i,n,o,r,s=this.$targetInput.val(),a=s.split(" "),l=a.length,d=/\d{1,2}:\d{1,2}/,c=/^\d{4}-\d{1,2}-\d{1,2}/;if(s){if(1==l)c.test(a[0])&&(e=a[0],i="00:00"),d.test(a[0])&&(e=this.dateValueNow,i=a[0]);else for(var u=0;u
                    '},String.prototype.escapeSymbol=function(){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return this.replace(/[&<>"']/g,function(t){return e[t]||t})},window.Mustache&&(window.Mustache.tags=["[[","]]"]),$(document).ajaxComplete(function(t,e,i){"POST"!=i.type&&"PUT"!=i.type||$.fn.qorSlideoutBeforeHide&&($.fn.qorSlideoutBeforeHide=null,window.onbeforeunload=null)}),$.fn.select2.ajaxCommonOptions=function(t){var i=t.remoteDataPrimaryKey;return{dataType:"json",headers:getSelect2Header(t),cache:!0,delay:250,data:function(t){return{keyword:t.term,page:t.page,per_page:20}},processResults:function(t,e){e.page=e.page||1;t=$.map(t,function(t){return t.id=t[i]||t.primaryKey||t.Id||t.ID,t});return{results:t,pagination:{more:20<=t.length}}}}},$.fn.select2.ajaxFormatResult=function(t,e,i){var n="";if(t.loading)return t.text;if(console.log("select2.ajaxFormatResult: Data"),console.log(t),console.log("select2.ajaxFormatResult: has remote image"),console.log(i),i){var o=t.text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],i=t.Image,n=i?'
                    '+o+"
                    ":'
                    '+o+"
                    ";return $(n)}return n=0|<\/.+>)/.test(n)?$(n):n},$(function(){var r=window._,o=window.QOR,s=window.QOR_Translations,t='"),a=$(t).appendTo("body");$(document).on("keyup.qor.confirm",function(t){a.is(":visible")&&(27===t.which&&setTimeout(function(){a.hide(),o.qorConfirmCallback=void 0},100),13===t.which&&setTimeout(function(){$('.dialog-button[data-type="confirm"]').click()},100))}).on("click.qor.confirm",".dialog-button",function(){var t=$(this).data("type"),e=o.qorConfirmCallback;return $.isFunction(e)&&e(t),a.hide(),o.qorConfirmCallback=void 0,!1}),o.qorConfirm=function(t,e){var i=a.find(".dialog-ok"),n=a.find(".dialog-cancel");return r.isString(t)?(a.find(".dialog-message").text(t),i.text(s.okButton),n.text(s.cancelButton)):r.isObject(t)&&(t.confirmOk&&t.confirmCancel?(i.text(t.confirmOk),n.text(t.confirmCancel)):(i.text(s.okButton),n.text(s.cancelButton)),t.icon&&a.find("i.material-icons").addClass(t.icon).html(t.icon),a.find(".dialog-message").text(t.confirm)),a.show(),o.qorConfirmCallback=e,!1};function l(t,e){var i,n,o=e||new FormData;for(n in t)t.hasOwnProperty(n)&&t[n]&&(i=n),t[n]instanceof Date?o.append(i,t[n].toISOString()):"object"!==_typeof(t[n])||t[n]instanceof File?o.append(i,t[n]):l(t[n],o);return o}o.qorAjaxHandleFile=function(t,i,n,e){var o=new XMLHttpRequest;o.responseType="arraybuffer",o.open("POST",t,!0),o.onload=function(){var t,e;200===this.status?(e=new Blob([this.response],{type:i}),t=window.URL.createObjectURL(e),e=document.createElement("a"),document.body.appendChild(e),e.href=t,e.download=n||"download-"+$.now(),e.click()):window.alert(s.serverError)},r.isObject(e)&&("[object FormData]"!=Object.prototype.toString.call(e)&&(e=l(e)),o.send(e))};t=function(){var t=$(".qor-linkify-object"),e=/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi;t.length&&t.each(function(){var t=$(this).data("video-link");t.match(e)&&$(this).html(''))})};($.fn.qorSliderAfterShow.converVideoLinks=t)(),o.handleAjaxError=function(t){var e=$("body"),i=t.responseJSON,n=t.responseText,o=$('
                    ');if(e.find(".qor-alert").remove(),422===t.status)if(i){var r=i.errors,s="";if($.isArray(r))for(var a=0;a\n error\n '.concat(r[a],"\n ");else s='
                  • \n error\n '.concat(r,"\n
                  • ");o.append(s)}else o=$(n).find(".qor-error");else o.append('
                  • \n error\n '.concat(t.statusText,"\n
                  • "));o.prependTo(e),setTimeout(function(){o.addClass("qor-alert__active")},50),setTimeout(function(){$('.qor-alert[data-dismissible="true"]').removeClass("qor-alert__active"),$("#qor-submit-loading").remove()},6e3)}}),function(t){"function"==typeof define&&define.amd?define("datepicker",["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(C){var t=C(window),o=window.document,h=C(o),r=window.Number,a="datepicker",i="click."+a,n="keyup."+a,s="focus."+a,e="resize."+a,l="show."+a,d="hide."+a,c="pick."+a,u=/(y|m|d)+/g,f=/\d+/g,p=/^\d{2,4}$/,m=a+"-top-left",y=a+"-bottom-left",g=[m,a+"-top-right",y,a+"-bottom-right"].join(" "),b=a+"-hide",v=Math.min,_=Object.prototype.toString;function q(t){return"string"==typeof t}function w(t){return"number"==typeof t&&!isNaN(t)}function S(t){return void 0===t}function $(t){return"date"===(t=t,_.call(t).slice(8,-1).toLowerCase())}function k(t,e){var i=[];return Array.from?Array.from(t).slice(e||0):(w(e)&&i.push(e),i.slice.apply(t,i))}function x(t,e){var i=k(arguments,2);return function(){return t.apply(e,i.concat(k(arguments)))}}function T(t,e){return[31,(t=t)%4==0&&t%100!=0||t%400==0?29:28,31,30,31,30,31,31,30,31,30,31][e]}function D(t,e){(e=C.isPlainObject(e)?e:{}).language&&(e=C.extend({},D.LANGUAGES[e.language],e)),this.$element=C(t),this.options=C.extend({},D.DEFAULTS,e),this.isBuilt=!1,this.isShown=!1,this.isInput=!1,this.isInline=!1,this.initialValue="",this.initialDate=null,this.startDate=null,this.endDate=null,this.init()}D.prototype={constructor:D,init:function(){var t=this.options,e=this.$element,i=t.startDate,n=t.endDate,o=t.date;this.$trigger=C(t.trigger||e),this.isInput=e.is("input")||e.is("textarea"),this.isInline=t.inline&&(t.container||!this.isInput),this.format=function(t){var e,i,n=String(t).toLowerCase(),o=n.match(u);if(!o||0===o.length)throw new Error("Invalid date format.");for(t={source:n,parts:o},e=o.length,i=0;in.getTime()&&(o=new Date(n)),this.endDate=n),this.date=o,this.viewDate=new Date(o),this.initialDate=new Date(this.date),this.bind(),(t.autoshow||this.isInline)&&this.show(),t.autopick&&this.pick()},build:function(){var t,e=this.options,i=this.$element;this.isBuilt||(this.isBuilt=!0,this.$picker=t=C(e.template),this.$week=t.find('[data-view="week"]'),this.$yearsPicker=t.find('[data-view="years picker"]'),this.$yearsPrev=t.find('[data-view="years prev"]'),this.$yearsNext=t.find('[data-view="years next"]'),this.$yearsCurrent=t.find('[data-view="years current"]'),this.$years=t.find('[data-view="years"]'),this.$monthsPicker=t.find('[data-view="months picker"]'),this.$yearPrev=t.find('[data-view="year prev"]'),this.$yearNext=t.find('[data-view="year next"]'),this.$yearCurrent=t.find('[data-view="year current"]'),this.$months=t.find('[data-view="months"]'),this.$daysPicker=t.find('[data-view="days picker"]'),this.$monthPrev=t.find('[data-view="month prev"]'),this.$monthNext=t.find('[data-view="month next"]'),this.$monthCurrent=t.find('[data-view="month current"]'),this.$days=t.find('[data-view="days"]'),this.isInline?C(e.container||i).append(t.addClass("datepicker-inline")):(C(o.body).append(t.addClass("datepicker-dropdown")),t.addClass(b)),this.fillWeek())},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.$picker.remove())},bind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.on(l,t.show),C.isFunction(t.hide)&&e.on(d,t.hide),C.isFunction(t.pick)&&e.on(c,t.pick),this.isInput&&(e.on(n,C.proxy(this.keyup,this)),t.trigger||e.on(s,C.proxy(this.show,this))),this.$trigger.on(i,C.proxy(this.show,this))},unbind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.off(l,t.show),C.isFunction(t.hide)&&e.off(d,t.hide),C.isFunction(t.pick)&&e.off(c,t.pick),this.isInput&&(e.off(n,this.keyup),t.trigger||e.off(s,this.show)),this.$trigger.off(i,this.show)},showView:function(t){var e=this.$yearsPicker,i=this.$monthsPicker,n=this.$daysPicker,o=this.format;if(o.hasYear||o.hasMonth||o.hasDay)switch(r(t)){case 2:case"years":i.addClass(b),n.addClass(b),o.hasYear?(this.fillYears(),e.removeClass(b)):this.showView(0);break;case 1:case"months":e.addClass(b),n.addClass(b),o.hasMonth?(this.fillMonths(),i.removeClass(b)):this.showView(2);break;default:e.addClass(b),i.addClass(b),o.hasDay?(this.fillDays(),n.removeClass(b)):this.showView(1)}},hideView:function(){this.options.autohide&&this.hide()},place:function(){var t=this.options,e=this.$element,i=this.$picker,n=h.outerWidth(),o=h.outerHeight(),r=e.outerWidth(),s=e.outerHeight(),a=i.width(),l=i.height(),d=e.offset(),c=d.left,u=d.top,e=parseFloat(t.offset)||10,d=m;l"+n.text+""},fillAll:function(){this.fillYears(),this.fillMonths(),this.fillDays()},fillWeek:function(){for(var t=this.options,e=parseInt(t.weekStart,10)%7,i=t.daysMin,n="",i=C.merge(i.slice(e),i.slice(0,e)),o=0;o<=6;o++)n+=this.createItem({text:i[o]});this.$week.html(n)},fillYears:function(){for(var t,e,i=this.options,n=i.disabledClass||"",o=i.yearSuffix||"",r=C.isFunction(i.filter)&&i.filter,s=this.startDate,a=this.endDate,i=this.viewDate,l=i.getFullYear(),d=i.getMonth(),c=i.getDate(),u=this.date,h=u.getFullYear(),f=!1,p=!1,m=!1,y="",g=-5;g<=6;g++)u=new Date(l+g,d,c),e=-5===g||6===g,t=l+g===h,m=!1,s&&(m=u.getFullYear()a.getFullYear(),6===g&&(p=m)),!m&&r&&(m=!1===r.call(this.$element,u)),y+=this.createItem({text:l+g,view:m?"year disabled":t?"year picked":"year",muted:e,picked:t,disabled:m});this.$yearsPrev.toggleClass(n,f),this.$yearsNext.toggleClass(n,p),this.$yearsCurrent.toggleClass(n,!0).html(l+-5+o+" - "+(l+6)+o),this.$years.html(y)},fillMonths:function(){for(var t,e=this.options,i=e.disabledClass||"",n=e.monthsShort,o=C.isFunction(e.filter)&&e.filter,r=this.startDate,s=this.endDate,a=this.viewDate,l=a.getFullYear(),d=a.getDate(),c=this.date,u=c.getFullYear(),h=c.getMonth(),f=!1,p=!1,m=!1,y="",g=0;g<=11;g++)c=new Date(l,g,d),t=l===u&&g===h,m=!1,r&&(m=(f=c.getFullYear()===r.getFullYear())&&c.getMonth()s.getMonth()),!m&&o&&(m=!1===o.call(this.$element,c)),y+=this.createItem({index:g,text:n[g],view:m?"month disabled":t?"month picked":"month",picked:t,disabled:m});this.$yearPrev.toggleClass(i,f),this.$yearNext.toggleClass(i,p),this.$yearCurrent.toggleClass(i,f&&p).html(l+e.yearSuffix||""),this.$months.html(y)},fillDays:function(){var t,e,i,n,o=this.options,r=o.disabledClass||"",s=o.yearSuffix||"",a=o.monthsShort,l=parseInt(o.weekStart,10)%7,d=C.isFunction(o.filter)&&o.filter,c=this.startDate,u=this.endDate,h=this.viewDate,f=h.getFullYear(),p=h.getMonth(),m=f,y=p,g=f,b=p,v=this.date,_=v.getFullYear(),q=v.getMonth(),w=v.getDate(),S=!1,h=!1,$=!1,k=[],x=[],D=[];for(0===p?(--m,y=11):--y,e=T(m,y),(n=(v=new Date(f,p,1)).getDay()-l)<=0&&(n+=7),c&&(S=v.getTime()<=c.getTime()),i=e-(n-1);i<=e;i++)v=new Date(m,y,i),$=!1,c&&($=v.getTime()=u.getTime()),i=1;i<=n;i++)v=new Date(g,b,i),$=!1,u&&($=v.getTime()>u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),x.push(this.createItem({text:i,view:"day next",muted:!0,disabled:$}));for(i=1;i<=e;i++)v=new Date(f,p,i),t=f===_&&p===q&&i===w,$=!1,c&&($=v.getTime()u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),D.push(this.createItem({text:i,view:$?"day disabled":t?"day picked":"day",picked:t,disabled:$}));this.$monthPrev.toggleClass(r,S),this.$monthNext.toggleClass(r,h),this.$monthCurrent.toggleClass(r,S&&h).html(o.yearFirst?f+s+" "+a[p]:a[p]+" "+f+s),this.$days.html(k.join("")+D.join(" ")+x.join(""))},click:function(t){var e,i,n,o,r,s,a=C(t.target),l=this.viewDate;if(t.stopPropagation(),t.preventDefault(),!a.hasClass("disabled"))switch(e=l.getFullYear(),i=l.getMonth(),n=l.getDate(),s=a.data("view")){case"years prev":case"years next":e="years prev"===s?e-10:e+10,r=a.text(),(o=p.test(r))&&(e=parseInt(r,10),this.date=new Date(e,i,v(n,28))),this.viewDate=new Date(e,i,v(n,28)),this.fillYears(),o&&(this.showView(1),this.pick("year"));break;case"year prev":case"year next":e="year prev"===s?e-1:e+1,this.viewDate=new Date(e,i,v(n,28)),this.fillMonths();break;case"year current":this.format.hasYear&&this.showView(2);break;case"year picked":this.format.hasMonth?this.showView(1):this.hideView();break;case"year":e=parseInt(a.text(),10),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasMonth?this.showView(1):this.hideView(),this.pick("year");break;case"month prev":case"month next":i="month prev"===s?i-1:"month next"===s?i+1:i,this.viewDate=new Date(e,i,v(n,28)),this.fillDays();break;case"month current":this.format.hasMonth&&this.showView(1);break;case"month picked":this.format.hasDay?this.showView(0):this.hideView();break;case"month":i=C.inArray(a.text(),this.options.monthsShort),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasDay?this.showView(0):this.hideView(),this.pick("month");break;case"day prev":case"day next":case"day":i="day prev"===s?i-1:"day next"===s?i+1:i,n=parseInt(a.text(),10),this.date=new Date(e,i,n),this.viewDate=new Date(e,i,n),this.fillDays(),"day"===s&&this.hideView(),this.pick("day");break;case"day picked":this.hideView(),this.pick("day")}},clickDoc:function(t){for(var e,i=t.target,n=this.$trigger[0];i!==o;){if(i===n){e=!0;break}i=i.parentNode}e||this.hide()},keyup:function(){this.update()},getValue:function(){var t=this.$element,e="";return this.isInput?e=t.val():this.isInline&&!this.options.container||(e=t.text()),e},setValue:function(t){var e=this.$element;t=q(t)?t:"",this.isInput?e.val(t):this.isInline&&!this.options.container||e.text(t)},show:function(){this.isBuilt||this.build(),this.isShown||this.trigger(l).isDefaultPrevented()||(this.isShown=!0,this.$picker.removeClass(b).on(i,C.proxy(this.click,this)),this.showView(this.options.startView),this.isInline||(t.on(e,this._place=x(this.place,this)),h.on(i,this._clickDoc=x(this.clickDoc,this)),this.place()))},hide:function(){this.isShown&&(this.trigger(d).isDefaultPrevented()||(this.isShown=!1,this.$picker.addClass(b).off(i,this.click),this.isInline||(t.off(e,this._place),h.off(i,this._clickDoc))))},update:function(){this.setDate(this.getValue(),!0)},pick:function(t){var e=this.$element,i=this.date;this.trigger(c,{view:t||"",date:i}).isDefaultPrevented()||(this.setValue(this.formatDate(this.date)),this.isInput&&e.trigger("change"))},reset:function(){this.setDate(this.initialDate,!0),this.setValue(this.initialValue),this.isShown&&this.showView(this.options.startView)},getMonthName:function(t,e){var i=this.options,n=i.months;return C.isNumeric(t)?t=r(t):S(e)&&(e=t),!0===e&&(n=i.monthsShort),n[w(t)?t:this.date.getMonth()]},getDayName:function(t,e,i){var n=this.options,o=n.days;return C.isNumeric(t)?t=r(t):(S(i)&&(i=e),S(e)&&(e=t)),(o=!0===i?n.daysMin:!0===e?n.daysShort:o)[w(t)?t:this.date.getDay()]},getDate:function(t){var e=this.date;return t?this.formatDate(e):new Date(e)},setDate:function(t,e){var i=this.options.filter;($(t)||q(t))&&(t=this.parseDate(t),C.isFunction(i)&&!1===i.call(this.$element,t)||(this.date=t,this.viewDate=new Date(t),e||this.pick(),this.isBuilt&&this.fillAll()))},setStartDate:function(t){($(t)||q(t))&&(this.startDate=this.parseDate(t),this.isBuilt&&this.fillAll())},setEndDate:function(t){($(t)||q(t))&&(this.endDate=this.parseDate(t),this.isBuilt&&this.fillAll())},parseDate:function(t){var e,i,n,o,r,s,a=this.format,l=[];if($(t))return new Date(t.getFullYear(),t.getMonth(),t.getDate());if(q(t)&&(l=t.match(f)||[]),i=(t=new Date).getFullYear(),n=t.getDate(),o=t.getMonth(),e=a.parts.length,l.length===e)for(s=0;s
                            ',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},D.setDefaults=function(t){C.extend(D.DEFAULTS,C.isPlainObject(t)&&t)},D.other=C.fn.qorDatepicker,C.fn.qorDatepicker=function(o){var r,s=k(arguments,1);return this.each(function(){var t,e,i=C(this),n=i.data(a);if(!n){if(/destroy/.test(o))return;t=C.extend({},i.data(),C.isPlainObject(o)&&o),i.data(a,n=new D(this,t))}q(o)&&C.isFunction(e=n[o])&&(r=e.apply(n,s))}),S(r)?this:r},C.fn.qorDatepicker.Constructor=D,C.fn.qorDatepicker.languages=D.LANGUAGES,C.fn.qorDatepicker.setDefaults=D.setDefaults,C.fn.qorDatepicker.noConflict=function(){return C.fn.qorDatepicker=D.other,this}}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(h){var i=window.Mustache,f=window.QOR,o="qor.action",t="enable."+o,n="click."+o,r='[data-ajax-form="true"][data-method]',e=".qor-action-bulk-buttons",s=".qor-page .qor-table-container",a=".qor-table--bulking",l=".qor-table--bulking tbody tr",p="is_undo",d="mdl-data-table--selectable",c="primary_values[]",m=".qor-body__loading";function u(t,e){this.$element=h(t),this.options=h.extend({},u.DEFAULTS,h.isPlainObject(e)&&e),this.ajaxForm={},this.init()}return u.prototype={constructor:u,init:function(){this.bind(),this.initActions()},bind:function(){this.$element.on(n,".qor-action--bulk",this.renderBulkTable.bind(this)).on(n,".qor-action--exit-bulk",this.removeBulkTable.bind(this)),h(document).on(n,l,this.handleBulkTableClick.bind(this)).on(n,r,this.clickAjaxButton.bind(this))},unbind:function(){this.$element.off(n),h(document).off(n,l,this.handleBulkTableClick).off(n,r,this.clickAjaxButton)},initActions:function(){h(s).find("table").length||(h(e).hide(),h(".qor-page__header a.qor-action--button").hide())},collectFormData:function(){var e,t=h(a).find(".mdl-checkbox__input:checked"),i=[],n=[];return t.length&&t.each(function(){var t=h(this).closest("tr").data("primary-key");e={},t&&(i.push({name:c,value:t.toString()}),e[c]=t.toString(),n.push(e))}),this.ajaxForm.formData=i,this.ajaxForm.normalFormData=n,this.ajaxForm},actionSubmit:function(t){return this.submit(t),!1},handleBulkTableClick:function(t){var e=h(t.target).closest("tr"),i=e.find("td").first(),t=i.find(".mdl-js-checkbox");return t.toggleClass("is-checked"),e.toggleClass("is-selected"),i.find("input").prop("checked",t.hasClass("is-checked")),!1},adjustPageBodyStyle:function(t){var e=h(".qor-page > .qor-page__header"),i=h(".qor-page > .qor-page__body"),n=e.find(".qor-page-subnav__header").length?96:48;t?e.height()>n&&i.css("padding-top",e.height()):parseInt(i.css("padding-top"))>n&&i.css("padding-top","")},renderBulkTable:function(){var t=h("body");t.hasClass("qor-slideout-open")&&t.data("qor.slideout").hide(),h(".qor-table__inner-list").remove(),this.toggleBulkButtons(),this.enableTableMDL(),this.adjustPageBodyStyle(!0)},removeBulkTable:function(){this.toggleBulkButtons(),this.disableTableMDL(),this.adjustPageBodyStyle()},enableTableMDL:function(){h(s).find("table").removeAttr("data-upgraded").addClass(d).trigger("enable")},disableTableMDL:function(){h(s).find("table").removeClass(d).find("tr").removeClass("is-selected").find("td:first,th:first").remove()},toggleBulkButtons:function(){this.$element.find(".qor-action-forms").toggle(),h(e).find("button").toggleClass("hidden"),h(s).toggleClass("qor-table--bulking").find(".qor-table__actions").toggle(),h(".qor-page__header .qor-actions, .qor-page__header .qor-search-container").toggle()},clickAjaxButton:function(t){t=h(t.target);return this.collectFormData(),this.ajaxForm.properties=t.data(),this.submit(t),!1},renderFlashMessage:function(t){var e=u.FLASHMESSAGETMPL;return i.parse(e),i.render(e,t)},addLoading:function(){h(m).remove(),h(u.TEMPLATE_LOADING).appendTo(h("body")).trigger("enable.qor.material")},submit:function(e){var i=this,n=this.ajaxForm||{},t=n.properties||e.data();if(e.hasClass("qor-action-disabled"))return!1;!t.fromIndex||n.formData&&n.formData.length?t.confirm?f.qorConfirm(t,function(t){t&&i.handleAjaxSubmit(n,e)}):this.handleAjaxSubmit(n,e):f.qorConfirm(n.properties.errorNoItem)},handleAjaxSubmit:function(o,r){var s=this,a=this.$element,l=r.closest(".qor-action-forms"),d=o.properties||r.data(),c=d.url,u=d.undoUrl,e=r.hasClass(p),t=r.closest(".qor-slideout").length,i=a.length&&!t;e&&(c=u),this.addLoading(),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).addClass("qor-action-disabled"),h.ajax(c,{method:d.method,data:o.formData,dataType:d.datatype||"json",beforeSend:function(){u?r.prop("disabled",!0):i&&s.switchButtons(a,1)},success:function(t){if(u)return a.trigger("undo.qor.action",[r,e,t]),e?r.removeClass(p):r.addClass(p),void r.prop("disabled",!1);window.location.reload()},error:function(t){200!=t.status&&(u?r.prop("disabled",!1):i&&s.switchButtons(a),f.handleAjaxError(t))},complete:function(t){var e,i=t.getResponseHeader("content-type"),n=t.getResponseHeader("Content-Disposition");h(m).remove(),r.prop("disabled",!1),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).removeClass("qor-action-disabled"),n&&-1!==n.indexOf("attachment")&&(e={},t="",null!=(n=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(n))&&n[1]&&(t=n[1].replace(/['"]/g,"")),d.method&&(e=h.extend({},o.normalFormData,{_method:d.method})),f.qorAjaxHandleFile(c,i,t,e),u?r.prop("disabled",!1):s.switchButtons(a))}})},switchButtons:function(t,e){e=!!e;t.find(".qor-action-button").prop("disabled",e)},destroy:function(){this.unbind(),this.$element.removeData(o)}},u.DEFAULTS={},u.TEMPLATE_LOADING='
                            \n
                            \n
                            \n
                            ',h.fn.qorSliderAfterShow.qorInsertActionData=function(t,e){var i=h(e).find('[data-toggle="qor-action-slideout"]'),n=i.find("form"),e=h(a).find(".mdl-checkbox__input:checked");i.length&&e.length&&e.each(function(){var t=h(this).closest("tr").data("primary-key");t&&n.prepend('')})},u.plugin=function(n){return this.each(function(){var t,e=h(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&h.isFunction(t=i[n])&&t.call(i)})},h(function(){var e={},i='[data-toggle="qor.action.bulk"]';h(i).length||h(document).on(n,r,function(t){return(new u).actionSubmit(h(t.target)),!1}),h(document).on("disable.qor.action",function(t){u.plugin.call(h(i,t.target),"destroy")}).on(t,function(t){u.plugin.call(h(i,t.target),e)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(a){var l=window.location,r=window.QOR,o="qor.advancedsearch",t="enable."+o,e="click."+o;function s(t,e){this.$element=a(t),this.options=a.extend({},s.DEFAULTS,a.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){this.$form=this.$element.find("form"),this.$modal=a(s.MODAL).appendTo("body"),this.bind()},bind:function(){this.$element.on("submit.qor.advancedsearch","form",this.submit.bind(this)).on(e,".qor-advanced-filter__save",this.showSaveFilter.bind(this)).on(e,".qor-advanced-filter__toggle",this.toggleFilterContent).on(e,".qor-advanced-filter__close",this.closeFilter).on(e,".qor-advanced-filter__delete",this.deleteSavedFilter),this.$modal.on("shown.qor.modal",this.start.bind(this))},closeFilter:function(){a(".qor-advanced-filter__dropdown").hide()},toggleFilterContent:function(t){a(t.target).closest(".qor-advanced-filter__toggle").parent().find(">[advanced-search-toggle]").toggle()},showSaveFilter:function(){this.$modal.qorModal("show")},deleteSavedFilter:function(t){var e=a(t.target).closest(".qor-advanced-filter__delete"),i=e.closest(".qor-advanced-filter__savedfilter"),n=e.data("filter-name"),o=l.pathname;return r.qorConfirm({confirm:"Are you sure you want to delete this saved filter?"},function(t){t&&a.get(o,a.param({delete_saved_filter:n})).done(function(){e.closest("li").remove(),0===i.find("li").length&&i.remove()}).fail(function(){r.qorConfirm("Server error, please try again!")})}),!1},start:function(){this.$modal.trigger("enable.qor.material").on(e,".qor-advanced-filter__savefilter",this.saveFilter.bind(this))},saveFilter:function(){var t=this.$modal.find("#qor-advanced-filter__savename").val();t&&this.$form.prepend('')).submit()},submit:function(){var t,e=this.$form,i=e.find("input[name],select[name]"),n=[],o=e.closest(".qor-bottomsheets"),r=e.serialize();if(i.each(function(){n.push(a(this).attr("name"))}),t=function(t){var e,i,n=decodeURIComponent(l.search.substr(1)).split("&"),o={};if(1==n.length&&""==n[0])return!1;for(i in n)""!==n[i]&&(e=n[i].split("="),o[e[0]]=e[1]);return t.forEach(function(t){delete o[t]}),o}(n),!a.isEmptyObject(t))for(var s in t)t.hasOwnProperty(s)&&e.prepend('\n
                            \n
                            \n

                            Save advanced filter

                            \n
                            \n
                            \n \n
                            \n \n \n
                            \n\n
                            \n \n
                            \n \n
                            \n
                            \n ',s.plugin=function(n){return this.each(function(){var t,e=a(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new s(this,n))}"string"==typeof n&&a.isFunction(t=i[n])&&t.apply(i)})},a(function(){var e='[data-toggle="qor.advancedsearch"]';a(document).on("disable.qor.advancedsearch",function(t){s.plugin.call(a(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(a(e,t.target),void 0)}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var r="qor.autoheight",t="enable."+r;function s(t,e){this.$element=o(t),this.options=o.extend({},s.DEFAULTS,o.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){var t=this.$element;this.paddingTop=parseInt(t.css("padding-top"),10),this.paddingBottom=parseInt(t.css("padding-bottom"),10),this.resize(),this.bind()},bind:function(){this.$element.on("input",o.proxy(this.resize,this))},unbind:function(){this.$element.off("input",this.resize)},resize:function(){var t=this.$element,e=t.prop("scrollHeight");e?t.height("auto").height(e-this.paddingTop-this.paddingBottom):t.height("40px")},destroy:function(){this.unbind(),this.$element.removeData(r)}},s.DEFAULTS={},s.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new s(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e="textarea.qor-js-autoheight";o(document).on("disable.qor.autoheight",function(t){s.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(o(e,t.target))}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(b){var o=window._,n=window.FormData,i=window.QOR_Translations,r="qor.bottomsheets",t="click."+r,e="submit."+r,v="qor-bottomsheets-open",_=".mdl-layout__content.qor-page",s=".qor-page__body",q=".qor-page__header",a=".qor-bottomsheets__search-input";function l(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(b(this).attr(n))}),o.uniq(i)}function d(t,e,i){for(var n=0,o=0,r=t.length;o')},filterChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},selectorChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},keyup:function(t){var e=this.$bottomsheets.find(a);13===t.which&&e.length&&e.is(":focus")&&this.search()},search:function(){var t=this.$bottomsheets,e=t.data().url,i=b.trim(t.find(a).val()),t=e+"?keyword="+i;/\?/g.test(e)&&(t=e+"&keyword="+i),this.reload(t)},pagination:function(t){t=b(t.target).closest("a").prop("href");return t&&this.reload(t),!1},reload:function(t){var e=this.$bottomsheets.find(s);this.addLoading(e),this.fetchPage(t)},reloadFromUrl:function(t,e){this.reload(e)},fetchPage:function(i){var n=this.$bottomsheets,o=this;b.get(i,function(t){var e=b(t).find(_),t=e.find(q),e=e.find(s);e.length?(n.find(s).html(e.html()),t.length&&(o.$body.find(q).html(t.html()).trigger("enable"),o.addHeaderClass()),n.trigger("reload.qor.bottomsheets")):o.reload(i)}).fail(function(){window.alert("server error, please try again later!")})},constructloadURL:function(t,e){var i,n,o=this.filterURL,r=this.$bottomsheets.data().url;if(!o){if(!r)return;o=r}return i=new URL("http://www.getqor.com/"+t),n=e,r=i.search,n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=null===(r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(decodeURIComponent(r)))?"":r[1].replace(/\+/g," "),o=this.filterURL=(i=e,n=t,r=o,e=String(i).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),t=new RegExp("([?&])"+e+"=.*?(&|$)","i"),e=-1!==r.indexOf("?")?"&":"?",r.match(t)?n?r.replace(t,"$1"+i+"="+n+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?r.replace(t,"$1"):r.replace(t,""):n?r+e+i+"="+n:void 0)},addHeaderClass:function(){this.$body.find(q).hide(),this.$bottomsheets.find(q).children(".qor-bottomsheet__filter").length&&this.$body.addClass("has-header").find(q).show()},addLoading:function(t){t.html(""),b(w.TEMPLATE_LOADING).appendTo(t).trigger("enable.qor.material")},loadExtraResource:function(t){var e,i,n=(e=t.$links,i=b("link"),e=l(e),i=l(i),o.difference(e,i)),i=(e=t.$scripts,i=b("script"),e=l(e,!0),i=l(i,!0),o.difference(e,i));n.length&&function t(e){var i=document.createElement("link"),n=e.shift();i.type="text/css",i.rel="stylesheet",i.onload=function(){e.length&&t(e)},i.href=n,document.getElementsByTagName("head")[0].appendChild(i)}(n),i.length&&d(i,t)},loadMedialibraryJS:function(t){var e,t=t.filter("script"),i=/theme=media_library/g,n=this;t.each(function(){var t;e=b(this).prop("src"),i.test(e)&&((t=document.createElement("script")).src=e,document.body.appendChild(t),n.mediaScriptAdded=!0)})},submit:function(t){var r,e=t.target,s=b(e),a=this,l=s.prop("action"),d=s.closest(".qor-bottomsheets"),c=d.data(),i=c.ajaxType,u=s.find(":submit");c.ingoreSubmit||s.data().normalSubmit||(b(document).trigger("bottomsheetBeforeSend.qor.bottomsheets"),t.preventDefault(),r=new n(e),b.ajax(l,{method:s.prop("method"),data:r,dataType:i||"html",processData:!1,contentType:!1,beforeSend:function(){u.prop("disabled",!0)},success:function(t,e,i){if(c.ajaxMute)d.remove();else if(c.ajaxTakeover)c.$target.parent().trigger("ajaxSuccessed.qor.bottomsheets",[t,d]);else{t=i.getResponseHeader("Content-Disposition");if(t&&-1!==t.indexOf("attachment")){var t=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t),n=i.getResponseHeader("Content-Type"),o="";return null!=t&&t[1]&&(o=t[1].replace(/['"]/g,"")),window.QOR.qorAjaxHandleFile(l,n,o,r),void u.prop("disabled",!1)}b(".qor-error").remove();n=s.data("returnUrl"),o=s.data("refreshUrl");o?window.location.href=o:"refresh"!=n?(n&&"refresh"!=n?a.load(n):a.refresh(),b(document).trigger("bottomsheetSubmitComplete.qor.bottomsheets")):a.refresh()}},error:function(t){window.QOR.handleAjaxError(t)},complete:function(){u.prop("disabled",!1)}}))},load:function(s,a,l){var d,t,e,c=this.options,u=a.actionData,h=this.resourseData,f=h.selectModal,p=h.ingoreSubmit,m=this.$bottomsheets,y=this.$header,g=this.$body;s&&(this.show(),this.addLoading(g),this.filterURL=s,g.removeClass("has-header has-hint"),a=b.isPlainObject(a)?a:{},d=a.method||"GET",t=a.datatype||"html",e=b.proxy(function(){b.ajax(s,{method:d,dataType:t,success:b.proxy(function(t){var e,i,n,o,r;"GET"===d?(i={$scripts:(e=b(t)).filter("script"),$links:e.filter("link"),url:s,response:t},n=f&&e.find(".qor-search-container").length,o=t.match(/<\s*body.*>[\s\S]*<\s*\/body\s*>/gi),r=e.find(_),o&&(o=o.join("").replace(/<\s*body/gi,"').concat(a.selectBacktolistTitle,"")),f&&(g.find(".qor-button--new").data("ingoreSubmit",!0).data("selectId",h.selectId).data("loadInline",!0),"one"==f||a.selectNohint||void 0!==h.maxItem&&"1"==h.maxItem||g.addClass("has-hint"),"mediabox"!=f||this.mediaScriptAdded||this.loadMedialibraryJS(e)),y.find(".qor-button--new").remove(),this.$title.after(g.find(".qor-button--new")),n&&(m.addClass("has-search"),y.find(".qor-bottomsheets__search").remove(),y.prepend(w.TEMPLATE_SEARCH)),u&&u.length&&this.bindActionData(u),h.bottomsheetClassname&&m.addClass(h.bottomsheetClassname),m.trigger("enable"),m.one("hidden.qor.bottomsheets",function(){b(this).trigger("disable")}),this.addHeaderClass(),m.data(a),l&&b.isFunction(l)&&l(this.$bottomsheets),m.trigger("bottomsheetLoaded.qor.bottomsheets",[s,t]))):a.returnUrl?this.load(a.returnUrl):this.refresh()},this),error:b.proxy(function(){var t;this.$bottomsheets.remove(),b(".qor-bottomsheets").is(":visible")||b("body").removeClass(v),t=0=u&&c&&v.isFunction(c)&&c()}).attr("src",t).data("originalUrl",t),p.show()},start:function(){var o=this.options,r=this.$modal,t=this.$target,e=t.data(),s=e.sizeName||"original",i=e.sizeResolution,n=e&&e.originalUrl&&t.attr("data-original-url")?/\.original\./.test(e.originalUrl)?e.originalUrl:/\.original\./.test(t.attr("data-original-url"))?t.attr("data-original-url"):t.attr("data-original-url").replace(/file\./,"file.original."):t.attr("src"),a=v("")),l=this.data||{},d=this,t=NaN,n=e.sizeResolutionWidth,e=e.sizeResolutionHeight;i&&(n||e||(n=q(i,"width"),e=q(i,"height")),t=n/e),l[o.key]||(l[o.key]={}),r.trigger("enable.qor.material").find(u).html(a),(e=this.getList(t))&&r.find(h).show().append(e),a.cropper({aspectRatio:t,data:function(t){var e,i={};if(v.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(i[String(e).toLowerCase()]=t[e]);return i}(l[o.key][s]),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,autoCropArea:1,ready:function(){r.find(".qor-cropper__options-toggle").on(c,function(){r.find(".qor-cropper__options-input").prop("checked",v(this).prop("checked"))}).prop("checked",!0),r.find(".qor-cropper__save").one(c,function(){var t,e=a.cropper("getData",!0),i=a.cropper("getCroppedCanvas"),n=[];if(l.Crop=!0,l[o.key][s]=e,d.imageData=a.cropper("getImageData"),d.cropData=e,i)try{t=i.toDataURL()}catch(t){console.log(t),console.log("Please check image Cross-origin setting")}r.find(h+" input").each(function(){var t=v(this);t.prop("checked")&&n.push(t.attr("name"))}),d.output(t,n),r.qorModal("hide")})}})},stop:function(){this.$modal.trigger("disable.qor.material").find(u+" > img").cropper("destroy").remove().end().find(h).hide().find("ul").remove()},getList:function(o){var r=[];return this.$list.find("img").not(this.$target).each(function(){var t=v(this).data(),e=t.sizeResolution,i=t.sizeName,n=t.sizeResolutionWidth,t=t.sizeResolutionHeight;e&&(n||t||(n=q(e,"width"),t=q(e,"height")),n/t===o&&r.push('"))}),r.length?"
                            • "+r.join("
                            • ")+"
                            ":""},output:function(t,e){var i=this.$target;t?this.center(i.attr("src",t),!0):this.preview(i),v.isArray(e)&&e.length&&this.autoCrop(t,e),this.$output.val(JSON.stringify(this.data)).trigger(o),this.$formCropInput.val(JSON.stringify(this.data))},preview:function(t,e,i){var n=t.parent().parent(),o=n.width(),r=n.height(),s=e||this.imageData,n=v.extend({},i||this.cropData),e=n.width/n.height,i=o;0!=i&&0!=s.naturalWidth&&0!=s.naturalHeight&&(r*e<=o&&(i=r*e),i=n.width/i,t.css({maxWidth:s.naturalWidth/i,maxHeight:s.naturalHeight/i}),this.center(t))},center:function(t,o){t.each(function(){var t=v(this),i=t.parent(),n=i.parent();function e(){var t=n.height(),e=i.height(),e=eclear'))},show:function(){this.$element.find(l).toggle()},close:function(t){var e=s(t.target),i=s(l),n=i.is(":visible"),o=e.closest(l).length,r=e.closest(".qor-filter-toggle").length,t=e.closest(".qor-modal").length,e=e.closest(".ui-timepicker-wrapper").length;n&&(o||r||t||e)||i.hide()},setFilterTime:function(t){var e,i,n=s(t.target),o=n.data(),t=o.filterRange;if(!t)return!1;if(s(this.options.label).removeClass(d),n.addClass(d),"events"==t)return this.$timeStart.val(o.scheduleStartAt||""),this.$timeEnd.val(o.scheduleEndAt||""),this.$searchButton.click(),!1;switch(t){case"today":e=i=new Date;break;case"week":e=this.startWeekDate,i=this.endWeekDate;break;case"month":e=this.startMonthDate,i=this.endMonthDate}if(!e||!i)return!1;o=this.getTime(e)+" 00:00",t=this.getTime(i)+" 23:59",this.$timeStart.val(o),this.$timeEnd.val(t),this.$searchButton.click()},getTime:function(t){var e=(e=t.getMonth()+1)<10?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i;return t.getFullYear()+"-"+e+"-"+i},clear:function(){var t=s(this.options.trigger),e=t.find(".qor-selector-label");return t.removeClass("active clearable"),e.html(e.data("label")),this.$timeStart.val(""),this.$timeEnd.val(""),this.$searchButton.click(),!1},getUrlParameter:function(t){var e=decodeURIComponent(a.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===e?"":e[1].replace(/\+/g," ")},updateQueryStringParameter:function(t,e,i){var n=i||a.href,o=n.match(/#\S*$/)||"",r=String(t).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),i=new RegExp("([?&])"+r+"=.*?(&|$)","i"),r=-1!==n.indexOf("?")?"&":"?";return o&&(o=o[0],n=n.replace(o,"")),n.match(i)?n=e?n.replace(i,"$1"+t+"="+e+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?n.replace(i,"$1"):n.replace(i,""):e&&(n=n+r+t+"="+e),n+o},search:function(){var t=this.$searchParam,i=a.href,n=this;t.length&&(t.each(function(){var t=s(this),e=t.data().searchParam,t=t.val();i=n.updateQueryStringParameter(e,t,i)}),this.$element.closest(r).length?s(r).trigger("filterChanged.qor.filter",[i,"qor.filter.time"]):a.href=i)},destroy:function(){this.unbind(),this.$element.removeData(o)}},c.DEFAULTS={label:!1,trigger:!1,button:!1,clear:!1},c.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new c(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.filter.time"]',i={label:".qor-filter__block-buttons button",trigger:"a.qor-filter-toggle",button:".qor-filter__button-search",clear:".qor-selector-clear"};s(document).on("disable.qor.filter",function(t){c.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){c.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),c}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(d){var c=window.location,o="qor.filter",t="enable."+o,e="click."+o,i="change."+o,u=".qor-bottomsheets";function h(t,i){var n,e=c.search,o=c.search.match(/per_page=\d+/),e=e.replace(/per_page=\d+/g,"").replace(/page=\d+/,"page=1");return o&&o.length&&(e=e+"&"+o[0]),d.isArray(t)&&(n=f(e),d.each(t,function(t,e){-1===(t=d.inArray(e,n))?n.push(e):i&&n.splice(t,1)}),e="?"+n.join("&")),e}function f(t){var e=[];return t&&-1 thead"),this.$tbody=e.find("> tbody"),this.$header=s(t.header),this.$subHeader=s(t.subHeader),this.$content=s(t.content),this.marginBottomPX=parseInt(this.$subHeader.css("marginBottom")),this.paddingHeight=t.paddingHeight,this.resize(),this.bind())},bind:function(){this.$content.on(i,this.toggle.bind(this)),t.on(e,this.resize.bind(this))},unbind:function(){this.$content.off(i,this.toggle).off(e,this.resize)},isNeedBuild:function(){var t=this.$element;return!!(1 tr:visible").length<=1||t.data("disable-fixer"))},build:function(){var e=[];this.$tbody.find("> tr:first").children().each(function(){var t=s(this).outerWidth();s(this).outerWidth(t),e.push(t)}),this.$thead.find(">tr").children().each(function(t){s(this).outerWidth(e[t])})},toggle:function(){var t,e,i,n,o,r;this.$content.length&&(t=this.$element,e=this.$thead,i=this.$content.scrollTop(),n=this.$subHeader.outerHeight()+this.paddingHeight+this.marginBottomPX,o=s(".qor-page__header").outerHeight(),r=this.$content.offset().top+s(".qor-page__header").height(),n-o\n \n \n "),this.bind()},bind:function(){this.$element.on(i,l,this.showEditButton).on(n,l,this.hideEditButton).on(e,".qor-inlineedit__cancel",this.hideEdit).on(e,".qor-inlineedit__save",this.saveEdit).on(e,r,this.showEdit.bind(this))},unbind:function(){this.$element.off(i).off(n).off(e)},showEditButton:function(t){var e=s(u.TEMPLATE_EDIT);if(s(t.target).closest(a).find("input:disabled, textarea:disabled,select:disabled").length)return!1;e.appendTo(s(this))},hideEditButton:function(){s(".qor-inlineedit__edit").remove()},showEdit:function(t){t=s(t.target).closest(r).hide().closest(a).addClass(c);s(this.TEMPLATE_SAVE).appendTo(t)},hideEdit:function(){s(this).closest(a).removeClass(c).find(d).remove()},saveEdit:function(){var n=s(this),o=n.closest(a),t=n.closest("form"),e=o.closest(".qor-fieldset").find('input.qor-hidden__primary_key[type="hidden"]'),i=o.find('input[name*="QorResource"],textarea[name*="QorResource"],select[name*="QorResource"]'),r=i.length&&i.prop("name").match(/\.\w+/g),i=i.serialize();e.length&&(i="".concat(i,"&").concat(e.serialize())),r.length&&s.ajax(t.prop("action"),{method:t.prop("method"),data:i,dataType:"json",beforeSend:function(){n.prop("disabled",!0)},success:function(t){var e=function(t,e){var i,n=e[t[0].slice(1)];if(1mode_edit',u.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.inlineEdit"]',i={};s(document).on("disable.qor.inlineEdit",function(t){u.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){u.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(e){var i=window.componentHandler,n='[class*="mdl-js"],[class*="mdl-tooltip"]';function o(t){i&&(e(t).is(n)?i.upgradeElements(t):i.upgradeElements(e(n,t).toArray()))}function r(t){i&&(e(t).is(n)?i.downgradeElements(t):i.downgradeElements(e(n,t).toArray()))}e(function(){e(document).on("enable.qor.material",function(t){o(t.target)}).on("disable.qor.material",function(t){r(t.target)}).on("update.qor.material",function(t){r(t.target),o(t.target)})})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var n=o(document),r="qor.modal",t="click."+r,e="keyup."+r,s="transitionend",a="qor-modal-open",l="in",i="aria-hidden";function d(t,e){this.$element=o(t),this.options=o.extend({},d.DEFAULTS,o.isPlainObject(e)&&e),this.transitioning=!1,this.fadable=!1,this.init()}return d.prototype={constructor:d,init:function(){this.fadable=this.$element.hasClass("fade"),this.options.show?this.show():this.toggle()},bind:function(){this.$element.on(t,o.proxy(this.click,this)),this.options.keyboard&&n.on(e,o.proxy(this.keyup,this))},unbind:function(){this.$element.off(t,this.click),this.options.keyboard&&n.off(e,this.keyup)},click:function(t){var e=this.$element[0],i=t.target;if(i===e&&this.options.backdrop)this.hide();else for(;i!==e;){if("modal"===o(i).data("dismiss")){this.hide();break}i=i.parentNode}},keyup:function(t){27===t.which&&this.hide()},show:function(t){var e,i=this.$element;if(!this.transitioning&&!i.hasClass(l)&&(e=o.Event("show.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").addClass(a),i.addClass("shown").scrollTop(0).get(0).offsetHeight,this.transitioning=!0,t||!this.fadable)return i.addClass(l),void this.shown();i.one(s,o.proxy(this.shown,this)),i.addClass(l)}},shown:function(){this.transitioning=!1,this.bind(),this.$element.attr(i,!1).trigger("shown.qor.modal").focus()},hide:function(t){var e,i=this.$element;if(!this.transitioning&&i.hasClass(l)&&(e=o.Event("hide.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").removeClass(a),this.transitioning=!0,t||!this.fadable)return i.removeClass(l),void this.hidden();i.one(s,o.proxy(this.hidden,this)),i.removeClass(l)}},hidden:function(){this.transitioning=!1,this.unbind(),this.$element.removeClass("shown").attr(i,!0).trigger("hidden.qor.modal")},toggle:function(){this.$element.hasClass(l)?this.hide():this.show()},destroy:function(){this.$element.removeData(r)}},d.DEFAULTS={backdrop:!1,keyboard:!0,show:!0},d.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new d(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o.fn.qorModal=d.plugin,o(function(){var e=".qor-modal";o(document).on(t,'[data-toggle="qor.modal"]',function(){var t=o(this),e=t.data(),t=o(e.target||t.attr("href"));d.plugin.call(t,t.data(r)?"toggle":e)}).on("disable.qor.modal",function(t){d.plugin.call(o(e,t.target),"destroy")}).on("enable.qor.modal",function(t){d.plugin.call(o(e,t.target))})}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var o="qor.tabbar.radio",t="enable."+o,e="click."+o,s="[data-tab-target]",a="is-active";function l(t,e){this.$element=r(t),this.options=r.extend({},l.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return l.prototype={constructor:l,init:function(){this.bind()},bind:function(){this.$element.on(e,s,this.switchTab.bind(this))},unbind:function(){this.$element.off(e,s,this.switchTab)},switchTab:function(t){var e=r(t.target),i=this.$element,n=i.find(s),o=i.find("[data-tab-source]"),t=e.data().tabTarget;e.hasClass(a)||(n.removeClass(a),e.addClass(a),o.hide().filter('[data-tab-source="'+t+'"]').show(),i.trigger("switched.qor.tabbar.radio",[i,t]))},destroy:function(){this.unbind()}},l.DEFAULTS={},l.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new l(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.tab.radio"]';r(document).on("disable.qor.tabbar.radio",function(t){l.plugin.call(r(e,t.target),"destroy")}).on(t,function(t){l.plugin.call(r(e,t.target))}).triggerHandler(t)}),l}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(c){var r="qor.redactor",t="enable."+r,l="click."+r,e="addCrop."+r,i="removeCrop."+r,s="scroll."+r,n=".qor-cropper__toggle--redactor";function u(t,e){this.$element=c(t),this.options=c.extend(!0,{},u.DEFAULTS,c.isPlainObject(e)&&e),this.init()}return u.prototype={constructor:u,init:function(){var i,t=this.options,e=this.$element,n=e.closest(t.parent);n.length||(n=e.parent()),this.$parent=n,this.$button=c(u.BUTTON),this.$modal=c((i=u.MODAL,t=t.text,"string"==typeof i&&"object"===_typeof(t)&&c.each(t,function(t,e){i=i.replace("$["+String(t).toLowerCase()+"]",e)}),i)).appendTo("body"),this.bind()},bind:function(){this.$element.on(e,c.proxy(this.addButton,this)).on(i,c.proxy(this.removeButton,this))},unbind:function(){this.$element.off(e).off(i).off(s)},addButton:function(t,e){var i=c(e);this.$button.css("left",c(e).width()/2).prependTo(i.parent()).find(n).one(l,c.proxy(this.crop,this,i))},removeButton:function(){this.$button.find(n).off(l),this.$button.detach()},crop:function(n){var o,r=this.options,s=n.attr("src"),t=s,a=this.$modal;c.isFunction(r.replace)&&(t=r.replace(t)),o=c("")),a.one("shown.qor.modal",function(){var t,e;o.cropper({data:(t=n.attr("data-crop-options"),e=t&&t.split(","),t=null,e&&4===e.length&&(t={x:Number(e[0]),y:Number(e[1]),width:Number(e[2]),height:Number(e[3])}),t),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,checkImageOrigin:!1,ready:function(){a.find(".qor-cropper__save").one(l,function(){var i=o.cropper("getData",!0);c.ajax(r.remote,{type:"POST",contentType:"application/json",data:JSON.stringify({Url:s,CropOptions:{original:function(t){var e,i,n={};if(c.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(n["string"==typeof(i=e)&&(i=i.charAt(0).toUpperCase()+i.substr(1)),i]=t[e]);return n}(i)},Crop:!0}),dataType:"json",success:function(t){var e;c.isPlainObject(t)&&t.url&&(n.attr("src",t.url).attr("data-crop-options",(t=i,e=[],c.isPlainObject(t)&&c.each(t,function(){e.push(arguments[1])}),e.join())).removeAttr("style").removeAttr("rel"),c.isFunction(r.complete)&&r.complete(),a.qorModal("hide"))}})})}})}).one("hidden.qor.modal",function(){o.cropper("destroy").remove()}).qorModal("show").find(".qor-cropper__wrapper").append(o)},destroy:function(){this.unbind(),this.$modal.qorModal("hide").remove(),this.$element.removeData(r)}},u.DEFAULTS={remote:!1,parent:!1,toggle:!1,replace:null,complete:null,text:{title:"Crop the image",ok:"OK",cancel:"Cancel"}},u.BUTTON='
                            \n Edit\n Crop\n
                            ',u.MODAL='',u.plugin=function(o){return this.each(function(){var t,i=c(this),n=i.data(r);if(n)/destroy/.test(o)&&window.$R(this,"destroy");else{if(!window.$R)return;if(/destroy/.test(o))return;i.data(r,n={});var e={imageUpload:i.data("uploadUrl"),fileUpload:i.data("uploadUrl"),buttons:["html","format","bold","italic","deleted","lists","image","file","link"],linkNewTab:!0,linkTitle:!1,autoparsePaste:!1,autoparseLinks:!1,multipleUpload:!1,toolbarFixedTarget:!i.closest(".qor-slideout").length&&!i.closest(".qor-bottomsheets").length&&c("main.mdl-layout__content").length?"main.mdl-layout__content":document,callbacks:{started:function(){var t,a=c(this.container.$container.nodes[0]),l=c(this.toolbar.$toolbar.nodes[0]),e=c(".qor-slideout").is(":visible"),d=64;e?d=0!=i.closest(".qor-bottomsheets").length?(t=i.closest(".qor-page__body"),i.closest(".qor-page__body").offset().top):(t=".qor-slideout__body",c(".qor-slideout__header").height()):d+=c(t=".qor-layout main.qor-page").find(".qor-page__header").height(),c(t).on(s,function(){var t,e,i,n,o,r,s;t=l,i=d,n=(e=a).offset().top,o=e.outerHeight(),r={position:"relative",top:"auto",width:"auto"},s={position:"fixed",top:i,width:e.width(),boxShadow:"none"},n .qor-field__block > .qor-fieldset--new");this.singlePage=!(t.closest(".qor-slideout").length&&t.closest(".qor-bottomsheets").length),this.maxitems=t.data("maxItem"),this.isSortable=t.hasClass("qor-fieldset-sortable"),e.length&&!t.closest(".qor-fieldset--new").length&&(e.trigger("disable"),e.find("select[data-toggle]").removeAttr("data-select2-id"),this.isMultipleTemplate=t.data("isMultiple"),this.isMultipleTemplate?(this.fieldsetName=[],this.template={},this.index=[],e.each(function(t,e){(i=c(e).data("fieldsetName"))&&(n.template[i]=c(e).prop("outerHTML"),n.fieldsetName.push(i))}),this.parseMultiple()):this.parse(e.prop("outerHTML")),e.hide(),this.bind(),this.resetButton(),this.resetPositionButton())},resetPositionButton:function(){var t=this.$element.find("> .qor-sortable__button");this.isSortable&&(1 .qor-field__block > .qor-fieldset").not(".qor-fieldset--new,.is-deleted").length},toggleButton:function(t){var e=this.$element.find("> .qor-field__block > .qor-fieldset__add");t?e.hide():e.show()},resetButton:function(){this.maxitems<=this.getCurrentItems()?this.toggleButton(!0):this.toggleButton()},parse:function(t){t&&(t=this.initTemplate(t),this.template=t.template,this.index=t.index)},parseMultiple:function(){for(var t,e,i=this.fieldsetName,n=0,o=i.length;n .qor-field__block > .qor-sortable__item").not(".qor-fieldset--new").length,e.attr("order-index",t).attr("order-item","item_".concat(t)).css("order",t)),e.data("itemIndex",this.index).removeClass("qor-fieldset--new"),e}},del:function(t){var e,i=this.options,n=c(t.target).closest(i.itemClass),o=this,t={confirm:c(t.target).closest(i.delClass).data("confirm")||"Are you sure?"};s.qorConfirm(t,function(t){t&&(n.addClass("is-deleted").children(":visible").addClass("hidden").hide(),(e=c(i.alertTemplate.replace("{{name}}",o.parseName(n)))).find(i.undoClass).one(a,function(){if(o.maxitems<=o.getCurrentItems())return window.QOR.qorConfirm(o.$element.data("maxItemHint")),!1;n.find("> .qor-fieldset__alert").remove(),n.removeClass("is-deleted").children(".hidden").removeClass("hidden").show(),o.resetButton(),o.resetPositionButton()}.bind(this)),o.resetButton(),o.resetPositionButton(),n.append(e))})},parseName:function(t){t=t.find("input[name]").attr("name")||t.find("textarea[name]").attr("name");if(t)return t.replace(/[^\[\]]+$/,"")},destroy:function(){this.unbind(),this.$element.removeData(o)}},d.DEFAULTS={itemClass:".qor-fieldset",newClass:".qor-fieldset--new",addClass:".qor-fieldset__add",delClass:".qor-fieldset__delete",childrenClass:".qor-field__block",undoClass:".qor-fieldset__undo",alertTemplate:'
                            '},d.plugin=function(n){return this.each(function(){var t,e=c(this),i=e.data(o);i||e.data(o,i=new d(this,n)),"string"==typeof n&&c.isFunction(t=i[n])&&t.call(i)})},c(function(){var e=l,i={};c(document).on("disable.qor.replicator",function(t){d.plugin.call(c(e,t.target),"destroy")}).on(t,function(t){d.plugin.call(c(e,t.target),i)}).triggerHandler(t)}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var a=window.location,o=window.componentHandler,l=window.history,r="qor.globalSearch",t="enable."+r,e="click."+r,d=".qor-global-search--resource",c=".qor-global-search--results",u="is-active";function h(t,e){this.$element=s(t),this.options=s.extend({},h.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return h.prototype={constructor:h,init:function(){this.bind(),this.initTab()},bind:function(){this.$element.on(e,s.proxy(this.click,this))},unbind:function(){this.$element.off(e,this.check)},initTab:function(){var t=a.search;/resource_name/.test(t)&&(t=t.match(/resource_name=\w+/g).toString().split("=")[1],s(d).removeClass(u),s('[data-resource="'+t+'"]').addClass(u))},click:function(t){var e,i,n,o=s(t.target),r=o.data();o.is(d)&&(n=a.href.replace(/#/g,""),e=r.resource,i=/resource_name/.test(n),t="resource_name="+e,r=/keyword/.test(n)?"&":"?keyword=&",n=e?i?n.replace(/resource_name=\w+/g,t):n+r+t:n.replace(/&resource_name=\w+/g,""),l.pushState?this.fetchSearch(n,o):a.href=n)},fetchSearch:function(e,i){var n=document.title;s.ajax(e,{method:"GET",dataType:"html",beforeSend:function(){s(".mdl-spinner").remove(),s(c).prepend('
                            ').find(".qor-section").hide(),o.upgradeElement(document.querySelector(".mdl-spinner"))},success:function(t){t=s(t).find(c).html();s(d).removeClass(u),i.addClass(u),l.pushState({Page:e,Title:n},n,e),s(".mdl-spinner").remove(),s(c).removeClass("loading").html(t),o.upgradeElements(document.querySelectorAll(".qor-table"))},error:function(t,e,i){s(c).find(".qor-section").show(),s(".mdl-spinner").remove(),window.alert([e,i].join(": "))}})},destroy:function(){this.unbind(),this.$element.removeData(r)}},h.DEFAULTS={},h.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(r);i||e.data(r,i=new h(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.global.search"]',i={};s(document).on("disable.qor.globalSearch",function(t){h.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){h.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),h}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var d=window.FormData,c=window.QOR,o="qor.selectcore",s="afterSelected."+o,t="click."+o,e="submit."+o,i="table.qor-js-table tr";function r(t,e){this.$element=l(t),this.options=l.extend({},r.DEFAULTS,l.isPlainObject(e)&&e),this.init()}return r.prototype={constructor:r,init:function(){this.bind()},bind:function(){this.$element.on(t,i,this.processingData.bind(this)).on(e,"form",this.submit.bind(this))},unbind:function(){this.$element.off(t,i).off(e,"form")},processingData:function(e){var t=l(e.target).closest("tr"),i=t.closest(".qor-bottomsheets"),n={},o=this.options,r=o.onSelect,o=o.loading;return(n=l.extend({},n,t.data())).$clickElement=t,t=n.mediaLibraryUrl||n.url,o&&l.isFunction(o)&&o(i),t?l.getJSON(t,function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),n=l.extend({},t,n),r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s))}).always(function(){i.find(".qor-media-loading").remove()}):r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s)),!1},submit:function(e){var i,t=e.target,n=l(t),o=this,r=n.find(":submit"),s=l(c.$formLoading),a=this.options.onSubmit;l(document).trigger("selectcoreBeforeSend.qor.selectcore"),n.find(".qor-fieldset--new").remove(),d&&(e.preventDefault(),l.ajax(n.prop("action"),{method:n.prop("method"),data:new d(t),dataType:"json",processData:!1,contentType:!1,beforeSend:function(){l(".qor-submit-loading").remove(),s.appendTo(r.prop("disabled",!0).closest(".qor-form__actions")).trigger("enable.qor.material")},success:function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),(i=t).primaryKey=i.ID,l(".qor-error").remove(),a&&l.isFunction(a)?(a(i,e),l(document).trigger("afterSubmitted.qor.selectcore")):o.refresh()},error:function(t){c.handleAjaxError(t)},complete:function(){r.prop("disabled",!1)}}))},refresh:function(){setTimeout(function(){window.location.reload()},350)},destroy:function(){this.unbind()}},r.plugin=function(n){return this.each(function(){var t,e=l(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new r(this,n))}"string"==typeof n&&l.isFunction(t=i[n])&&t.apply(i)})},l.fn.qorSelectCore=r.plugin,r}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var i=s("body"),t=s(document),a=window.Mustache,o="qor.selectone",n="click."+o,r="enable."+o,e="reload.qor.bottomsheets",l=".qor-selected-many__remove",d=".qor-selected-many__undo",c="qor-selected-many__deleted",u=".qor-field__selectmany",h="is_selected",f="qor-bottomsheets__select-many";function p(t,e){this.$element=s(t),this.options=s.extend({},p.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return p.prototype={constructor:p,init:function(){this.bind()},bind:function(){t.on(e,".".concat(f),this.reloadData.bind(this)),this.$element.on(n,l,this.clearSelect.bind(this)).on(n,'[data-select-modal="many"]',this.openBottomSheets.bind(this)).on(n,d,this.undoDelete.bind(this))},unbind:function(){t.off(n,'[data-select-modal="many"]').off(e,".".concat(f)),this.$element.off(n,l).off(n,d)},clearSelect:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").addClass(c),this.updateSelectInputData(t),!1},undoDelete:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").removeClass(c),this.updateSelectInputData(t),!1},openBottomSheets:function(t){var e=s(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.bottomsheetsData=t,this.$selector=t.selectId?s(t.selectId):e.closest(u).find("select"),this.$selectFeild=this.$selector.closest(u).find(".qor-field__selected-many"),this.SELECT_MANY_SELECTED_ICON=s('[name="select-many-selected-icon"]').html(),this.SELECT_MANY_UNSELECTED_ICON=s('[name="select-many-unselected-icon"]').html(),this.SELECT_MANY_HINT=s('[name="select-many-hint"]').html(),this.SELECT_MANY_TEMPLATE=s('[name="select-many-template"]').html(),t.url=t.selectListingUrl,t.selectDefaultCreating&&(t.url=t.selectCreatingUrl),this.BottomSheets.open(t,this.handleSelectMany.bind(this))},reloadData:function(){this.initItems()},renderSelectMany:function(t){return a.render(this.SELECT_MANY_TEMPLATE,t)},renderHint:function(t){return a.render(this.SELECT_MANY_HINT,t)},initItems:function(){var i,t=this.$bottomsheets.find("tbody tr"),n=this.SELECT_MANY_SELECTED_ICON,o=this.SELECT_MANY_UNSELECTED_ICON,r=[];this.$selectFeild.find("[data-primary-key]").not("."+c).each(function(){r.push(s(this).data().primaryKey)}),t.each(function(){var t=s(this),e=t.find("td:first");i=t.data().primaryKey,"-1"!=r.indexOf(i)?(t.addClass(h),e.append(n)):e.append(o)}),this.updateHint(this.getSelectedItemData())},getSelectedItemData:function(){return{selectedNum:this.$selectFeild.find("[data-primary-key]").not("."+c).length}},updateHint:function(t){s.extend(t,this.bottomsheetsData),t=this.renderHint(t),this.$bottomsheets.find(".qor-selectmany__hint").remove(),this.$bottomsheets.find(".qor-page__body").before(t)},updateSelectInputData:function(t){var e,i,n=(t||this.$selectFeild).find("[data-primary-key]").not("."+c),o=t?t.find(".qor-field__selectmany-input"):this.$selector,r=o.find("option");r.prop("selected",!1),n.each(function(){i=s(this).data().primaryKey,(e=r.filter('[value="'+i+'"]')).length||(i={primaryKey:i,displayName:""},e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,i)),o.append(e)),e.prop("selected",!0)})},changeIcon:function(t,e){t.find(".qor-select__select-icon").remove(),t.find("td:first").prepend(e)},removeItem:function(t){var e=t.primaryKey;this.$selectFeild.find('[data-primary-key="'+e+'"]').find(l).click(),this.changeIcon(t.$clickElement,this.SELECT_MANY_UNSELECTED_ICON)},addItem:function(t,e){var i=this.renderSelectMany(t),n=this.$selectFeild.find('[data-primary-key="'+t.primaryKey+'"]');return n.length?n.hasClass(c)?(n.removeClass(c),this.updateSelectInputData(),void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON)):void 0:(this.$selectFeild.append(i),e?((e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,t))).appendTo(this.$selector),e.prop("selected",!0),this.$bottomsheets.remove(),void(s(".qor-bottomsheets").is(":visible")||s("body").removeClass("qor-bottomsheets-open"))):void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON))},handleSelectMany:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(f),t.on(n,".qor-selectmany__selectall",this.handleSelectAll.bind(this)),this.$bottomsheets=t,this.initItems()},handleSelectAll:function(){var t=this.$bottomsheets.find(".qor-table tbody tr"),e=t.not(".is_selected");(e.length?e:t).click()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t,e){t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.displayName=t.displayName.escapeSymbol(),e?this.addItem(t,!0):((e=t.$clickElement).toggleClass(h),e.hasClass(h)?this.addItem(t):this.removeItem(t),this.updateHint(this.getSelectedItemData()),this.updateSelectInputData())},destroy:function(){this.unbind(),this.$element.removeData(o)}},p.SELECT_MANY_OPTION_TEMPLATE='',p.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new p(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.selectmany"]';s(document).on("disable.qor.selectone",function(t){p.plugin.call(s(e,t.target),"destroy")}).on(r,function(t){p.plugin.call(s(e,t.target))}).triggerHandler(r)}),p}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var i=r("body"),t=r(document),s=window.Mustache,o="qor.selectone",e="click."+o,n="enable."+o,a="reload.qor.bottomsheets",l=".qor-selected__remove",d=".qor-selected__change",c=".qor-field__selected",u=".qor-field__selectone-input",h=".qor-field__selectone-trigger",f=".qor-field__selectone",p="qor-bottomsheets__select-one";function m(t,e){this.$element=r(t),this.options=r.extend({},m.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return m.prototype={constructor:m,init:function(){this.bind()},bind:function(){t.on(a,".".concat(p),this.reloadData.bind(this)),this.$element.on(e,l,this.clearSelect.bind(this)).on(e,"[data-selectone-url]",this.openBottomSheets.bind(this)).on(e,d,this.changeSelect)},unbind:function(){t.off(e,"[data-selectone-url]").off(a,".".concat(p)),this.$element.off(e,l).off(e,d)},clearSelect:function(t){t=r(t.target).closest(f);return t.find(c).remove(),t.find(u).html(""),t.find(u)[0].value="",t.find(h).show(),t.trigger("qor.selectone.unselected"),!1},changeSelect:function(){r(this).closest(f).find(h).trigger("click")},openBottomSheets:function(t){var e=r(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.$parent=e.closest(f),t.url=t.selectoneUrl,this.SELECT_ONE_SELECTED_ICON=r('[name="select-one-selected-icon"]').html(),this.BottomSheets.open(t,this.handleSelectOne.bind(this))},initItem:function(){var t,e=this.$parent.find(c);e.length&&(t=e.data().primaryKey)&&this.$bottomsheets.find('tr[data-primary-key="'+t+'"]').addClass("is_selected").find("td:first").append(this.SELECT_ONE_SELECTED_ICON)},reloadData:function(){this.initItem()},renderSelectOne:function(t){return s.render(r('[name="select-one-selected-template"]').html(),t)},handleSelectOne:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(p),this.$bottomsheets=t,this.initItem()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t){var e,i=this.$parent,n=i.find("select"),o=i.find(c);t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.selectoneValue=t.primaryKey||t.ID,t.displayName=t.displayName.escapeSymbol(),n.length&&(e=this.renderSelectOne(t),o.length&&o.remove(),i.prepend(e),i.find(h).hide(),n.html(s.render(m.SELECT_ONE_OPTION_TEMPLATE,t)),n[0].value=t.primaryKey||t.ID,i.trigger("qor.selectone.selected",[t]),this.$bottomsheets.qorSelectCore("destroy").remove(),r(".qor-bottomsheets").is(":visible")||r("body").removeClass("qor-bottomsheets-open"))},destroy:function(){this.unbind(),this.$element.removeData(o)}},m.SELECT_ONE_OPTION_TEMPLATE='',m.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new m(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.selectone"]';r(document).on("disable.qor.selectone",function(t){m.plugin.call(r(e,t.target),"destroy")}).on(n,function(t){m.plugin.call(r(e,t.target))}).triggerHandler(n)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var t=l(document),r="qor.selector",i="enable."+r,e="click."+r,d="selected",c="disabled",s="clearable",a="."+d,u=".qor-selector-toggle",h=".qor-selector-label",f=".qor-selector-menu",p=".qor-bottomsheets";function m(t,e){this.options=e,this.$element=l(t),this.init()}return m.prototype={constructor:m,init:function(){var t=this.$element;this.placeholder=t.attr("placeholder")||t.attr("name")||"Select",this.build()},build:function(){var t=this.$element,e=l(m.TEMPLATE),i=this.options.aligned+"-aligned",s={},n=t.data(),o=n.hover,a=t.attr("name");this.isBottom="bottom"==n.position,o&&e.addClass("hover"),e.addClass(i).find(f).html(function(){var r=[];return t.children().each(function(){var t=l(this),e=t.attr("selected"),i=t.attr("disabled"),n=t.attr("value"),o=t.text(),t=[];e&&(t.push(d),s.value=n,s.label=o,s.paramName=a),i&&t.push(c),r.push("'+o+"")}),r.join("")}),this.$selector=e,t.hide().after(e),e.find(u).data("paramName",a),this.pick(s,!0),this.bind()},unbuild:function(){this.unbind(),this.$selector.remove(),this.$element.show()},bind:function(){this.$selector.on(e,l.proxy(this.click,this)),t.on(e,l.proxy(this.close,this))},unbind:function(){this.$selector.off(e,this.click)},click:function(t){var e=l(t.target);t.stopPropagation(),e.is(".qor-selector-clear")?this.clear():e.is("li")?(e.hasClass(d)||e.hasClass(c)||this.pick(e.data()),this.close()):e.closest(u).length&&this.open()},pick:function(t,e){var i=this.$selector,n=!!t.value,o=this.$element;i.find(u).toggleClass("active",n).toggleClass(s,n&&this.options.clearable).find(h).text(t.label||this.placeholder),e||(i.find(f).children('[data-value="'+t.value+'"]').addClass(d).siblings(a).removeClass(d),o.val(t.value),o.closest(p).length&&!o.closest('[data-toggle="qor.filter"]').length?l(p).trigger("selectorChanged.qor.selector",[t.value,t.paramName]):o.trigger("change"))},clear:function(){var t=this.$element;this.$selector.find(u).removeClass("active").removeClass(s).find(h).text(this.placeholder).end().end().find(f).children(a).removeClass(d),t.val("").trigger("change")},open:function(){t.triggerHandler(e),l(".qor-filter__dropdown").hide(),this.$selector.addClass("open"),this.isBottom&&this.$selector.addClass("bottom")},close:function(){this.$selector.removeClass("open"),this.isBottom&&this.$selector.removeClass("bottom")},destroy:function(){this.unbuild(),this.$element.removeData(r)}},m.DEFAULTS={aligned:"left",clearable:!1},m.TEMPLATE='',m.plugin=function(o){return this.each(function(){var t,e,i=l(this),n=i.data(r);if(!n){if(/destroy/.test(o))return;t=l.extend({},m.DEFAULTS,i.data(),"object"===_typeof(o)&&o),i.data(r,n=new m(this,t))}"string"==typeof o&&l.isFunction(e=n[o])&&e.apply(n)})},l(function(){var e='[data-toggle="qor.selector"]';l(document).on("disable.qor.selector",function(t){m.plugin.call(l(e,t.target),"destroy")}).on(i,function(t){m.plugin.call(l(e,t.target))}).triggerHandler(i)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(p){var t=p(document),l=window.FormData,m=window.QOR_Translations,o=window._,d=window.QOR,r="qor.slideout",e="keyup."+r,i="click."+r,n="submit."+r,y="shown."+r,g="hidden."+r,s="transitionend",a="qor-slideout-open",c="qor-slideout-mini",u="is-shown",h="is-slided",b=".qor-body__loading";function f(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(p(this).attr(n))}),o.uniq(i)}function v(t,e,i){for(var n=0,o=0,r=t.length;o\s]+))?)+\s*|\s*)>/g))for(var r=0;r[\s\S]*<\s*\/body\s*>/gi);r&&(r=r.join("").replace(/<\s*body/gi," thead > tr > th",o.proxy(this.sort,this))},unbind:function(){this.$element.off(e,this.sort)},sort:function(t){var e=o(t.currentTarget).data("orderBy"),t=n.search,i="order_by="+e;e&&(/order_by/.test(t)?t=t.replace(/order_by(=\w+)?/,function(){return i}):t+=-1this.slideoutWidth&&this.$element.find(d).append(f.ARROW_RIGHT)},scrollTabLeft:function(t){t.stopPropagation();var e=o(d),i=e.scrollLeft(),t=i-this.slideoutWidth;0=i&&o(c).hide()}),o(u).length||this.$element.find(d).prepend(f.ARROW_LEFT))},switchTab:function(t){var e=o(t.target),i=this.$element,t=e.data(),n=r.data().tabScopeActive;if(o(".qor-slideout").is(":visible"))return e.hasClass(h)||(i.find(a).removeClass(h),e.addClass(h),o.ajax(t.tabUrl,{method:"GET",dataType:"html",processData:!1,contentType:!1,beforeSend:function(){o(".qor-layout__tab-spinner").remove();o(l).hide().before('
                            '),window.componentHandler.upgradeElement(o(".qor-layout__tab-spinner")[0])},success:function(t){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",e.data("name"));t=o(t).find(l).html();o(l).show().html(t).trigger("enable")},error:function(){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",n)}})),!1},destroy:function(){this.unbind(),r.removeData("tabScopeActive")}},f.ARROW_RIGHT='',f.ARROW_LEFT='',f.DEFAULTS={},f.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(s);if(!i){if(/destroy/.test(n))return;e.data(s,i=new f(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e='[data-toggle="qor.tab"]';o(document).on("disable.qor.tabbar",function(t){f.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){f.plugin.call(o(e,t.target))}).triggerHandler(t)}),f}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var s="qor.timepicker",t="enable."+s,e="click."+s,i="focus."+s,n="keydown."+s,o="blur."+s,a="selectTime."+s,l="[data-picker-type]";function d(t,e){this.$element=r(t),this.options=r.extend(!0,{},d.DEFAULTS,r.isPlainObject(e)&&e),this.formatDate=null,this.pickerData=this.$element.data(),this.parent=this.$element.closest(l),this.isDateTimePicker="datetime"==this.parent.data("picker-type"),this.$targetInput=this.parent.find(this.pickerData.targetInput||(this.isDateTimePicker?".qor-datetimepicker__input":".qor-datepicker__input")),this.init()}return d.prototype={init:function(){var t,e,i;this.$targetInput.is(":disabled")?this.$element.remove():(this.bind(),this.oldValue=this.$targetInput.val(),e=(e=(t=new Date).getMonth()+1)<8?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i,this.dateValueNow=t.getFullYear()+"-"+e+"-"+i)},bind:function(){this.isDateTimePicker&&this.$targetInput.qorTimepicker({timeFormat:"H:i",showOn:null,wrapHours:!1,scrollDefault:"now"}).on(a,r.proxy(this.changeTime,this)).on(o,r.proxy(this.blur,this)).on(i,r.proxy(this.focus,this)).on(n,r.proxy(this.keydown,this)),this.$element.on(e,r.proxy(this.show,this))},unbind:function(){this.$element.off(e,this.show),this.isDateTimePicker&&this.$targetInput.off(a,this.changeTime).off(o,this.blur).off(i,this.focus).off(n,this.keydown)},focus:function(){},blur:function(){var t,e,i,n,o,r,s=this.$targetInput.val(),a=s.split(" "),l=a.length,d=/\d{1,2}:\d{1,2}/,c=/^\d{4}-\d{1,2}-\d{1,2}/;if(s){if(1==l)c.test(a[0])&&(e=a[0],i="00:00"),d.test(a[0])&&(e=this.dateValueNow,i=a[0]);else for(var u=0;u
                            '},String.prototype.escapeSymbol=function(){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return this.replace(/[&<>"']/g,function(t){return e[t]||t})},window.Mustache&&(window.Mustache.tags=["[[","]]"]),$(document).ajaxComplete(function(t,e,i){"POST"!=i.type&&"PUT"!=i.type||$.fn.qorSlideoutBeforeHide&&($.fn.qorSlideoutBeforeHide=null,window.onbeforeunload=null)}),$.fn.select2.ajaxCommonOptions=function(t){var i=t.remoteDataPrimaryKey;return{dataType:"json",headers:getSelect2Header(t),cache:!0,delay:250,data:function(t){return{keyword:t.term,page:t.page,per_page:20}},processResults:function(t,e){e.page=e.page||1;t=$.map(t,function(t){return t.id=t[i]||t.primaryKey||t.Id||t.ID,t});return{results:t,pagination:{more:20<=t.length}}}}},$.fn.select2.ajaxFormatResult=function(t,e,i){var n="";if(t.loading)return t.text;if(console.log("select2.ajaxFormatResult: Data"),console.log(t),console.log("select2.ajaxFormatResult: has remote image"),console.log(i),i){var o=t.text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],i=t.Image,n=i?'
                            '+o+"
                            ":'
                            '+o+"
                            ";return $(n)}return n=0|<\/.+>)/.test(n)?$(n):n},$(function(){var r=window._,o=window.QOR,s=window.QOR_Translations,t='"),a=$(t).appendTo("body");$(document).on("keyup.qor.confirm",function(t){a.is(":visible")&&(27===t.which&&setTimeout(function(){a.hide(),o.qorConfirmCallback=void 0},100),13===t.which&&setTimeout(function(){$('.dialog-button[data-type="confirm"]').click()},100))}).on("click.qor.confirm",".dialog-button",function(){var t=$(this).data("type"),e=o.qorConfirmCallback;return $.isFunction(e)&&e(t),a.hide(),o.qorConfirmCallback=void 0,!1}),o.qorConfirm=function(t,e){var i=a.find(".dialog-ok"),n=a.find(".dialog-cancel");return r.isString(t)?(a.find(".dialog-message").text(t),i.text(s.okButton),n.text(s.cancelButton)):r.isObject(t)&&(t.confirmOk&&t.confirmCancel?(i.text(t.confirmOk),n.text(t.confirmCancel)):(i.text(s.okButton),n.text(s.cancelButton)),t.icon&&a.find("i.material-icons").addClass(t.icon).html(t.icon),a.find(".dialog-message").text(t.confirm)),a.show(),o.qorConfirmCallback=e,!1};function l(t,e){var i,n,o=e||new FormData;for(n in t)t.hasOwnProperty(n)&&t[n]&&(i=n),t[n]instanceof Date?o.append(i,t[n].toISOString()):"object"!==_typeof(t[n])||t[n]instanceof File?o.append(i,t[n]):l(t[n],o);return o}o.qorAjaxHandleFile=function(t,i,n,e){var o=new XMLHttpRequest;o.responseType="arraybuffer",o.open("POST",t,!0),o.onload=function(){var t,e;200===this.status?(e=new Blob([this.response],{type:i}),t=window.URL.createObjectURL(e),e=document.createElement("a"),document.body.appendChild(e),e.href=t,e.download=n||"download-"+$.now(),e.click()):window.alert(s.serverError)},r.isObject(e)&&("[object FormData]"!=Object.prototype.toString.call(e)&&(e=l(e)),o.send(e))};t=function(){var t=$(".qor-linkify-object"),e=/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi;t.length&&t.each(function(){var t=$(this).data("video-link");t.match(e)&&$(this).html(''))})};($.fn.qorSliderAfterShow.converVideoLinks=t)(),o.handleAjaxError=function(t){var e=$("body"),i=t.responseJSON,n=t.responseText,o=$('
                            ');if(e.find(".qor-alert").remove(),422===t.status)if(i){var r=i.errors,s="";if($.isArray(r))for(var a=0;a\n error\n '.concat(r[a],"\n ");else s='
                          • \n error\n '.concat(r,"\n
                          • ");o.append(s)}else o=$(n).find(".qor-error");else o.append('
                          • \n error\n '.concat(t.statusText,"\n
                          • "));o.prependTo(e),setTimeout(function(){o.addClass("qor-alert__active")},50),setTimeout(function(){$('.qor-alert[data-dismissible="true"]').removeClass("qor-alert__active"),$("#qor-submit-loading").remove()},6e3)}}),function(t){"function"==typeof define&&define.amd?define("datepicker",["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(C){var t=C(window),o=window.document,h=C(o),r=window.Number,a="datepicker",i="click."+a,n="keyup."+a,s="focus."+a,e="resize."+a,l="show."+a,d="hide."+a,c="pick."+a,u=/(y|m|d)+/g,f=/\d+/g,p=/^\d{2,4}$/,m=a+"-top-left",y=a+"-bottom-left",g=[m,a+"-top-right",y,a+"-bottom-right"].join(" "),b=a+"-hide",v=Math.min,_=Object.prototype.toString;function q(t){return"string"==typeof t}function w(t){return"number"==typeof t&&!isNaN(t)}function S(t){return void 0===t}function $(t){return"date"===(t=t,_.call(t).slice(8,-1).toLowerCase())}function k(t,e){var i=[];return Array.from?Array.from(t).slice(e||0):(w(e)&&i.push(e),i.slice.apply(t,i))}function x(t,e){var i=k(arguments,2);return function(){return t.apply(e,i.concat(k(arguments)))}}function T(t,e){return[31,(t=t)%4==0&&t%100!=0||t%400==0?29:28,31,30,31,30,31,31,30,31,30,31][e]}function D(t,e){(e=C.isPlainObject(e)?e:{}).language&&(e=C.extend({},D.LANGUAGES[e.language],e)),this.$element=C(t),this.options=C.extend({},D.DEFAULTS,e),this.isBuilt=!1,this.isShown=!1,this.isInput=!1,this.isInline=!1,this.initialValue="",this.initialDate=null,this.startDate=null,this.endDate=null,this.init()}D.prototype={constructor:D,init:function(){var t=this.options,e=this.$element,i=t.startDate,n=t.endDate,o=t.date;this.$trigger=C(t.trigger||e),this.isInput=e.is("input")||e.is("textarea"),this.isInline=t.inline&&(t.container||!this.isInput),this.format=function(t){var e,i,n=String(t).toLowerCase(),o=n.match(u);if(!o||0===o.length)throw new Error("Invalid date format.");for(t={source:n,parts:o},e=o.length,i=0;in.getTime()&&(o=new Date(n)),this.endDate=n),this.date=o,this.viewDate=new Date(o),this.initialDate=new Date(this.date),this.bind(),(t.autoshow||this.isInline)&&this.show(),t.autopick&&this.pick()},build:function(){var t,e=this.options,i=this.$element;this.isBuilt||(this.isBuilt=!0,this.$picker=t=C(e.template),this.$week=t.find('[data-view="week"]'),this.$yearsPicker=t.find('[data-view="years picker"]'),this.$yearsPrev=t.find('[data-view="years prev"]'),this.$yearsNext=t.find('[data-view="years next"]'),this.$yearsCurrent=t.find('[data-view="years current"]'),this.$years=t.find('[data-view="years"]'),this.$monthsPicker=t.find('[data-view="months picker"]'),this.$yearPrev=t.find('[data-view="year prev"]'),this.$yearNext=t.find('[data-view="year next"]'),this.$yearCurrent=t.find('[data-view="year current"]'),this.$months=t.find('[data-view="months"]'),this.$daysPicker=t.find('[data-view="days picker"]'),this.$monthPrev=t.find('[data-view="month prev"]'),this.$monthNext=t.find('[data-view="month next"]'),this.$monthCurrent=t.find('[data-view="month current"]'),this.$days=t.find('[data-view="days"]'),this.isInline?C(e.container||i).append(t.addClass("datepicker-inline")):(C(o.body).append(t.addClass("datepicker-dropdown")),t.addClass(b)),this.fillWeek())},unbuild:function(){this.isBuilt&&(this.isBuilt=!1,this.$picker.remove())},bind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.on(l,t.show),C.isFunction(t.hide)&&e.on(d,t.hide),C.isFunction(t.pick)&&e.on(c,t.pick),this.isInput&&(e.on(n,C.proxy(this.keyup,this)),t.trigger||e.on(s,C.proxy(this.show,this))),this.$trigger.on(i,C.proxy(this.show,this))},unbind:function(){var t=this.options,e=this.$element;C.isFunction(t.show)&&e.off(l,t.show),C.isFunction(t.hide)&&e.off(d,t.hide),C.isFunction(t.pick)&&e.off(c,t.pick),this.isInput&&(e.off(n,this.keyup),t.trigger||e.off(s,this.show)),this.$trigger.off(i,this.show)},showView:function(t){var e=this.$yearsPicker,i=this.$monthsPicker,n=this.$daysPicker,o=this.format;if(o.hasYear||o.hasMonth||o.hasDay)switch(r(t)){case 2:case"years":i.addClass(b),n.addClass(b),o.hasYear?(this.fillYears(),e.removeClass(b)):this.showView(0);break;case 1:case"months":e.addClass(b),n.addClass(b),o.hasMonth?(this.fillMonths(),i.removeClass(b)):this.showView(2);break;default:e.addClass(b),i.addClass(b),o.hasDay?(this.fillDays(),n.removeClass(b)):this.showView(1)}},hideView:function(){this.options.autohide&&this.hide()},place:function(){var t=this.options,e=this.$element,i=this.$picker,n=h.outerWidth(),o=h.outerHeight(),r=e.outerWidth(),s=e.outerHeight(),a=i.width(),l=i.height(),d=e.offset(),c=d.left,u=d.top,e=parseFloat(t.offset)||10,d=m;l"+n.text+""},fillAll:function(){this.fillYears(),this.fillMonths(),this.fillDays()},fillWeek:function(){for(var t=this.options,e=parseInt(t.weekStart,10)%7,i=t.daysMin,n="",i=C.merge(i.slice(e),i.slice(0,e)),o=0;o<=6;o++)n+=this.createItem({text:i[o]});this.$week.html(n)},fillYears:function(){for(var t,e,i=this.options,n=i.disabledClass||"",o=i.yearSuffix||"",r=C.isFunction(i.filter)&&i.filter,s=this.startDate,a=this.endDate,i=this.viewDate,l=i.getFullYear(),d=i.getMonth(),c=i.getDate(),u=this.date,h=u.getFullYear(),f=!1,p=!1,m=!1,y="",g=-5;g<=6;g++)u=new Date(l+g,d,c),e=-5===g||6===g,t=l+g===h,m=!1,s&&(m=u.getFullYear()a.getFullYear(),6===g&&(p=m)),!m&&r&&(m=!1===r.call(this.$element,u)),y+=this.createItem({text:l+g,view:m?"year disabled":t?"year picked":"year",muted:e,picked:t,disabled:m});this.$yearsPrev.toggleClass(n,f),this.$yearsNext.toggleClass(n,p),this.$yearsCurrent.toggleClass(n,!0).html(l+-5+o+" - "+(l+6)+o),this.$years.html(y)},fillMonths:function(){for(var t,e=this.options,i=e.disabledClass||"",n=e.monthsShort,o=C.isFunction(e.filter)&&e.filter,r=this.startDate,s=this.endDate,a=this.viewDate,l=a.getFullYear(),d=a.getDate(),c=this.date,u=c.getFullYear(),h=c.getMonth(),f=!1,p=!1,m=!1,y="",g=0;g<=11;g++)c=new Date(l,g,d),t=l===u&&g===h,m=!1,r&&(m=(f=c.getFullYear()===r.getFullYear())&&c.getMonth()s.getMonth()),!m&&o&&(m=!1===o.call(this.$element,c)),y+=this.createItem({index:g,text:n[g],view:m?"month disabled":t?"month picked":"month",picked:t,disabled:m});this.$yearPrev.toggleClass(i,f),this.$yearNext.toggleClass(i,p),this.$yearCurrent.toggleClass(i,f&&p).html(l+e.yearSuffix||""),this.$months.html(y)},fillDays:function(){var t,e,i,n,o=this.options,r=o.disabledClass||"",s=o.yearSuffix||"",a=o.monthsShort,l=parseInt(o.weekStart,10)%7,d=C.isFunction(o.filter)&&o.filter,c=this.startDate,u=this.endDate,h=this.viewDate,f=h.getFullYear(),p=h.getMonth(),m=f,y=p,g=f,b=p,v=this.date,_=v.getFullYear(),q=v.getMonth(),w=v.getDate(),S=!1,h=!1,$=!1,k=[],x=[],D=[];for(0===p?(--m,y=11):--y,e=T(m,y),(n=(v=new Date(f,p,1)).getDay()-l)<=0&&(n+=7),c&&(S=v.getTime()<=c.getTime()),i=e-(n-1);i<=e;i++)v=new Date(m,y,i),$=!1,c&&($=v.getTime()=u.getTime()),i=1;i<=n;i++)v=new Date(g,b,i),$=!1,u&&($=v.getTime()>u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),x.push(this.createItem({text:i,view:"day next",muted:!0,disabled:$}));for(i=1;i<=e;i++)v=new Date(f,p,i),t=f===_&&p===q&&i===w,$=!1,c&&($=v.getTime()u.getTime()),!$&&d&&($=!1===d.call(this.$element,v)),D.push(this.createItem({text:i,view:$?"day disabled":t?"day picked":"day",picked:t,disabled:$}));this.$monthPrev.toggleClass(r,S),this.$monthNext.toggleClass(r,h),this.$monthCurrent.toggleClass(r,S&&h).html(o.yearFirst?f+s+" "+a[p]:a[p]+" "+f+s),this.$days.html(k.join("")+D.join(" ")+x.join(""))},click:function(t){var e,i,n,o,r,s,a=C(t.target),l=this.viewDate;if(t.stopPropagation(),t.preventDefault(),!a.hasClass("disabled"))switch(e=l.getFullYear(),i=l.getMonth(),n=l.getDate(),s=a.data("view")){case"years prev":case"years next":e="years prev"===s?e-10:e+10,r=a.text(),(o=p.test(r))&&(e=parseInt(r,10),this.date=new Date(e,i,v(n,28))),this.viewDate=new Date(e,i,v(n,28)),this.fillYears(),o&&(this.showView(1),this.pick("year"));break;case"year prev":case"year next":e="year prev"===s?e-1:e+1,this.viewDate=new Date(e,i,v(n,28)),this.fillMonths();break;case"year current":this.format.hasYear&&this.showView(2);break;case"year picked":this.format.hasMonth?this.showView(1):this.hideView();break;case"year":e=parseInt(a.text(),10),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasMonth?this.showView(1):this.hideView(),this.pick("year");break;case"month prev":case"month next":i="month prev"===s?i-1:"month next"===s?i+1:i,this.viewDate=new Date(e,i,v(n,28)),this.fillDays();break;case"month current":this.format.hasMonth&&this.showView(1);break;case"month picked":this.format.hasDay?this.showView(0):this.hideView();break;case"month":i=C.inArray(a.text(),this.options.monthsShort),this.date=new Date(e,i,v(n,28)),this.viewDate=new Date(e,i,v(n,28)),this.format.hasDay?this.showView(0):this.hideView(),this.pick("month");break;case"day prev":case"day next":case"day":i="day prev"===s?i-1:"day next"===s?i+1:i,n=parseInt(a.text(),10),this.date=new Date(e,i,n),this.viewDate=new Date(e,i,n),this.fillDays(),"day"===s&&this.hideView(),this.pick("day");break;case"day picked":this.hideView(),this.pick("day")}},clickDoc:function(t){for(var e,i=t.target,n=this.$trigger[0];i!==o;){if(i===n){e=!0;break}i=i.parentNode}e||this.hide()},keyup:function(){this.update()},getValue:function(){var t=this.$element,e="";return this.isInput?e=t.val():this.isInline&&!this.options.container||(e=t.text()),e},setValue:function(t){var e=this.$element;t=q(t)?t:"",this.isInput?e.val(t):this.isInline&&!this.options.container||e.text(t)},show:function(){this.isBuilt||this.build(),this.isShown||this.trigger(l).isDefaultPrevented()||(this.isShown=!0,this.$picker.removeClass(b).on(i,C.proxy(this.click,this)),this.showView(this.options.startView),this.isInline||(t.on(e,this._place=x(this.place,this)),h.on(i,this._clickDoc=x(this.clickDoc,this)),this.place()))},hide:function(){this.isShown&&(this.trigger(d).isDefaultPrevented()||(this.isShown=!1,this.$picker.addClass(b).off(i,this.click),this.isInline||(t.off(e,this._place),h.off(i,this._clickDoc))))},update:function(){this.setDate(this.getValue(),!0)},pick:function(t){var e=this.$element,i=this.date;this.trigger(c,{view:t||"",date:i}).isDefaultPrevented()||(this.setValue(this.formatDate(this.date)),this.isInput&&e.trigger("change"))},reset:function(){this.setDate(this.initialDate,!0),this.setValue(this.initialValue),this.isShown&&this.showView(this.options.startView)},getMonthName:function(t,e){var i=this.options,n=i.months;return C.isNumeric(t)?t=r(t):S(e)&&(e=t),!0===e&&(n=i.monthsShort),n[w(t)?t:this.date.getMonth()]},getDayName:function(t,e,i){var n=this.options,o=n.days;return C.isNumeric(t)?t=r(t):(S(i)&&(i=e),S(e)&&(e=t)),(o=!0===i?n.daysMin:!0===e?n.daysShort:o)[w(t)?t:this.date.getDay()]},getDate:function(t){var e=this.date;return t?this.formatDate(e):new Date(e)},setDate:function(t,e){var i=this.options.filter;($(t)||q(t))&&(t=this.parseDate(t),C.isFunction(i)&&!1===i.call(this.$element,t)||(this.date=t,this.viewDate=new Date(t),e||this.pick(),this.isBuilt&&this.fillAll()))},setStartDate:function(t){($(t)||q(t))&&(this.startDate=this.parseDate(t),this.isBuilt&&this.fillAll())},setEndDate:function(t){($(t)||q(t))&&(this.endDate=this.parseDate(t),this.isBuilt&&this.fillAll())},parseDate:function(t){var e,i,n,o,r,s,a=this.format,l=[];if($(t))return new Date(t.getFullYear(),t.getMonth(),t.getDate());if(q(t)&&(l=t.match(f)||[]),i=(t=new Date).getFullYear(),n=t.getDate(),o=t.getMonth(),e=a.parts.length,l.length===e)for(s=0;s
                                    ',offset:10,zIndex:1e3,filter:null,show:null,hide:null,pick:null},D.setDefaults=function(t){C.extend(D.DEFAULTS,C.isPlainObject(t)&&t)},D.other=C.fn.qorDatepicker,C.fn.qorDatepicker=function(o){var r,s=k(arguments,1);return this.each(function(){var t,e,i=C(this),n=i.data(a);if(!n){if(/destroy/.test(o))return;t=C.extend({},i.data(),C.isPlainObject(o)&&o),i.data(a,n=new D(this,t))}q(o)&&C.isFunction(e=n[o])&&(r=e.apply(n,s))}),S(r)?this:r},C.fn.qorDatepicker.Constructor=D,C.fn.qorDatepicker.languages=D.LANGUAGES,C.fn.qorDatepicker.setDefaults=D.setDefaults,C.fn.qorDatepicker.noConflict=function(){return C.fn.qorDatepicker=D.other,this}}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(h){var i=window.Mustache,f=window.QOR,o="qor.action",t="enable."+o,n="click."+o,r='[data-ajax-form="true"][data-method]',e=".qor-action-bulk-buttons",s=".qor-page .qor-table-container",a=".qor-table--bulking",l=".qor-table--bulking tbody tr",p="is_undo",d="mdl-data-table--selectable",c="primary_values[]",m=".qor-body__loading";function u(t,e){this.$element=h(t),this.options=h.extend({},u.DEFAULTS,h.isPlainObject(e)&&e),this.ajaxForm={},this.init()}return u.prototype={constructor:u,init:function(){this.bind(),this.initActions()},bind:function(){this.$element.on(n,".qor-action--bulk",this.renderBulkTable.bind(this)).on(n,".qor-action--exit-bulk",this.removeBulkTable.bind(this)),h(document).on(n,l,this.handleBulkTableClick.bind(this)).on(n,r,this.clickAjaxButton.bind(this))},unbind:function(){this.$element.off(n),h(document).off(n,l,this.handleBulkTableClick).off(n,r,this.clickAjaxButton)},initActions:function(){h(s).find("table").length||(h(e).hide(),h(".qor-page__header a.qor-action--button").hide())},collectFormData:function(){var e,t=h(a).find(".mdl-checkbox__input:checked"),i=[],n=[];return t.length&&t.each(function(){var t=h(this).closest("tr").data("primary-key");e={},t&&(i.push({name:c,value:t.toString()}),e[c]=t.toString(),n.push(e))}),this.ajaxForm.formData=i,this.ajaxForm.normalFormData=n,this.ajaxForm},actionSubmit:function(t){return this.submit(t),!1},handleBulkTableClick:function(t){var e=h(t.target).closest("tr"),i=e.find("td").first(),t=i.find(".mdl-js-checkbox");return t.toggleClass("is-checked"),e.toggleClass("is-selected"),i.find("input").prop("checked",t.hasClass("is-checked")),!1},adjustPageBodyStyle:function(t){var e=h(".qor-page > .qor-page__header"),i=h(".qor-page > .qor-page__body"),n=e.find(".qor-page-subnav__header").length?96:48;t?e.height()>n&&i.css("padding-top",e.height()):parseInt(i.css("padding-top"))>n&&i.css("padding-top","")},renderBulkTable:function(){var t=h("body");t.hasClass("qor-slideout-open")&&t.data("qor.slideout").hide(),h(".qor-table__inner-list").remove(),this.toggleBulkButtons(),this.enableTableMDL(),this.adjustPageBodyStyle(!0)},removeBulkTable:function(){this.toggleBulkButtons(),this.disableTableMDL(),this.adjustPageBodyStyle()},enableTableMDL:function(){h(s).find("table").removeAttr("data-upgraded").addClass(d).trigger("enable")},disableTableMDL:function(){h(s).find("table").removeClass(d).find("tr").removeClass("is-selected").find("td:first,th:first").remove()},toggleBulkButtons:function(){this.$element.find(".qor-action-forms").toggle(),h(e).find("button").toggleClass("hidden"),h(s).toggleClass("qor-table--bulking").find(".qor-table__actions").toggle(),h(".qor-page__header .qor-actions, .qor-page__header .qor-search-container").toggle()},clickAjaxButton:function(t){t=h(t.target);return this.collectFormData(),this.ajaxForm.properties=t.data(),this.submit(t),!1},renderFlashMessage:function(t){var e=u.FLASHMESSAGETMPL;return i.parse(e),i.render(e,t)},addLoading:function(){h(m).remove(),h(u.TEMPLATE_LOADING).appendTo(h("body")).trigger("enable.qor.material")},submit:function(e){var i=this,n=this.ajaxForm||{},t=n.properties||e.data();if(e.hasClass("qor-action-disabled"))return!1;!t.fromIndex||n.formData&&n.formData.length?t.confirm?f.qorConfirm(t,function(t){t&&i.handleAjaxSubmit(n,e)}):this.handleAjaxSubmit(n,e):f.qorConfirm(n.properties.errorNoItem)},handleAjaxSubmit:function(o,r){var s=this,a=this.$element,l=r.closest(".qor-action-forms"),d=o.properties||r.data(),c=d.url,u=d.undoUrl,e=r.hasClass(p),t=r.closest(".qor-slideout").length,i=a.length&&!t;e&&(c=u),this.addLoading(),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).addClass("qor-action-disabled"),h.ajax(c,{method:d.method,data:o.formData,dataType:d.datatype||"json",beforeSend:function(){u?r.prop("disabled",!0):i&&s.switchButtons(a,1)},success:function(t){if(u)return a.trigger("undo.qor.action",[r,e,t]),e?r.removeClass(p):r.addClass(p),void r.prop("disabled",!1);window.location.reload()},error:function(t){200!=t.status&&(u?r.prop("disabled",!1):i&&s.switchButtons(a),f.handleAjaxError(t))},complete:function(t){var e,i=t.getResponseHeader("content-type"),n=t.getResponseHeader("Content-Disposition");h(m).remove(),r.prop("disabled",!1),(l.length?l.find('[data-ajax-form="true"][data-method]'):r).removeClass("qor-action-disabled"),n&&-1!==n.indexOf("attachment")&&(e={},t="",null!=(n=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(n))&&n[1]&&(t=n[1].replace(/['"]/g,"")),d.method&&(e=h.extend({},o.normalFormData,{_method:d.method})),f.qorAjaxHandleFile(c,i,t,e),u?r.prop("disabled",!1):s.switchButtons(a))}})},switchButtons:function(t,e){e=!!e;t.find(".qor-action-button").prop("disabled",e)},destroy:function(){this.unbind(),this.$element.removeData(o)}},u.DEFAULTS={},u.TEMPLATE_LOADING='
                                    \n
                                    \n
                                    \n
                                    ',h.fn.qorSliderAfterShow.qorInsertActionData=function(t,e){var i=h(e).find('[data-toggle="qor-action-slideout"]'),n=i.find("form"),e=h(a).find(".mdl-checkbox__input:checked");i.length&&e.length&&e.each(function(){var t=h(this).closest("tr").data("primary-key");t&&n.prepend('')})},u.plugin=function(n){return this.each(function(){var t,e=h(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&h.isFunction(t=i[n])&&t.call(i)})},h(function(){var e={},i='[data-toggle="qor.action.bulk"]';h(i).length||h(document).on(n,r,function(t){return(new u).actionSubmit(h(t.target)),!1}),h(document).on("disable.qor.action",function(t){u.plugin.call(h(i,t.target),"destroy")}).on(t,function(t){u.plugin.call(h(i,t.target),e)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(a){var l=window.location,r=window.QOR,o="qor.advancedsearch",t="enable."+o,e="click."+o;function s(t,e){this.$element=a(t),this.options=a.extend({},s.DEFAULTS,a.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){this.$form=this.$element.find("form"),this.$modal=a(s.MODAL).appendTo("body"),this.bind()},bind:function(){this.$element.on("submit.qor.advancedsearch","form",this.submit.bind(this)).on(e,".qor-advanced-filter__save",this.showSaveFilter.bind(this)).on(e,".qor-advanced-filter__toggle",this.toggleFilterContent).on(e,".qor-advanced-filter__close",this.closeFilter).on(e,".qor-advanced-filter__delete",this.deleteSavedFilter),this.$modal.on("shown.qor.modal",this.start.bind(this))},closeFilter:function(){a(".qor-advanced-filter__dropdown").hide()},toggleFilterContent:function(t){a(t.target).closest(".qor-advanced-filter__toggle").parent().find(">[advanced-search-toggle]").toggle()},showSaveFilter:function(){this.$modal.qorModal("show")},deleteSavedFilter:function(t){var e=a(t.target).closest(".qor-advanced-filter__delete"),i=e.closest(".qor-advanced-filter__savedfilter"),n=e.data("filter-name"),o=l.pathname;return r.qorConfirm({confirm:"Are you sure you want to delete this saved filter?"},function(t){t&&a.get(o,a.param({delete_saved_filter:n})).done(function(){e.closest("li").remove(),0===i.find("li").length&&i.remove()}).fail(function(){r.qorConfirm("Server error, please try again!")})}),!1},start:function(){this.$modal.trigger("enable.qor.material").on(e,".qor-advanced-filter__savefilter",this.saveFilter.bind(this))},saveFilter:function(){var t=this.$modal.find("#qor-advanced-filter__savename").val();t&&this.$form.prepend('')).submit()},submit:function(){var t,e=this.$form,i=e.find("input[name],select[name]"),n=[],o=e.closest(".qor-bottomsheets"),r=e.serialize();if(i.each(function(){n.push(a(this).attr("name"))}),t=function(t){var e,i,n=decodeURIComponent(l.search.replace(/page=\d+/,"page=1").substr(1)).split("&"),o={};if(1==n.length&&""==n[0])return!1;for(i in n)""!==n[i]&&(e=n[i].split("="),o[e[0]]=e[1]);return t.forEach(function(t){delete o[t]}),o}(n),!a.isEmptyObject(t))for(var s in t)t.hasOwnProperty(s)&&e.prepend('\n
                                    \n
                                    \n

                                    Save advanced filter

                                    \n
                                    \n
                                    \n \n
                                    \n \n \n
                                    \n\n
                                    \n \n
                                    \n \n
                                    \n
                                    \n ',s.plugin=function(n){return this.each(function(){var t,e=a(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new s(this,n))}"string"==typeof n&&a.isFunction(t=i[n])&&t.apply(i)})},a(function(){var e='[data-toggle="qor.advancedsearch"]';a(document).on("disable.qor.advancedsearch",function(t){s.plugin.call(a(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(a(e,t.target),void 0)}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var r="qor.autoheight",t="enable."+r;function s(t,e){this.$element=o(t),this.options=o.extend({},s.DEFAULTS,o.isPlainObject(e)&&e),this.init()}return s.prototype={constructor:s,init:function(){var t=this.$element;this.paddingTop=parseInt(t.css("padding-top"),10),this.paddingBottom=parseInt(t.css("padding-bottom"),10),this.resize(),this.bind()},bind:function(){this.$element.on("input",o.proxy(this.resize,this))},unbind:function(){this.$element.off("input",this.resize)},resize:function(){var t=this.$element,e=t.prop("scrollHeight");e?t.height("auto").height(e-this.paddingTop-this.paddingBottom):t.height("40px")},destroy:function(){this.unbind(),this.$element.removeData(r)}},s.DEFAULTS={},s.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new s(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e="textarea.qor-js-autoheight";o(document).on("disable.qor.autoheight",function(t){s.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){s.plugin.call(o(e,t.target))}).triggerHandler(t)}),s}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(b){var o=window._,n=window.FormData,i=window.QOR_Translations,r="qor.bottomsheets",t="click."+r,e="submit."+r,v="qor-bottomsheets-open",_=".mdl-layout__content.qor-page",s=".qor-page__body",q=".qor-page__header",a=".qor-bottomsheets__search-input";function l(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(b(this).attr(n))}),o.uniq(i)}function d(t,e,i){for(var n=0,o=0,r=t.length;o')},filterChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},selectorChanged:function(t,e,i){i=this.constructloadURL(e,i);return i&&this.reload(i),!1},keyup:function(t){var e=this.$bottomsheets.find(a);13===t.which&&e.length&&e.is(":focus")&&this.search()},search:function(){var t=this.$bottomsheets,e=t.data().url,i=b.trim(t.find(a).val()),t=e+"?keyword="+i;/\?/g.test(e)&&(t=e+"&keyword="+i),this.reload(t)},pagination:function(t){t=b(t.target).closest("a").prop("href");return t&&this.reload(t),!1},reload:function(t){var e=this.$bottomsheets.find(s);this.addLoading(e),this.fetchPage(t)},reloadFromUrl:function(t,e){this.reload(e)},fetchPage:function(i){var n=this.$bottomsheets,o=this;b.get(i,function(t){var e=b(t).find(_),t=e.find(q),e=e.find(s);e.length?(n.find(s).html(e.html()),t.length&&(o.$body.find(q).html(t.html()).trigger("enable"),o.addHeaderClass()),n.trigger("reload.qor.bottomsheets")):o.reload(i)}).fail(function(){window.alert("server error, please try again later!")})},constructloadURL:function(t,e){var i,n,o=this.filterURL,r=this.$bottomsheets.data().url;if(!o){if(!r)return;o=r}return i=new URL("http://www.getqor.com/"+t),n=e,r=i.search,n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),t=null===(r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(decodeURIComponent(r)))?"":r[1].replace(/\+/g," "),o=this.filterURL=(i=e,n=t,r=o,e=String(i).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),t=new RegExp("([?&])"+e+"=.*?(&|$)","i"),e=-1!==r.indexOf("?")?"&":"?",r.match(t)?n?r.replace(t,"$1"+i+"="+n+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?r.replace(t,"$1"):r.replace(t,""):n?r+e+i+"="+n:void 0)},addHeaderClass:function(){this.$body.find(q).hide(),this.$bottomsheets.find(q).children(".qor-bottomsheet__filter").length&&this.$body.addClass("has-header").find(q).show()},addLoading:function(t){t.html(""),b(w.TEMPLATE_LOADING).appendTo(t).trigger("enable.qor.material")},loadExtraResource:function(t){var e,i,n=(e=t.$links,i=b("link"),e=l(e),i=l(i),o.difference(e,i)),i=(e=t.$scripts,i=b("script"),e=l(e,!0),i=l(i,!0),o.difference(e,i));n.length&&function t(e){var i=document.createElement("link"),n=e.shift();i.type="text/css",i.rel="stylesheet",i.onload=function(){e.length&&t(e)},i.href=n,document.getElementsByTagName("head")[0].appendChild(i)}(n),i.length&&d(i,t)},loadMedialibraryJS:function(t){var e,t=t.filter("script"),i=/theme=media_library/g,n=this;t.each(function(){var t;e=b(this).prop("src"),i.test(e)&&((t=document.createElement("script")).src=e,document.body.appendChild(t),n.mediaScriptAdded=!0)})},submit:function(t){var r,e=t.target,s=b(e),a=this,l=s.prop("action"),d=s.closest(".qor-bottomsheets"),c=d.data(),i=c.ajaxType,u=s.find(":submit");c.ingoreSubmit||s.data().normalSubmit||(b(document).trigger("bottomsheetBeforeSend.qor.bottomsheets"),t.preventDefault(),r=new n(e),b.ajax(l,{method:s.prop("method"),data:r,dataType:i||"html",processData:!1,contentType:!1,beforeSend:function(){u.prop("disabled",!0)},success:function(t,e,i){if(c.ajaxMute)d.remove();else if(c.ajaxTakeover)c.$target.parent().trigger("ajaxSuccessed.qor.bottomsheets",[t,d]);else{t=i.getResponseHeader("Content-Disposition");if(t&&-1!==t.indexOf("attachment")){var t=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t),n=i.getResponseHeader("Content-Type"),o="";return null!=t&&t[1]&&(o=t[1].replace(/['"]/g,"")),window.QOR.qorAjaxHandleFile(l,n,o,r),void u.prop("disabled",!1)}b(".qor-error").remove();n=s.data("returnUrl"),o=s.data("refreshUrl");o?window.location.href=o:"refresh"!=n?(n&&"refresh"!=n?a.load(n):a.refresh(),b(document).trigger("bottomsheetSubmitComplete.qor.bottomsheets")):a.refresh()}},error:function(t){window.QOR.handleAjaxError(t)},complete:function(){u.prop("disabled",!1)}}))},load:function(s,a,l){var d,t,e,c=this.options,u=a.actionData,h=this.resourseData,f=h.selectModal,p=h.ingoreSubmit,m=this.$bottomsheets,y=this.$header,g=this.$body;s&&(this.show(),this.addLoading(g),this.filterURL=s,g.removeClass("has-header has-hint"),a=b.isPlainObject(a)?a:{},d=a.method||"GET",t=a.datatype||"html",e=b.proxy(function(){b.ajax(s,{method:d,dataType:t,success:b.proxy(function(t){var e,i,n,o,r;"GET"===d?(i={$scripts:(e=b(t)).filter("script"),$links:e.filter("link"),url:s,response:t},n=f&&e.find(".qor-search-container").length,o=t.match(/<\s*body.*>[\s\S]*<\s*\/body\s*>/gi),r=e.find(_),o&&(o=o.join("").replace(/<\s*body/gi,"').concat(a.selectBacktolistTitle,"")),f&&(g.find(".qor-button--new").data("ingoreSubmit",!0).data("selectId",h.selectId).data("loadInline",!0),"one"==f||a.selectNohint||void 0!==h.maxItem&&"1"==h.maxItem||g.addClass("has-hint"),"mediabox"!=f||this.mediaScriptAdded||this.loadMedialibraryJS(e)),y.find(".qor-button--new").remove(),this.$title.after(g.find(".qor-button--new")),n&&(m.addClass("has-search"),y.find(".qor-bottomsheets__search").remove(),y.prepend(w.TEMPLATE_SEARCH)),u&&u.length&&this.bindActionData(u),h.bottomsheetClassname&&m.addClass(h.bottomsheetClassname),m.trigger("enable"),m.one("hidden.qor.bottomsheets",function(){b(this).trigger("disable")}),this.addHeaderClass(),m.data(a),l&&b.isFunction(l)&&l(this.$bottomsheets),m.trigger("bottomsheetLoaded.qor.bottomsheets",[s,t]))):a.returnUrl?this.load(a.returnUrl):this.refresh()},this),error:b.proxy(function(){var t;this.$bottomsheets.remove(),b(".qor-bottomsheets").is(":visible")||b("body").removeClass(v),t=0=u&&c&&v.isFunction(c)&&c()}).attr("src",t).data("originalUrl",t),p.show()},start:function(){var o=this.options,r=this.$modal,t=this.$target,e=t.data(),s=e.sizeName||"original",i=e.sizeResolution,n=e&&e.originalUrl&&t.attr("data-original-url")?/\.original\./.test(e.originalUrl)?e.originalUrl:/\.original\./.test(t.attr("data-original-url"))?t.attr("data-original-url"):t.attr("data-original-url").replace(/file\./,"file.original."):t.attr("src"),a=v("")),l=this.data||{},d=this,t=NaN,n=e.sizeResolutionWidth,e=e.sizeResolutionHeight;i&&(n||e||(n=q(i,"width"),e=q(i,"height")),t=n/e),l[o.key]||(l[o.key]={}),r.trigger("enable.qor.material").find(u).html(a),(e=this.getList(t))&&r.find(h).show().append(e),a.cropper({aspectRatio:t,data:function(t){var e,i={};if(v.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(i[String(e).toLowerCase()]=t[e]);return i}(l[o.key][s]),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,autoCropArea:1,ready:function(){r.find(".qor-cropper__options-toggle").on(c,function(){r.find(".qor-cropper__options-input").prop("checked",v(this).prop("checked"))}).prop("checked",!0),r.find(".qor-cropper__save").one(c,function(){var t,e=a.cropper("getData",!0),i=a.cropper("getCroppedCanvas"),n=[];if(l.Crop=!0,l[o.key][s]=e,d.imageData=a.cropper("getImageData"),d.cropData=e,i)try{t=i.toDataURL()}catch(t){console.log(t),console.log("Please check image Cross-origin setting")}r.find(h+" input").each(function(){var t=v(this);t.prop("checked")&&n.push(t.attr("name"))}),d.output(t,n),r.qorModal("hide")})}})},stop:function(){this.$modal.trigger("disable.qor.material").find(u+" > img").cropper("destroy").remove().end().find(h).hide().find("ul").remove()},getList:function(o){var r=[];return this.$list.find("img").not(this.$target).each(function(){var t=v(this).data(),e=t.sizeResolution,i=t.sizeName,n=t.sizeResolutionWidth,t=t.sizeResolutionHeight;e&&(n||t||(n=q(e,"width"),t=q(e,"height")),n/t===o&&r.push('"))}),r.length?"
                                    • "+r.join("
                                    • ")+"
                                    ":""},output:function(t,e){var i=this.$target;t?this.center(i.attr("src",t),!0):this.preview(i),v.isArray(e)&&e.length&&this.autoCrop(t,e),this.$output.val(JSON.stringify(this.data)).trigger(o),this.$formCropInput.val(JSON.stringify(this.data))},preview:function(t,e,i){var n=t.parent().parent(),o=n.width(),r=n.height(),s=e||this.imageData,n=v.extend({},i||this.cropData),e=n.width/n.height,i=o;0!=i&&0!=s.naturalWidth&&0!=s.naturalHeight&&(r*e<=o&&(i=r*e),i=n.width/i,t.css({maxWidth:s.naturalWidth/i,maxHeight:s.naturalHeight/i}),this.center(t))},center:function(t,o){t.each(function(){var t=v(this),i=t.parent(),n=i.parent();function e(){var t=n.height(),e=i.height(),e=eclear'))},show:function(){this.$element.find(l).toggle()},close:function(t){var e=s(t.target),i=s(l),n=i.is(":visible"),o=e.closest(l).length,r=e.closest(".qor-filter-toggle").length,t=e.closest(".qor-modal").length,e=e.closest(".ui-timepicker-wrapper").length;n&&(o||r||t||e)||i.hide()},setFilterTime:function(t){var e,i,n=s(t.target),o=n.data(),t=o.filterRange;if(!t)return!1;if(s(this.options.label).removeClass(d),n.addClass(d),"events"==t)return this.$timeStart.val(o.scheduleStartAt||""),this.$timeEnd.val(o.scheduleEndAt||""),this.$searchButton.click(),!1;switch(t){case"today":e=i=new Date;break;case"week":e=this.startWeekDate,i=this.endWeekDate;break;case"month":e=this.startMonthDate,i=this.endMonthDate}if(!e||!i)return!1;o=this.getTime(e)+" 00:00",t=this.getTime(i)+" 23:59",this.$timeStart.val(o),this.$timeEnd.val(t),this.$searchButton.click()},getTime:function(t){var e=(e=t.getMonth()+1)<10?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i;return t.getFullYear()+"-"+e+"-"+i},clear:function(){var t=s(this.options.trigger),e=t.find(".qor-selector-label");return t.removeClass("active clearable"),e.html(e.data("label")),this.$timeStart.val(""),this.$timeEnd.val(""),this.$searchButton.click(),!1},getUrlParameter:function(t){var e=decodeURIComponent(a.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);return null===e?"":e[1].replace(/\+/g," ")},updateQueryStringParameter:function(t,e,i){var n=i||a.href,o=n.match(/#\S*$/)||"",r=String(t).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&"),i=new RegExp("([?&])"+r+"=.*?(&|$)","i"),r=-1!==n.indexOf("?")?"&":"?";return o&&(o=o[0],n=n.replace(o,"")),n.match(i)?n=e?n.replace(i,"$1"+t+"="+e+"$2"):"?"===RegExp.$1||RegExp.$1===RegExp.$2?n.replace(i,"$1"):n.replace(i,""):e&&(n=n+r+t+"="+e),n+o},search:function(){var t=this.$searchParam,i=a.href.replace(/page=\d+/,"page=1"),n=this;t.length&&(t.each(function(){var t=s(this),e=t.data().searchParam,t=t.val();i=n.updateQueryStringParameter(e,t,i)}),this.$element.closest(r).length?s(r).trigger("filterChanged.qor.filter",[i,"qor.filter.time"]):a.href=i)},destroy:function(){this.unbind(),this.$element.removeData(o)}},c.DEFAULTS={label:!1,trigger:!1,button:!1,clear:!1},c.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new c(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.filter.time"]',i={label:".qor-filter__block-buttons button",trigger:"a.qor-filter-toggle",button:".qor-filter__button-search",clear:".qor-selector-clear"};s(document).on("disable.qor.filter",function(t){c.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){c.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),c}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(d){var c=window.location,o="qor.filter",t="enable."+o,e="click."+o,i="change."+o,u=".qor-bottomsheets";function h(t,i){var n,e=c.search,o=c.search.match(/per_page=\d+/),e=e.replace(/per_page=\d+/g,"").replace(/page=\d+/,"page=1");return o&&o.length&&(e=e+"&"+o[0]),d.isArray(t)&&(n=f(e),d.each(t,function(t,e){-1===(t=d.inArray(e,n))?n.push(e):i&&n.splice(t,1)}),e="?"+n.join("&")),e}function f(t){var e=[];return t&&-1 thead"),this.$tbody=e.find("> tbody"),this.$header=s(t.header),this.$subHeader=s(t.subHeader),this.$content=s(t.content),this.marginBottomPX=parseInt(this.$subHeader.css("marginBottom")),this.paddingHeight=t.paddingHeight,this.resize(),this.bind())},bind:function(){this.$content.on(i,this.toggle.bind(this)),t.on(e,this.resize.bind(this))},unbind:function(){this.$content.off(i,this.toggle).off(e,this.resize)},isNeedBuild:function(){var t=this.$element;return!!(1 tr:visible").length<=1||t.data("disable-fixer"))},build:function(){var e=[];this.$tbody.find("> tr:first").children().each(function(){var t=s(this).outerWidth();s(this).outerWidth(t),e.push(t)}),this.$thead.find(">tr").children().each(function(t){s(this).outerWidth(e[t])})},toggle:function(){var t,e,i,n,o,r;this.$content.length&&(t=this.$element,e=this.$thead,i=this.$content.scrollTop(),n=this.$subHeader.outerHeight()+this.paddingHeight+this.marginBottomPX,o=s(".qor-page__header").outerHeight(),r=this.$content.offset().top+s(".qor-page__header").height(),n-o\n \n \n "),this.bind()},bind:function(){this.$element.on(i,l,this.showEditButton).on(n,l,this.hideEditButton).on(e,".qor-inlineedit__cancel",this.hideEdit).on(e,".qor-inlineedit__save",this.saveEdit).on(e,r,this.showEdit.bind(this))},unbind:function(){this.$element.off(i).off(n).off(e)},showEditButton:function(t){var e=s(u.TEMPLATE_EDIT);if(s(t.target).closest(a).find("input:disabled, textarea:disabled,select:disabled").length)return!1;e.appendTo(s(this))},hideEditButton:function(){s(".qor-inlineedit__edit").remove()},showEdit:function(t){t=s(t.target).closest(r).hide().closest(a).addClass(c);s(this.TEMPLATE_SAVE).appendTo(t)},hideEdit:function(){s(this).closest(a).removeClass(c).find(d).remove()},saveEdit:function(){var n=s(this),o=n.closest(a),t=n.closest("form"),e=o.closest(".qor-fieldset").find('input.qor-hidden__primary_key[type="hidden"]'),i=o.find('input[name*="QorResource"],textarea[name*="QorResource"],select[name*="QorResource"]'),r=i.length&&i.prop("name").match(/\.\w+/g),i=i.serialize();e.length&&(i="".concat(i,"&").concat(e.serialize())),r.length&&s.ajax(t.prop("action"),{method:t.prop("method"),data:i,dataType:"json",beforeSend:function(){n.prop("disabled",!0)},success:function(t){var e=function(t,e){var i,n=e[t[0].slice(1)];if(1mode_edit',u.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);i||e.data(o,i=new u(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.inlineEdit"]',i={};s(document).on("disable.qor.inlineEdit",function(t){u.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){u.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),u}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(e){var i=window.componentHandler,n='[class*="mdl-js"],[class*="mdl-tooltip"]';function o(t){i&&(e(t).is(n)?i.upgradeElements(t):i.upgradeElements(e(n,t).toArray()))}function r(t){i&&(e(t).is(n)?i.downgradeElements(t):i.downgradeElements(e(n,t).toArray()))}e(function(){e(document).on("enable.qor.material",function(t){o(t.target)}).on("disable.qor.material",function(t){r(t.target)}).on("update.qor.material",function(t){r(t.target),o(t.target)})})}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(o){var n=o(document),r="qor.modal",t="click."+r,e="keyup."+r,s="transitionend",a="qor-modal-open",l="in",i="aria-hidden";function d(t,e){this.$element=o(t),this.options=o.extend({},d.DEFAULTS,o.isPlainObject(e)&&e),this.transitioning=!1,this.fadable=!1,this.init()}return d.prototype={constructor:d,init:function(){this.fadable=this.$element.hasClass("fade"),this.options.show?this.show():this.toggle()},bind:function(){this.$element.on(t,o.proxy(this.click,this)),this.options.keyboard&&n.on(e,o.proxy(this.keyup,this))},unbind:function(){this.$element.off(t,this.click),this.options.keyboard&&n.off(e,this.keyup)},click:function(t){var e=this.$element[0],i=t.target;if(i===e&&this.options.backdrop)this.hide();else for(;i!==e;){if("modal"===o(i).data("dismiss")){this.hide();break}i=i.parentNode}},keyup:function(t){27===t.which&&this.hide()},show:function(t){var e,i=this.$element;if(!this.transitioning&&!i.hasClass(l)&&(e=o.Event("show.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").addClass(a),i.addClass("shown").scrollTop(0).get(0).offsetHeight,this.transitioning=!0,t||!this.fadable)return i.addClass(l),void this.shown();i.one(s,o.proxy(this.shown,this)),i.addClass(l)}},shown:function(){this.transitioning=!1,this.bind(),this.$element.attr(i,!1).trigger("shown.qor.modal").focus()},hide:function(t){var e,i=this.$element;if(!this.transitioning&&i.hasClass(l)&&(e=o.Event("hide.qor.modal"),i.trigger(e),!e.isDefaultPrevented())){if(n.find("body").removeClass(a),this.transitioning=!0,t||!this.fadable)return i.removeClass(l),void this.hidden();i.one(s,o.proxy(this.hidden,this)),i.removeClass(l)}},hidden:function(){this.transitioning=!1,this.unbind(),this.$element.removeClass("shown").attr(i,!0).trigger("hidden.qor.modal")},toggle:function(){this.$element.hasClass(l)?this.hide():this.show()},destroy:function(){this.$element.removeData(r)}},d.DEFAULTS={backdrop:!1,keyboard:!0,show:!0},d.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(r);if(!i){if(/destroy/.test(n))return;e.data(r,i=new d(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o.fn.qorModal=d.plugin,o(function(){var e=".qor-modal";o(document).on(t,'[data-toggle="qor.modal"]',function(){var t=o(this),e=t.data(),t=o(e.target||t.attr("href"));d.plugin.call(t,t.data(r)?"toggle":e)}).on("disable.qor.modal",function(t){d.plugin.call(o(e,t.target),"destroy")}).on("enable.qor.modal",function(t){d.plugin.call(o(e,t.target))})}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var o="qor.tabbar.radio",t="enable."+o,e="click."+o,s="[data-tab-target]",a="is-active";function l(t,e){this.$element=r(t),this.options=r.extend({},l.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return l.prototype={constructor:l,init:function(){this.bind()},bind:function(){this.$element.on(e,s,this.switchTab.bind(this))},unbind:function(){this.$element.off(e,s,this.switchTab)},switchTab:function(t){var e=r(t.target),i=this.$element,n=i.find(s),o=i.find("[data-tab-source]"),t=e.data().tabTarget;e.hasClass(a)||(n.removeClass(a),e.addClass(a),o.hide().filter('[data-tab-source="'+t+'"]').show(),i.trigger("switched.qor.tabbar.radio",[i,t]))},destroy:function(){this.unbind()}},l.DEFAULTS={},l.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new l(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.tab.radio"]';r(document).on("disable.qor.tabbar.radio",function(t){l.plugin.call(r(e,t.target),"destroy")}).on(t,function(t){l.plugin.call(r(e,t.target))}).triggerHandler(t)}),l}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(c){var r="qor.redactor",t="enable."+r,l="click."+r,e="addCrop."+r,i="removeCrop."+r,s="scroll."+r,n=".qor-cropper__toggle--redactor";function u(t,e){this.$element=c(t),this.options=c.extend(!0,{},u.DEFAULTS,c.isPlainObject(e)&&e),this.init()}return u.prototype={constructor:u,init:function(){var i,t=this.options,e=this.$element,n=e.closest(t.parent);n.length||(n=e.parent()),this.$parent=n,this.$button=c(u.BUTTON),this.$modal=c((i=u.MODAL,t=t.text,"string"==typeof i&&"object"===_typeof(t)&&c.each(t,function(t,e){i=i.replace("$["+String(t).toLowerCase()+"]",e)}),i)).appendTo("body"),this.bind()},bind:function(){this.$element.on(e,c.proxy(this.addButton,this)).on(i,c.proxy(this.removeButton,this))},unbind:function(){this.$element.off(e).off(i).off(s)},addButton:function(t,e){var i=c(e);this.$button.css("left",c(e).width()/2).prependTo(i.parent()).find(n).one(l,c.proxy(this.crop,this,i))},removeButton:function(){this.$button.find(n).off(l),this.$button.detach()},crop:function(n){var o,r=this.options,s=n.attr("src"),t=s,a=this.$modal;c.isFunction(r.replace)&&(t=r.replace(t)),o=c("")),a.one("shown.qor.modal",function(){var t,e;o.cropper({data:(t=n.attr("data-crop-options"),e=t&&t.split(","),t=null,e&&4===e.length&&(t={x:Number(e[0]),y:Number(e[1]),width:Number(e[2]),height:Number(e[3])}),t),background:!1,movable:!1,zoomable:!1,scalable:!1,rotatable:!1,checkImageOrigin:!1,ready:function(){a.find(".qor-cropper__save").one(l,function(){var i=o.cropper("getData",!0);c.ajax(r.remote,{type:"POST",contentType:"application/json",data:JSON.stringify({Url:s,CropOptions:{original:function(t){var e,i,n={};if(c.isPlainObject(t))for(e in t)t.hasOwnProperty(e)&&(n["string"==typeof(i=e)&&(i=i.charAt(0).toUpperCase()+i.substr(1)),i]=t[e]);return n}(i)},Crop:!0}),dataType:"json",success:function(t){var e;c.isPlainObject(t)&&t.url&&(n.attr("src",t.url).attr("data-crop-options",(t=i,e=[],c.isPlainObject(t)&&c.each(t,function(){e.push(arguments[1])}),e.join())).removeAttr("style").removeAttr("rel"),c.isFunction(r.complete)&&r.complete(),a.qorModal("hide"))}})})}})}).one("hidden.qor.modal",function(){o.cropper("destroy").remove()}).qorModal("show").find(".qor-cropper__wrapper").append(o)},destroy:function(){this.unbind(),this.$modal.qorModal("hide").remove(),this.$element.removeData(r)}},u.DEFAULTS={remote:!1,parent:!1,toggle:!1,replace:null,complete:null,text:{title:"Crop the image",ok:"OK",cancel:"Cancel"}},u.BUTTON='
                                    \n Edit\n Crop\n
                                    ',u.MODAL='',u.plugin=function(o){return this.each(function(){var t,i=c(this),n=i.data(r);if(n)/destroy/.test(o)&&window.$R(this,"destroy");else{if(!window.$R)return;if(/destroy/.test(o))return;i.data(r,n={});var e={imageUpload:i.data("uploadUrl"),fileUpload:i.data("uploadUrl"),buttons:["html","format","bold","italic","deleted","lists","image","file","link"],linkNewTab:!0,linkTitle:!1,autoparsePaste:!1,autoparseLinks:!1,multipleUpload:!1,toolbarFixedTarget:!i.closest(".qor-slideout").length&&!i.closest(".qor-bottomsheets").length&&c("main.mdl-layout__content").length?"main.mdl-layout__content":document,callbacks:{started:function(){var t,a=c(this.container.$container.nodes[0]),l=c(this.toolbar.$toolbar.nodes[0]),e=c(".qor-slideout").is(":visible"),d=64;e?d=0!=i.closest(".qor-bottomsheets").length?(t=i.closest(".qor-page__body"),i.closest(".qor-page__body").offset().top):(t=".qor-slideout__body",c(".qor-slideout__header").height()):d+=c(t=".qor-layout main.qor-page").find(".qor-page__header").height(),c(t).on(s,function(){var t,e,i,n,o,r,s;t=l,i=d,n=(e=a).offset().top,o=e.outerHeight(),r={position:"relative",top:"auto",width:"auto"},s={position:"fixed",top:i,width:e.width(),boxShadow:"none"},n .qor-field__block > .qor-fieldset--new");this.singlePage=!(t.closest(".qor-slideout").length&&t.closest(".qor-bottomsheets").length),this.maxitems=t.data("maxItem"),this.isSortable=t.hasClass("qor-fieldset-sortable"),e.length&&!t.closest(".qor-fieldset--new").length&&(e.trigger("disable"),e.find("select[data-toggle]").removeAttr("data-select2-id"),this.isMultipleTemplate=t.data("isMultiple"),this.isMultipleTemplate?(this.fieldsetName=[],this.template={},this.index=[],e.each(function(t,e){(i=c(e).data("fieldsetName"))&&(n.template[i]=c(e).prop("outerHTML"),n.fieldsetName.push(i))}),this.parseMultiple()):this.parse(e.prop("outerHTML")),e.hide(),this.bind(),this.resetButton(),this.resetPositionButton())},resetPositionButton:function(){var t=this.$element.find("> .qor-sortable__button");this.isSortable&&(1 .qor-field__block > .qor-fieldset").not(".qor-fieldset--new,.is-deleted").length},toggleButton:function(t){var e=this.$element.find("> .qor-field__block > .qor-fieldset__add");t?e.hide():e.show()},resetButton:function(){this.maxitems<=this.getCurrentItems()?this.toggleButton(!0):this.toggleButton()},parse:function(t){t&&(t=this.initTemplate(t),this.template=t.template,this.index=t.index)},parseMultiple:function(){for(var t,e,i=this.fieldsetName,n=0,o=i.length;n .qor-field__block > .qor-sortable__item").not(".qor-fieldset--new").length,e.attr("order-index",t).attr("order-item","item_".concat(t)).css("order",t)),e.data("itemIndex",this.index).removeClass("qor-fieldset--new"),e}},del:function(t){var e,i=this.options,n=c(t.target).closest(i.itemClass),o=this,t={confirm:c(t.target).closest(i.delClass).data("confirm")||"Are you sure?"};s.qorConfirm(t,function(t){t&&(n.addClass("is-deleted").children(":visible").addClass("hidden").hide(),(e=c(i.alertTemplate.replace("{{name}}",o.parseName(n)))).find(i.undoClass).one(a,function(){if(o.maxitems<=o.getCurrentItems())return window.QOR.qorConfirm(o.$element.data("maxItemHint")),!1;n.find("> .qor-fieldset__alert").remove(),n.removeClass("is-deleted").children(".hidden").removeClass("hidden").show(),o.resetButton(),o.resetPositionButton()}.bind(this)),o.resetButton(),o.resetPositionButton(),n.append(e))})},parseName:function(t){t=t.find("input[name]").attr("name")||t.find("textarea[name]").attr("name");if(t)return t.replace(/[^\[\]]+$/,"")},destroy:function(){this.unbind(),this.$element.removeData(o)}},d.DEFAULTS={itemClass:".qor-fieldset",newClass:".qor-fieldset--new",addClass:".qor-fieldset__add",delClass:".qor-fieldset__delete",childrenClass:".qor-field__block",undoClass:".qor-fieldset__undo",alertTemplate:'
                                    '},d.plugin=function(n){return this.each(function(){var t,e=c(this),i=e.data(o);i||e.data(o,i=new d(this,n)),"string"==typeof n&&c.isFunction(t=i[n])&&t.call(i)})},c(function(){var e=l,i={};c(document).on("disable.qor.replicator",function(t){d.plugin.call(c(e,t.target),"destroy")}).on(t,function(t){d.plugin.call(c(e,t.target),i)}).triggerHandler(t)}),d}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var a=window.location,o=window.componentHandler,l=window.history,r="qor.globalSearch",t="enable."+r,e="click."+r,d=".qor-global-search--resource",c=".qor-global-search--results",u="is-active";function h(t,e){this.$element=s(t),this.options=s.extend({},h.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return h.prototype={constructor:h,init:function(){this.bind(),this.initTab()},bind:function(){this.$element.on(e,s.proxy(this.click,this))},unbind:function(){this.$element.off(e,this.check)},initTab:function(){var t=a.search;/resource_name/.test(t)&&(t=t.match(/resource_name=\w+/g).toString().split("=")[1],s(d).removeClass(u),s('[data-resource="'+t+'"]').addClass(u))},click:function(t){var e,i,n,o=s(t.target),r=o.data();o.is(d)&&(n=a.href.replace(/#/g,""),e=r.resource,i=/resource_name/.test(n),t="resource_name="+e,r=/keyword/.test(n)?"&":"?keyword=&",n=e?i?n.replace(/resource_name=\w+/g,t):n+r+t:n.replace(/&resource_name=\w+/g,""),l.pushState?this.fetchSearch(n,o):a.href=n)},fetchSearch:function(e,i){var n=document.title;s.ajax(e,{method:"GET",dataType:"html",beforeSend:function(){s(".mdl-spinner").remove(),s(c).prepend('
                                    ').find(".qor-section").hide(),o.upgradeElement(document.querySelector(".mdl-spinner"))},success:function(t){t=s(t).find(c).html();s(d).removeClass(u),i.addClass(u),l.pushState({Page:e,Title:n},n,e),s(".mdl-spinner").remove(),s(c).removeClass("loading").html(t),o.upgradeElements(document.querySelectorAll(".qor-table"))},error:function(t,e,i){s(c).find(".qor-section").show(),s(".mdl-spinner").remove(),window.alert([e,i].join(": "))}})},destroy:function(){this.unbind(),this.$element.removeData(r)}},h.DEFAULTS={},h.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(r);i||e.data(r,i=new h(this,n)),"string"==typeof n&&s.isFunction(t=i[n])&&t.call(i)})},s(function(){var e='[data-toggle="qor.global.search"]',i={};s(document).on("disable.qor.globalSearch",function(t){h.plugin.call(s(e,t.target),"destroy")}).on(t,function(t){h.plugin.call(s(e,t.target),i)}).triggerHandler(t)}),h}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var d=window.FormData,c=window.QOR,o="qor.selectcore",s="afterSelected."+o,t="click."+o,e="submit."+o,i="table.qor-js-table tr";function r(t,e){this.$element=l(t),this.options=l.extend({},r.DEFAULTS,l.isPlainObject(e)&&e),this.init()}return r.prototype={constructor:r,init:function(){this.bind()},bind:function(){this.$element.on(t,i,this.processingData.bind(this)).on(e,"form",this.submit.bind(this))},unbind:function(){this.$element.off(t,i).off(e,"form")},processingData:function(e){var t=l(e.target).closest("tr"),i=t.closest(".qor-bottomsheets"),n={},o=this.options,r=o.onSelect,o=o.loading;return(n=l.extend({},n,t.data())).$clickElement=t,t=n.mediaLibraryUrl||n.url,o&&l.isFunction(o)&&o(i),t?l.getJSON(t,function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),n=l.extend({},t,n),r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s))}).always(function(){i.find(".qor-media-loading").remove()}):r&&l.isFunction(r)&&(r(n,e),l(document).trigger(s)),!1},submit:function(e){var i,t=e.target,n=l(t),o=this,r=n.find(":submit"),s=l(c.$formLoading),a=this.options.onSubmit;l(document).trigger("selectcoreBeforeSend.qor.selectcore"),n.find(".qor-fieldset--new").remove(),d&&(e.preventDefault(),l.ajax(n.prop("action"),{method:n.prop("method"),data:new d(t),dataType:"json",processData:!1,contentType:!1,beforeSend:function(){l(".qor-submit-loading").remove(),s.appendTo(r.prop("disabled",!0).closest(".qor-form__actions")).trigger("enable.qor.material")},success:function(t){t.MediaOption&&(t.MediaOption=JSON.parse(t.MediaOption)),(i=t).primaryKey=i.ID,l(".qor-error").remove(),a&&l.isFunction(a)?(a(i,e),l(document).trigger("afterSubmitted.qor.selectcore")):o.refresh()},error:function(t){c.handleAjaxError(t)},complete:function(){r.prop("disabled",!1)}}))},refresh:function(){setTimeout(function(){window.location.reload()},350)},destroy:function(){this.unbind()}},r.plugin=function(n){return this.each(function(){var t,e=l(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new r(this,n))}"string"==typeof n&&l.isFunction(t=i[n])&&t.apply(i)})},l.fn.qorSelectCore=r.plugin,r}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(s){var i=s("body"),t=s(document),a=window.Mustache,o="qor.selectone",n="click."+o,r="enable."+o,e="reload.qor.bottomsheets",l=".qor-selected-many__remove",d=".qor-selected-many__undo",c="qor-selected-many__deleted",u=".qor-field__selectmany",h="is_selected",f="qor-bottomsheets__select-many";function p(t,e){this.$element=s(t),this.options=s.extend({},p.DEFAULTS,s.isPlainObject(e)&&e),this.init()}return p.prototype={constructor:p,init:function(){this.bind()},bind:function(){t.on(e,".".concat(f),this.reloadData.bind(this)),this.$element.on(n,l,this.clearSelect.bind(this)).on(n,'[data-select-modal="many"]',this.openBottomSheets.bind(this)).on(n,d,this.undoDelete.bind(this))},unbind:function(){t.off(n,'[data-select-modal="many"]').off(e,".".concat(f)),this.$element.off(n,l).off(n,d)},clearSelect:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").addClass(c),this.updateSelectInputData(t),!1},undoDelete:function(t){var e=s(t.target),t=e.closest(u);return e.closest("[data-primary-key]").removeClass(c),this.updateSelectInputData(t),!1},openBottomSheets:function(t){var e=s(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.bottomsheetsData=t,this.$selector=t.selectId?s(t.selectId):e.closest(u).find("select"),this.$selectFeild=this.$selector.closest(u).find(".qor-field__selected-many"),this.SELECT_MANY_SELECTED_ICON=s('[name="select-many-selected-icon"]').html(),this.SELECT_MANY_UNSELECTED_ICON=s('[name="select-many-unselected-icon"]').html(),this.SELECT_MANY_HINT=s('[name="select-many-hint"]').html(),this.SELECT_MANY_TEMPLATE=s('[name="select-many-template"]').html(),t.url=t.selectListingUrl,t.selectDefaultCreating&&(t.url=t.selectCreatingUrl),this.BottomSheets.open(t,this.handleSelectMany.bind(this))},reloadData:function(){this.initItems()},renderSelectMany:function(t){return a.render(this.SELECT_MANY_TEMPLATE,t)},renderHint:function(t){return a.render(this.SELECT_MANY_HINT,t)},initItems:function(){var i,t=this.$bottomsheets.find("tbody tr"),n=this.SELECT_MANY_SELECTED_ICON,o=this.SELECT_MANY_UNSELECTED_ICON,r=[];this.$selectFeild.find("[data-primary-key]").not("."+c).each(function(){r.push(s(this).data().primaryKey)}),t.each(function(){var t=s(this),e=t.find("td:first");i=t.data().primaryKey,"-1"!=r.indexOf(i)?(t.addClass(h),e.append(n)):e.append(o)}),this.updateHint(this.getSelectedItemData())},getSelectedItemData:function(){return{selectedNum:this.$selectFeild.find("[data-primary-key]").not("."+c).length}},updateHint:function(t){s.extend(t,this.bottomsheetsData),t=this.renderHint(t),this.$bottomsheets.find(".qor-selectmany__hint").remove(),this.$bottomsheets.find(".qor-page__body").before(t)},updateSelectInputData:function(t){var e,i,n=(t||this.$selectFeild).find("[data-primary-key]").not("."+c),o=t?t.find(".qor-field__selectmany-input"):this.$selector,r=o.find("option");r.prop("selected",!1),n.each(function(){i=s(this).data().primaryKey,(e=r.filter('[value="'+i+'"]')).length||(i={primaryKey:i,displayName:""},e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,i)),o.append(e)),e.prop("selected",!0)})},changeIcon:function(t,e){t.find(".qor-select__select-icon").remove(),t.find("td:first").prepend(e)},removeItem:function(t){var e=t.primaryKey;this.$selectFeild.find('[data-primary-key="'+e+'"]').find(l).click(),this.changeIcon(t.$clickElement,this.SELECT_MANY_UNSELECTED_ICON)},addItem:function(t,e){var i=this.renderSelectMany(t),n=this.$selectFeild.find('[data-primary-key="'+t.primaryKey+'"]');return n.length?n.hasClass(c)?(n.removeClass(c),this.updateSelectInputData(),void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON)):void 0:(this.$selectFeild.append(i),e?((e=s(a.render(p.SELECT_MANY_OPTION_TEMPLATE,t))).appendTo(this.$selector),e.prop("selected",!0),this.$bottomsheets.remove(),void(s(".qor-bottomsheets").is(":visible")||s("body").removeClass("qor-bottomsheets-open"))):void this.changeIcon(t.$clickElement,this.SELECT_MANY_SELECTED_ICON))},handleSelectMany:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(f),t.on(n,".qor-selectmany__selectall",this.handleSelectAll.bind(this)),this.$bottomsheets=t,this.initItems()},handleSelectAll:function(){var t=this.$bottomsheets.find(".qor-table tbody tr"),e=t.not(".is_selected");(e.length?e:t).click()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t,e){t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.displayName=t.displayName.escapeSymbol(),e?this.addItem(t,!0):((e=t.$clickElement).toggleClass(h),e.hasClass(h)?this.addItem(t):this.removeItem(t),this.updateHint(this.getSelectedItemData()),this.updateSelectInputData())},destroy:function(){this.unbind(),this.$element.removeData(o)}},p.SELECT_MANY_OPTION_TEMPLATE='',p.plugin=function(n){return this.each(function(){var t,e=s(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new p(this,n))}"string"==typeof n&&s.isFunction(t=i[n])&&t.apply(i)})},s(function(){var e='[data-toggle="qor.selectmany"]';s(document).on("disable.qor.selectone",function(t){p.plugin.call(s(e,t.target),"destroy")}).on(r,function(t){p.plugin.call(s(e,t.target))}).triggerHandler(r)}),p}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var i=r("body"),t=r(document),s=window.Mustache,o="qor.selectone",e="click."+o,n="enable."+o,a="reload.qor.bottomsheets",l=".qor-selected__remove",d=".qor-selected__change",c=".qor-field__selected",u=".qor-field__selectone-input",h=".qor-field__selectone-trigger",f=".qor-field__selectone",p="qor-bottomsheets__select-one";function m(t,e){this.$element=r(t),this.options=r.extend({},m.DEFAULTS,r.isPlainObject(e)&&e),this.init()}return m.prototype={constructor:m,init:function(){this.bind()},bind:function(){t.on(a,".".concat(p),this.reloadData.bind(this)),this.$element.on(e,l,this.clearSelect.bind(this)).on(e,"[data-selectone-url]",this.openBottomSheets.bind(this)).on(e,d,this.changeSelect)},unbind:function(){t.off(e,"[data-selectone-url]").off(a,".".concat(p)),this.$element.off(e,l).off(e,d)},clearSelect:function(t){t=r(t.target).closest(f);return t.find(c).remove(),t.find(u).html(""),t.find(u)[0].value="",t.find(h).show(),t.trigger("qor.selectone.unselected"),!1},changeSelect:function(){r(this).closest(f).find(h).trigger("click")},openBottomSheets:function(t){var e=r(t.target),t=e.data();this.BottomSheets=i.data("qor.bottomsheets"),this.$parent=e.closest(f),t.url=t.selectoneUrl,this.SELECT_ONE_SELECTED_ICON=r('[name="select-one-selected-icon"]').html(),this.BottomSheets.open(t,this.handleSelectOne.bind(this))},initItem:function(){var t,e=this.$parent.find(c);e.length&&(t=e.data().primaryKey)&&this.$bottomsheets.find('tr[data-primary-key="'+t+'"]').addClass("is_selected").find("td:first").append(this.SELECT_ONE_SELECTED_ICON)},reloadData:function(){this.initItem()},renderSelectOne:function(t){return s.render(r('[name="select-one-selected-template"]').html(),t)},handleSelectOne:function(t){var e={onSelect:this.onSelectResults.bind(this),onSubmit:this.onSubmitResults.bind(this)};t.qorSelectCore(e).addClass(p),this.$bottomsheets=t,this.initItem()},onSelectResults:function(t){this.handleResults(t)},onSubmitResults:function(t){this.handleResults(t,!0)},handleResults:function(t){var e,i=this.$parent,n=i.find("select"),o=i.find(c);t.displayName=t.Text||t.Name||t.Title||t.Code||t[Object.keys(t)[0]],t.selectoneValue=t.primaryKey||t.ID,t.displayName=t.displayName.escapeSymbol(),n.length&&(e=this.renderSelectOne(t),o.length&&o.remove(),i.prepend(e),i.find(h).hide(),n.html(s.render(m.SELECT_ONE_OPTION_TEMPLATE,t)),n[0].value=t.primaryKey||t.ID,i.trigger("qor.selectone.selected",[t]),this.$bottomsheets.qorSelectCore("destroy").remove(),r(".qor-bottomsheets").is(":visible")||r("body").removeClass("qor-bottomsheets-open"))},destroy:function(){this.unbind(),this.$element.removeData(o)}},m.SELECT_ONE_OPTION_TEMPLATE='',m.plugin=function(n){return this.each(function(){var t,e=r(this),i=e.data(o);if(!i){if(/destroy/.test(n))return;e.data(o,i=new m(this,n))}"string"==typeof n&&r.isFunction(t=i[n])&&t.apply(i)})},r(function(){var e='[data-toggle="qor.selectone"]';r(document).on("disable.qor.selectone",function(t){m.plugin.call(r(e,t.target),"destroy")}).on(n,function(t){m.plugin.call(r(e,t.target))}).triggerHandler(n)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(l){var t=l(document),r="qor.selector",i="enable."+r,e="click."+r,d="selected",c="disabled",s="clearable",a="."+d,u=".qor-selector-toggle",h=".qor-selector-label",f=".qor-selector-menu",p=".qor-bottomsheets";function m(t,e){this.options=e,this.$element=l(t),this.init()}return m.prototype={constructor:m,init:function(){var t=this.$element;this.placeholder=t.attr("placeholder")||t.attr("name")||"Select",this.build()},build:function(){var t=this.$element,e=l(m.TEMPLATE),i=this.options.aligned+"-aligned",s={},n=t.data(),o=n.hover,a=t.attr("name");this.isBottom="bottom"==n.position,o&&e.addClass("hover"),e.addClass(i).find(f).html(function(){var r=[];return t.children().each(function(){var t=l(this),e=t.attr("selected"),i=t.attr("disabled"),n=t.attr("value"),o=t.text(),t=[];e&&(t.push(d),s.value=n,s.label=o,s.paramName=a),i&&t.push(c),r.push("'+o+"")}),r.join("")}),this.$selector=e,t.hide().after(e),e.find(u).data("paramName",a),this.pick(s,!0),this.bind()},unbuild:function(){this.unbind(),this.$selector.remove(),this.$element.show()},bind:function(){this.$selector.on(e,l.proxy(this.click,this)),t.on(e,l.proxy(this.close,this))},unbind:function(){this.$selector.off(e,this.click)},click:function(t){var e=l(t.target);t.stopPropagation(),e.is(".qor-selector-clear")?this.clear():e.is("li")?(e.hasClass(d)||e.hasClass(c)||this.pick(e.data()),this.close()):e.closest(u).length&&this.open()},pick:function(t,e){var i=this.$selector,n=!!t.value,o=this.$element;i.find(u).toggleClass("active",n).toggleClass(s,n&&this.options.clearable).find(h).text(t.label||this.placeholder),e||(i.find(f).children('[data-value="'+t.value+'"]').addClass(d).siblings(a).removeClass(d),o.val(t.value),o.closest(p).length&&!o.closest('[data-toggle="qor.filter"]').length?l(p).trigger("selectorChanged.qor.selector",[t.value,t.paramName]):o.trigger("change"))},clear:function(){var t=this.$element;this.$selector.find(u).removeClass("active").removeClass(s).find(h).text(this.placeholder).end().end().find(f).children(a).removeClass(d),t.val("").trigger("change")},open:function(){t.triggerHandler(e),l(".qor-filter__dropdown").hide(),this.$selector.addClass("open"),this.isBottom&&this.$selector.addClass("bottom")},close:function(){this.$selector.removeClass("open"),this.isBottom&&this.$selector.removeClass("bottom")},destroy:function(){this.unbuild(),this.$element.removeData(r)}},m.DEFAULTS={aligned:"left",clearable:!1},m.TEMPLATE='',m.plugin=function(o){return this.each(function(){var t,e,i=l(this),n=i.data(r);if(!n){if(/destroy/.test(o))return;t=l.extend({},m.DEFAULTS,i.data(),"object"===_typeof(o)&&o),i.data(r,n=new m(this,t))}"string"==typeof o&&l.isFunction(e=n[o])&&e.apply(n)})},l(function(){var e='[data-toggle="qor.selector"]';l(document).on("disable.qor.selector",function(t){m.plugin.call(l(e,t.target),"destroy")}).on(i,function(t){m.plugin.call(l(e,t.target))}).triggerHandler(i)}),m}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(p){var t=p(document),l=window.FormData,m=window.QOR_Translations,o=window._,d=window.QOR,r="qor.slideout",e="keyup."+r,i="click."+r,n="submit."+r,y="shown."+r,g="hidden."+r,s="transitionend",a="qor-slideout-open",c="qor-slideout-mini",u="is-shown",h="is-slided",b=".qor-body__loading";function f(t,e){var i=[],n=e?"src":"href";return t.each(function(){i.push(p(this).attr(n))}),o.uniq(i)}function v(t,e,i){for(var n=0,o=0,r=t.length;o\s]+))?)+\s*|\s*)>/g))for(var r=0;r[\s\S]*<\s*\/body\s*>/gi);r&&(r=r.join("").replace(/<\s*body/gi," thead > tr > th",o.proxy(this.sort,this))},unbind:function(){this.$element.off(e,this.sort)},sort:function(t){var e=o(t.currentTarget).data("orderBy"),t=n.search,i="order_by="+e;e&&(/order_by/.test(t)?t=t.replace(/order_by(=\w+)?/,function(){return i}):t+=-1this.slideoutWidth&&this.$element.find(d).append(f.ARROW_RIGHT)},scrollTabLeft:function(t){t.stopPropagation();var e=o(d),i=e.scrollLeft(),t=i-this.slideoutWidth;0=i&&o(c).hide()}),o(u).length||this.$element.find(d).prepend(f.ARROW_LEFT))},switchTab:function(t){var e=o(t.target),i=this.$element,t=e.data(),n=r.data().tabScopeActive;if(o(".qor-slideout").is(":visible"))return e.hasClass(h)||(i.find(a).removeClass(h),e.addClass(h),o.ajax(t.tabUrl,{method:"GET",dataType:"html",processData:!1,contentType:!1,beforeSend:function(){o(".qor-layout__tab-spinner").remove();o(l).hide().before('
                                    '),window.componentHandler.upgradeElement(o(".qor-layout__tab-spinner")[0])},success:function(t){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",e.data("name"));t=o(t).find(l).html();o(l).show().html(t).trigger("enable")},error:function(){o(".qor-layout__tab-spinner").remove(),r.data("tabScopeActive",n)}})),!1},destroy:function(){this.unbind(),r.removeData("tabScopeActive")}},f.ARROW_RIGHT='',f.ARROW_LEFT='',f.DEFAULTS={},f.plugin=function(n){return this.each(function(){var t,e=o(this),i=e.data(s);if(!i){if(/destroy/.test(n))return;e.data(s,i=new f(this,n))}"string"==typeof n&&o.isFunction(t=i[n])&&t.apply(i)})},o(function(){var e='[data-toggle="qor.tab"]';o(document).on("disable.qor.tabbar",function(t){f.plugin.call(o(e,t.target),"destroy")}).on(t,function(t){f.plugin.call(o(e,t.target))}).triggerHandler(t)}),f}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?t(require("jquery")):t(jQuery)}(function(r){var s="qor.timepicker",t="enable."+s,e="click."+s,i="focus."+s,n="keydown."+s,o="blur."+s,a="selectTime."+s,l="[data-picker-type]";function d(t,e){this.$element=r(t),this.options=r.extend(!0,{},d.DEFAULTS,r.isPlainObject(e)&&e),this.formatDate=null,this.pickerData=this.$element.data(),this.parent=this.$element.closest(l),this.isDateTimePicker="datetime"==this.parent.data("picker-type"),this.$targetInput=this.parent.find(this.pickerData.targetInput||(this.isDateTimePicker?".qor-datetimepicker__input":".qor-datepicker__input")),this.init()}return d.prototype={init:function(){var t,e,i;this.$targetInput.is(":disabled")?this.$element.remove():(this.bind(),this.oldValue=this.$targetInput.val(),e=(e=(t=new Date).getMonth()+1)<8?"0"+e:e,i=(i=t.getDate())<10?"0"+i:i,this.dateValueNow=t.getFullYear()+"-"+e+"-"+i)},bind:function(){this.isDateTimePicker&&this.$targetInput.qorTimepicker({timeFormat:"H:i",showOn:null,wrapHours:!1,scrollDefault:"now"}).on(a,r.proxy(this.changeTime,this)).on(o,r.proxy(this.blur,this)).on(i,r.proxy(this.focus,this)).on(n,r.proxy(this.keydown,this)),this.$element.on(e,r.proxy(this.show,this))},unbind:function(){this.$element.off(e,this.show),this.isDateTimePicker&&this.$targetInput.off(a,this.changeTime).off(o,this.blur).off(i,this.focus).off(n,this.keydown)},focus:function(){},blur:function(){var t,e,i,n,o,r,s=this.$targetInput.val(),a=s.split(" "),l=a.length,d=/\d{1,2}:\d{1,2}/,c=/^\d{4}-\d{1,2}-\d{1,2}/;if(s){if(1==l)c.test(a[0])&&(e=a[0],i="00:00"),d.test(a[0])&&(e=this.dateValueNow,i=a[0]);else for(var u=0;u