<%@ Page Title="" Language="C#" MasterPageFile="~/Master/UserMaster.master" CodeBehind="TipsSetting.aspx.cs" Inherits="WAP2P.Web.PC.User.SNS.TipsSetting" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <div class="m-userbox m-buserbox pb50">
        <div class="m-prompt pl10 pr10 mt20">
            <div class="prompt-left g-left mt10">
                联系专属客服：<div class="mt10 fs14 g-fcenter"><% =CurrentUser.GetService() %></div>
            </div>
            <div class="prompt-small g-right">
                <p>若设置了不接收有关通知或提醒，则有可能收不到某些与您切身有关的重要信息，请您慎重选择。</p>
                <p>详细情况具体请查看 <a href="/Help/" target="_blank">帮助中心</a>。</p>
            </div>
        </div>
        <form class="js-auto js-vsum" method="post" action="" data-beforesubmit="setJsons();">
            <table class="table-normal m-boborder mt25" id="tipSetting">
                <asp:Repeater runat="server" ID="rptReminddd">
                    <ItemTemplate>
                        <tr>
                            <th style="width:55%;" class="g-fleft pl40"><%# Container.DataItem %></th>
                            <th style="width:15%;" class="g-fleft">站内信</th>
                            <th style="width:15%;" class="g-fleft">邮件</th>
                            <th style="width:15%;" class="g-fleft">手机</th>
                        </tr>
                        <asp:Repeater runat="server" ID="rptRemindDetail">
                            <ItemTemplate>
                                <tr class="js-data">
                                    <td class="g-fleft pl30"><%# Eval("Value.Item1") %> <input type="hidden" data-to="TipKey" value="<%# Eval("Key") %>" /></td>
                                    <td class="g-fleft">
                                        <div class="ui-vcheckbox">
                                            <label>
                                                <input type="checkbox" data-to="SiteMessage" value="<% =(int)RemindSetting.TipType.SiteMessage %>"
                                                <%# ((remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).TipTypes & RemindSetting.TipType.SiteMessage) == RemindSetting.TipType.SiteMessage && (userRemindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) == null || (userRemindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")).TipTypes & RemindSetting.TipType.SiteMessage) == RemindSetting.TipType.SiteMessage) ?  " checked=\"checked\"" : string.Empty  %>
                                                <%# (remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).UserEdit && (((remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).TipTypes & RemindSetting.TipType.SiteMessage) == RemindSetting.TipType.SiteMessage) ? string.Empty : " disabled=\"disabled\"" %> />
                                            </label>
                                        </div>
                                    </td>
                                    <td class="g-fleft">
                                        <div class="ui-vcheckbox">
                                            <label>
                                                <input type="checkbox" data-to="Email" value="<% =(int)RemindSetting.TipType.Email %>"
                                                <%# ((remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).TipTypes & RemindSetting.TipType.Email) == RemindSetting.TipType.Email && (userRemindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) == null || (userRemindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")).TipTypes & RemindSetting.TipType.Email) == RemindSetting.TipType.Email) ?  " checked=\"checked\"" : string.Empty  %>
                                                <%# (remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).UserEdit && (((remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).TipTypes & RemindSetting.TipType.Email) == RemindSetting.TipType.Email) ? string.Empty : " disabled=\"disabled\"" %> />
                                            </label>
                                        </div>
                                    </td>
                                    <td class="g-fleft">
                                        <div class="ui-vcheckbox">
                                            <label>
                                                <input type="checkbox" data-to="PhoneMessage" value="<% =(int)RemindSetting.TipType.PhoneMessage %>"
                                                <%# ((remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).TipTypes & RemindSetting.TipType.PhoneMessage) == RemindSetting.TipType.PhoneMessage && (userRemindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) == null || (userRemindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")).TipTypes & RemindSetting.TipType.PhoneMessage) == RemindSetting.TipType.PhoneMessage) ?  " checked=\"checked\"" : string.Empty  %>
                                                <%# (remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).UserEdit && (((remindSetting.FirstOrDefault(item => item.TipKey == (string)Eval("Key")) ?? new RemindSetting()).TipTypes & RemindSetting.TipType.PhoneMessage) == RemindSetting.TipType.PhoneMessage) ?  string.Empty : " disabled=\"disabled\"" %> />
                                            </label>
                                        </div>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
            <input type="submit" value="提交" class="btn-bbord fs18 c-normal w258 mt50 ml250" data-success-text="提交成功" >
            <input type="hidden" name="remindJson" id="remindJson" />
        </form>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script>
        //提交前设置Json对象。
        function setJsons() {
            //提醒设置
            var reminds = [];
            $('#tipSetting tr.js-data').each(function (i, n) {
                n = $(n);
                var tipTypes = 0;
                $.each(n.find(':checked'), function (j, m) {                   
                    tipTypes = tipTypes | parseInt($(m).val());                    
                });
                reminds.push({
                    TipKey: n.find('input[data-to=TipKey]').val(),
                    TipTypes: tipTypes                 
                });
            });
            $('#remindJson').val(utils.toJsonString(reminds));
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>
