<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebPushOption.aspx.cs" Inherits="Options_WebPushOption" meta:resourcekey="Page" %>
<%@ Register src="../Common/TopNavbar.ascx" tagname="TopNavbar" tagprefix="tabs" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../libs/fontawesome/css/all.min.css" >
    <script type="text/javascript" src="../libs/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="../libs/bootstrap/js/bootstrap.min.js"></script>
    <style>
        .folder
        {
            padding-top: 4px;
            padding-bottom: 4px;
            margin-left: 4px;
            margin-right: 4px;
            border-bottom:1px solid var(--seperator-color);
        }
        .wpCheckBox label
        { 
            font-weight: normal;
            padding-left: 0.7em;
            display: inline;
        }
    </style>
</head>
<body>
    <script type="text/javascript">
        $(document).ready(function () {            
            $("#SetTzButton").on("click", function() {    
                var tzval = $("#TimeZoneList option:selected").val();
                $.ajax({
                    type: "POST",
                    url: "WebPushOption.aspx/GetTimezoneInfo",
                    data: JSON.stringify({ tzval: tzval }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response) {
                        $("#TimeZoneTextBox").val(response.d.TzText);
                        $("#TimeZoneUtcOffset").val(response.d.TzOffset);
                    },
                    failure: function (response) {
                    }
                });
            });
        });
    </script>

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <tabs:TopNavbar ID="TopMenu1" runat="server" />

        <div class="container-fluid topNavbarRegion">
        </div>

        <div class="container-fluid" style="padding-top:10px">
            <asp:Panel ID="MsgBox" runat="server" Visible="false">
                <asp:Label ID="MsgBoxLabel" runat="server" Text="Label"></asp:Label>                
            </asp:Panel>

            <h4><asp:Localize ID="Localize4" runat="server" meta:resourcekey="L04">알림 설정</asp:Localize></h4>
            <div class="form-group">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="radio">
                            <label><input type="radio" runat="server" id="NotificationType1" name="NotificationType" value="1" /><asp:Localize ID="Localize5" runat="server" meta:resourcekey="L05">항상 알림 정보를 전송합니다.</asp:Localize></label>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <div class="radio">
                            <label><input type="radio" runat="server" id="NotificationType2" name="NotificationType" value="2" /><asp:Localize ID="Localize6" runat="server" meta:resourcekey="L06">지정된 요일에 알림 정보를 전송합니다.</asp:Localize></label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="row">
                    <div class="col-xs-12">
                        <label><asp:Localize ID="Localize7" runat="server" meta:resourcekey="L07">표준 시간대</asp:Localize>:</label>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-8">
                        <asp:TextBox ID="TimeZoneTextBox" runat="server" ReadOnly="true" CssClass="form-control"></asp:TextBox>
                        <asp:HiddenField ID="TimeZoneUtcOffset" runat="server" />
                    </div>
                    <div class="col-xs-4">
                        <input type="button" class="btn" id="SetTzButton" value="<<">
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <asp:DropDownList ID="TimeZoneList" runat="server" CssClass="form-control">
                        </asp:DropDownList>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="row">
                    <div class="col-xs-12">
                        <label><asp:Localize ID="Localize8" runat="server" meta:resourcekey="L08">요일</asp:Localize>:</label>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday1" runat="server" value="2"/> <asp:Localize ID="Localize10" runat="server" meta:resourcekey="L10">월</asp:Localize></label>
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday2" runat="server" value="4"/> <asp:Localize ID="Localize11" runat="server" meta:resourcekey="L11">화</asp:Localize></label>
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday3" runat="server" value="8"/> <asp:Localize ID="Localize12" runat="server" meta:resourcekey="L12">수</asp:Localize></label>
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday4" runat="server" value="16"/> <asp:Localize ID="Localize13" runat="server" meta:resourcekey="L13">목</asp:Localize></label>
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday5" runat="server" value="32"/> <asp:Localize ID="Localize14" runat="server" meta:resourcekey="L14">금</asp:Localize></label>
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday6" runat="server" value="64"/> <asp:Localize ID="Localize15" runat="server" meta:resourcekey="L15">토</asp:Localize></label>
                        <label class="checkbox-inline"><input type="checkbox" id="Weekday7" runat="server" value="128"/> <asp:Localize ID="Localize16" runat="server" meta:resourcekey="L16">일</asp:Localize></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="row">
                    <div class="col-xs-12">
                        <label><asp:Localize ID="Localize18" runat="server" meta:resourcekey="L18">시간</asp:Localize>:</label>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-5">
                        <asp:TextBox ID="BeginTime" runat="server" type="time" CssClass="form-control"></asp:TextBox>
                    </div>
                    <div class="col-xs-1" style="text-align:center;">-</div>
                    <div class="col-xs-5">
                        <asp:TextBox ID="EndTime" runat="server" type="time" CssClass="form-control"></asp:TextBox>
                    </div>
                </div>
                <div class="row">
                    &nbsp;
                </div>
            </div>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                <ContentTemplate>
                    <h4><asp:Localize ID="Localize19" runat="server" meta:resourcekey="L19">메일 알림</asp:Localize></h4>
                    <div class="form-group">
                        <div class="row">
                            <div class="col-xs-12">
                                <asp:CheckBox ID="MailNotifyCheckBox" runat="server" Text="메일 수신 알림을 받습니다." CssClass="wpCheckBox" 
                                    meta:resourcekey="MailNotifyCheckBox"/>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-1"></div>
                            <div class="col-xs-11">
                                <asp:Localize ID="Localize3" runat="server" meta:resourcekey="L03">기본적으로 받은 편지함은 선택됩니다.</asp:Localize><br />
                                <asp:Localize ID="Localize9" runat="server" meta:resourcekey="L09">알림 메시지를 받을 편지함을 추가로 선택할 수 있습니다.</asp:Localize>
                            </div>
                        </div>
                        <div class="row">
                            <asp:Repeater ID="FolderRepeater" runat="server" DataSourceID="FolderDataSource" OnItemDataBound="FolderRepeater_ItemDataBound">
                                <HeaderTemplate>
                                    <div class="col-xs-12">
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <div class="row folder">
                                        <div class="col-xs-1">
                                            <asp:CheckBox ID="CheckBox" runat="server" />
                                        </div>
                                        <div class="col-xs-10" style='padding-left:<%# GetIndent((int)Eval("Indent")) %>px;'>
                                            <%# GetFolderInfo((Guid)Eval("ID"), (string)Eval("FolderName"))%>
                                        </div>
	                                </div>
                                </ItemTemplate>
                                <FooterTemplate>
                                    </div>
                                </FooterTemplate>
                            </asp:Repeater>
                        </div>
                    </div>
                    <div class="row">&nbsp;</div>

                    <asp:Panel ID="CalendarPanel" runat="server">
                        <h4><asp:Localize ID="Localize21" runat="server" meta:resourcekey="L21">일정 알림</asp:Localize></h4>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:CheckBox ID="PrivateCalendarNotifyCheckBox" runat="server" Text="개인 일정표에 대한 알림을 받습니다." CssClass="wpCheckBox"
                                        OnCheckedChanged="PrivateCalendarNotifyCheckBox_CheckedChanged" AutoPostBack="true" meta:resourcekey="PrivateCalendarNotifyCheckBox"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:CheckBox ID="SharedCalendarNotifyCheckBox" runat="server" Text="공유 일정표에 대한 알림을 받습니다." CssClass="wpCheckBox"
                                        meta:resourcekey="SharedCalendarNotifyCheckBox"/>
                                </div>
                            </div>
                        </div>
                        <div class="row">&nbsp;</div>
                    </asp:Panel>

                    <asp:Panel ID="BoardPanel" runat="server">
                        <h4><asp:Localize ID="Localize1" runat="server" meta:resourcekey="L01">게시판 알림</asp:Localize></h4>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:CheckBox ID="BoardNotifyCheckBox1" runat="server" Text="아래 구독한 게시판에서 새글이 작성될 때 알림을 받습니다." CssClass="wpCheckBox"
                                        meta:resourcekey="BoardNotifyCheckBox1"/>
                                </div>
                            </div>
                            <div class="row">
                                <asp:Repeater ID="BoardRepeater" runat="server" DataSourceID="BoardDataSource" OnItemDataBound="BoardRepeater_ItemDataBound">
                                    <HeaderTemplate>
                                        <div class="col-xs-12">
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <div class="row folder">
                                            <div class="col-xs-1">
                                                <asp:CheckBox ID="CheckBox" runat="server" />
                                            </div>
                                            <div class="col-xs-10">
                                                <%=FontIcon.Board%> <%# Eval("Name")%>
                                            </div>
	                                    </div>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </div>
                                    </FooterTemplate>
                                </asp:Repeater>
                            </div>
                            <div class="row">&nbsp;</div>
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:CheckBox ID="BoardNotifyCheckBox2" runat="server" Text="내가 작성한 글에 답변글이 게시될 경우 알림을 받습니다." CssClass="wpCheckBox"
                                        meta:resourcekey="BoardNotifyCheckBox2"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:CheckBox ID="BoardNotifyCheckBox3" runat="server" Text="댓글에 대한 알림을 받습니다." CssClass="wpCheckBox"
                                        meta:resourcekey="BoardNotifyCheckBox3"/>
                                </div>
                            </div>
                        </div>
                        <div class="row">&nbsp;</div>
                    </asp:Panel>

                    <asp:Panel ID="ApprovalPanel" runat="server">
                        <h4><asp:Localize ID="Localize2" runat="server" meta:resourcekey="L02">결재 알림</asp:Localize></h4>
                        <div class="form-group">
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:CheckBox ID="ApprovalCheckBox" runat="server" Text="결재 요청/승인/반려 시 알림을 받습니다." CssClass="wpCheckBox"
                                        meta:resourcekey="ApprovalCheckBox"/>
                                </div>
                            </div>
                        </div>
                        <div class="row">&nbsp;</div>
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
            <div class="row">&nbsp;</div>

            <div class="row">
                <div class="col-xs-12">
                    <asp:Button ID="SaveButton" runat="server" Text="저장" CssClass="btn btn-primary" meta:resourcekey="SaveButton" OnClick="SaveButton_Click"  />
                </div>
            </div>
            <div class="row">&nbsp;</div>
        </div>

        <asp:ObjectDataSource ID="FolderDataSource" runat="server" TypeName="MailFolderDataSource" SelectMethod="GetFolders4WebPush" >
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="BoardDataSource" runat="server" TypeName="BoardSubscribedDataSource" SelectMethod="GetBoards" >
        </asp:ObjectDataSource>
    </form>
</body>
</html>
