(()=>{function t(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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,n;return o=e,(n=[{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 n=[];console.log(o.find("tbody tr")),$.each(o.find("tbody tr"),(function(t,e){n.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:n},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,n),e}();$(document).ready((function(){(new e).init()}))})();
