(()=>{function t(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var e=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e)}var o,r,n;return o=e,(r=[{key:"init",value:function(){$.each($("#simple-slider-items-table_wrapper tbody"),(function(t,e){Sortable.create(e,{group:e+"_"+t,sort:!0,delay:0,disabled:!1,store:null,animation:150,handle:"tr",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dataIdAttr:"data-id",forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,scroll:!0,scrollSensitivity:30,scrollSpeed:10,onEnd:function(){var t=$(e).closest(".widget-body");t.find(".btn-save-sort-order").addClass("sort-button-active").show(),$.each(t.find("tbody tr"),(function(t,e){$(e).find(".order-column").text(t+1)}))}})})),$(".btn-save-sort-order").off("click").on("click",(function(t){t.preventDefault();var e=$(t.currentTarget);if(e.hasClass("sort-button-active")){var o=e.closest(".widget-body");o.find(".btn-save-sort-order").addClass("button-loading");var r=[];console.log(o.find("tbody tr")),$.each(o.find("tbody tr"),(function(t,e){r.push(parseInt($(e).find("td:first-child").text())),$(e).find(".order-column").text(t+1)})),$.ajax({type:"POST",cache:!1,url:route("simple-slider.sorting"),data:{items:r},success:function(t){Botble.showSuccess(t.message),o.find(".btn-save-sort-order").removeClass("button-loading").hide(),e.removeClass("sort-button-active")},error:function(t){Botble.showError(t.message),e.removeClass("sort-button-active")}})}}))}}])&&t(o.prototype,r),n&&t(o,n),Object.defineProperty(o,"prototype",{writable:!1}),e}();$(document).ready((function(){(new e).init()}))})();