<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="WebSite.Controllers" %>
<%
    List<Light> ServiceList = ViewData["ServiceList"] as List<Light>;       
%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
	<meta http-equiv="cache-control" content="max-age=0" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
	<meta http-equiv="pragma" content="no-cache" />
	<title>房间号：<%=ViewData["RoomNumber"] %></title>
	<link type="text/css" rel="stylesheet" href="/Styles/WeiXin/common.css" />
    <link type="text/css" rel="stylesheet" href="/Styles/WeiXin/service.css" />
    <link type="text/css" rel="stylesheet" href="/Styles/WeiXin/tip.css" />
    <script type="text/javascript" src="/Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="/Scripts/WeiXin/tip.js"></script>
    <script type="text/javascript" src="/Scripts/avalon.mobile.min.js"></script>
    <script type="text/javascript">

        var currentGroupAddress = "";
        var currentLight = null;

        function setLight(modalId, status) {
            $.ajax({
                url: '/WeiXin/LightControl/',
                type: "POST",
                dataType: "JSON",
                data: { roomNumber: document.getElementById("hidRoomNumber").value, groupAddress: modalId, status: status == 1 ? 1 : 2 },
                success: function (r) {
                    showTip(r.Message);
                }
            });
        }

        $(function () {
            $('#service-list li a').click(function () {
                if ($(this).hasClass("selected") == 1) {
                    $(this).removeClass("selected");
                } else {
                    $(this).addClass("selected");
                }
                setLight($(this).attr("modal"), $(this).hasClass("selected"));
            });
        });
    </script>
</head>
<body>
	<input id="hidRoomNumber" type="hidden" value='<%=ViewData["RoomNumber"] %>' />
	<div id="cmain">
        <ul id="service-list" class="clearfix">
            <% foreach (var item in ServiceList)
               { %>
            <li><a href="javascript:void(0)" type="0" class=' <%=item.Status == 1 ? "selected":"" %>'
                modal='<%=item.ModalAddress %>'><i class="icon B10"></i><em class="text">
                    <%=item.Name %></em> </a></li>
            <% } %>
        </ul>
		<%--<ul id="service-list" class="clearfix">
			<li><a id="B03" href="javascript:void(0)" ><i
				class="icon B03"></i><em class="text">清即清理</em> </a></li>
			<li><a id="B02" href="javascript:void(0)" "><i
				class="icon B02"></i><em class="text">请勿打扰</em> </a></li>
			<li><a id="B10" href="javascript:void(0)""><i
				class="icon B10"></i><em class="text">请稍后</em> </a></li>
			<li><a id="B04" href="javascript:void(0)" "><i
				class="icon B04"></i><em class="text">呼叫服务</em> </a></li>
			<li><a id="B09" href="javascript:void(0)" "><i
				class="icon B09"></i><em class="text">打开门锁</em> </a></li>
			<li><a id="B05" href="javascript:void(0)""><i
				class="icon B05"></i><em class="text">预约退房</em> </a></li>
		</ul>--%>
	</div>
	<% Html.RenderPartial("Footer"); %>
</body>
</html>
