<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ExhibitorMaster.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>


<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(function () {
            var type = $("#Type").val();
            var title = "";
            if (type == "Agree") {
                title = "确定预约信息";
            }
            if (type == "Suggest") {
                title = "建议新预约时间";
            }
            $("#CurrentPosition").html(title);
            //$("#menu6").css("visibility", "visible");

            SetTime(1);

            var oldDate = $("#oldDate").val();
            var oldHour = $("#oldHour").val();
            var oldMinute = $("#oldMinute").val();

            $("input[name='Date'][value='" + oldDate + "']").attr("checked", true);
            $("#Hour").find("option[value='" + oldHour + "']").attr("selected", true);
            $("#Minute").find("option[value='" + oldMinute + "']").attr("selected", true);

            var TktIDObjChk = $("input[name='TktID']:checked");
            if (TktIDObjChk.length > 0) {
                Show($("input[name='TktID']:checked").val());
            }

            
        });

        function Save() {
            //            var area = $("input[name='Area']:checked").val();
            //            if ($.trim(area) == "") {
            //                $("input[name='Area']")[0].focus();
            //                showMsg("请选择见面地点！");
            //                return;
            //            }

            var type = $("#Type").val();
            if (type == "Suggest") {
                var date = $("input[name='Date']:checked").val();
                if ($.trim(date) == "") {
                    $("input[name='Date']")[0].focus();
                    showMsg("请选择预约日期！");
                    return;
                }
            }
            var TktIDObj = $("input[name='TktID']");
            if (TktIDObj.length > 0) {
                var TktIDObjChk = $("input[name='TktID']:checked");
                if (TktIDObjChk.length <= 0) {
                    TktIDObj[0].focus();
                    showMsg("请选择接待人员！");
                    return;
                }
            } else {
                if (confirm("您还没有设置接待人员，是否跳转到接待人员管理？")) {
                    window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/Reception";
                } else {

                }
                return;
            }

            if (confirm("确认此次预约信息？")) {
                $("#f1").submit();
            }
        }

        function Show(id) {
            $("#ShowInfo").attr("src", "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/ScheduleReceiverInfo/" + id);
            $("#trShow").css("display", "");
        }

        function Back() {
            window.history.go(-1);
        }
    </script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <center>
            <form id="f1" action="" method="post">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td align="left">
                        <%
                            string type = ViewData["Type"].ToString();
                            System.Data.DataRow dr = ViewData["DataRow"] as System.Data.DataRow;
                            if (dr != null)
                            {
                        %>
                        <table width="100%" border="0" cellpadding="10" cellspacing="0">
                            <tr>
                                <td align="right">预约人姓名：</td>
                                <td>
                                    <%=Server.HtmlEncode(dr["PsnName"].ToString())%>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">预约人公司：</td>
                                <td>
                                    <%=Server.HtmlEncode(dr["PsnComName"].ToString())%>
                                </td>
                            </tr>
                            <%--<tr>
                                <td align="right">会面主题：</td>
                                <td>
                                    <%=Server.HtmlEncode(dr["MmiReason"].ToString())%>
                                </td>
                            </tr>--%>
                            <tr>
                                <td align="right" valign="top">备注信息：</td>
                                <td>
                                    <textarea cols="40" rows="5" id="LinkInfo" name="LinkInfo" readonly="readonly"><%=Server.HtmlEncode(dr["MmiLinkInfo"].ToString())%></textarea>
                                </td>
                            </tr>
                        <% 
if (type == "Suggest")
{
                        %>
                            <tr>
                                <td align="right">预约日期：</td>
                                <td>
                        <input type="radio" id="Date1" name="Date" value="2014/8/21" onclick="SetTime(1)" checked="checked" />&nbsp;&nbsp;<label for="Date1" style="color:Black">2014/8/21</label>&nbsp;<input type="radio" id="Date2" name="Date" value="2014/8/22" onclick="SetTime(1)" />&nbsp;&nbsp;<label for="Date2" style="color:Black">2014/8/22</label>
                               &nbsp;<input type="radio" id="Date3" name="Date" value="2014/8/23" onclick="SetTime(1)" />&nbsp;&nbsp;<label for="Date3" style="color:Black">2014/8/23</label>&nbsp;<input type="radio" id="Date4" name="Date" value="2014/8/24" onclick="SetTime(2)" />&nbsp;&nbsp;<label for="Date4" style="color:Black">2014/8/24</label>&nbsp;

                        <% 


    DateTime dateTime = Convert.ToDateTime(dr["MmiBTime"]);
    string oldDate = dateTime.ToShortDateString();
    int oldHourInt = dateTime.Hour;
    int oldMinuteInt = dateTime.Minute;
    string oldHour = oldHourInt < 10 ? "0" + oldHourInt : "" + oldHourInt;
    string oldMinute = oldMinuteInt < 10 ? "0" + oldMinuteInt : "" + oldMinuteInt;
                        %>
                                    <input type="hidden" id="oldDate" name="oldDate" value="<%=oldDate %>" />
                                    <input type="hidden" id="oldHour" name="oldHour" value="<%=oldHour %>" />
                                    <input type="hidden" id="oldMinute" name="oldMinute" value="<%=oldMinute %>" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right">预约时间：</td>
                                <td>
                                    <script type="text/javascript">
                                        function SetTime(Time) {
                                            var varOptionHour = "";
                                            if (Time == "1") {
                                                for (var i = 9; i < 18; i++) {
                                                    var hour = i + "";
                                                    if (i < 10) {
                                                        hour = "0" + hour;
                                                    }
                                                    varOptionHour += "<option value='" + hour + "'>" + hour + "</option>";
                                                }
                                            }
                                            else {
                                                for (var i = 9; i < 16; i++) {
                                                    var hour = i + "";
                                                    if (i < 10) {
                                                        hour = "0" + hour;
                                                    }
                                                    varOptionHour += "<option value='" + hour + "'>" + hour + "</option>";
                                                }
                                            }
                                            var varOptionMinute = "";
                                            for (var i = 0; i < 60; i++) {
                                                if (i % 15 == 0) {
                                                    var minute = i + "";
                                                    if (i < 10) {
                                                        minute = "0" + minute;
                                                    }
                                                    varOptionMinute += "<option value='" + minute + "'>" + minute + "</option>";
                                                }

                                            }
                                            var html = "";
                                            html += "<select id='Hour' name='Hour' style='width:40px;'>" + varOptionHour + "</select>";
                                            html += "时";
                                            html += "<select id='Minute' name='Minute' style='width:40px;'>" + varOptionMinute + "</select>";
                                            html += "分";

                                            document.getElementById("showtime").innerHTML = html;
                                        }
                                    </script>
                                    <span id="showtime"></span>
                                </td>
                            </tr>
                        <% 
}
else
{ 
                        %>
                            <tr>
                                <td align="right">预约日期时间：</td>
                                <td align="left"><%=Server.HtmlEncode(dr["MmiBTime"].ToString())%></td>
                            </tr>
                        <%
}    
                        %>
                            <tr>
                                <td width="20%" align="right">接待人员：</td>
                                <td>
                        <%
Dictionary<int, string> di = ViewData["ReceptionDi"] as Dictionary<int, string>;
if (di.Count > 0)
{
    foreach (int TktID in di.Keys)
    {
                        %>
                                    <input type="radio" name="TktID" value="<%=TktID %>" onclick="Show(this.value)" /><%=di[TktID]%>&nbsp;
                        <%
    }
}
else
{ 
                        %>
                                    <font color="red">请先在接待人员管理中设置接待人员。</font>
                                    <a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/Reception">点击这里</a>
                        <%    
}
                        %>
                                </td>
                            </tr>
                            <tr id="trShow" style="display:none">
                                <td align="center" valign="top" colspan="2">
                                    <iframe id="ShowInfo" marginwidth="0" frameborder="0" width="100%"></iframe>
                                </td>
                            </tr>
                            <%--<tr>
                                <td align="right">见面地点：</td>
                                <td>
                                    <input type="radio" name="Area" value="展台接待处" />展台接待处
                                    <input type="radio" name="Area" value="观众休息区" />观众休息区
                                    <input type="radio" name="Area" value="其他" />其他
                                </td>
                            </tr>--%>
                            <tr>
                                <td colspan="2">
                                    <table border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td><div class="button" onclick="Save()">确定</div></td>
                                            <td><div class="button" onclick="Back()">返回</div></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input type="hidden" id="MmiID" name="MmiID" value="<%=dr["MmiID"] %>" />
                                                <input type="hidden" id="Type" name="Type" value="<%=type %>" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <%
                            }    
                        %>
                    </td>
                </tr>
            </table>
            </form>
        </center>
    </div>
</asp:Content>