<title>管理员</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>系统设置</cite></a>
    <a><cite>管理员</cite></a>
  </div>
</div>

<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-card-header">管理员</div>
    <div class="layui-card-body">
      <div style="padding-bottom: 10px;">
        <a href="#J_view" class="layui-btn J_popup" title="添加管理员"><i class="layui-icon layui-icon-add-circle"></i>添加管理员</a>
      </div>
      
      <table id="J_table_list" lay-filter="J_table_list"></table>

    </div>
  </div>
</div>

<script type="text/html" id="status_tpl">
  {{# if(d.status==1){ }}
    <span style="color: #5FB878;">正常</span>
  {{# }else{ }}
    <span style="color: #FF5722;">禁止</span>
  {{# } }}
</script> 

<script type="text/html" id="J_table_tool">
	{{# if(d.roles.type=='system'){ }}
  <button type="button" class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>编辑</button>
  <button type="button" class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</button>
	{{# }else{ }}
  <a href="#J_view" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="popup" title="编辑角色"><i class="layui-icon layui-icon-edit"></i>编辑</a>
  <a href="founder/remove" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="req" title="确定要删除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
	{{# } }}
</script>

<script>
;!function(){
  var $ = layui.$
  ,laydate = layui.laydate
  ,table = layui.table;

  //执行渲染
table.render({
  elem: '#J_table_list'
  ,url: '{:url('/founder/list')}'
  ,cols: [[
      {field:'username',title:'用户名',width:200}
      ,{field:'rolename',title:'管理组',width:200}
      ,{field:'status',title:'状况',align:'center',width:100,templet:'#status_tpl'}
      ,{title:'操作',minWidth:120,toolbar:'#J_table_tool'}
  ]]
  ,page: true
  ,limit: 20
  ,height: 'auto'
  ,text: {
    none: '暂无数据！'
  }
});

}();
</script>

<script type="text/html" id="J_view">
<form class="layui-form" action="{:url('/founder/dorun')}" method="post">
  <input type="hidden" name="id" value="{{d.id || 0}}">
  
            <div class="layui-form-item">
              <label class="layui-form-label">角色</label>
              <div class="layui-input-inline">
                <select name="role">
                  {volist name="role" id="item"}
                  <option value="{$item.id}" {{ d.group_id=={$item.id} ? 'selected="selected"' : '' }}>{$item.name}</option>
                  {/volist}
                </select>
              </div>
            </div>
            
            <div class="layui-form-item">
              <label class="layui-form-label">用户名</label>
              <div class="layui-input-inline">
                <input type="text" name="username" value="{{d.username || ''}}" lay-verify="required" autocomplete="off" class="layui-input">
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">邮箱</label>
              <div class="layui-input-inline">
                <input type="text" name="email" value="{{d.email || ''}}" lay-verify="required|email" autocomplete="off" class="layui-input">
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">密码</label>
              <div class="layui-input-inline">
                <input type="text" name="password" value="" autocomplete="off" class="layui-input">
              </div>
            </div>
            
             <div class="layui-form-item">
              <label class="layui-form-label">状态</label>
              <div class="layui-input-inline">
                <input type="radio" name="status" value="1" title="正常" {{ d.status==1 ? 'checked' : (typeof d.status==='undefined'&&'checked') }}>
                <input type="radio" name="status" value="0" title="禁止" {{ d.status==0 ? 'checked' : '' }}>
              </div>
            </div>
            
            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="J_ajax_submit_btn"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
              </div>
            </div>
            
</form>
</script>