<%@ Page Title="" Language="C#" MasterPageFile="~/m/m.Master" ClientIDMode="Static" AutoEventWireup="true" CodeBehind="EditBook.aspx.cs" Inherits="Book.m.EditBook" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
       
    <link href="js/jdate/mobiscroll.css" rel="stylesheet" />
    <link href="js/jdate/mobiscroll_date.css" rel="stylesheet" />
    <script src="js/jdate/mobiscroll_date.js"></script>
    <script src="js/jdate/mobiscroll.js"></script>
    <link href="js/icheck/skins/square/blue.css" rel="stylesheet" />
    <script src="js/icheck/icheck.min.js"></script>
    <script src="../javascript/layer_mobile/popwin.js"></script>
    <link href="../javascript/select2/select2.css?a=1" rel="stylesheet" />
    <script src="../Javascript/select2/select2.min.js"></script> 


       <script>
           document.body.onclick = function () {
               $("#result").hide();
           }

    </script>


    <style>
     .m20 {
     margin-left:-25px;
     }

     .mui-pull-right input[type=text]  {
      margin-bottom:0px;
      margin-top:0px;
      height:32px;
       width:200px;
       border-radius:0px;
     }
      
  
      .mui-pull-right select{
       margin-bottom:0px;
       margin-top:0px;
       height:38px;
       width:200px;
       border-radius:0px;
       padding:8px 10px !important;
     }

     .chk label {
        
         display:inline-block;margin-right:10px;
        }
 </style>
 

     
    
 <header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">更新预定</h1>
            <a class="mui-icon mui-icon-bars mui-pull-right" href="default.aspx"></a>
 </header>

 

    <div class="mui-content">
        <div class="mui-page">


            <p>基本信息</p>
                <ul class="mui-table-view">

                   <li class="mui-table-view-cell">
                       会议主题 <span class="_r">*</span>

                        <span class="mui-pull-right">
                             <asp:TextBox ID="txt_title"  ClientIDMode="Static" runat="server"></asp:TextBox> 
                      </span>
                  </li>


                 <li class="mui-table-view-cell">
                       与会人数  <span class="_r">*</span>
                       <span class="mui-pull-right">
		             		<div class="mui-numbox" data-numbox-step='1' data-numbox-min='1' data-numbox-max='120'>
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
					<input class="mui-input-numbox" type="number" value="<%=num %>" name="total" id="total"   />
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
				              </div>
                           </span>
                    </li>



  <li class="mui-table-view-cell">
      会议日期  <span class="_r">*</span>

       <span class="mui-pull-right">
             <asp:TextBox ID="txt_start" ClientIDMode="Static"     class="form-control"  runat="server"></asp:TextBox>
        </span>
  </li>




  <li class="mui-table-view-cell">
      开始时间  <span class="_r">*</span>

       <span class="mui-pull-right">
           <asp:DropDownList runat="server" ID="ddl_start"  ></asp:DropDownList>
          </span>
      </li>


  <li class="mui-table-view-cell">
      结束时间  <span class="_r">*</span>

       <span class="mui-pull-right">
            <asp:DropDownList runat="server"  ID="ddl_end"></asp:DropDownList>
          </span>
 </li>




                    
   <li class="mui-table-view-cell">
      所在区域  <span class="_r">*</span>

       <span class="mui-pull-right">
           
       <asp:DropDownList  runat="server" ID="ddl_area"  Enabled="false"  ClientIDMode="Static"></asp:DropDownList>
            
          </span>
 </li>




   <li class="mui-table-view-cell">
      可用会议室  <span class="_r">*</span>

       <span class="mui-pull-right">
           
 <asp:DropDownList runat="server" ID="ddl_room"></asp:DropDownList>
            
          </span>
 </li>






  <li class="mui-table-view-cell" style="<% =(pc_count=="0")?" display:none ":"" %> ">
      可用笔记本 

       <span class="mui-pull-right">
           
 <asp:DropDownList runat="server" ID="ddl_pc"></asp:DropDownList>

            
          </span>
 </li>







  <li class="mui-table-view-cell" style="<% =(projector_count=="0")? "display:none ":"" %> ">
      可用投影仪   

       <span class="mui-pull-right"> 
   
             <asp:DropDownList runat="server" ID="ddl_projector"></asp:DropDownList>
          </span>
 </li>




      <li class="mui-table-view-cell">
      会议属性  

       <span class="mui-pull-right chk">


          <asp:RadioButtonList runat="server" RepeatDirection="Horizontal" ID="rbl_types"> 

          </asp:RadioButtonList>


          </span>
 </li>
                          

</ul>




<p></p>
             <ul class="mui-table-view">

                 

     <li class="mui-table-view-cell">
      所需资源  

       <div class="chk" style="margin-top:5px;">
           	 
           <asp:CheckBoxList runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" ID="cb_other1"></asp:CheckBoxList>
                   
          </div>
 </li>



<li class="mui-table-view-cell">
    
 与会人员 <span  onclick="openPop('attend'); return false;" style="color:#0094ff !important;  font-size:13px; display:inline-block">点击选择   </span>  
              
    <select id="sel_attend" multiple="multiple" style="width:100%;"  class="select2"></select> 


     
    
    
<!-- outlook style -->
   <script>

       $("#sel_attend").select2().on("select2-opening", function (e) {
           e.preventDefault();
       });

</script>

               
   <style>
                  #result {
                 
                  }
                  #result li {
                   list-style-type:none; line-height:30px;
                    width:200px;padding:3px;
                  }

                   #result li:hover {
                   list-style-type:none; line-height:30px; background-color:#2d6077;color:#ffffff;

                  }
              </style>
              
 

 <div  > 
   <div id="result" style="display:none; position:relative; background-color:#ffffff; z-index:200;  left:-30px; top:0px;">
       <ul>
          
       </ul>
   </div>
</div>
   






              
              <script>


                  $(".select2-input").blur(
                      function () {
                          $("#result").hide();
                      }
                 );


                  $(".select2-input").keyup(
                      function () {
                          var _v = $(this).val();

                          if (_v != "") {
                              $.ajax({
                                  url: "../book/data.aspx",
                                  data: { key: _v },
                                  cache: false,
                                  async: true,
                                  dataType: 'json',

                                  success: function (data) {

                                      $("#result ul").html("");

                                      var c = data.length;

                                      if (c == 0) {
                                          $("#result").hide();
                                      }

                                      for (var i = 0; i < c; i++) {
                                          $("#result ul").append("<li>" + data[i].text + "(" + data[i].id + ")</li>");
                                      }



                                      $("#result ul").on("click", "li", function () {

                                          var temp = $(this).html();
                                          displayname = temp;
                                          loginname = temp.split("(")[0];
                                          text = displayname;

                                          var DATA = $("#sel_attend").select2("data")
                                          DATA.push({ id: loginname, text: text });

                                          $("#sel_attend").select2("data", DATA);

                                          $("#result").hide();

                                      });

                                      $("#result").show();

                                  }



                              });



                          }
                          else {
                              $("#result").hide();

                          }



                      });

              </script>

 

               








<!-- /outlook style -->


    
    
    
    
    
              
 </li>

</ul>

            <p></p>

   <ul class="mui-table-view">  

   <li class="mui-table-view-cell">
      额外通知 
            <div>
           <asp:TextBox runat="server" placeholder="通知人员邮件列表"   TextMode="MultiLine"   Height="60" ID="txt_notice"></asp:TextBox>
           </div>
 </li>





   <li class="mui-table-view-cell">
      特别需求  

      <div>
           <asp:TextBox runat="server"   TextMode="MultiLine"   Height="60" ID="txt_specialrequire"></asp:TextBox>
           </div>
     </li>


     </ul>



              <div class="mui-content-padded">

                <asp:Button ID="btnsubmit"
                     
                      OnClientClick=" if(!IsOK()) {return false;}    if(!isRoomOK()) {return false;}    if(!isProjectorOK()) {return false;}    if(!isPcOK()) {return false;}              " 
                        UseSubmitBehavior="false"
                        class=" mui-btn mui-btn-block mui-btn-primary" 
                                style="padding:10px;" 
                     runat="server" Text="提交" OnClick="btnsubmit_Click" />

             </div>


             

           </div>
   </div>







    <script src="js/book.js"></script>



     






  



      

     <input id="hf_attend_text" name="hf_attend_text"  type="hidden"  />
     <input id="hf_attend" name="hf_attend"  type="hidden" />  
    <input type="text" name="meetingtype" value="<%=_meetingtype %>" style="display:none" id="meetingtype" />


  
     
      

    <asp:Panel runat="server" ID="pn_hide" Visible="false">
         
     <asp:TextBox runat="server" ID="txt_contactname"  placeholder="姓名"  CssClass="noborder line" />  
      <asp:TextBox runat="server" ID="txt_contactdept"   placeholder="部门"  CssClass="noborder line "/> 
      <asp:TextBox runat="server" ID="txt_contacttel"  placeholder="电话"  CssClass="noborder line"  />  
     <asp:TextBox runat="server" ID="txt_contactemail"   placeholder="邮件" Width="250" CssClass="noborder line" />
      <asp:HiddenField runat="server" ID="hf_myemail" />
        <asp:HiddenField runat="server" ID="hf_guid" />
 </asp:Panel>











     







  <script type="text/javascript">



      $(document).ready(function () {
          $("input[type='radio']").iCheck({
              checkboxClass: 'icheckbox_square-blue',
              radioClass: 'iradio_square-blue'

          });


          $("input[type='checkbox']").iCheck({
              checkboxClass: 'icheckbox_square-blue',
              radioClass: 'iradio_square-blue'

          });





          var attendIds = "<%=_hf_attend%>".split(";");
          var attendTexts = "<%=_hf_attend_text%>".split(";");
          var dataAttend = [];
          for (var i = 0; i < attendIds.length; i++) {
              if (attendIds[i] != "") {
                  dataAttend.push({ id: attendIds[i], text: attendTexts[i] });
              }

          }
           


          $("#sel_attend").select2("data", dataAttend);




          $("input[type='radio']").on('ifClicked', function (e) {

              if (e.currentTarget.id == "rbl_types_1") {
                  $("#meetingtype").val("外部会议");
              }
              else {
                  $("#meetingtype").val("内部会议");
              }

          });


      });



</script>

     
     

    <script src="js/dt.js"></script>

    <script>



        function IsOK() {

            if ($("#txt_title").val() == "") {
                alert("请填写会议主题");
                return false;
            }
             

            _att = getSelect($("#sel_attend").select2("data"));
            $("#hf_attend").val(_att);



            _att = getSelectText($("#sel_attend").select2("data"));
            $("#hf_attend_text").val(_att);

             
            return true;
        }



        function isRoomOK()
        {
            var result = true;

            //check room avaliable
         

            var Start = $("#txt_start").val() + " " + $("#ddl_start").val();
            var End = $("#txt_start").val() + " " + $("#ddl_end").val();
            var id= '<%=id%>';
         

            $.ajax({
                url: "ajax_get_available_room_edit.aspx",
                data: { start: Start, end: End, t: "room", catid: $("#ddl_room").val(), bookid: id },
                type: "get",
                cache: false,
                async: false,
                success: function (r) {
                     
                    if (r == "1") { 
                        result = true;
                    }
                    else {
                        result = false;
                        alert("会议室冲突");
                       

                    }

                } 
            });

            return result;

        }



        function isProjectorOK() {

            var result = true;



            var Start = $("#txt_start").val() + " " + $("#ddl_start").val();
            var End = $("#txt_start").val() + " " + $("#ddl_end").val();
            var id = '<%=id%>';
         

            $.ajax({
                url: "ajax_get_available_room_edit.aspx",
                data: { start: Start, end: End, t: "projector", catid: $("#ddl_projector").val(), bookid: id },
                type: "get",
                cache: false,
                async: false,
                success: function (r) {

                    if (r == "1") {
                        result = true;
                    }
                    else {
                        result = false;
                        alert("笔记本冲突");
                      

                    }

                }
            });

            return result;
        }



        function isPcOK()
        {
            var result = true;



            var Start = $("#txt_start").val() + " " + $("#ddl_start").val();
            var End = $("#txt_start").val() + " " + $("#ddl_end").val();
            var id = '<%=id%>';
         


            $.ajax({
                url: "ajax_get_available_room_edit.aspx",
                data: { start: Start, end: End, t: "projector", catid: $("#ddl_projector").val(), bookid: id },
                type: "get",
                cache: false,
                async: false,
                success: function (r) {

                    if (r == "1") {
                        result = true;
                    }
                    else {
                        result = false;
                        alert("投影仪冲突");
                       

                    }

                }
            });

            return result;
        }

       


          


     

    </script>






</asp:Content>
