{{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/brand/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/brand/index', $params)}}" enctype="multipart/form-data">
			<legend>
				<span class="am-text-default">品牌{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
				<a href="{{:MyUrl('admin/brand/index', $params)}}" class="am-fr am-text-sm am-margin-top-sm am-icon-mail-reply"> 返回</a>
			</legend>
			<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['name'])}} value="{{$data.name}}"{{/if}} required />
			</div>
			<div class="am-form-group">
				<label>品牌分类</label>
			    <select name="brand_category_id" class="am-radius chosen-select" multiple="multiple" minchecked="1" data-placeholder="可选择..." data-validation-message="请选择品牌分类" required>
					{{foreach $brand_category as $v}}
						<option value="{{$v.id}}" {{if isset($data['brand_category_ids']) and is_array($data['brand_category_ids']) and in_array($v['id'], $data['brand_category_ids'])}}selected{{/if}}>{{$v.name}}</option>
					{{/foreach}}
				</select>
			</div>

			<div class="am-form-group">
				<label>官网地址<span class="am-form-group-label-tips">带http://或https://</span></label>
				<input type="url" placeholder="官网地址" name="website_url"  data-validation-message="官网地址格式有误" class="am-radius" {{if !empty($data['website_url'])}} value="{{$data.website_url}}"{{/if}} />
			</div>

			<div class="am-form-group">
				<label>描述</label>
				<textarea rows="5" name="describe" maxlength="230" class="am-radius" placeholder="描述" data-validation-message="描述最多230个字符">{{if !empty($data['describe'])}} {{$data.describe}}{{/if}}</textarea>
			</div>

			<div class="am-form-group am-form-file">
				<label class="block">LOGO<span class="am-form-group-label-tips">建议150x50像素</span></label>
				<ul class="plug-file-upload-view brand-logo-images-view" data-form-name="logo" data-max-number="1" data-dialog-type="images">
					{{if !empty($data['logo'])}}
						<li>
							<input type="text" name="logo" value="{{$data.logo}}" />
							<img src="{{$data.logo}}" />
							<i>×</i>
						</li>
					{{/if}}
				</ul>
				<div class="plug-file-upload-submit" data-view-tag="ul.brand-logo-images-view">+上传图片</div>
			</div>
			<div class="am-form-group">
				<label>顺序</label>
				<input type="number" placeholder="顺序" name="sort" min="0" max="255" data-validation-message="顺序 0~255 之间的数值" class="am-radius" value="{{if isset($data['sort'])}}{{$data.sort}}{{else /}}0{{/if}}" required />
			</div>
			<div class="am-form-group">
			    <label class="block">是否启用</label>
			    <input name="is_enable" 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_enable']) and $data['is_enable'] eq 1) or !isset($data['is_enable'])}}checked="true"{{/if}} />
			</div>

			<!-- 插件扩展数据 start -->
			{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_brand_save</span>
                </div>
            {{/if}}
			{{if !empty($plugins_view_admin_brand_save_data) and is_array($plugins_view_admin_brand_save_data)}}
				<div class="am-alert am-alert-secondary">
					<label class="am-text-sm am-text-warning">该区域为插件扩展数据，请按照插件文档填写相应的值</label>
					<div>
						{{foreach $plugins_view_admin_brand_save_data as $hook}}
		                    {{if is_string($hook) or is_int($hook)}}
		                        {{$hook|raw}}
		                    {{/if}}
		                {{/foreach}}
					</div>
				</div>
			{{/if}}
			<!-- 插件扩展数据 end -->

			<div class="am-alert am-alert-secondary">
				{{include file="lib/seo" /}}
			</div>

			<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
				<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
				<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 -->