<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Pop_Room.aspx.cs" Inherits="Book.Book.Pop_Room" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>


    <script src="../javascript/jquery-1.9.1.min.js"></script>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" />

    <script src="../bootstrap/js/bootstrap.min.js"></script>

    <script src="../Javascript/layer/layer.min.js"></script>
    
    <link href="../style/btn.css" rel="stylesheet" />

    <script src="../Javascript/common.js"></script>
 
     <style>
           #gv_room tr td{ cursor:pointer}
     </style>

</head>
<body style=" margin:8px; color:#1970c0; ">
    <form id="form1" runat="server">


        <div class="well" style="height:80px;"> 
       <div class="pull-left "  >
      <asp:DropDownList runat="server" ID="ddl_area" Width="300px" CssClass="form-control" AutoPostBack="True" 
            onselectedindexchanged="ddl_area_SelectedIndexChanged" ClientIDMode="Static"></asp:DropDownList> 
           </div>


             <div class="pull-right input-group form-group form-inline"  >  
         
       <button class="btn btn-primary btn-flat" id="btnSelect"
              onclick="submitAndClose(); "
              >  <%=iseng?"OK":"确定" %> </button>
                 &nbsp;&nbsp;
     
  <button class="btn btn-danger btn-flat" onclick=" parent.layer.close(parent.layer.getFrameIndex(window.name));"> 
          <%=iseng?"Close":"关闭" %>

  </button>
      </div>




            </div>


  <asp:GridView ID="gv_room"  
      AutoGenerateColumns="false"   
   DataKeyNames="id"  
      ClientIDMode="Static" 
       BorderWidth="0px"
     CssClass="table table-hover"
   AllowPaging="false"  
   runat="server"  
     GridLines="None"
      >
    <Columns>
   
   <asp:TemplateField>
    <ItemTemplate>
    <input type="checkbox" 
     title='<%#Eval("catname") %>' 
     <%#Book.BLL.CategoryHelper.IsCatEnabled(Eval("allowroles")) %> class="roomgroup"  value='<%#Eval("id")%>$<%#Eval("catname") %>'   id="room<%#Eval("id")%>"/>
   
    </ItemTemplate>
   <ItemStyle Width=40px />
   </asp:TemplateField>

   <asp:TemplateField>
   <ItemStyle  HorizontalAlign="Left" />
   <HeaderStyle HorizontalAlign="Left" />
   <HeaderTemplate>
        <%=iseng?"Room Name":"会议室名称" %>
       </HeaderTemplate>
   <ItemTemplate>
        
   <%#Eval("catname") %>
   
   </ItemTemplate>
   
   </asp:TemplateField>
     
    


<asp:TemplateField>
<HeaderTemplate>

<%=projectorhead%>

</HeaderTemplate>
<ItemTemplate>
   <%#Eval("hasprojector").ToString() == "1" ? "<img src=images/tick.gif >" : ""%>
</ItemTemplate>
 

</asp:TemplateField>





<asp:TemplateField>
<HeaderTemplate>
<%=pchead%>
</HeaderTemplate>
<ItemTemplate>
<%#Eval("haspc").ToString() == "1" ? "<img src=images/tick.gif >" : ""%>
</ItemTemplate>

 
</asp:TemplateField>



<asp:TemplateField>
<HeaderTemplate>
 <%=tchead%>

</HeaderTemplate>
<ItemTemplate>
<%#Eval("hastc").ToString() == "1" ? "<img src=images/tick.gif >" : ""%>
</ItemTemplate>

 
</asp:TemplateField>



<asp:TemplateField>
<HeaderTemplate>
<%=vtchead%>

</HeaderTemplate>
<ItemTemplate>
   <%#Eval("hasvtc").ToString() == "1" ? "<img src=images/tick.gif >" : ""%>
</ItemTemplate>
 

</asp:TemplateField>





<asp:TemplateField>
<HeaderTemplate>
<%=numhead%>
</HeaderTemplate>
<ItemTemplate>
<%#Eval("num") %> 人
</ItemTemplate>
 

</asp:TemplateField>

 

  
<asp:TemplateField>
<HeaderTemplate>
 状态
</HeaderTemplate>
<ItemTemplate>
 
    <%#isFree(Eval("id")) %>

</ItemTemplate>
 

</asp:TemplateField>



 </Columns>
    
   
    </asp:GridView>
  


       
        <script>




            $("#gv_room").on("click", "tr", function () {

                $(".roomgroup").prop("checked", false);

                $(this).parent().find("tr").each(
                    function () {
                        $(this).removeClass("selected");
                    });


                var input = $(this).find("input");

                if ($(input).prop("disabled")) {
                }
                else {


                    if ($(input).prop("checked")) {
                        $(input).prop("checked", false);
                        $(this).removeClass("selected");
                    }

                    else {
                        $(input).prop("checked", true);
                        $(this).addClass("selected");
                    }
                }



            });




            function submitAndClose() {
                var checked = 0;
                var result = '';

                var _c = 0;
                $(".roomgroup").each(
                 function () {
                     if ($(this).is(':checked')) {
                         checked++;
                         result = $(this).val() + "$" + $("#ddl_area").val();
                     }
                 }

                );



                if (checked > 0) {

                }
                else {

                    alert('请至少选择一条记录');
                    return false;
                }

                parent.setPopRoom(result);
                parent.layer.close(parent.layer.getFrameIndex(window.name));

            }

        </script>

    </form>
</body>
</html>
