{layout:default} {class:Shop.Admin.user.OftenBuy}
<lbhead>
    <title><%if (type == 141){ %><%=Tag("收藏夹")%><%}else{%><%=Tag("常购清单")%><%} %>-<%=Tag("会员管理")%>-<%=site.title%></title>
</lbhead>
<lbfile>
    <link href="<%=site.AdminAssetsPath %>/plugins/daterangepicker/daterangepicker.css" rel="stylesheet">
</lbfile>
<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"><a href="<%=site.AdminPath %>/user/default.aspx"><%=Tag("会员管理")%></a></li>
        <li class="breadcrumb-item"><a href="<%=site.AdminPath %>/user/oftenbuy.aspx"><%if (type == 141){ %><%=Tag("收藏夹")%><%}else{%><%=Tag("常购清单")%><%} %></a></li>
        <%if (user.UserName != ""){ %><li class="breadcrumb-item active"><%=user.UserName%></li><%} %>
    </ol>
</lbpath>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <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><%=Tag("图片")%></th>
                                <th><%=Tag("商品")%></th>
                                <th><%=Tag("价格")%></th>
                                <th><%=Tag("数量")%></th>
                                <%if (type == 141){ %>
                                <th><%=Tag("收藏时间")%></th>
                                <%}else{ %>
                                <th><%=Tag("购买周期")%></th>
                                <th><%=Tag("预购时间")%></th>
                                <%} %>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (DB.LebiShop.Lebi_User_Product model in models){
                            DB.LebiShop.Lebi_Product product = GetProduct(model.Product_id);
                            %>
                            <tr>
                                <td>
                                    <% if (product.ImageSmall != ""){ %>
                                    <a href="<%=Image(product.ImageOriginal," big") %>" data-lightbox="image<%=model.Product_id %>"><img style="height: 30px;width: 30px;vertical-align:middle" src="<%=Image(product.ImageOriginal,30,30) %>" /></a>
                                    <%} %>
                                </td>
                                <td><a href="<%=Shop.Bussiness.ThemeUrl.GetURL(" P_Product",model.Product_id.ToString(),"",CurrentLanguage.Code) %>" target="_blank"><%=Lang(product.Name)%></a></td>
                                <td><%=FormatMoney(product.Price) %></td>
                                <td><%=model.count %></td>
                                <%if (type == 141){ %>
                                <td><%=FormatTime(model.Time_Add.AddDays(model.WarnDays))%></td>
                                <%}else{ %>
                                <td><%=model.WarnDays %> <%=Tag("天")%></td>
                                <td><%=FormatTime(model.Time_Add.AddDays(model.WarnDays))%></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 name="type" id="type" class="form-control">
                                <option value="141" <%=type==141?"selected":"" %>><%=Tag("收藏夹")%></option>
                                <option value="144" <%=type==144?"selected":"" %>><%=Tag("常购清单")%></option>
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="input-group">
                                <input type="text" name="daterange" id="daterange" class="form-control">
                                <div class="input-group-append">
                                    <span class="input-group-text">
                                        <span class="ti-calendar"></span>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <input name="key" type="text" id="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>
    {MOD:DateRangePicker}
    <script>
        function search_() {
            var key = $("#key").val();
            window.location = "?key=" + escape(key);
        }
        function modal_search_() {
            var key = $("#key").val();
            var dateFrom = "";
            var dateTo = "";
            var daterange = $("#daterange").val();
            if (daterange.indexOf(" - ") > -1) {
                dateFrom = daterange.split(" - ")[0];
                dateTo = daterange.split(" - ")[1];
            }
            var type = $("#type").val();
            window.location = "?key=" + escape(key) + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "&type=" + type;
        }
    </script>
</lbscripts>