var placeholder = "Seçiminizi yapın";



$(function () {



	$('[data-toggle="tooltip"]').tooltip();



  	//$('.select2').select2({

  	//	placeholder: placeholder,

  	//	minimumResultsForSearch: -1

	//});



	function MinHeightPlugin(editor) {

		this.editor = editor;

	}



	MinHeightPlugin.prototype.init = function() {

		this.editor.ui.view.editable.extendTemplate({

			attributes: {

				style: {

					minHeight: '300px'

				}

			}

		});

	};



	ClassicEditor.builtinPlugins.push(MinHeightPlugin);

	ClassicEditor.create( document.querySelector('#editor'),{

		language: 'tr'

	}).then(editor => {

		console.log( editor );

	}).catch(error => { });



	$(".sortable").sortable({
		containerSelector: "ul.sortable",
		itemSelector: "li.sort",
		handle: ".handle",
		refreshPositions: true, 
		opacity: 0.6,
		scroll:true,
		placeholder: 'highlight',
		distance: 0,
		onDrop: function($item) {
			$item.attr("style", null).removeClass("dragged");
			$item.toggleClass("highlight");
			$("body").removeClass("dragging");
		},
		stop: function(event, ui) {
			$("ul#category").each(function() {
				var result = [];
				$(this).find("li").each(function(){
				    if($(this).data("id")){
					result.push($(this).data("id"));
				        
				    }
				        
				    });
				post("update_ordering", {type:"categories",ordering:result});
			});
		}
	});


	$(".paymentSortable").sortable({

		containerSelector: "ul.sortable",

		itemSelector: "li.sort",

		handle: ".handle",

		refreshPositions: true, 

		opacity: 0.6,

		scroll:true,

		placeholder: 'highlight',

		distance: 0,

		onDrop: function($item) {

			$item.attr("style", null).removeClass("dragged");

			$item.toggleClass("highlight");

			$("body").removeClass("dragging");

		},

		stop: function(event, ui) {

			$("#paymentMethods").each(function() {

				var result = [];

				$(this).find("li").each(function(){

					result.push($(this).data("id"));

				});

				post("update_ordering", {type:"methods",ordering:result});

			});

		}

	});







});