{layout:default} {class:Shop.Admin.product.Brand}
<lbhead>
    <title><%=Tag("品牌管理")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <h3 class="text-themecolor m-b-0 m-t-0"><%=Tag("品牌管理")%></h3>
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a></li>
        <li class="breadcrumb-item active"><%=Tag("品牌管理")%></li>
    </ol>
</lbpath>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-9 m-b-10">
                        <%if (PageReturnMsg == ""){%>
                        <a class="btn btn-info" href="brand_edit.aspx" target="_blank"><i class="ti-plus"></i> <%=Tag("添加")%></a>
                        <button class="btn btn-success" onclick="Edits();"><i class="ti-check"></i> <%=Tag("保存")%></button>
                        <button class="btn btn-danger" onclick="DeleteConfirm()"><i class="ti-trash"></i> <%=Tag("删除")%></button>
                        <%}%>
                    </div>
                    <div class="col-md-3 m-b-10">
                        <div class="input-group">
                            <input type="text" id="key" name="key" value="<%=key %>" class="form-control" onkeydown="if(event.keyCode==13){search_();}">
                            <div class="input-group-append">
                                <button type="button" class="btn btn-primary" onclick="search_();"><i class="ti-search"></i></button>
                                <button class="btn btn-default" data-toggle="modal" data-target="#SearchModal"><i class="ti-filter"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover no-wrap">
                        <thead>
                            <tr>
                                <th class="selectAll" style="width:40px">
                                    <a href="javascript:void(0);" onclick="$('input[name=\'Delid\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
                                </th>
                                <th>
                                    <%=Tag("ID")%>
                                </th>
                                <th>
                                    <%=Tag("品牌名称")%>
                                </th>
                                <th>
                                    <%=Tag("图片")%>
                                </th>
                                <th style="width: 7%">
                                    <%=Tag("首字母")%>
                                </th>
                                <th style="width: 7%">
                                    <%=Tag("推荐")%>
                                </th>
                                <th style="width: 7%">
                                    <%=Tag("排序")%>
                                </th>
                                <th>
                                    <%=Tag("商品数量")%>
                                </th>
                                <th>
                                    <%=Tag("状态")%>
                                </th>
                                <th>
                                    <%=Tag("是否含税")%>
                                </th>
                                <th>
                                    <%=Tag("操作")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (DB.LebiShop.Lebi_Brand model in models){%>
                            <tr>
                                <td>
                                    <label class="custom-control custom-checkbox">
                                        <input type="checkbox" id="checkbox<%=model.id %>" name="Delid" value="<%=model.id %>" class="custom-control-input" del="true">
                                        <span class="custom-control-label"></span>
                                    </label>
                                    <input type="hidden" name="IDS" shop="true" value="<%=model.id %>" />
                                </td>
                                <td>
                                    <%=model.id%>
                                </td>
                                <td>
                                    <%=Lang(model.Name)%>&nbsp;
                                    <%if (model.Supplier_id > 0){ %>&nbsp;<i class="ti-user" title="<%=Tag("商家")%>：<%=Shop.Bussiness.EX_Supplier.GetSupplier(model.Supplier_id).Company%>"></i><%} %>
                                    <a href="<%=Shop.Bussiness.ThemeUrl.GetURL("P_Brand", model.id.ToString(), "" , CurrentLanguage.Code)%>" target="_blank"><i class="ti-new-window"></i></a>

                                </td>
                                <td>
                                    <% if (model.ImageUrl != ""){ %>
                                    <img src="<%=site.WebPath + model.ImageUrl %>" style="height: 25px;vertical-align:middle" name="ImageUrl" />
                                    <%} %>
                                </td>
                                <td>
                                    <input type="text" name="FirstLetter<%=model.id %>" value="<%=model.FirstLetter %>" class="form-control form-control-sm" shop="true">
                                </td>
                                <td>
                                    <label class="custom-control custom-checkbox">
                                        <input type="checkbox" id="IsRecommend<%=model.id %>" name="IsRecommend<%=model.id %>" value="1" class="custom-control-input" shop="true" <%=model.IsRecommend==1?"checked":"" %>>
                                        <span class="custom-control-label"></span>
                                    </label>
                                </td>
                                <td>
                                    <input type="text" id="Sort<%=model.id %>" name="Sort<%=model.id %>" value="<%=model.Sort %>" class="form-control form-control-sm" shop="true" onkeyup='value=value.replace(/[^\d]/g,"")'>
                                </td>
                                <td>
                                    <a href="default.aspx?Brand_id=<%=model.id %>&Type_id_ProductType=320,321,322,323"><%=Shop.Bussiness.EX_Product.BrandProductCount(model.id)%></a>

                                </td>
                                <td><%=Shop.Bussiness.EX_Type.TypeName(model.Type_id_BrandStatus) %></td>
                                <td><%=model.IsVAT == 1?"<span class=\"label label-success\">" + Tag("是") + "</span>" : "<span class=\"label label-danger\">" + Tag("否") + "</span>"%></td>
                                <td>
                                    <a href="brand_edit.aspx?id=<%=model.id %>" target="_blank"><%=Tag("编辑")%></a>
                                </td>
                            </tr>
                            <%} %>
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-12">
                        <nav aria-label="Page navigation">
                            <%=PageString%>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="SearchModal" tabindex="-1" role="dialog" aria-labelledby="SearchModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title"><%=Tag("高级搜索")%></h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                </div>
                <div class="modal-body">
                    <form>
                        <div class="form-group">
                            <select id="type" name="type" class="form-control">
                                <option value=""><%=Tag("全部分类")%></option>
                                <%=Shop.Bussiness.EX_Product.TypeOption(0, type, 0, CurrentLanguage.Code, Shop.Bussiness.EX_Admin.Project().Pro_Type_ids)%>
                            </select>
                        </div>
                        <div class="form-group">
                            <select id="status" name="status" class="form-control">
                                <option value="0"><%=Tag("状态")%></option>
                                <%=Shop.Bussiness.EX_Type.TypeOption("BrandStatus", status, CurrentLanguage.Code)%>
                            </select>
                        </div>
                        <div class="form-group">
                            <input type="text" id="key" name="key" class="form-control" value="<%=key %>" onkeydown="if(event.keyCode==13){modal_search_();}">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="ti-close"></i> <%=Tag("关闭")%></button>
                    <button type="button" class="btn btn-success" onclick="modal_search_();"><i class="ti-search"></i> <%=Tag("搜索")%></button>
                </div>
            </div>
        </div>
    </div>
</lbbody>
<lbscripts>
    <script>
        function search_() {
            var key = $("#key").val();
            window.location = "?key=" + escape(key);
        }
        function modal_search_() {
            $("#SearchModal").modal("hide");
            var status = $("#status").val();
            var type = $("#type").val();
            var key = $("#key").val();
            window.location = "?key=" + escape(key) + "&status=" + status + "&type=" + type;
        }
        function DeleteConfirm() {
            $("#Modal-Confirm").modal("show");
            $("#Confirm-Content").html("<%=Tag("确认要删除吗？")%>");
            $("#Modal-Confirm .btn-success.btn-ok").attr("onclick", "DeleteObj();");
        }
        function DeleteObj() {
            $("#Modal-Confirm").modal("hide");
            var postData = GetFormJsonData("del");
            var url = "<%=site.AdminPath %>/ajax/ajax_product.aspx?__Action=Brand_Del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
        function Edits() {
            var postData = GetFormJsonData("shop");
            var url = "<%=site.AdminPath %>/ajax/ajax_product.aspx?__Action=Brands_Edit";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbscripts>