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

<!-- 表单顶部操作栏 -->
{{block name="form_operate_top"}}
    <button type="button" class="am-btn am-btn-primary am-radius am-btn-xs add-goods-submit">
        <i class="iconfont icon-add am-show-sm-only"></i>
        <span>{{:MyLang('add_title')}}</span>
    </button>
    <!-- 父级内容 -->
    {__block__}
{{/block}}

<!-- 公共代码 -->
{{block name="form_page_bottom"}}
    <!-- 商品添加弹窗 -->
    <div class="am-popup am-radius am-popup-full-max-lg" id="warehouse-goods-popup">
        <div class="am-popup-inner">
            <div class="am-popup-hd">
                <h4 class="am-popup-title">{{:MyLang('warehousegoods.add_goods_title')}}</h4>
                <span data-am-modal-close class="am-close">&times;</span>
            </div>
            <div class="am-popup-bd am-padding-0">
                <form class="am-form am-padding-sm goods-add-container">
                    <!-- 搜索 -->
                    <div class="forth-selection-container" data-search-url="{{:MyUrl('admin/warehousegoods/goodssearch')}}">
                        <select class="am-radius chosen-select forth-selection-form-warehouse" data-placeholder="{{:MyLang('common_service.warehousegoods.form_item_warehouseg_placeholder')}}" data-validation-message="{{:MyLang('common_service.warehousegoods.form_item_warehouseg_message')}}">
                            <option value="">{{:MyLang('common_service.warehousegoods.form_item_warehouseg_placeholder')}}</option>
                            {{if !empty($warehouse_list)}}
                                {{foreach $warehouse_list as $k=>$v}}
                                    <option value="{{$v.id}}" {{if $k eq 0}}selected{{/if}}>{{$v.name}}</option>
                                {{/foreach}}
                            {{/if}}
                        </select>
                        <select class="am-radius chosen-select forth-selection-form-category" data-placeholder="{{:MyLang('form_goods_category_placeholder')}}" data-validation-message="{{:MyLang('form_goods_category_message')}}">
                            <option value="">{{:MyLang('form_goods_category_placeholder')}}</option>
                            {{if !empty($goods_category_list)}}
                                {{foreach $goods_category_list as $v}}
                                    <option value="{{$v.id}}">{{$v.name}}</option>
                                    {{if !empty($v['items'])}}
                                        {{foreach $v.items as $vs}}
                                            <option style="padding-left: 15px;" value="{{$vs.id}}">{{if empty($vs['items'])}}├{{else /}}└{{/if}}² {{$vs.name}}</option>
                                            {{if !empty($vs['items'])}}
                                                {{foreach $vs.items as $kss=>$vss}}
                                                    <option style="padding-left: 30px;" value="{{$vss.id}}">{{if $kss eq count($vs['items'])-1}}└{{else /}}├{{/if}}³ {{$vss.name}}</option>
                                                {{/foreach}}
                                            {{/if}}
                                        {{/foreach}}
                                    {{/if}}
                                {{/foreach}}
                            {{/if}}
                        </select>
                        <input type="text" placeholder="{{:MyLang('goods_name')}}" class="am-radius forth-selection-form-keywords" />
                        <button type="button" class="am-btn am-btn-primary am-radius am-btn-xs search-submit" data-am-loading="{spinner: 'circle-o-notch', loadingText: '{{:MyLang('search_title')}}'}">
                            <i class="iconfont icon-search"></i>
                            <span>{{:MyLang('search_title')}}</span>
                        </button>
                    </div>

                    <!-- 商品列表 -->
                    <div class="am-scrollable-vertical am-margin-top-sm am-padding-bottom-xs am-radius goods-list-container" data-loading-msg="{{:MyLang('searching_tips')}}" data-add-url="{{:MyUrl('admin/warehousegoods/goodsadd')}}" data-del-url="{{:MyUrl('admin/warehousegoods/goodsdel')}}">
                        <ul class="am-gallery am-avg-sm-2 am-avg-md-6 am-avg-lg-8 am-gallery-bordered"></ul>
                    </div>

                    <!-- 分页 -->
                    <div class="am-margin-top-sm am-text-center goods-page-container"></div>
                </form>
            </div>
        </div>
    </div>
{{/block}}