<%@ Page Title="修改预定" Language="C#" MasterPageFile="~/Book/Book.master" AutoEventWireup="true" CodeBehind="Editbook.aspx.cs" Inherits="Book.Book.Editbook" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cont_form" runat="server">

   
   <asp:HiddenField runat="server" ID="hf_rec" ClientIDMode="Static" />
   <asp:HiddenField runat="server" ID="hf_myemail" />
      <script>
          MAXDAY = '<%=maxday%>';
      </script>



    <div class="form-group">
    <label class="col-sm-2 control-label"> 会议主题<span class="rr">*</span>
    </label>
      <div class="col-sm-10">
         <asp:TextBox runat="server" ID="txt_intro" ClientIDMode="Static"     CssClass="form-control flat bdc"  /> 
       </div>
  </div>

     <br /><br /> <br />


    <div class="form-group">
    <label   class="col-sm-2 control-label">会议时间<span class="rr">*</span>
    </label>
      <div class="col-sm-10 form-inline" >
        <asp:TextBox type="text" id="txt_startdate" ClientIDMode="Static"   runat="server" CssClass="form-control _dt  flat bdc"  />
 &nbsp;&nbsp;&nbsp;&nbsp;开始 
        <asp:DropDownList   Width="150px"   ClientIDMode="Static"  runat="server" id="ddl_starttime" CssClass="form-control  flat bdc" ></asp:DropDownList>
  
 &nbsp;&nbsp;&nbsp;&nbsp;结束     
     <asp:DropDownList    Width="150px" ClientIDMode="Static"   runat="server" id="ddl_endtime"  CssClass="form-control  flat bdc"  ></asp:DropDownList>
       
       </div>
  </div>


  <br /> <br />

<div class="form-group">
    <label   class="col-sm-2 control-label">会议室/人数 <span class="rr">*</span>     
    </label>


         <div class="col-sm-8">
     <div class="input-group">
      <asp:TextBox runat="server" ID="txt_room"  ClientIDMode="Static" 
           onfocus="openPop('room'); this.blur(); return false;" 
           onclick="openPop('room'); return false;"
          CssClass="form-control   flat bdc"  /> 

              <span class="input-group-addon">
    <a href="#"  onclick="openPop('room'); return false;">
        <i class="glyphicon glyphicon-th-large"></i>
     </a>
</span>
              </div> 
      </div>


         <div class="col-sm-2 form-inline" > 

             <!-- rr --> 

             <div class="input-group">
          <span class="input-group-btn">
              <button type="button" class="btn btn-default btn-number  flat bdc"   data-type="minus" data-field="quant[1]">
                  <span class="glyphicon glyphicon-minus   "></span>
              </button>
          </span>
          <input type="text" id="numbers" name="quant[1]" class="form-control input-number   flat bdc" value="2" min="1" max="9999">
         
                  <span class="input-group-btn">
              <button type="button" class="btn btn-default btn-number  flat bdc" data-type="plus" data-field="quant[1]">
                  <span class="glyphicon glyphicon-plus  "></span>
              </button>
          </span>
      </div>


             <!-- /rr -->

        </div>
  </div>

  


    
    <br /><br />





        
     <div class="form-group">
    <label  class="col-sm-2 control-label">会议类型
     
    </label>
      <div class="col-sm-10 gchk">
    
        
                 
   <asp:CheckBoxList ID="cb_other2" runat="server" CssClass="serviceitem"  RepeatColumns="2"     > 
   </asp:CheckBoxList>
 



      </div>
  </div>

     <br /> <br />





   


    
         <div class="form-group">
    <label   class="col-sm-2 control-label">重复周期
        
     
    </label>
         <div class="col-sm-10">
     <div class="input-group">
      <asp:TextBox runat="server" ID="txt_rule"    onfocus="this.blur(); return false;"   onclick=" return false;"  ClientIDMode="Static" 
           CssClass="form-control flat bdc"  /> 

   <span class="input-group-addon">
      <a href="#"  onclick="alert('重复会议规则请在日历上，双击修改'); return false;">
        <i class="glyphicon glyphicon-th-large"></i>
     </a> 
</span>
              </div> 
      </div>

 
  </div>



     
 

     <br /> <br />

     
      <div class="form-group">
    <label   class="col-sm-2 control-label">与会人员
     
    </label>
      <div class="col-sm-10 flat">
     
          <div class="input-append   ">
          <div class="input-group ">
               
              
    <select id="sel_attend" multiple="multiple" style="width:100%;     border-collapse:collapse; border:solid 1px #4f81bd" class="select2">

    </select> 

        <span class="input-group-addon">
    <a href="#"  onclick="openPop('attend'); return false;"><i class="glyphicon glyphicon-user"></i>

    </a> 
</span>
                    </div>
              </div>


      </div>
  </div>

     <br /> <br />





     <div class="form-group">
    <label  class="col-sm-2 control-label">会议资源
     
    </label>
      <div class="col-sm-10">
    
          <asp:CheckBoxList ID="cb_other1" runat="server"  CssClass="serviceitem"  Width="90%" RepeatColumns="5"     > 
    
    </asp:CheckBoxList>
 



      </div>
  </div>

     <br /> <br />

     


      <div class="form-group">
    <label   class="col-sm-2 control-label">备注
     
    </label>
      <div class="col-sm-10">
      <asp:TextBox runat="server" ID="txt_specialrequire" Height="60px"  TextMode="MultiLine" CssClass="form-control flat bdc "  /> 
      </div>
  </div>

     <br /> <br /> 

 
      <div class="form-group">
    <label   class="col-sm-2 control-label">联系人员 </label>
      <div class="col-sm-10">
          
          <p class="form-control-static form-inline">
   
                  <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="请输入邮件" CssClass="noborder line" />  
         </p>
      </div>
  </div>

     <br /> <br />


      <div class="form-group"  >
     
      <div class="col-sm-12  text-center">
          <asp:Button ID="btn_add" runat="server" Text="提交" 
           UseSubmitBehavior="false" 
           OnClientClick="if(!checkvalue()) return false;  this.value='please wait…';this.disabled=true; "
                
               CssClass="btn btn-primary btn-flat" OnClick="btn_add_Click" />

          
      </div>
  </div>




    
       <input id="hf_mgr_text" name="hf_mgr_text"  type="hidden" value="<%=_hf_mgr_text%>"  />
    <input id="hf_mgr" name="hf_mgr"    type="hidden" value="<%=_hf_mgr%>" />

        <input id="hf_attend_text" name="hf_attend_text"  type="hidden" value="<%=_hf_attend_text%>" />
     <input id="hf_attend" name="hf_attend"  type="hidden"   value="<%=_hf_attend%>" />


     <input id="hf_roomid" name="hf_roomid"  type="hidden"  value="<%=_hf_roomid%>" />
        <input id="hf_roomname" name="hf_roomname" type="hidden"  value="<%=_hf_roomname%>" />
    <input id="hf_numbers" name="hf_numbers"   type="hidden"  value="<%=_hf_numbers%>" />
     <input id="hf_aid" name="hf_aid"   type="hidden" value="<%=_hf_aid%>" />




      <input id="hf_pcid" name="hf_pcid"  type="hidden"  value="<%=_hf_pcid%>" />
        <input id="hf_pcname" name="hf_pcname" type="hidden"  value="<%=_hf_pcname%>" />

      <input id="hf_projectorid" name="hf_projectorid"  type="hidden"  value="<%=_hf_projectorid%>" />
        <input id="hf_projectorname" name="hf_projectorname" type="hidden"  value="<%=_hf_projectorname%>" />

    <script>

        function openPop(types) {
            switch (types) {
                case "room":
                    url = "Pop_Room.aspx?";
                    break; 

                case "attend":
                    url = "Pop_Users.aspx?t=attend&";
                    break;

                case "rule":
                    
                    break;

            }

            url += "dt=" + $("#txt_startdate").val() + "&";
            url += "starttime=" + $("#ddl_starttime").val() + "&";
            url += "endtime=" + $("#ddl_endtime").val();

            layer.open({
                type: 2,
                title: "选择",
                shadeClose: true,
                shade: 0.8,
                area: ['880px', '550px'],
                content: url
            });
        }

         


        function setPopAttend(result) {
            var oldValue = $("#sel_attend").select2("data");
            var newValue = processArray(oldValue, result);
            $("#sel_attend").select2("data", newValue);
        }


        function setPopRoom(result) {
            var roomid = result.split('$')[0];
            var roomname = result.split('$')[1];
            var aid = result.split('$')[2];
            $("#hf_roomid").val(roomid);
            $("#hf_roomname").val(roomname);
            $("#txt_room").val(roomname);
            $("#hf_aid").val(aid);
        }

         



        $(document).ready(function () { 


            $("#numbers").val($("#hf_numbers").val());
            $("#txt_room").val($("#hf_roomname").val()); 

            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().on("select2-opening", function (e) {
                e.preventDefault();
            });

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










             
             
            $(".gchk input").change(

                function () {
                    var ischeck = $(this).prop("checked");
                    if (ischeck) {
                        $(".gchk input").prop("checked", false);
                        $(this).prop("checked", true);
                    }
                });
             

        });


        function checkvalue() {
  
            var _mgr = getSelect($("#sel_attend").select2("data"));
            $("#hf_attend").val(_mgr);


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


            $("#hf_numbers").val($("#numbers").val());

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


            if ($("#hf_roomid").val() == "" || $("#hf_roomid").val() == "0") {
                layer.msg("请选择会议室");
                return false;
            }
             

            return true;
        }



        function processArray(arrSource, strResult) {
            strResults = strResult.split('!');
            var users = "";
            var loginname = "";
            var displayname = "";
            var text = "";

            for (var i = 0; i < strResults.length; i++) {
                if (strResults[i] != "") {
                    users = strResults[i].split('$');
                    loginname = users["1"];
                    displayname = users["2"];
                    text = displayname + "(" + loginname + ")";
                    arrSource.push({ id: loginname, text: text });
                }
            }

            return arrSource;

        }


        function getSelect(arrSource) {
            var result = "";
            for (var i = 0; i < arrSource.length; i++) {
                if (arrSource[i] != "") {
                    result += arrSource[i].id + ";";
                }
            }
            return result;
        }


        function getSelectText(arrSource) {
            var result = "";
            for (var i = 0; i < arrSource.length; i++) {
                if (arrSource[i] != "") {
                    result += arrSource[i].text + ";";
                }
            }
            return result;
        }


         

        


        function setRule(_rec, _txt) {   
            $("#hf_rec").val(_rec);
            $("#txt_rule").val(_txt);
        
        }

         
    </script>

    



     

    <script src="../Javascript/txtPlusMinus.js"></script>

 


 


</asp:Content>
