<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<link rel="stylesheet" type="text/css" href="/Styles/partbox.css" />
<style type="text/css">
	form fieldset {
		border:1px solid #95B8E7;
	}
	form table th {
		font-weight: normal;
		text-align: right;	
	}
	.reload {
		display: inline-block;
		width: 16px;
		height: 16px;
		margin-left: 5px;
	}
</style>
<div class="partbox" style="width:1000px;margin:5px;">
	<div class="title"><%: Html.Language("SceneControl")%></div>
	<div class="container">
		<div class="content" style="height:35px;">
			<form id="form1" method="post" action="#">
				<input type="hidden" name="Type" value="0" />
				<input type="hidden" name="OnOff" value="true" />
				<div style="line-height:35px;height:35px;">
					<label><%: Html.Language("Scene")%></label>
					<input id="cbxScene1" name="SceneID" class="easyui-combobox" style="width:120px;" 
						data-options="
							method: 'post',
							editable: false,
							required: true,
							valueField: 'ID',
							textField: 'Name',
							panelHeight: 'auto',
							url: '/RoomTypeScene/LoadAll/'
						" />
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-send'" onclick="send1(0)"><%: Html.Language("Issue")%></a>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-send'" onclick="send1(1)"><%: Html.Language("TakeInverseIssue")%></a>
				</div>
			</form>
		</div>
	</div>
</div>
<div class="partbox" style="width:1000px;margin:5px;">
	<div class="title"><%: Html.Language("DeviceControl")%><a href="javascript:void(0)" onclick="$('#dgLights').datagrid('reload');" class="reload icon-reload"></a></div>
	<div class="container">
		<div class="content" style="height:480px;">
			<table id="dgLights" class="easyui-datagrid" 
				data-options="
						border: true,
						singleSelect: true,
						rownumbers: true,
						striped: true,
						fit: true,
						fitColumns: true,
						idField: 'HostID',
						method: 'post',
						sortName: 'Number',
						sortOrder: 'asc'
					">
				<thead>
					<tr>
                        <th data-options="field:'TypeName',resizable:false">
                            <%: Html.Language("Type")%>
                        </th>
						<th data-options="field:'ModalAddress',resizable:false">
							  <%: Html.Language("ReturnAddress")%>
						</th>
						<%--<th data-options="field:'Outlet',resizable:false">
							  <%: Html.Language("DeliveryOutlet")%>
						</th>--%>
						<th data-options="field:'Name',resizable:false">
							 <%: Html.Language("Name")%>
						</th>
						<th data-options="field:'Status',align:'center',resizable:false,
							formatter: function(val){ 
								if(val == 1){
									return lang.Opened;
								} else {
									return lang.Closed;
								}
							}">
							<%: Html.Language("Status")%>
						</th>
				        <th data-options="field:'Brightness',align:'center',resizable:false,
                            formatter:function(val,row){                    
						        switch (row.Type) {
                                    case 'Dimmer':
                                    case 'Strip':
                                    case 'Traic':
                                    case 'PWMDimmer':
                                        return val + '%';
                                    case 'Relay':
                                    case 'Expand':
                                        return row.Status==1?'100%':'0%';
                                    case 'AirDetect':
                                        return val;
                                    default:
                                        return '';
                                }
                                }">
					        <%: Html.Language("Brightness")%>
				        </th>
						<%--<th data-options="field:'Time',resizable:false,formatter:timeFormatter">
							 <%: Html.Language("WhenTheDayOfOpenLong")%>
						</th>--%>
                        <!--这里的operationFormatter 是JS中的一个函数，这个函数非常地重要-->
						<th data-options="field:'Operation',align:'center',resizable:false,formatter:operationFormatter"> <%: Html.Language("Operation")%></th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
</div>

<% switch ((int)Session["isCN"]){case 1: %>
<script type="text/javascript" src="/Scripts/en-US.js"></script>
<% break; case 2: %>
<script type="text/javascript" src="/Scripts/zh-TW.js"></script>
<% break;default: %>
<script type="text/javascript" src="/Scripts/zh-CN.js"></script>
<% break; } %>