<!-- 继承公共的 form -->
{{extend name="../../../module/view/form_table/form" /}}

<!-- 表单顶部操作栏 -->
{{block name="form_operate_top"}}
    <!-- 是否有添加编辑页面权限 -->
    {{if AdminIsPower('themedata', 'saveinfo') and !empty($theme_type_list) and is_array($theme_type_list)}}
        <div class="am-dropdown am-margin-right-sm" data-am-dropdown>
            <button type="button" class="am-btn am-btn-primary am-radius am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle>{{:MyLang('add_title')}} <span class="am-icon-caret-down"></span></button>
            <ul class="am-dropdown-content am-radius-lg">
                {{foreach $theme_type_list as $v}}
                    <li>
                        <a href="{{:MyUrl('admin/themedata/saveinfo', ['type'=>$v['value']])}}" class="am-text-primary am-text-left"> 
                            <i class="iconfont icon-add"></i>
                            <span>{{$v.name}}</span>
                        </a>
                    </li>
                {{/foreach}}
            </ul>
        </div>
    {{/if}}
    <!-- 导入 -->
    {{if AdminIsPower('themedata', 'upload')}}
        <button type="button" class="am-btn am-btn-default-plain am-btn-xs am-radius" data-am-modal="{target: '#popup-themedata-upload'}">
            <i class="iconfont icon-upload am-show-sm-only"></i>
            <span>{{:MyLang('import_title')}}</span>
        </button>
    {{/if}}
    <!-- 下载 -->
    {{if AdminIsPower('themedata', 'download')}}
        <button type="button" class="am-btn am-btn-default-plain am-btn-xs am-radius themedata-download-submit-all" data-url="{{:MyUrl('admin/themedata/download')}}">
            <i class="iconfont icon-download am-show-sm-only"></i>
            <span>{{:MyLang('download_title')}}</span>
        </button>
    {{/if}}

    <!-- 父级内容 -->
    {__block__}
{{/block}}

<!-- 扩展 -->
{{block name="form_extend"}}
    <!-- upload start -->
    <div class="am-popup am-radius" id="popup-themedata-upload">
        <div class="am-popup-inner">
            <div class="am-popup-hd">
                <h4 class="am-popup-title">{{:MyLang('import_title')}}</h4>
                <span data-am-modal-close class="am-close">&times;</span>
            </div>
            <div class="am-popup-bd">
                <!-- win form start -->
                <form class="am-form form-validation am-form-popup-fixed am-upload-file" action="{{:MyUrl('admin/themedata/upload')}}" method="POST" request-type="ajax-reload" enctype="multipart/form-data">
                    <div class="am-form-group am-flex-1">
                        <div class="am-form-file">
                            <button type="button" class="am-btn am-btn-default am-btn-xl am-radius"><i class="iconfont icon-upload-file"></i></button>
                            <input type="file" name="file" class="file-event" data-tips-tag="#form-upload-file-tips" data-validation-message="{{:MyLang('form_upload_file_message')}}" accept=".zip" multiple required />
                            <div id="form-upload-file-tips" class="am-margin-top-xs"></div>
                            <div class="tips am-text-xs am-color-ccc am-margin-top-sm">
                                {{if is_array(MyLang('themedata.upload_list_tips'))}}
                                    <p class="am-margin-top-xs">{{:implode('</p><p class="am-margin-top-xs">', MyLang('themedata.upload_list_tips'))}}</p>
                                {{/if}}
                            </div>
                        </div>
                    </div>
                    <div class="am-form-popup-submit">
                        <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('confirm_title')}}'}">
                            <i class="am-icon-save"></i>
                            <span>{{:MyLang('confirm_title')}}</span>
                        </button>
                    </div>
                </form>
                <!-- win form end -->
            </div>
        </div>
    </div>
    <!-- upload end -->
{{/block}}