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

<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	       <div class="page-header">
                <h1>权限组管理</h1>
        </div>
	<div class="operate panel panel-default">
		<div class="panel-body">
			<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>
	<div class="row">
		<div class="col-sm-4 sub_left_menu ">
			<table class="table table-bordered">
				<thead>
					<tr>
						<th>名称</th>
						<th>状态</th>
					</tr>
				</thead>
				<tbody>
					<!--{foreach $list as  $key=>$parent}-->
						<tr id="<!--{$parent.id}-->">
							<td><!--{$parent.name}--></td>
							<td>
                                                            <!--{if $parent.is_del=='0'}--> 
                                                                        启用
                                                           <!--{else}-->
                                                                        禁用
                                                            <!--{/if}-->
                                                        </td>
						</tr>
				 <!--{/foreach}-->
				</tbody>
			</table>
		</div>
		<div class="col-sm-8 last 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="0">
				<input type="hidden" name="opmode" id="opmode" value="">
				<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="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  class="form-control" name="is_del" id="is_del">
							<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" name="remark" id="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=Role&a=add?controller=<!--{$controller}-->",560, 470);
                 };

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

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

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

		$(document).ready(function() {
			set_return_url();
			$(".sub_left_menu tbody tr").click(function() {
				$(".sub_left_menu  tr.active").removeClass("active");
				$(this).attr("class", "active");
				sendAjax("oa.php?c=Role&a=read", "id=" + $(this).attr("id"), function(data) {
					showdata(data);
				});
				return false;
			});
		});
	</script>
</block>
	</body>
</html>
