<button style="margin-bottom: 20px;" class="btn btn-default" data-toggle="modal" data-toggle="modal" data-target="#modalDefault" data-action="add_menu">Menü Oluştur</button>
<div class="panel panel-default">
	<div class="panel-body">
		<div class="row settings-menu__row">
			<div class="col-md-3">
				<div class="settings-menu__title">Herkese Açık</div>
				<div class="settings-menu__description">Üye girişi yapmayanlar</div>
			</div>
			<div class="col-md-9">
				<div class="dd">
					<ul class="dd-list sortable3" id="public_menu">
						<?php foreach($menus as $row): if($row['menu_type'] == 2): ?>
						<li class="dd-item sort" data-id="<?=$row['menu_id']?>">
							<div class="dd-handle">
								<i class="fas fa-arrows-alt handle" style="float:left;margin-top:7px;margin-right:10px;"></i>
								<div style="color:grey;"><i class="<?=$row['menu_icon']?>"></i> <?=$row['menu_title']?> </div>
							</div>
							<div class="settings-menu__action">
								<div class="tt" style="font-size: 1.5em;">
									<a href="#" class="btn btn-xs btn-default" onclick="delete_menu(<?=$row['menu_id']?>)">Sil</a>
								</div>
							</div>
						</li>
						<?php endif; endforeach; ?>
					</ul>
				</div>
			</div>
		</div>
		<div class="row settings-menu__row" style="margin-top:20px;">
			<div class="col-md-3">
				<div class="settings-menu__title">Sadece Üyeler</div>
				<div class="settings-menu__description">Giriş yapmış kullanıcılar</div>
			</div>
			<div class="col-md-9">
				<div class="dd">
					<ul class="dd-list sortable2" id="private_menu">
						<?php foreach($menus as $row): if($row['menu_type'] == 1): ?>
						<li class="dd-item sort" data-id="<?=$row['menu_id']?>">
							<div class="dd-handle">
								<i class="fas fa-arrows-alt handle" style="float:left;margin-top:7px;margin-right:10px;"></i>
								
								<div style="color:grey;"><i class="<?=$row['menu_icon']?>"></i> <?=$row['menu_title']?> </div>
							</div>
							<?php if($row['menu_lock'] == 0): ?>
							<div class="settings-menu__action">
								<div class="tt" style="font-size: 1.5em;">
									<a href="#" class="btn btn-xs btn-default" onclick="delete_menu(<?=$row['menu_id']?>)">Sil</a>
								</div>
							</div>
							<?php endif; ?>
						</li>
						<?php endif; endforeach; ?>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
	<script src="<?=admin_public_url('assets/js/jquery.min.js')?>?v=<?=time()?>"></script>
	<script src="<?=public_url('system/js/jquery-ui.js');?>"></script>
	<script type="text/javascript">
		$(".sortable2").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#private_menu").each(function() {
				var result = [];
				$(this).find("li").each(function(){
					result.push($(this).data("id"));
				});
				post("update_menu_ordering", {type:"private",ordering:result});
			});
		}
	});

	$(".sortable3").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#public_menu").each(function() {
				var result = [];
				$(this).find("li").each(function(){
					result.push($(this).data("id"));
				});
				post("update_menu_ordering", {type:"public",ordering:result});
			});
		}
	});
	</script>