{layout:default} {class:Shop.Admin.product.Comment}
<lbhead>
    <title><%=Tag("商品评价")%>-<%=site.title%></title>
</lbhead>
<lbfile>
    <link href="<%=site.AdminAssetsPath %>/plugins/daterangepicker/daterangepicker.css" rel="stylesheet">
    <link href="<%=site.AdminAssetsPath %>/plugins/lightbox/css/lightbox.min.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 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 == ""){%>
                        <button class="btn btn-success" onclick="Update();"><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" style="min-width:920px;">
                        <thead>
                            <tr class="no-wrap">
                                <th style="width: 40px" class="selectAll">
                                    <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("图片")%>
                                </th>
                                <th style="width: 30%">
                                    <%=Tag("商品名称")%>
                                </th>
                                <th style="width: 30%">
                                    <%=Tag("内容")%>
                                </th>
                                <th>
                                    <%=Tag("会员账号")%>
                                </th>
                                <th style="width: 10%">
                                    <%=Tag("状态")%>
                                </th>
                                <th>
                                    <%=Tag("操作")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (DB.LebiShop.Lebi_Comment model in models){%>
                            <tr ondblclick="Edit(<%=model.id %>);">
                                <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>
                                    <div class="piclist<%=model.id %>">
                                        <% if (GetProduct(model.Keyid).ImageSmall != ""){ %>
                                        <a href="<%=Image(GetProduct(model.Keyid).ImageOriginal," big") %>" data-lightbox="image<%=model.id %>" ><img style="height: 30px;width: 30px;vertical-align:middle" src="<%=Image(GetProduct(model.Keyid).ImageOriginal,50,50) %>" /></a>
                                        <%} %>
                                    </div>
                                </td>
                                <td>
                                    <%=Lang(GetProduct(model.Keyid).Name)%>&nbsp;<a target="_blank" href="<%=Shop.Bussiness.ThemeUrl.GetURL(" P_Product",model.Keyid.ToString(),"",CurrentLanguage.Code)%>"><i class="ti-new-window"></i></a>
                                </td>
                                <td>
                                    <%=model.Content.Replace("\r\n", "<br />")%><em>(<%=FormatTime(model.Time_Add)%>)</em>
                                    <ul class="sharepiclist<%=model.id %> clearfix">
                                        <%
                                        string[] images = model.ImagesSmall.Split('@');
                                        string[] bigs = model.Images.Split('@');
                                        for (int i = 0; i < images.Count();i++)
                                        {
                                        if (images[i] == "")
                                        continue;
                                        %>
                                        <li class="imagespreviewlist">
                                            <span class="image"><a href="<%=WebPath+bigs[i] %>" data-lightbox="image<%=model.id %>"><img src="<%=WebPath+images[i] %>" /></a></span>
                                        </li>
                                        <%} %>
                                    </ul>
                                </td>
                                <td>
                                    <%=model.User_UserName %>
                                </td>
                                <td>
                                    <select id="status<%=model.id %>" name="status<%=model.id %>" class="form-control form-control-sm" shop="true">
                                        <%=Shop.Bussiness.EX_Type.TypeOption("CommentStatus", model.Status, CurrentLanguage.Code)%>
                                    </select>
                                </td>
                                <td>
                                    <a href="javascript:void(0)" onclick="Edit(<%=model.id %>);"><%=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="lang" name="lang" class="form-control">
                                <option value=""><%=Tag("语言")%></option>
                                <%=Shop.Bussiness.Language.LanguageOption(lang)%>
                            </select>
                        </div>
                        <div class="form-group">
                            <select id="status" name="status" class="form-control">
                                <option value="0"><%=Tag("状态")%></option>
                                <%=Shop.Bussiness.EX_Type.TypeOption("CommentStatus", status, CurrentLanguage.Code)%>
                            </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 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 src="<%=site.AdminAssetsPath %>/plugins/lightbox/lightbox.min.js"></script>
    {MOD:DateRangePicker}
    <script>
        function search_() {
            var key = $("#key").val();
            window.location = "?key=" + escape(key);
        }
        function modal_search_() {
            $("#SearchModal").modal("hide");
            var status = $("#status").val();
            var lang = $("#lang").val();
            var key = $("#key").val();
            var dateFrom = "";
            var dateTo = "";
            var daterange = $("#daterange").val();
            if (daterange.indexOf(" - ") > -1) {
                dateFrom = daterange.split(" - ")[0];
                dateTo = daterange.split(" - ")[1];
            }
            window.location = "?key=" + escape(key) + "&lang=" + lang + "&status=" + status + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo;
        }
        function Edit(id) {
            $("#EditModal").modal("show");
            $.ajax({
                url: "comment_edit_window.aspx",
                type: "GET",
                cache: false,
                data: { id: id },
            }).done(function (result) {
                $("#EditModal .modal-content").html(result);
            });
        }
        function DeleteConfirm() {
            $("#Modal-Confirm").modal("show");
            $("#Confirm-Content").html("<%=Tag("确认要删除吗？")%>");
            $("#Modal-Confirm .btn-success.btn-ok").attr("onclick", "Delete();");
        }
        function Delete() {
            $("#Modal-Confirm").modal("hide");
            var postData = GetFormJsonData("del");
            var url = "<%=site.AdminPath %>/ajax/ajax_product.aspx?__Action=Comment_Del";
            RequestAjax(url, postData, function () { MsgBox(1, "<%=Tag("操作成功")%>", "?") });
        }
        function Update() {
            var postData = GetFormJsonData("shop");
            var url = "<%=site.AdminPath %>/ajax/ajax_product.aspx?__Action=Comment_Update";
            RequestAjax(url, postData, function () { MsgBox(1, "<%=Tag("操作成功")%>", "?") });
        }
    </script>
</lbscripts>