<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_RoomList.aspx.vb" Inherits="TourEx.Web.Admin_RoomList" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script language="javascript" src="../Sys/Js/jquery.js"></script>
</head>
<body>
<form runat="server" id="TourExForm">
<ul class="tools">
	<li class="add" p="18"><span><asp:HyperLink ID="AddRoom" runat="server">添加</asp:HyperLink></span></li>
	<li class="save" p="19"><span><a href="javascript:void(0);" onclick="Save(0);return false;">保存</a></span></li>
	<li class="del" p="20"><span><a href="javascript:void(0);" onclick="Del(0);return false;">删除</a></span></li>
</ul>
<div style="display:none"><asp:Label ID="navIgation" runat="server" Text=""></asp:Label></div>
</form>
    <form id="BatchSubmit" name="BatchSubmit" method="post" action="?act=edit" style="display: none">
    </form>
<asp:Repeater ID="Repeater" runat="server">
    <HeaderTemplate>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabBox">
            <tr class="tabTitleMain">
                <td width="35" class="selectAll">
                    <a href="javascript:void(0);" onclick="$('input[name=\'R_ID\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));">全选</a>
                </td>
                <td width="50">
                    编号
                </td>
                <td>
                    房型名称
                </td>
                <td width="100">
                    排序
                </td>
                <td width="100">
                    操作
                </td>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
         <tr class="tabTextMain" id="From_<%#Eval("R_ID")%>" onmouseout="this.style.background='#FFFFFF';" onmouseover="this.style.background='#F4F7FA';">
            <td>
                <input name="R_ID" id="R_ID_<%#Eval("R_ID")%>" type="checkbox" value="<%#Eval("R_ID")%>" />
            </td>
            <td>
                <%#Eval("R_ID")%>
            </td>
            <td>
                <input id="R_Name_<%#Eval("R_ID")%>" name="R_Name_<%#Eval("R_ID")%>" type="text" value="<%#Eval("R_Name")%>" ovalue="<%#Eval("R_Name")%>" class="formTitle"/>
            </td>
            <td>
                <input id="R_OrderID_<%#Eval("R_ID")%>" name="R_OrderID_<%#Eval("R_ID")%>" type="text" value="<%#Eval("R_OrderID")%>" ovalue="<%#Eval("R_OrderID")%>" onkeyup="this.value=this.value.replace(/\D/g,'');" size="6" maxlength="6" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" class="formTitle"/>
            </td>
            <td>
                <a href="Admin_HotelOrder.aspx?RId=<%#Eval("R_ID")%>" p="11,12">订单</a>
                <a href="javascript:void(0);" onclick="Save(<%#Eval("R_ID")%>);return false;" p="19">保存</a>
                <a href="Admin_Room.aspx?id=<%#Eval("R_ID")%>" p="19">编辑</a> 
                <a href="javascript:void(0);" onclick="Del(<%#Eval("R_ID")%>);return false;" p="20">删除</a>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
        <asp:Label ID="lblEmpty" Text="暂无" runat="server" Visible="<%#Boolean.Parse((Repeater.Items.Count = 0).ToString())%>"
            Width="100%" Style="text-align: center">     
        </asp:Label>
    </FooterTemplate>
</asp:Repeater>
<script type="text/javascript">
 <!--//
 var AP='<%=TourEx.BLL.GetSession("AdminPermissions") %>';
 if(AP!='')
 {
    if(AP.indexOf(',18,')==-1)$('*[p="18"]').remove();
    if(AP.indexOf(',19,')==-1)$('*[p="19"]').remove();
    if(AP.indexOf(',20,')==-1)$('*[p="20"]').remove();
    if(AP.indexOf(',11,')+AP.indexOf(',12,')==-2)$('*[p="11,12"]').remove();
 }
 function Save(ID)
 {
 	var R_IDs=ID==0?$('input[name="R_ID"]'):$('#R_ID_'+ID);
	var R_Name,R_O;
	$('#BatchSubmit').html('');
	for(var i=0;i<R_IDs.length;i++)
	{
		R_Name = $.trim($('#R_Name_'+R_IDs[i].value).val());
		$('#R_Name_'+R_IDs[i].value).val(R_Name);
		if(R_Name==''){alert('请填写房型名称！');return;}
		R_O=$('#R_OrderID_'+R_IDs[i].value).val();
		if(R_Name!=$('#R_Name_'+R_IDs[i].value).attr('ovalue') || R_O!=$('#R_OrderID_'+R_IDs[i].value).attr('ovalue'))
		{
			R_IDs[i].checked=true;
			$('#From_'+R_IDs[i].value).clone().prependTo("#BatchSubmit");
			$('#R_Name_'+R_IDs[i].value,'#BatchSubmit').val(R_Name);
			$('#R_OrderID_'+R_IDs[i].value,'#BatchSubmit').val(R_O);
		}
	}
 	if($('#BatchSubmit').html()==''){alert('数据没有改动过，无需保存！');return;}
	$('input[name="R_ID"]','#BatchSubmit').attr('checked',true);
	$('#BatchSubmit').submit();
 }
 function Del(ID)
 {
 	var Url='?Act=del&';
	var IDs;
	if(ID>0)
	{
		Url +='R_ID='+ID;
	}else{
 		IDs = $("input[name='R_ID']").serialize().replace(/&R_ID=/g,',');
		if(IDs==''){alert('请选择您要删除的房型！');return;}
		Url +=IDs;
	}
	if(confirm('您确定删除吗！')){location=Url;}
 }
//-->
</script>

</body>
</html>
