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

<!-- right content start  -->
<div class="content-right">
	<div class="content">
        {{if AdminIsPower('goodscategory', 'save')}}
            <!-- operation start -->
            <div class="am-flex am-flex-justify-between am-flex-items-center am-gap-2">
                <button class="am-btn am-btn-primary am-radius am-btn-xs tree-submit-add" data-am-modal="{target: '#data-save-win'}">
                    <i class="iconfont icon-add am-show-sm-only"></i>
                    <span>{{:MyLang('add_title')}}</span>
                </button>
            </div>
            <!-- operation end -->

            <!-- save win start -->
            <div class="am-popup am-radius" id="data-save-win">
                <div class="am-popup-inner">
                    <div class="am-popup-hd">
                        <h4 class="am-popup-title" data-add-title="{{:MyLang('goodscategory.base_nav_title')}}{{:MyLang('add_title')}}" data-edit-title="{{:MyLang('goodscategory.base_nav_title')}}{{:MyLang('edit_title')}}">{{:MyLang('goodscategory.base_nav_title')}}{{:MyLang('add_title')}}</h4>
                        <span data-am-modal-close class="am-close">&times;</span>
                    </div>
                    <div class="am-popup-bd">
                        <!-- form start -->
                        <form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/goodscategory/save')}}" method="POST" request-type="ajax-fun" request-value="TreeFormSaveBack">
                            <div class="am-form-group row am-form-file">
                                <label class="am-block">{{:MyLang('common_service.goodscategory.form_item_icon')}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.goodscategory.form_item_icon_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                                <div class="am-form-file-upload-container">
                                    <ul class="plug-file-upload-view goods-category-icon-images-view" data-form-name="icon" data-max-number="1" data-dialog-type="images">
                                        <li class="plug-file-upload-submit" data-view-tag="ul.goods-category-icon-images-view">
                                            <i class="iconfont icon-add"></i>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="am-form-group row am-form-file">
                                <label class="am-block">{{:MyLang('common_service.goodscategory.form_item_icon_active')}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.goodscategory.form_item_icon_active_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                                <div class="am-form-file-upload-container">
                                    <ul class="plug-file-upload-view goods-category-icon-active-images-view" data-form-name="icon_active" data-max-number="1" data-dialog-type="images">
                                        <li class="plug-file-upload-submit" data-view-tag="ul.goods-category-icon-active-images-view">
                                            <i class="iconfont icon-add"></i>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="am-form-group row am-form-file">
                                <label class="am-block">{{:MyLang('common_service.goodscategory.form_item_realistic_images')}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.goodscategory.form_item_realistic_images_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                                <div class="am-form-file-upload-container">
                                    <ul class="plug-file-upload-view goods-category-realistic_images-images-view" data-form-name="realistic_images" data-max-number="1" data-dialog-type="images">
                                        <li class="plug-file-upload-submit" data-view-tag="ul.goods-category-realistic_images-images-view">
                                            <i class="iconfont icon-add"></i>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="am-form-group row am-form-file">
                                <label class="am-block">{{:MyLang('common_service.goodscategory.form_item_big_images')}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.goodscategory.form_item_big_images_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                                <div class="am-form-file-upload-container">
                                    <ul class="plug-file-upload-view goods-category-big_images-images-view" data-form-name="big_images" data-max-number="1" data-dialog-type="images">
                                        <li class="plug-file-upload-submit" data-view-tag="ul.goods-category-big_images-images-view">
                                            <i class="iconfont icon-add"></i>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.goodscategory.form_item_name')}}<span class="am-form-group-label-tips-must">*</span></label>
                                <input type="text" placeholder="{{:MyLang('common_service.goodscategory.form_item_name_message')}}" name="name" minlength="1" maxlength="60" data-validation-message="{{:MyLang('common_service.goodscategory.form_item_name_message')}}" class="am-radius" required />
                            </div>
                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.goodscategory.form_item_vice_name')}}</label>
                                <input type="text" placeholder="{{:MyLang('common_service.goodscategory.form_item_vice_name_message')}}" name="vice_name" minlength="0" maxlength="60" data-validation-message="{{:MyLang('common_service.goodscategory.form_item_vice_name_message')}}" class="am-radius" />
                            </div>
                            <div class="am-form-group row">
                                <label>{{:MyLang('common_service.goodscategory.form_item_describe')}}</label>
                                <textarea rows="1" name="describe" maxlength="200" class="am-radius" placeholder="{{:MyLang('common_service.goodscategory.form_item_describe_message')}}" data-validation-message="{{:MyLang('common_service.goodscategory.form_item_describe_message')}}"></textarea>
                            </div>
                            <div class="am-form-group row">
                                <label>{{:MyLang('form_bg_color_title')}}</label>
                                <div class="colorpicker-container">
                                    <input type="hidden" name="bg_color" value="" />
                                    <div class="colorpicker-submit" data-color-tag="input[name='bg_color']" data-color-style="background-color"></div>
                                    <img class="imitate-colorpicker-submit" src="{{:StaticAttachmentUrl('colorpicker.png')}}" width="24" height="24" />
                                </div>
                            </div>
                            {{:ModuleInclude('lib/sort', ['is_row'=>1])}}
                            <div class="am-form-group row">
                                <label class="am-block">{{:MyLang('common_service.goodscategory.form_item_is_home_recommended')}}</label>
                                <input name="is_home_recommended" value="1" type="checkbox" data-off-text="{{:MyLang('no_title')}}" data-on-text="{{:MyLang('yes_title')}}" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['is_home_recommended']) and $data['is_home_recommended'] eq 1) or !isset($data['is_home_recommended'])}}checked="true"{{/if}} />
                            </div>
                            {{:ModuleInclude('lib/is_enable', ['is_row'=>1])}}

                            {{:ModuleInclude('lib/seo', ['is_row'=>1])}}

                            <div class="am-form-popup-submit">
                                <input type="hidden" name="id" />
                                <input type="hidden" name="pid" value="0" />
                                <button type="button" class="am-btn am-btn-warning am-radius am-btn-xs am-margin-right-lg" 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>
            </div>
            <!-- save win end -->
        {{/if}}

        <!-- list start -->
        <div id="tree" class="am-margin-top-sm" data-head='[{"name":"ID","field":"id"},{"name":"{{:MyLang("name_title")}}","field":"name","is_arrow":"1","value_style":{"style":"color:#999","value_style_key":"is_enable","value_style_key_status":"0"}},{"name":"{{:MyLang("icon_title")}}","field":"icon","type":"img"},{"name":"{{:MyLang("form_is_enable_title")}}","field":"is_enable","type":"status"},{"name":"{{:MyLang("operate_title")}}","type":"operate"}]' data-additional='[{"field":"is_home_recommended", "value":"0", "type":"input"},{"field":"bg_color", "value":"", "type":"input"}, {"field":"bg_color", "value":"", "type":"css", "tag":".colorpicker-submit", "style":"background-color"}, {"field":"icon", "value":"", "type":"input"}, {"field":"icon", "value":"", "type":"annex", "tag":"ul.goods-category-icon-images-view", "style":"src"}, {"field":"icon_active", "value":"", "type":"input"}, {"field":"icon_active", "value":"", "type":"annex", "tag":"ul.goods-category-icon-active-images-view", "style":"src"}, {"field":"realistic_images", "value":"", "type":"input"}, {"field":"realistic_images", "value":"", "type":"annex", "tag":"ul.goods-category-realistic_images-images-view", "style":"src"}, {"field":"big_images", "value":"", "type":"input"}, {"field":"big_images", "value":"", "type":"annex", "tag":"ul.goods-category-big_images-images-view", "style":"src"}]' data-node-url="{{:MyUrl('admin/goodscategory/getnodeson')}}" data-del-url="{{if AdminIsPower('goodscategory', 'delete')}}{{:MyUrl('admin/goodscategory/delete')}}{{/if}}" data-status-url="{{if AdminIsPower('goodscategory', 'statusupdate')}}{{:MyUrl('admin/goodscategory/statusupdate')}}{{/if}}" data-popup-tag="#data-save-win" data-rank="3">
            {{:ModuleInclude('public/loading')}}
        </div>
        <!-- list end -->
	</div>
</div>
<!-- right content end -->

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

<script type="text/javascript">
	// 初始化
	Tree(0, $('#tree').data('node-url'), 0, 1);

	// 回调处理
	function TreeFormSaveBack(e)
	{
		TreeFormSaveBackHandle(e);
	}
</script>