{{:ModuleInclude('public/header')}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
        <!-- nav start -->
        {{:ModuleInclude('public/admin_nav', [
            'title'     => MyLang('admin.base_nav_title').(empty($data['id']) ? MyLang('created_title') : MyLang('edit_title')),
            'back_url'  => $is_setup == 1 ? '' : MyUrl('admin/admin/index', $form_back_params),
        ])}}
        <!-- nav end -->
        <!-- form start -->
        <form class="am-form form-validation am-form-full-screen am-form-popup-sticky" action="{{:MyUrl('admin/admin/save')}}" method="POST" request-type="ajax-{{if $is_setup eq 1}}view{{else /}}url{{/if}}" request-value="{{:MyUrl('admin/admin/index', $form_back_params)}}">
            <div class="am-form-group am-form-file">
                <label class="am-block">{{:MyLang('common_service.admin.form_item_avatar')}}</label>
                <div class="am-form-file-upload-container">
                    <ul class="plug-file-upload-view avatar-images-view" data-form-name="avatar" data-max-number="1" data-dialog-type="images" data-is-eye="1">
                        <li class="plug-file-upload-submit" data-view-tag="ul.avatar-images-view">
                            {{if empty($data['avatar'])}}
                                <i class="iconfont icon-add"></i>
                            {{else /}}
                                <input type="text" name="avatar" value="{{$data.avatar}}" />
                                <img src="{{$data.avatar}}" />
                                <i class="iconfont icon-close"></i>
                                <i class="iconfont icon-eye"></i>
                            {{/if}}
                        </li>
                    </ul>
                </div>
            </div>
            <div class="am-form-group">
                <label>{{:MyLang('common_service.admin.form_item_username')}}{{if empty($data)}}<span class="am-form-group-label-tips-must">*</span>{{/if}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{if empty($data)}}{{:MyLang('common_service.admin.form_item_username_created_tips')}}{{else /}}{{:MyLang('common_service.admin.form_item_username_edit_tips')}}{{/if}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                <input type="text" name="username" placeholder="{{:MyLang('common_service.admin.form_item_username_message')}}" pattern="{{:MyConst('common_regex_username')}}" data-validation-message="{{:MyLang('common_service.admin.form_item_username_message')}}" class="am-radius" {{if !empty($data['username'])}}value="{{$data.username}}" disabled{{/if}} required />
            </div>
            <div class="am-form-group">
                <label>{{:MyLang('common_service.admin.form_item_password')}}{{if empty($data)}}<span class="am-form-group-label-tips-must">*</span>{{else /}}<span class="am-form-group-label-tips">{{:MyLang('common_service.admin.form_item_password_edit_tips')}}</span>{{/if}}</label>
                <input type="password" name="login_pwd" placeholder="{{:MyLang('common_service.admin.form_item_password')}}" pattern="{{:MyConst('common_regex_pwd')}}"  data-validation-message="{{:MyLang('common_service.admin.form_item_password_message')}}" class="am-radius" autocomplete="off" {{if empty($data)}}required{{/if}} />
            </div>
            <div class="am-form-group">
                <label>{{:MyLang('common_service.admin.form_item_mobile')}}</label>
                <input type="text" name="mobile" placeholder="{{:MyLang('common_service.admin.form_item_mobile')}}" pattern="{{:MyConst('common_regex_mobile')}}" data-validation-message="{{:MyLang('common_service.admin.form_item_mobile_message')}}" class="am-radius" {{if !empty($data['mobile'])}}value="{{$data.mobile}}"{{/if}} />
            </div>
            <div class="am-form-group">
                <label>{{:MyLang('common_service.admin.form_item_email')}}</label>
                <input type="email" name="email" placeholder="{{:MyLang('common_service.admin.form_item_email')}}" maxlength="60" data-validation-message="{{:MyLang('common_service.admin.form_item_email_message')}}" class="am-radius" value="{{if !empty($data['email'])}}{{$data.email}}{{/if}}" />
            </div>
            {{if !isset($data['id']) or $admin['id'] neq $data['id']}}
                <div class="am-form-group">
                    <label>{{:MyLang('common_service.admin.form_item_role')}}<span class="am-form-group-label-tips-must">*</span></label>
                    <select class="am-radius chosen-select" name="role_id" data-validation-message="{{:MyLang('common_service.admin.form_item_role_message')}}" required>
                        <option value="">{{:MyLang('optional_tips')}}</option>
                        {{foreach $role_list 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}}
            {{:ModuleInclude('lib/gender')}}
            <div class="am-form-group">
                <label>{{:MyLang('common_service.admin.form_item_status')}}<span class="am-form-group-label-tips-must">*</span></label>
                <div class="am-radio-group">
                    {{foreach :MyConst('common_admin_status_list') as $v}}
                        <label class="am-radio-inline am-margin-right-sm">
                            <input type="radio" name="status" value="{{$v.value}}" {{if isset($data['status']) and $data['status'] eq $v['value']}}checked="checked"{{else /}}{{if !isset($data['status']) and isset($v['checked']) and $v['checked'] eq true}}checked="checked"{{/if}}{{/if}} data-am-ucheck /> {{$v.name}}
                        </label>
                    {{/foreach}}
                </div>
            </div>

            <!-- 插件扩展数据 start -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_admin_save</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_admin_admin_save_data) and is_array($plugins_view_admin_admin_save_data)}}
                <div class="card-grey">
                    <label class="am-text-sm am-text-warning">{{:MyLang('plugins_view_region_config_tips')}}</label>
                    <div>
                        {{foreach $plugins_view_admin_admin_save_data as $hook}}
                            {{if is_string($hook) or is_int($hook)}}
                                {{$hook|raw}}
                            {{/if}}
                        {{/foreach}}
                    </div>
                </div>
            {{/if}}
            <!-- 插件扩展数据 end -->
            
            <div class="am-form-popup-submit">
                <input type="hidden" name="id" {{if !empty($data['id'])}}value="{{$data.id}}"{{/if}} />
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('save_title')}}</span>
                </button>
            </div>
        </form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{:ModuleInclude('public/footer')}}