<!--
Name:用户中心-站内信
Page:P_UserMEssage
-->
<div class="nbbox loadlist clearfix">
<div class="user">
    <ul class="tablist">
        <li <%if (type == 0){Response.Write("class=\"selected\"");} %>><a href="<%=URL("P_UserMessage","0","")%>"><span>{tag:收件箱}<em>(<%=Count_Message(0) %>)</em></span></a></li>
        <li <%if (type == 1){Response.Write("class=\"selected\"");} %>><a href="<%=URL("P_UserMessage","1","")%>"><span>{tag:发件箱}</span></a></li>
        <li><a href="<%=URL("P_UserMessageWrite","","")%>"><span>{tag:发信息}</span></a></li>
    </ul>
    <div class="searchbox clearfix">
        <select id="type_id">
            <option value="">┌ {tag:类型}</option>
            <%foreach (DB.LebiShop.Lebi_Message_Type modeltype in message_types)
            {%>
            <option value="<%=modeltype.id %>" <%if (type_id == ""+modeltype.id+""){%>selected<%} %>><%=Lang(modeltype.Name)%></option>
            <%} %>
            <option value="0" <%if (type_id == "0"){%>selected<%} %>>{tag:系统消息}</option>
        </select>
        <input type="text" id="key" name="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" />
        <a href="javascript:void(0)" onclick="search_();" class="btn btn-12"><s></s>{tag:查询}</a>
    </div>
    <div class="table-list">
        <%foreach (DB.LebiShop.Lebi_Message model in messages){%>
        <div class="loadli">
        <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <th style="width:30px"><%if (model.IsRead == 0){%><img src="{/image}icon/email.png" title="{tag:未读}" /><%}else{ %><img src="{/image}icon/email_open.png" title="{tag:已读}" /><%} %></th>
            <th style="text-align:left"><input type="checkbox" value="<%=model.id %>" name="id" /> <a href="<%=URL("P_UserMessageDetails",model.id)%>"><%=model.Title %></a></th>
        </tr>
        <tr>
            <td colspan="2"><%=FormatTime(model.Time_Add) %></td>
        </tr>
        </table>
        </div>
        <%} %>
    </div>
    <div class="bottom clearfix"><div class="left"><a href="javascript:void(0);" onclick="$('input[name=\'id\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));" class="selectAll">{tag:全选}</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="Delete();" class="btn btn-11"><s></s>{tag:删除}</a></div></div>
    <%if (CurrentSite.IsMobile==0){ %>
        <div class="bottom clearfix"><div class="right"><%=PageString%></div></div>
    <%}else{%>
    <div class="loadpage">
        <a data-next="<%=NextPage%>"></a>
    </div>
    <script>
        $(document).ready(function () {
            var container = document.querySelector('.loadlist');
            var ias = $.ias({
                container: ".loadlist",
                item: ".loadli",
                pagination: ".loadpage",
                next: ".loadpage a"
            });
            ias.on('render', function (items) {
                //$(items).css({ opacity: 0 });
            });
            ias.on("rendered", function (items) {
            });
            ias.extension(new IASSpinnerExtension({ html: "<div class=\"loadinginfo\"><img src=\"{src}\" />&nbsp;{Tag:加载中}</div>" }));
            ias.extension(new IASTriggerExtension({ text: '{Tag:加载更多}', offset: 100, html: "<div class=\"loadinginfo more\"><p>{text}</p></div>" }));
            ias.extension(new IASNoneLeftExtension({
                text: '', html: ""
            }));
        });
    </script>
    <%}%>
</div>
</div>
<script>
    function search_() {
        var key = $("#key").val();
        var type_id = $("#type_id").val();
        window.location = "?type=<%=type %>&key=" + escape(key) + "&type_id=" + type_id;
    }
    function Delete() {
        if (!confirm("{tag:确认要删除吗？}"))
            return false;
        var ids = GetChkCheckedValues("id");
        var postData = { "ids": ids };
        var url = path+"/ajax/Ajax_userin.aspx?__Action=Message_Delete";
        RequestAjax(url, postData, function () { MsgBox(1, "{tag:操作成功}", "?") });
    }
</script>