<?php include $this->admin_tpl('meta');?>
<title>菜单管理 - YzmCMS内容管理系统</title>
<style>.parentid{cursor:pointer;user-select:none}</style>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 菜单管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container footer_padding">
	<div class="cl tb-top"> 
		<span class="l">
		<a href="javascript:;" onclick="yzm_tree_toggle(this)" isshow="1" class="btn btn-secondary radius tree_toggle"><i class="yzm-iconfont">&#xe653;</i> 收起子项</a>
		<a href="javascript:;" onclick="yzm_open('添加菜单','<?php echo U('add', array('type'=>0));?>',600,410)" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加菜单</a>
		</span>
	</div>
	<form action="<?php echo U('order');?>" method="post">
	<table class="table table-border table-bg table-hover">
		<thead>
			<tr class="text-c">
				<th width="50">排序</th>
				<th width="60">菜单ID</th>
				<th class="text-l">菜单名称</th>
				<th width="80">显示</th>
				<th width="200">管理操作</th>
			</tr>
		</thead>
		<tbody>
			 <?php echo $menus;?>
		</tbody>
	</table>
	<div class="footer_btn footer_border"> 
		<input class="btn btn-primary radius mr-10" name="dosubmit" value="排 序" type="submit">
	</div>
	</form>
</div>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript">

  	function yzm_tree_toggle(obj) {
		var isshow = $(obj).attr("isshow");
		if(isshow == "0"){
			$(obj).attr("isshow", "1");
			$(obj).html('<i class="yzm-iconfont">&#xe653;</i> 收起子项');
			$(".top .parentid").attr('action', 2).html('&#xe653;');
			$(".child").show();
		}else{
			$(obj).attr("isshow", "0");
			$(obj).html('<i class="yzm-iconfont">&#xe652;</i> 展开子项');
			$(".top .parentid").attr('action', 1).html('&#xe652;');
			$(".child").hide();
		}
    }

    $(".parentid").click(function () {
        var action = parseInt($(this).attr("action"));
        var tr = $(this).parents('tr').eq(0);
        switch (action) {
            case 1://展示
                $(tr).nextUntil('.top').show();
                $(this).attr('action', 2).html('&#xe653;');
                break;
            case 2://收缩
                $(tr).nextUntil('.top').hide();
                $(this).attr('action', 1).html('&#xe652;');
                break;
        }
    })
</script>
</body>
</html>