<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Edit.aspx.cs" Inherits="Calendar_Edit" ValidateRequest="false" meta:resourcekey="Page" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <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/bootstrapValidator.min.css">
    <link rel="stylesheet" href="../libs/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../libs/fontawesome/css/all.min.css" >
    <link rel="stylesheet" href="../libs/kendoui/2023.3.1114/styles/bootstrap-3.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>
    <script type="text/javascript" src="../libs/bootstrapValidator.min.js"></script>
    <script type="text/javascript" src="../libs/moment.min.js"></script>
    <script type="text/javascript" src="../libs/bootstrap-datetimepicker.min.js"></script>
    <script src="../libs/kendoui/2023.3.1114/mjs/kendo.editor.js" type="module"></script>
    <script src="../libs/kendoui/2023.3.1114/mjs/kendo.listbox.js" type="module"></script>
</head>
<body>
    <style>
    @media (max-width: 767px) {
      .form-inline .form-control {
        display: inline-block;
        width: auto;
        vertical-align: middle;
      }
    }
    @media (max-width: 767px) {
      .form-inline .form-group {
        display: inline-block;
        margin-bottom: 0;
        vertical-align: middle;
      }
    }
    /* kendo ListBox를 bootstrap form에 배치하기 위한 스타일 정의 */
    .form-control.k-listbox {
        padding: 0;
        width: 100%;
        height: 120px;
    }
    .form-control.k-listbox:not(.k-autocomplete) {
        border-width: 0;
    }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            Dialog.setMessage('<asp:Literal runat="server" Text="<%$ Resources:Dialog, Title%>" />', '<asp:Literal runat="server" Text="<%$ Resources:Dialog, OK%>" />', '<asp:Literal runat="server" Text="<%$ Resources:Dialog, Cancel%>" />');
            Dialog.setUseBrowserConfirm(<%=AppSetting.UseBrowserConfirm%>);
            InitEditor();
            if ("<%=WebUser.CurrentUser.UiLanguage%>" == "ko") kendo.culture("ko-KR");

            InitDateTimePicker();
            InitValidator();
            InitRecurrence();
            InitAttendee();

            $("#form1").bootstrapValidator().on('success.form.bv', function (e) {
                // 폼 서브미션 금지하고 __doPostBack 호출
                e.preventDefault();
                var msg = (<%=_new.ToString().ToLower()%>) ? '<asp:Literal runat="server" Text="<%$ Resources:, Msg01%>" />' : '<asp:Literal runat="server" Text="<%$ Resources:, Msg02%>" />';
                Dialog.confirm({
                    content: msg,
                    ok: function () {
                        DisablePeriodPicker(false);     // datetimepicker가 disable 되어 있을 경우 서버로 null이 전달되므로 강제로 enable 시킨다.
                        var attendees = "";
                        $("#AttendeeListBox").data("kendoListBox").dataItems().forEach((elem) => attendees += elem.text + ";");    // 참석자 항목을 읽어 ;로 구분되는 하나의 문자열로 저장
                        $("#Attendees").val(attendees);
                        __doPostBack("SaveButton", "");
                    },
                    cancel: function () {
                        // confirm 취소 시 서브밋 버튼 활성화
                        var $form = $(e.target);
                        $form.bootstrapValidator("disableSubmitButtons", false);
                    }
                });
            });

            $("form input:text").keydown(function () {
                if (event.keyCode == 13) {
                    return false;
                }
                return true;
            });
        });

        function InitDateTimePicker() {
            $('#BeginDateTime').datetimepicker({
                defaultDate: "<%=_BeginDateTime_defaultDate%>",
                format: "YYYY-MM-DD LT"

            });
            $('#EndDateTime').datetimepicker({
                defaultDate: "<%=_EndDateTime_defaultDate%>",
                format: "YYYY-MM-DD LT",
                useCurrent: false
            });
            $('#FinishDate').datetimepicker({
                defaultDate: "<%=_FinishDate_defaultDate%>",
                format: "YYYY-MM-DD"
            });

            // 선택 가능 기간 제한
            $("#BeginDateTime").on("dp.change", function (e) {
                $("#EndDateTime").data("DateTimePicker").minDate(e.date);
            });
            $("#EndDateTime").on("dp.change", function (e) {
                $("#BeginDateTime").data("DateTimePicker").maxDate(e.date);
            });

            $("#AllDayCheckBox").on("click", function () {
                DisablePeriodPicker($(this).prop("checked"));
            });

            DisablePeriodPicker($("#AllDayCheckBox").prop("checked"));
        }

        function DisablePeriodPicker(disabled) {
            if (disabled) {
                $("#BeginDateTime").data("DateTimePicker").disable();
                $("#EndDateTime").data("DateTimePicker").disable();
            } else {
                $("#BeginDateTime").data("DateTimePicker").enable();
                $("#EndDateTime").data("DateTimePicker").enable();
            }
        }

        function InitValidator() {
            $("#form1").bootstrapValidator({
                message: "This value is not valid",
                feedbackIcons: {
                    valid: "glyphicon glyphicon-ok",
                    invalid: "glyphicon glyphicon-remove",
                    validating: "glyphicon glyphicon-refresh"
                },
                fields: {
                    SubjectTextBox: {
                        message: "The username is not valid",
                        validators: {
                            notEmpty: {
                                message: '<asp:Literal runat="server" Text="<%$ Resources:, Msg03%>" />'  // 약속 제목을 입력하십시오.
                            }
                        }
                    },
                    BeginDateTime: {
                        validators: {
                            notEmpty: {
                                message: '<asp:Literal runat="server" Text="<%$ Resources:, Msg04%>" />'  // 약속 시작 일자를 지정하십시오.
                            }
                        }
                    },
                    EndDateTime: {
                        validators: {
                            notEmpty: {
                                message: '<asp:Literal runat="server" Text="<%$ Resources:, Msg05%>" />'  // 약속 종료 일자를 지정하십시오.
                            }
                        }
                    },
                    FinishRecurCountTextBox: {
                        validators: {
                            notEmpty: {
                                message: '<asp:Literal runat="server" Text="<%$ Resources:, Msg06%>" />'  // 반복 회수를 지정하십시오.
                            },
                            lessThan: {
                                value: 366,
                                inclusive: true,
                                message: '<asp:Literal runat="server" Text="<%$ Resources:, Msg07%>" />' // 1에서 365 사이의 값이 되어야 합니다.
                            },
                            greaterThan: {
                                value: 0,
                                inclusive: false,
                                message: '<asp:Literal runat="server" Text="<%$ Resources:, Msg07%>" />' // 1에서 365 사이의 값이 되어야 합니다.
                            }
                        }
                    }
                }
            });
        }

        function InitRecurrence() {
            $("#RecurList").change(function () {
                SetRecurrencePanel($(this).val());
            });

            SetRecurrencePanel($("#RecurList").val());
        }

        function SetRecurrencePanel(selectedRecurrence) {
            switch (selectedRecurrence) {
                case "0":
                    $("#Recurrence1").collapse("hide");
                    $("#Recurrence2").collapse("hide");
                    $("#Recurrence3").collapse("hide");
                    $("#Recurrence4").collapse("hide");
                    $("#EndRecurrence").collapse("hide");
                    break;
                case "1":
                    $("#Recurrence1").collapse("show");
                    $("#Recurrence2").collapse("hide");
                    $("#Recurrence3").collapse("hide");
                    $("#Recurrence4").collapse("hide");
                    $("#EndRecurrence").collapse("show");
                    break;
                case "2":
                    $("#Recurrence1").collapse("hide");
                    $("#Recurrence2").collapse("show");
                    $("#Recurrence3").collapse("hide");
                    $("#Recurrence4").collapse("hide");
                    $("#EndRecurrence").collapse("show");
                    break;
                case "3":
                    $("#Recurrence1").collapse("hide");
                    $("#Recurrence2").collapse("hide");
                    $("#Recurrence3").collapse("show");
                    $("#Recurrence4").collapse("hide");
                    $("#EndRecurrence").collapse("show");
                    break;
                case "4":
                    $("#Recurrence1").collapse("hide");
                    $("#Recurrence2").collapse("hide");
                    $("#Recurrence3").collapse("hide");
                    $("#Recurrence4").collapse("show");
                    $("#EndRecurrence").collapse("show");
                    break;
            }
        }

        function GotoCalendar() {
            location.href="Monthly.aspx?cid=<%=_calId%>&sdate=<%=_sdate%>";
        }

        function GotoCalendarLater(cid, sdate) {
            window.setTimeout(function() {
                location.href="Monthly.aspx?cid=" + cid + "&sdate=" + sdate;
                }, 1000);
        }

        function ShowWarningMessage(msg) {
            $("#MsgBox").removeClass("collapse");
            $("#MsgBox").addClass("alert alert-danger");            
            $("#MsgBoxText").text(msg);
        }

        function InitEditor() {
            // 모든 #mc_container unwrap
            var html = $("#MemoTextBox").val();
            var $content = $($.parseHTML("<div>" + html + "</div>"));
            var mcContainer = $content.find("#mc_container");
            if (mcContainer.length > 0) mcContainer.contents().unwrap();
            html = $content.html();

            $("#MemoTextBox").kendoEditor({
                tools: KendoEditorTools,
                resizable: {
                    content: true,
                    toolbar: false
                },
                stylesheets: [
                    "../css/EditorCSS.ashx"
                ],
                paste: onEditorPaste
            });

            // textarea 값을 변경 후 kendoEditor를 생성하면 변경된 값이 적용되지 않고 원 값이 적용되는 문제가 있어 생성 후 직접 적용한다.
            $("#MemoTextBox").data("kendoEditor").value(html);
        }

        function onEditorPaste(e) {
            const dataVal = e.html;
            var imgUrls = [];
            const regex = /<img[^>]+src=["']?((http|https):\/\/[^"'>\s]+)["']?[^>]*>/ig;
            while ((match = regex.exec(dataVal)) !== null) {
                imgUrls.push(match[1]);
            }

            if (imgUrls.length > 0) {
                e.html = "";

                var newTag = dataVal;
                Base64Image_loadAllImages(imgUrls).then(images => {
                    images.forEach(img => {
                        if (img == null) return;
                        const canvas = document.createElement("canvas");
                        canvas.width = img.naturalWidth;
                        canvas.height = img.naturalHeight;
                        const ctx = canvas.getContext('2d');
                        ctx.drawImage(img, 0, 0);
                        const base64 = canvas.toDataURL("image/png");
                        newTag = newTag.replace(img.src, base64);
                    });
                    var editor = $("#MemoTextBox").data("kendoEditor");
                    editor.paste(newTag);
                }).catch(error => {
                    console.error("Image loading failed:", error);
                });
            }
        }

        function InitAttendee() {
            // 참석자 메일 주소 자동완성 구성
            $.ajax({
                type: "POST",
                url: "../Mail/GetRecipients.aspx/GetAutoCmplRecipientList4Actb",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var autoCmplArray = response.d;
                    actb($("#AttendeeTextBox").get(0), autoCmplArray, undefined, true);
                },
                failure: function (response) {
                    Dialog.alert('<asp:Literal runat="server" Text="<%$ Resources:, Msg17%>" />');     // 자동 완성 데이터 로딩 작업을 실패했습니다.
                }
            });

            $("#AttendeeListBox").kendoListBox();

            // 참석자 추가
            $("#AddAttendeeButton").click(function () {
                var emailText = $("#AttendeeTextBox").val();
                if (emailText.indexOf("@") > 0) {
                    var existDup = false;
                    var listBox = $("#AttendeeListBox").data("kendoListBox");
                    var dataItems = listBox.dataItems();        // ListBox에 바인드된 데이터 배열을 반환
                    for (var i = 0; i < dataItems.length; i++) {
                        if (dataItems[i].text.toLowerCase() == emailText.toLowerCase()) {
                            existDup = true;
                            break;
                        }
                    }
                    if (!existDup) {
                        listBox.add({ text: emailText });
                        $("#AttendeeTextBox").val("");
                    } else {
                        Dialog.alert('<asp:Literal runat="server" Text="<%$ Resources:, Msg18%>" />');     // 동일한 참석자가 이미 존재합니다.
                    }                    
                }
            });

            $("#RemoveAttendeeButton").click(function () {
                var listBox = $("#AttendeeListBox").data("kendoListBox");
                var items = listBox.items();                // ListBox를 구성하는 li 항목을 반환
                $(items).filter(".k-selected").remove();    // 선택 항목을 삭제
            });
        }
    </script>

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Path="~/libs/tabs/common.js" />
                    <asp:ScriptReference Path="~/libs/tabs/dialog.js" />
                    <asp:ScriptReference Path="~/libs/tabs/actb.js" />
                    <asp:ScriptReference Path="~/libs/tabs/actb_common.js" />
                    <asp:ScriptReference Path="~/libs/tabs/base64image.js" />
                </Scripts>
            </CompositeScript>
        </asp:ScriptManager>

        <div class="container-fluid">
            <div class="row" id="toolBar" data-spy="affix">
                <div class="col-xs-12" style="padding-top:2px;padding-bottom:2px;">
                    <button type="submit" id="saveToolButton" class="btn btn-primary"><span class="fa-solid fa-download"></span> <asp:Localize ID="Localize1" runat="server" meta:resourcekey="L01">저장</asp:Localize></button>
                    <span>&nbsp;</span>
                    <button type="button" id="closeToolButton" class="btn btn-primary" onclick="GotoCalendar();"><span class="fa-solid fa-xmark"></span></button>
                </div>
            </div>
        </div>

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

            <div class="panel panel-success">
                <div class="panel-heading"><asp:Localize ID="Localize2" runat="server" meta:resourcekey="L02">약속 정보</asp:Localize></div>
                <div class="panel-body">
                    <div class="form-group">
                        <label for="SubjectTextBox"><asp:Localize ID="Localize3" runat="server" meta:resourcekey="L03">제목</asp:Localize>:</label>
                        <input type="text" runat="server" id="SubjectTextBox" name="SubjectTextBox" class="form-control" maxlength="128" placeholder="" autocomplete="off" />
                    </div>
                    <div class="form-group">
                        <label for="PlaceTextBox"><asp:Localize ID="Localize4" runat="server" meta:resourcekey="L04">장소</asp:Localize>:</label>
                        <input type="text" runat="server" id="PlaceTextBox" name="PlaceTextBox" class="form-control" maxlength="64" placeholder="" autocomplete="off" />
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="checkbox"><label><input type="checkbox" id="AllDayCheckBox" runat="server"><asp:Localize ID="Localize5" runat="server" meta:resourcekey="L05">하루 종일</asp:Localize></label></div>
                            <div class="form-group">
                                <label for="BeginDateTime"><asp:Localize ID="Localize6" runat="server" meta:resourcekey="L06">시작</asp:Localize>:</label>
                                <div class="input-group date" id="BeginDateTime">
                                    <input type="text" class="form-control" name="BeginDateTime" />
                                    <span class="input-group-addon">
                                        <span class="fa-solid fa-calendar-days"></span>
                                    </span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="EndDateTime"><asp:Localize ID="Localize7" runat="server" meta:resourcekey="L07">종료</asp:Localize>:</label>
                                <div class="input-group date" id="EndDateTime">
                                    <input type="text" class="form-control" name="EndDateTime" />
                                    <span class="input-group-addon">
                                        <span class="fa-solid fa-calendar-days"></span>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="panel panel-default" id="AlertPanel" runat="server">
                        <div class="panel-body">
                            <div class="form-group">                        
                                <div class="checkbox">
                                    <label><input type="checkbox" id="AlertCheckBox" runat="server"><asp:Localize ID="Localize8" runat="server" meta:resourcekey="L08">미리 알림</asp:Localize></label>
                                </div>
                                <asp:DropDownList ID="AlertMinList" runat="server" CssClass="form-control">
                                    <asp:ListItem Text="0분" Value="0" meta:resourcekey="Am01" />
                                    <asp:ListItem Text="5분" Value="5" meta:resourcekey="Am02" />
                                    <asp:ListItem Text="10분" Value="10" meta:resourcekey="Am03" />
                                    <asp:ListItem Text="15분" Value="15" meta:resourcekey="Am04" />
                                    <asp:ListItem Text="30분" Value="30" meta:resourcekey="Am05" />
                                    <asp:ListItem Text="1시간" Value="60" meta:resourcekey="Am06" />
                                    <asp:ListItem Text="2시간" Value="120" meta:resourcekey="Am07" />
                                    <asp:ListItem Text="3시간" Value="180" meta:resourcekey="Am08" />
                                    <asp:ListItem Text="4시간" Value="240" meta:resourcekey="Am09" />
                                    <asp:ListItem Text="5시간" Value="300" meta:resourcekey="Am10" />
                                    <asp:ListItem Text="6시간" Value="360" meta:resourcekey="Am11" />
                                    <asp:ListItem Text="7시간" Value="420" meta:resourcekey="Am12" />
                                    <asp:ListItem Text="8시간" Value="480" meta:resourcekey="Am13" />
                                    <asp:ListItem Text="9시간" Value="540" meta:resourcekey="Am14" />
                                    <asp:ListItem Text="10시간" Value="600" meta:resourcekey="Am15" />
                                    <asp:ListItem Text="11시간" Value="660" meta:resourcekey="Am16" />
                                    <asp:ListItem Text="0.5일" Value="720" meta:resourcekey="Am17" />
                                    <asp:ListItem Text="18시간" Value="1080" meta:resourcekey="Am18" />
                                    <asp:ListItem Text="1일" Value="1440" meta:resourcekey="Am19" />
                                    <asp:ListItem Text="2일" Value="2880" meta:resourcekey="Am20" />
                                    <asp:ListItem Text="3일" Value="4320" meta:resourcekey="Am21" />
                                    <asp:ListItem Text="1주" Value="10080" meta:resourcekey="Am22" />
                                    <asp:ListItem Text="2주" Value="20160" meta:resourcekey="Am23" />
                                </asp:DropDownList>
                                <div class="checkbox" id="AlertedCheckBoxDiv" runat="server">
                                    <label><input type="checkbox" id="AlertedCheckBox" runat="server"><asp:Localize ID="Localize9" runat="server" meta:resourcekey="L09">약속을 확인하였습니다.</asp:Localize></label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="BusyStatusList"><asp:Localize ID="Localize10" runat="server" meta:resourcekey="L10">상태</asp:Localize>:</label>
                        <asp:DropDownList ID="BusyStatusList" runat="server" CssClass="form-control">
                            <asp:ListItem Text="<%$ Resources:Calendar, BusyStatus1 %>" Value="0" />
                            <asp:ListItem Text="<%$ Resources:Calendar, BusyStatus2 %>" Value="1" />
                            <asp:ListItem Text="<%$ Resources:Calendar, BusyStatus3 %>" Value="2" Selected="True" />
                            <asp:ListItem Text="<%$ Resources:Calendar, BusyStatus4 %>" Value="3" />
                        </asp:DropDownList>
                    </div>
                    <div class="form-group">
                        <label for="MemoTextBox"><asp:Localize ID="Localize11" runat="server" meta:resourcekey="L11">메모</asp:Localize>: </label>
                        <textarea class="form-control" rows="6" id="MemoTextBox" runat="server"></textarea>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading"><asp:Localize ID="Localize13" runat="server" meta:resourcekey="L13">되풀이 정보</asp:Localize></div>
                <div class="panel-body">
                    <div class="form-group">
                        <asp:DropDownList ID="RecurList" runat="server" CssClass="form-control">
                            <asp:ListItem Text="사용 안함" Value="0" Selected="True" meta:resourcekey="RL01" />
                            <asp:ListItem Text="매일" Value="1" meta:resourcekey="RL02" />
                            <asp:ListItem Text="매주" Value="2" meta:resourcekey="RL03" />
                            <asp:ListItem Text="매월" Value="3" meta:resourcekey="RL04" />
                            <asp:ListItem Text="매년" Value="4" meta:resourcekey="RL05" />
                        </asp:DropDownList>
                    </div>                    

                    <!-- 매일 되풀이 -->
                    <div class="collapse" id="Recurrence1">
                        <div class="form-inline">
                            <div class="form-group">
                                <span><asp:Localize ID="Localize14" runat="server" meta:resourcekey="L14">약속을 매</asp:Localize></span>
                                <asp:DropDownList ID="EverydayIntervalList" runat="server" CssClass="form-control">
                                    <asp:ListItem Text="1" Value="1" Selected="True" />
                                    <asp:ListItem Text="2" Value="2" />
                                    <asp:ListItem Text="3" Value="3" />
                                    <asp:ListItem Text="4" Value="4" />
                                    <asp:ListItem Text="5" Value="5" />
                                    <asp:ListItem Text="6" Value="6" />
                                    <asp:ListItem Text="7" Value="7" />
                                    <asp:ListItem Text="8" Value="8" />
                                    <asp:ListItem Text="9" Value="9" />
                                    <asp:ListItem Text="10" Value="10" /> 
                                    <asp:ListItem Text="11" Value="11" />
                                    <asp:ListItem Text="12" Value="12" />
                                    <asp:ListItem Text="13" Value="13" /> 
                                    <asp:ListItem Text="14" Value="14" />
                                    <asp:ListItem Text="15" Value="15" />
                                    <asp:ListItem Text="16" Value="16" /> 
                                    <asp:ListItem Text="17" Value="17" />
                                    <asp:ListItem Text="18" Value="18" />
                                    <asp:ListItem Text="19" Value="19" /> 
                                    <asp:ListItem Text="20" Value="20" />
                                    <asp:ListItem Text="21" Value="21" />
                                    <asp:ListItem Text="22" Value="22" /> 
                                    <asp:ListItem Text="23" Value="23" />
                                    <asp:ListItem Text="24" Value="24" />
                                    <asp:ListItem Text="25" Value="25" /> 
                                    <asp:ListItem Text="26" Value="26" />
                                    <asp:ListItem Text="27" Value="27" />
                                    <asp:ListItem Text="28" Value="28" />
                                    <asp:ListItem Text="29" Value="29" />
                                    <asp:ListItem Text="30" Value="30" /> 
                                </asp:DropDownList>
                                <span><asp:Localize ID="Localize15" runat="server" meta:resourcekey="L15">일마다 되풀이합니다.</asp:Localize></span>
                            </div>
                        </div>
                    </div>
                    <!-- 매일 되풀이 -->

                    <!-- 매주 되풀이 -->
                    <div class="collapse" id="Recurrence2">
                        <div class="form-inline">
                            <div class="form-group">
                                 <span><asp:Localize ID="Localize16" runat="server" meta:resourcekey="L16">매</asp:Localize></span>
                                 <asp:DropDownList ID="EveryweekList" runat="server" CssClass="form-control">
                                    <asp:ListItem Text="1" Value="1" Selected="True" />
                                    <asp:ListItem Text="2" Value="2" />
                                    <asp:ListItem Text="3" Value="3" />
                                    <asp:ListItem Text="4" Value="4" />
                                    <asp:ListItem Text="5" Value="5" />
                                    <asp:ListItem Text="6" Value="6" />
                                    <asp:ListItem Text="7" Value="7" />
                                    <asp:ListItem Text="8" Value="8" />
                                    <asp:ListItem Text="9" Value="9" />
                                    <asp:ListItem Text="10" Value="10" /> 
                                </asp:DropDownList> 
                                <span><asp:Localize ID="Localize17" runat="server" meta:resourcekey="L17">주 마다 다음 요일에 되풀이됩니다.</asp:Localize></span>
                            </div>
                        </div>
                        <div class="form-inline">
                            <div class="form-group">
                                <div>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList1" runat="server" value="1"><asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:Calendar,WeekDay1%>" /></label>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList2" runat="server" value="2"><asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Calendar,WeekDay2%>" /></label>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList3" runat="server" value="4"><asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:Calendar,WeekDay3%>" /></label>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList4" runat="server" value="8"><asp:Literal ID="Literal4" runat="server" Text="<%$ Resources:Calendar,WeekDay4%>" /></label>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList5" runat="server" value="16"><asp:Literal ID="Literal5" runat="server" Text="<%$ Resources:Calendar,WeekDay5%>" /></label>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList6" runat="server" value="32"><asp:Literal ID="Literal6" runat="server" Text="<%$ Resources:Calendar,WeekDay6%>" /></label>
                                    <label class="checkbox-inline"><input type="checkbox" id="WeekdayCheckBoxList7" runat="server" value="64"><asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:Calendar,WeekDay7%>" /></label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- 매주 되풀이 -->

                    <!-- 매월 되풀이 -->
                    <div class="collapse" id="Recurrence3">
                        <div class="form-inline">
                            <div class="form-group">
                                <div class="radio">
                                    <label><input type="radio" runat="server" id="EverymonthButton1" name="Everymonth" checked="true"></label>
                                    <span class=""><asp:Localize ID="Localize18" runat="server" meta:resourcekey="L18">약속을 매</asp:Localize></span> 
                                    <asp:DropDownList ID="EverymonthIntervalList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="1" Value="1" Selected="True" />
                                        <asp:ListItem Text="2" Value="2" />
                                        <asp:ListItem Text="3" Value="3" />
                                        <asp:ListItem Text="4" Value="4" />
                                        <asp:ListItem Text="5" Value="5" />
                                        <asp:ListItem Text="6" Value="6" />
                                        <asp:ListItem Text="7" Value="7" />
                                        <asp:ListItem Text="8" Value="8" />
                                        <asp:ListItem Text="9" Value="9" />
                                        <asp:ListItem Text="10" Value="10" />
                                        <asp:ListItem Text="11" Value="11" />
                                        <asp:ListItem Text="12" Value="12" />
                                    </asp:DropDownList>
                                    <span><asp:Localize ID="Localize19" runat="server" meta:resourcekey="L19">개월마다 되풀이합니다.</asp:Localize></span>
                                </div>
                            </div>
                        </div>
                        <div class="form-inline">
                            <div class="form-group">
                                <div class="radio">
                                    <label><input type="radio" runat="server" id="EverymonthButton2" name="Everymonth"></label>
                                    <span><asp:Localize ID="Localize20" runat="server" meta:resourcekey="L20">매</asp:Localize></span> 
                                    <asp:DropDownList ID="MonthEveryList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="1" Value="1"/>
                                        <asp:ListItem Text="2" Value="2"/>
                                        <asp:ListItem Text="3" Value="3"/>
                                        <asp:ListItem Text="4" Value="4"/>
                                        <asp:ListItem Text="5" Value="5" />
                                        <asp:ListItem Text="6" Value="6" />
                                        <asp:ListItem Text="7" Value="7" />
                                        <asp:ListItem Text="8" Value="8" />
                                        <asp:ListItem Text="9" Value="9" />
                                        <asp:ListItem Text="10" Value="10" />
                                        <asp:ListItem Text="11" Value="11" />
                                        <asp:ListItem Text="12" Value="12" />
                                    </asp:DropDownList> 
                                    <span><asp:Localize ID="Localize21" runat="server" meta:resourcekey="L21">개월마다</asp:Localize></span>
                                    <asp:DropDownList ID="MonthOrderList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth1 %>" Value="1" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth2 %>" Value="2" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth3 %>" Value="3" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth4 %>" Value="4" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth5 %>" Value="5" />
                                    </asp:DropDownList>
                                    <asp:DropDownList ID="MonthOrderWeekList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx1 %>" Value="1" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx2 %>" Value="2" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx3 %>" Value="4" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx4 %>" Value="8" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx5 %>" Value="16" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx6 %>" Value="32" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx7 %>" Value="64" />
                                    </asp:DropDownList>
                                    <span><asp:Localize ID="Localize22" runat="server" meta:resourcekey="L22">에 되풀이됩니다.</asp:Localize></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- 매월 되풀이 -->

                    <!-- 매년 되풀이 -->
                    <div class="collapse" id="Recurrence4">
                        <div class="form-inline">
                            <div class="form-group">
                                <div class="radio">
                                    <label><input type="radio" runat="server" id="EveryyearButton1" name="Everyyear" checked="true"></label>
                                    <span><asp:Localize ID="Localize23" runat="server" meta:resourcekey="L23">약속을 매</asp:Localize></span> 
                                    <asp:DropDownList ID="EveryyearIntervalList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="1" Value="1" Selected="True" />
                                        <asp:ListItem Text="2" Value="2" />
                                        <asp:ListItem Text="3" Value="3" />
                                        <asp:ListItem Text="4" Value="4" />
                                        <asp:ListItem Text="5" Value="5" />
                                    </asp:DropDownList>
                                    <span><asp:Localize ID="Localize24" runat="server" meta:resourcekey="L24">년마다 되풀이합니다.</asp:Localize></span>
                                </div>
                            </div>
                        </div>
                        <div class="form-inline">
                            <div class="form-group">
                                <div class="radio">
                                    <label><input type="radio" runat="server" id="EveryyearButton2" name="Everyyear" checked="true"></label>
                                    <span><asp:Localize ID="Localize25" runat="server" meta:resourcekey="L25">약속을 매</asp:Localize></span>
                                    <asp:DropDownList ID="EveryyearIntervalList2" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="1" Value="1" Selected="True" />
                                        <asp:ListItem Text="2" Value="2" />
                                        <asp:ListItem Text="3" Value="3" />
                                        <asp:ListItem Text="4" Value="4" />
                                        <asp:ListItem Text="5" Value="5" />
                                    </asp:DropDownList>
                                    <span><asp:Localize ID="Localize26" runat="server" meta:resourcekey="L26">년</asp:Localize></span>
                                    <asp:DropDownList ID="EveryyearMonthList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="1" Value="1"/>
                                        <asp:ListItem Text="2" Value="2"/>
                                        <asp:ListItem Text="3" Value="3"/>
                                        <asp:ListItem Text="4" Value="4"/>
                                        <asp:ListItem Text="5" Value="5" />
                                        <asp:ListItem Text="6" Value="6" />
                                        <asp:ListItem Text="7" Value="7" />
                                        <asp:ListItem Text="8" Value="8" />
                                        <asp:ListItem Text="9" Value="9" />
                                        <asp:ListItem Text="10" Value="10" />
                                        <asp:ListItem Text="11" Value="11" />
                                        <asp:ListItem Text="12" Value="12" /> 
                                    </asp:DropDownList>
                                    <span><asp:Localize ID="Localize27" runat="server" meta:resourcekey="L27">월마다</asp:Localize></span>
                                    <asp:DropDownList ID="EveryyearOrderList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth1 %>" Value="1" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth2 %>" Value="2" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth3 %>" Value="3" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth4 %>" Value="4" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekOfMonth5 %>" Value="5" />
                                    </asp:DropDownList> 
                                    <asp:DropDownList ID="EveryyearWeekList" runat="server" CssClass="form-control">
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx1 %>" Value="1" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx2 %>" Value="2" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx3 %>" Value="4" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx4 %>" Value="8" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx5 %>" Value="16" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx6 %>" Value="32" />
                                        <asp:ListItem Text="<%$ Resources:Calendar,WeekDayEx7 %>" Value="64" />
                                    </asp:DropDownList>
                                    <span><asp:Localize ID="Localize28" runat="server" meta:resourcekey="L28">에 되풀이됩니다.</asp:Localize></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- 매년 되풀이 -->

                    <!-- 되풀이 종료일 -->
                    <div class="collapse" id="EndRecurrence">
                        <div class="panel panel-default">                
                            <div class="panel-body">
                                <div class="form-group">
                                    <label class="control-label"><asp:Localize ID="Localize29" runat="server" meta:resourcekey="L29">종료일</asp:Localize>:</label>
                                    <div class="row">
                                        <div class="col-xs-12">
                                            <div class="radio"><label><input type="radio" runat="server" id="FinishButton1" name="FinishSet" checked="true"><asp:Localize ID="Localize30" runat="server" meta:resourcekey="L30">종료일 지정하지 않음</asp:Localize></label></div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-xs-4">
                                            <div class="radio"><label><input type="radio" runat="server" id="FinishButton2" name="FinishSet"><asp:Localize ID="Localize31" runat="server" meta:resourcekey="L31">반복 횟수 이후 종료</asp:Localize></label></div>
                                        </div>
                                        <div class="col-xs-8">
                                            <input type="text" runat="server" id="FinishRecurCountTextBox" name="FinishRecurCountTextBox" class="form-control" autocomplete="off" value="10" />                                            
                                            <asp:Localize ID="Localize32" runat="server" meta:resourcekey="L32"></asp:Localize>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-xs-4">
                                            <div class="radio"><label><input type="radio" runat="server" id="FinishButton3" name="FinishSet"><asp:Localize ID="Localize33" runat="server" meta:resourcekey="L33">종료일 지정</asp:Localize></label></div>
                                        </div>
                                        <div class="col-xs-8">
                                            <div class="input-group date" id="FinishDate">
                                                <input type="text" class="form-control" name="FinishDate" />
                                                <span class="input-group-addon">
                                                    <span class="fa-solid fa-calendar-days"></span>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>                        
                    </div>
                    <!-- 되풀이 종료일 -->
                </div>
            </div>

            <div class="panel panel-default" id="AttendeePanel" runat="server">
                <div class="panel-heading"><asp:Localize ID="Localize35" runat="server" meta:resourcekey="L35">참석자</asp:Localize></div>
                <div class="panel-body">
                    <div id="AttendeeInput" runat="server">
                        <div class="form-group">
                            <label for="AttendeeTextBox"><asp:Localize ID="Localize36" runat="server" meta:resourcekey="L36">메일 주소</asp:Localize>:</label>
                            <div class="input-group">
                                <input type="text" runat="server" id="AttendeeTextBox" name="AttendeeTextBox" class="form-control" placeholder="" autocomplete="off" />
                                <div class="input-group-btn">
                                    <button class="btn" id="AddAttendeeButton" runat="server" type="button">
                                        <i class="glyphicon glyphicon-plus"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="AttendeeListBox"><asp:Localize ID="Localize37" runat="server" meta:resourcekey="L37">참석자 목록</asp:Localize>:</label>
                            <select class="form-control" id="AttendeeListBox"></select>
                            <asp:HiddenField ID="Attendees" runat="server" />
                        </div>
                        <div class="form-group text-right">
                            <button class="btn" type="button" id="RemoveAttendeeButton" runat="server"><asp:Localize ID="Localize38" runat="server" meta:resourcekey="L38">참석자 삭제</asp:Localize></button>
                        </div>
                    </div>
                    <div class="form-group">
                        <label><asp:Localize ID="Localize39" runat="server" meta:resourcekey="L39">참석자 응답</asp:Localize>:</label>
                        <asp:Repeater ID="AttendeeListView" runat="server">
                            <HeaderTemplate>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <div class="row">
                                    <div class="col-xs-8"><%# Eval("Name") %> (<%# Eval("Email") %>)</div>
                                    <div class="col-xs-4 text-right"><%# GetAttendeeStatusString((TABS.MailCarrier.WebSDK.Calendar.Attendee.AttendeeStatus)Eval("Status"))%></div>
                                </div>
                            </ItemTemplate>
                            <FooterTemplate>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                </div>
            </div>
        </div>

        <div style="display:">
            <asp:LinkButton ID="SaveButton" runat="server" OnClick="SaveButton_Click" /> 
        </div>
    </form>
</body>
</html>
