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

<block name="content">
<input type="hidden" name="ajax" id="ajax" value="0">
<div class="page-header">
	<h1>分组管理</h1>
</div><div class="operate panel panel-default">
	<div class="panel-body">
		<div class="pull-left">
			<a href="oa.php?c=Contact" class="btn btn-sm btn-primary">返回</a>
		</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>
			&nbsp;|&nbsp;
			<a onclick="del()" class="btn btn-sm btn-danger">删除</a>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-sm-4 sub_left_menu ">
		<div class="well">
			<!--{$menu}-->
		</div>
	</div>
	<div class="col-sm-8 ">
		<form id="form_data" name="form_data" method="post" class="form-horizontal well">
			<input type="hidden" name="id" id="id">
			<input type="hidden" name="pid" id="pid" >
			<input type="hidden" name="opmode" id="opmode" value="">
			
			<div class="form-group">
				<label class="col-sm-4 control-label" for="name">名称：</label>
				<div class="col-sm-8">
					<input type="text" id="name" name="name" check="require" msg="请输入名称" class="form-control">
				</div>
			</div>
			<!--
				<div class="form-group">
					<label class="col-sm-4 control-label" for="tag_name">父节点*：</label>
					<div class="col-sm-8">
						<div class="input-group">
							<input name="tag_name" class="form-control" id="tag_name" type="text" readonly="readonly"/>
							<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">
				<label class="col-sm-4 control-label" for="sort">排序：</label>
				<div class="col-sm-8">
					<input type="text" id="sort" name="sort" class="form-control">
				</div>
			</div>
			<div class="form-group">
				<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 col-10">
						<option  value="0">启用</option>
						<option value="1">禁用</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-4 control-label" for="remark">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" class="col-xs-12 form-control"></textarea>
				</div>
			</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(){
		$("#opmode").val("add");
		$("#id").val("");
		sendForm("form_data","oa.php?c=Contact&a=add_tag", "");
	};

	function del(){
		ui_confirm('相应的子目录也会自动删除,真的要删除吗?',function(){
			sendForm("form_data", "oa.php?c=Contact&a=del_tag", "");
		});
	}

	function save() {
		
			sendForm("form_data", "oa.php?c=Contact&a=save_tag", "");
		
	};

	function showdata(result) {
		for (var s in result.data) {
                    
			set_val(s, result.data[s]);
		}
		$("#opmode").val("edit");
	}

	function select_pid() {
		winopen("{:U('user_tag/winpop','controller='.CONTROLLER_NAME)}",560, 470);
	}


	$(document).ready(function() {
		$(".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=Contact&a=tag_read", "id=" + $(this).attr("node"), function(data) {
				showdata(data);
			});
			return false;
		});
	}); 
</script>
</block>
	</body>
</html>
