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

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/goodsparamstemplate/save')}}" method="POST" request-type="ajax-reload" request-value="parent">
			
            <div class="am-form-group row">
                <label>{{:MyLang('common_service.goodsparamstemplate.form_item_name')}}<span class="am-form-group-label-tips-must">*</span></label>
                <input type="text" name="name" placeholder="{{:MyLang('common_service.goodsparamstemplate.form_item_name_message')}}" minlength="1" maxlength="80" data-validation-message="{{:MyLang('common_service.goodsparamstemplate.form_item_name_message')}}" class="am-radius" {{if !empty($data['name'])}} value="{{$data.name}}"{{/if}} required />
            </div>
            <div class="am-form-group row">
                <label class="am-block">
                    {{:MyLang('common_service.goodsparamstemplate.form_item_category_id')}}
                    <span class="am-form-group-label-tips-must">*</span>
                    <a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.goodsparamstemplate.form_item_category_id_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a>
                </label>
                <select name="category_id" class="am-radius chosen-select" data-placeholder="{{:MyLang('please_select_tips')}}" data-validation-message="{{:MyLang('common_service.goodsparamstemplate.form_item_category_id_message')}}" required>
                    {{if !empty($goods_category_list)}}
                        <option value="">{{:MyLang('please_select_tips')}}</option>
                        {{foreach $goods_category_list as $v}}
                            <option value="{{$v.id}}" {{if isset($data['category_id']) and $data['category_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
                            {{if !empty($v['items'])}}
                                {{foreach $v.items as $vs}}
                                    <option style="padding-left: 20px;" value="{{$vs.id}}" {{if isset($data['category_id']) and $data['category_id'] eq $vs['id']}}selected{{/if}}>{{if empty($vs['items'])}}├{{else /}}└{{/if}}² {{$vs.name}}</option>
                                    {{if !empty($vs['items'])}}
                                        {{foreach $vs.items as $kss=>$vss}}
                                            <option style="padding-left: 40px;" value="{{$vss.id}}" {{if isset($data['category_id']) and $data['category_id'] eq $vss['id']}}selected{{/if}}>{{if $kss eq count($vs['items'])-1}}└{{else /}}├{{/if}}³ {{$vss.name}}</option>
                                        {{/foreach}}
                                    {{/if}}
                                {{/foreach}}
                            {{/if}}
                        {{/foreach}}
                    {{/if}}
                </select>
            </div>
            {{:ModuleInclude('lib/is_enable', ['is_row'=>1])}}

			<div class="am-form-group row am-padding-bottom-0">
                <label class="am-block">
                    {{:MyLang('common_service.goodsparamstemplate.form_item_config_title')}}
                    <span class="am-form-group-label-tips-must">*</span>
                    <a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.goodsparamstemplate.form_item_config_list_content_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a>
                </label>
                <div>
                    <!-- 通过配置生成商品参数 -->
                    <div class="am-dropdown" id="parameters-quick-container" data-am-dropdown>
                        <span class="business-operations-submit am-dropdown-toggle parameters-quick-add">
                            <span>{{:MyLang('common_service.goodsparamstemplate.form_item_config_template_title')}}</span>
                            <i class="am-icon-angle-down am-margin-left-xs"></i>
                        </span>
                        <div class="am-dropdown-content am-radius parameters-quick-config">
                            <textarea class="am-radius" rows="5" placeholder="{{:MyLang('common_service.goodsparamstemplate.form_item_config_value_placeholder')}}"></textarea>
                            <button type="button" class="am-btn am-btn-primary am-btn-xs am-radius am-btn-block am-margin-top-sm">{{:MyLang('confirm_title')}}</button>
                        </div>
                    </div>
                    <!-- 复制操作 -->
                    <span class="business-operations-submit am-margin-left-sm parameters-quick-copy">
                        <i class="am-icon-copy"></i>
                        <span>{{:MyLang('common_service.goodsparamstemplate.form_item_config_copy_title')}}</span>
                    </span>
                    <!-- 清空操作 -->
                    <span class="business-operations-submit am-margin-left-sm parameters-quick-remove">
                        <i class="am-icon-times"></i>
                        <span>{{:MyLang('common_service.goodsparamstemplate.form_item_config_empty_title')}}</span>
                    </span>
                </div>
			</div>
            <div class="am-form-group am-margin-top-sm">
                {{:ModuleInclude('public/goodsparamstemplate/table')}}
                {{:ModuleInclude('public/goodsparamstemplate/tips')}}
            </div>
			<!-- 插件扩展数据 start -->
			{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_goods_params_template_save</span>
                </div>
            {{/if}}
			{{if !empty($plugins_view_admin_goods_params_template_save_data) and is_array($plugins_view_admin_goods_params_template_save_data)}}
				<div class="am-alert am-alert-secondary">
					<label class="am-text-sm am-text-warning">{{:MyLang('plugins_view_region_config_tips')}}</label>
					<div>
						{{foreach $plugins_view_admin_goods_params_template_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 am-text-left">
				<input type="hidden" name="id" {{if !empty($data['id'])}} value="{{$data.id}}"{{/if}} />
				<button type="button" class="am-btn am-btn-warning am-radius am-btn-xs" data-am-modal-close>
                    <i class="am-icon-paint-brush"></i>
                    <span>{{:MyLang('cancel_title')}}</span>
                </button>
                <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')}}