{{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/article/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/article/index', $params)}}">
			<legend>
				<span class="am-text-default">文章{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
				<a href="{{:MyUrl('admin/article/index', $params)}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
			</legend>
			<div class="am-form-group">
				<label>标题</label>
				<div class="am-input-group am-input-group-sm">
					<input type="hidden" name="title_color" value="{{if !empty($data['title_color'])}}{{$data.title_color}}{{/if}}" />
					<input type="text" name="title" placeholder="标题" minlength="2" maxlength="60" data-validation-message="标题长度 2~60 个字符" class="am-form-field am-radius" {{if !empty($data)}} value="{{$data.title}}" {{/if}} {{if !empty($data['title_color'])}} style="color:{{$data.title_color}};" {{/if}} required />
					<span class="am-input-group-btn">
						<button class="am-btn am-btn-default am-btn-xs colorpicker-submit" type="button" data-input-tag="input[name='title']" data-color-tag="input[name='title_color']">
							<img src="{{$attachment_host}}/static/common/images/colorpicker.png" />
						</button>
					</span>
				</div>
			</div>
			<div class="am-form-group">
				<label>文章分类</label>
				<select name="article_category_id" class="am-radius chosen-select" data-placeholder="可选择..." data-validation-message="请选择文章分类" required>
					<option value="">可选择...</option>
					{{foreach $article_category_list as $v}}
						<option value="{{$v.id}}" {{if isset($data['article_category_id']) and $data['article_category_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
					{{/foreach}}
				</select>
			</div>
			<div class="am-form-group">
				<label>跳转url地址<span class="am-form-group-label-tips">带http://或https://</span></label>
				<input type="url" name="jump_url" placeholder="跳转url地址" data-validation-message="跳转url地址格式有误" class="am-radius" {{if !empty($data)}} value="{{$data.jump_url}}"{{/if}} />
			</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 !empty($data) and $data['is_enable'] eq 1}}checked="true"{{/if}} />
			</div>
			<div class="am-form-group">
			    <label class="block">首页推荐</label>
			    <input name="is_home_recommended" 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 !empty($data) and $data['is_home_recommended'] eq 1}}checked="true"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>内容</label>
				<textarea class="am-radius am-validate" name="content" rows="5" minlength="10" maxlength="105000" {{if !IsMobile()}}id="editor-tag" data-url="{{:MyUrl('admin/ueditor/index', ['path_type'=>'article'])}}" placeholder="内容格式 10~105000 个字符之间" {{else /}} placeholder="内容格式 10~105000 个字符之间更多编辑功能请使用电脑访问" {{/if}} data-validation-message="内容格式 10~105000 个字符之间" required>{{if !empty($data)}}{{$data.content}}{{/if}}</textarea>
			</div>

			<!-- 插件扩展数据 start -->
			{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_article_save</span>
                </div>
            {{/if}}
			{{if !empty($plugins_view_admin_article_save_data) and is_array($plugins_view_admin_article_save_data)}}
				<div class="am-alert am-alert-secondary">
					<label class="am-text-sm am-text-warning">该区域为插件扩展数据，请按照插件文档填写相应的值</label>
					<div>
						{{foreach $plugins_view_admin_article_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 -->