<!--{include file="<!--{$oapath}-->public/ins_page.tpl"}-->

<block name="content">
		<div class="page-header">
	<h1>菜单管理</h1>
</div>
	<form id="form_search" name="form_search" method="post" action="">
		<div class="operate panel panel-default">
			<div class="panel-body">
				<div class="pull-left">
					<select name="eq_pid" id="eq_pid" class="form-control col-10" onchange="submit_search();">
                                              <!--{foreach $groupList as $volist}-->
                                                      <option value="<!--{$volist.id}-->" <!--{if $volist.id==$eq_pid}-->selected<!--{/if}-->><!--{$volist.name}--></option>
                                                <!--{/foreach}-->	
					</select>
				</div>
				<div class="pull-right">
					<a onclick="add();" class="btn btn-sm btn-primary">新增</a>
					<a onclick="save();"  class="btn btn-sm btn-primary">保存</a>
					|
					<a onclick="del();"  class="btn btn-sm btn-danger">删除</a>
				</div>
			</div>
		</div>
	</form>
	<div class="row">
		<div class="col-sm-4 sub_left_menu">
			<div class="well">
				<!--{$menu}-->
			</div>
		</div>
		<div class="col-sm-8 sub_content">
			<form id="form_data" name="form_data" method="post" class="well form-horizontal clearfix">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="ajax" id="ajax" value="1">
				<input type="hidden" name="opmode" id="opmode" value="">
				<select name="node_list" id="node_list" class="hidden">
                                        <!--{foreach $node_list as $volist}-->
                                                      <option value="<!--{$volist.id}-->" <!--{if $volist.id==$eq_pid}-->selected<!--{/if}-->><!--{$volist.name}--></option>
                                        <!--{/foreach}-->
				</select>
				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="name">名称*：</label>
					<div class="col-sm-8">
						<input class="form-control" type="text" id="name" name="name" check="require" msg="请输入名称">
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="url">地址：</label>
					<div class="col-sm-8">
						<input class="form-control" type="text" id="url" name="url">
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="url">父节点：</label>
					<div class="col-sm-8">
						<div class="input-group">
							<input name="node_name" class="form-control val" id="node_name" type="text"  readonly="readonly"/>
							<input name="pid"  id="pid" type="hidden" msg="请选择父节点" check="require"  />
							<span class="input-group-btn">
								<button class="btn btn-sm btn-primary" onclick="select_pid()" type="button">
									选择
								</button> </span>
						</div>
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="icon">图标：</label>
					<div class="col-sm-8">
						<input class="form-control" type="text" id="icon" name="icon" ><br/>
                                                <span style="color: gray;">此处为矢量图标,从<a href='http://fontawesome.dashgame.com/' target='_black' style="color: orange;">图标库</a>选择合适的图标,标准格式:fa fa-选择的图标</span>
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="badge_function">统计函数：</label>
					<div class="col-sm-8">
						<input class="form-control" type="text" id="badge_function" name="badge_function" >
					</div>
				</div>
				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="sort">排序：</label>
					<div class="col-sm-8">
						<input class="form-control" type="text" id="sort" name="sort" >
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="is_del">状态*：</label>
					<div class="col-sm-8">
						<select   name="is_del" id="is_del" class="form-control">
							<option  value="0">启用</option>
							<option value="1">禁用</option>
						</select>
					</div>
				</div>

				<div class="form-group col-xs-12">
					<label class="col-sm-4 control-label" for="remark" >备注：</label>
					<div class="col-sm-8" >
						<textarea class="form-control" id='remark' name="remark" rows="5" class="col-xs-12" ></textarea>
					</div>
				</div>
			</form>
		</div>
	</div>
</block>

					
				</div>
			</div>
		</div>
		<!--<iframe src="{:U('push/client')}" class="push" id="push"></iframe>-->
		<!-- Mainly scripts -->
		<script src="<!--{$oapath}-->Ins/js/jquery-2.1.1.js"></script>
		<script src="<!--{$oapath}-->Ins/js/bootstrap.min.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/metisMenu/jquery.metisMenu.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<!-- Custom and plugin javascript -->
		<script src="<!--{$oapath}-->Ins/js/inspinia.js"></script>
		<script src="<!--{$oapath}-->Ins/js/common.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/pace/pace.min.js"></script>
                
		<script src="<!--{$oapath}-->Ins/js/plugins/toastr/toastr.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/gritter/jquery.gritter.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/bootbox/bootbox.min.js"></script>
		<include file="Layout:ins_plugin_js"/>
<block name="js">
	<script type="text/javascript">
		function add() {
			winopen("oa.php?c=Node&a=add",560, 470);
		};

		function del() {
			var vars = $("#form_data").serialize();
			ui_confirm('确定要删除吗?', function() {
				sendAjax("oa.php?c=Node&a=del", vars, function(data) {
					if (data.status) {
						ui_alert(data.info, function() {
							$("#form_search").submit();
						});
					} else {
						ui_alert(data.info, function() {
						});
					}
				});
			});
		}

		function save() {
			sendForm("form_data", "oa.php?c=Node&a=save", fix_url("oa.php?c=Node?eq_pid=<!--{$eq_pid}-->"));
		}

		function select_pid() {
			winopen("oa.php?c=Node&a=winpop",560, 470);
		}

		function showdata(result) {
			for (var s in result.data) {
				set_val(s, result.data[s]);
			}
			$("#node_name").val($("#node_list option[value='" + $("#pid").val() + "']").text());
			$("#opmode").val("edit");
		}


		$(document).ready(function() {
			set_return_url();
			set_val('eq_pid', '<!--{$eq_pid}-->');
			$(".sub_left_menu .tree_menu a").click(function() {
				$(".sub_left_menu .tree_menu  a").each(function() {
					$(this).attr("class", "");
				});
				$(this).attr("class", "active");
				sendAjax("oa.php?c=Node&a=read", "id=" + $(this).attr("node"), function(data) {
					showdata(data);
				});
				return false;
			});
			sendAjax("oa.php?c=Node&a=read", "id=<!--{$eq_pid}-->", function(data) {
				showdata(data);
			});
		});

	</script>

</block>
	</body>
</html>
