{{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/pluginsadmin/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/pluginsadmin/index')}}" enctype="multipart/form-data">
            <legend>
                <span class="am-text-default">应用{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
                <a href="{{:MyUrl('admin/pluginsadmin/index')}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
            </legend>

            <div class="am-form-group">
                <label>应用唯一标记<span class="am-form-group-label-tips">以数字、字母小写、下划线</span></label>
                <input type="text" name="plugins" placeholder="名称" minlength="2" maxlength="60" data-validation-message="应用唯一标记格式 2~60 个字符" pattern="^[a-z0-9_]{2,60}$" class="am-radius" {{if !empty($plugins)}} value="{{$plugins}}"{{/if}} readonly="true" required />
            </div>

            <div class="am-form-group am-form-file">
                <label class="block">LOGO<span class="am-form-group-label-tips">建议600x600px</span></label>
                <ul class="plug-file-upload-view plugins-logo-view" data-form-name="logo" data-max-number="1" data-delete="0" data-dialog-type="images">
                    <li>
                        <input type="text" name="logo" value="{{if !empty($data['logo_old'])}}{{$data.logo_old}}{{/if}}" data-validation-message="请上传图片" required />
                        <img src="{{if !empty($data['logo'])}}{{$data.logo}}{{else /}}{{$attachment_host}}/static/admin/default/images/default-images.jpg{{/if}}" />
                    </li>
                </ul>
                <div class="plug-file-upload-submit" data-view-tag="ul.plugins-logo-view">+上传图片</div>
            </div>

            <div class="am-form-group">
                <label>名称</label>
                <input type="text" name="name" placeholder="名称" minlength="2" maxlength="30" data-validation-message="名称格式 2~30 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.name}}"{{/if}} required />
            </div>

            <div class="am-form-group">
                <label>作者</label>
                <input type="text" name="author" placeholder="作者" minlength="2" maxlength="30" data-validation-message="作者格式 2~30 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.author}}"{{/if}} required />
            </div>

            <div class="am-form-group">
                <label>作者主页<span class="am-form-group-label-tips">带http://或https://</span></label>
                <input type="url" placeholder="作者主页" name="author_url"  data-validation-message="请填写作者主页" class="am-radius" {{if !empty($data)}} value="{{$data.author_url}}"{{/if}} required />
            </div>

            <div class="am-form-group">
                <label>版本<span class="am-form-group-label-tips">主版本.次版本号.修订号，每个段不超过6位，如 1.0.0</span></label>
                <input type="text" name="version" placeholder="版本" minlength="5" maxlength="18" data-validation-message="版本格式有误" pattern="{{:lang('common_regex_version')}}" class="am-radius" {{if !empty($data)}} value="{{$data.version}}"{{/if}} required />
            </div>

            <div class="am-form-group am-form-file">
                <label class="block">描述</label>
                <textarea rows="3" name="desc" class="am-radius am-field-valid" placeholder="描述" minlength="2" maxlength="60" data-validation-message="描述内容格式 2~60 个字符">{{if !empty($data['desc'])}}{{$data.desc}}{{/if}}</textarea>
            </div>

            <div class="am-form-group">
                <label>适用终端</label>
                <select name="apply_terminal" class="am-radius chosen-select" multiple="multiple" minchecked="1" data-placeholder="可选择..." data-validation-message="至少选择一个适用终端" required>
                    {{foreach :lang('common_platform_type') as $v}}
                        <option value="{{$v.value}}" {{if isset($data['apply_terminal']) and in_array($v['value'], $data['apply_terminal'])}}selected{{/if}}>{{$v.name}}</option>
                    {{/foreach}}
                </select>
            </div>

            <div class="am-form-group">
                <label>适用系统版本</label>
                <select name="apply_version" class="am-radius chosen-select" multiple="multiple" minchecked="1" data-placeholder="可选择..." data-validation-message="至少选择一个适用系统版本" required>
                    {{foreach :lang('common_system_version_list') as $v}}
                        <option value="{{$v.value}}" {{if isset($data['apply_version']) and in_array($v['value'], $data['apply_version'])}}selected{{/if}}>{{$v.name}}</option>
                    {{/foreach}}
                </select>
            </div>

            <div class="am-form-group">
                <label class="block">是否有前端入口<span class="am-form-group-label-tips">前端独立页面入口</span></label>
                <input name="is_home" value="1" type="checkbox" data-off-text="没有" data-on-text="有" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if isset($data['is_home']) and $data['is_home'] eq 1}}checked="true"{{/if}} />
            </div>

            <div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
                <button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
            </div>
        </form>
        <!-- form end -->
    </div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->