{layout:default} {class:Shop.Admin.Config.EmailJob}
<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>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-12 m-b-10">
                        <%if (PageReturnMsg == ""){%>
                        <button class="btn btn-danger" onclick="DeleteConfirm()"><i class="ti-trash"></i> <%=Tag("删除")%></button>
                        <%}%>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover no-wrap">
                        <thead>
                            <tr class="no-wrap">
                                <th class="selectAll" style="width:40px">
                                    <a href="javascript:void(0);" onclick="$('input[name=\'id\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
                                </th>
                                <th>
                                    <%=Tag("邮箱")%>
                                </th>
                                <th>
                                    <%=Tag("用户")%>
                                </th>
                                <th>
                                    <%=Tag("主题")%>
                                </th>
                                <th>
                                    <%=Tag("状态")%>
                                </th>
                                <th>
                                    <%=Tag("任务时间")%>
                                </th>
                                <th>
                                    <%=Tag("发送时间")%>
                                </th>
                                <th>
                                    <%=Tag("操作")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (DB.LebiShop.Lebi_Email model in models){%>
                            <tr ondblclick="EditObj(<%=model.id %>);">
                                <td>
                                    <label class="custom-control custom-checkbox">
                                        <input type="checkbox" id="checkbox<%=model.id %>" name="id" value="<%=model.id %>" class="custom-control-input" del="true">
                                        <span class="custom-control-label"></span>
                                    </label>
                                    <input type="hidden" name="IDS" value="<%=model.id %>" shop="true">
                                </td>
                                <td>
                                    <%=model.Email%>
                                </td>
                                <td>
                                    <%=model.User_Name%>
                                </td>
                                <td>
                                    <a href="javascript:void(0)" onclick="EditObj(<%=model.id %>);"><%=model.Title%></a>
                                </td>
                                <td>
                                    <%=Shop.Bussiness.EX_Type.TypeName(model.Type_id_EmailStatus)%>
                                </td>
                                <td>
                                    <%=FormatTime(model.Time_Task)%>
                                </td>
                                <td>
                                    <%=model.Type_id_EmailStatus==271?FormatTime(model.Time_Send):""%>
                                </td>
                                <td>
                                    <%if (model.Type_id_EmailStatus == 270){ %>
                                    <a href="javascript:void(0)" onclick="Send(<%=model.id %>);"><%=Tag("发送")%></a> |
                                    <%} %>
                                    <a href="javascript:void(0)" onclick="EditObj(<%=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>
</lbbody>
<lbscripts>
    <script>
        function EditObj(id) {
            $("#EditModal").modal("show");
            $.ajax({
                url: "emailjob_edit_window.aspx",
                type: "GET",
                cache: false,
                data: {id: id},
            }).done(function(result){
                $("#EditModal .modal-content").html(result);
            });
        }
        function Send(id) {
            var postData ={"id":id};
            var url = "<%=site.AdminPath %>/ajax/ajax_site.aspx?__Action=Email_send";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("发送成功")%>", "?")});
        }
        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_site.aspx?__Action=Email_del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbscripts>
