{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation view-save" action="{{:MyUrl('admin/admin/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/admin/index')}}">
			<legend>
				<span class="fs-16">
					{{if empty($data['id'])}}
						管理员添加
					{{else /}}
						管理员编辑
					{{/if}}
				</span>
				<a href="{{:MyUrl('admin/admin/index')}}" class="fr fs-14 m-t-5 am-icon-mail-reply"> 返回</a>
			</legend>
			<div class="am-form-group">
				<label>用户名</label>
				<input type="text" placeholder="用户名" name="username" pattern="{{:lang('common_regex_username')}}" data-validation-message="用户名格式 5~18 个字符（可以是字母数字下划线）" class="am-radius" {{if !empty($data)}}value="{{$data.username}}" disabled{{/if}} required />
			</div>
			<div class="am-form-group">
				<label>登录密码</label>
				<input type="password" placeholder="登录密码" name="login_pwd" pattern="{{:lang('common_regex_pwd')}}"  data-validation-message="密码格式 6~18 个字符" class="am-radius" {{if empty($data)}}required{{/if}} />
			</div>
			<div class="am-form-group">
				<label>手机号码</label>
				<input type="text" placeholder="手机号码" name="mobile" pattern="{{:lang('common_regex_mobile')}}" data-validation-message="手机号码格式错误" class="am-radius" {{if !empty($data)}}value="{{$data.mobile}}"{{/if}} />
			</div>
			{{if !isset($data['id']) or $admin['id'] neq $data['id']}}
				<div class="am-form-group">
					<label>权限组</label>
					<select  class="am-radius c-p" name="role_id" data-validation-message="请选择所属角色组" required>
						<option value="">可选择...</option>
						{{foreach $role as $v}}
							<option value="{{$v.id}}" {{if isset($data['role_id']) and $data['role_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
						{{/foreach}}
					</select>
				</div>
			{{/if}}
			{{include file="lib/gender" /}}
			<div class="am-form-group">
				<input type="hidden" name="id" {{if !empty($data['id'])}}value="{{$data.id}}"{{/if}} />
				<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">保存</button>
			</div>
		</form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->
		
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->