<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SimonMasterPage.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%: Html.Language("HostManagement") %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false" style="overflow:hidden;height:30px;">
			<div class="toolbar">
                <label>
                    <%: Html.Language("RoomNumber")%>：</label>
                <input id="txtRoomNumber" class="easyui-validatebox" style="width: 60px;" />
				<select id="cbxIsSyncRoomNumber" class="easyui-combobox" style="width:60px;" data-options="panelHeight: 'auto',editable: false">
					<option value='2'><%: Html.Language("Sync")%></option>
					<option value='1' selected="selected"><%: Html.Language("Yes")%></option>
					<option value='0'><%: Html.Language("No")%></option>
				</select>
                <label>MAC：</label>
                <input id="txtMac" class="easyui-validatebox" style="width: 120px;" />
                <label>
                    <%: Html.Language("RoomType")%></label>
                <input id="txtRoomType" class="easyui-validatebox" style="width: 60px;" />
				<a href="javascript:void(0)" class="toolbar-button tb-icon-search" onclick="groupTreeOnSelect(null);"><%: Html.Language("Query")%></a>
                <a href="javascript:void(0)" class="toolbar-button tb-icon-password" onclick="getKey()"><%: Html.Language("GetKey")%></a>
                <a href="javascript:void(0)" class="toolbar-button tb-icon-apply" onclick="publishKey()"><%: Html.Language("PublishKey")%></a>
                <a href="javascript:void(0)" class="toolbar-button tb-icon-password" onclick="getHostKey()"><%: Html.Language("GetHostKey")%></a>
            </div>
		</div>
		<div title="" style="border-right:1px solid #95B8E7;" data-options="region:'center',border:false">
			<table id="dg" class="easyui-datagrid" style="width:100%;"
				data-options="
						border: false,
						singleSelect: false,
						pagination: true,
						pageSize: 200,
                        pageList: [30, 50, 100, 200],
						rownumbers: true,
						sortName: 'RegisterDate',
						sortOrder: 'desc',
						fit: true,
						fitColumns: true,
						striped: true,
						idField: 'ID',
						frozenColumns: [[
							{ field: 'ID', checkbox: true }
						]],
						method: 'POST',
						onDblClickRow: function(index, row) { edit(row); }
					">
				<thead>
					<tr>
						<th data-options="field:'HostNumber',sortable:true,align:'center'">
							<%: Html.Language("ID") %>
						</th>
						<th data-options="field:'RoomNumber',sortable:true,align:'center'">
							<%: Html.Language("RoomNumber") %>
						</th>
						<th data-options="field:'DeviceName'">
							<%: Html.Language("DeviceName")%>
						</th>
						<th data-options="field:'DeviceSecret'">
							<%: Html.Language("DeviceSecret")%>
						</th>
						<th data-options="field:'IsPublish',align:'center',formatter:function(val,rec){return val ? lang.Yes : lang.No;}">
							<%: Html.Language("Publish")%>
						</th>
						<th data-options="field:'HostSecret'">
							<%: Html.Language("HostSecret")%>
						</th>
						<th data-options="field:'MAC',sortable:true">
							<%: Html.Language("MAC")%>
						</th>
						<th data-options="field:'GroupName',sortable:true">
							<%: Html.Language("Group") %>
						</th>
						<th data-options="field:'RoomType',sortable:true">
							<%: Html.Language("RoomType") %>
						</th>
						<%--<th data-options="field:'Version',sortable:true">
							<%: Html.Language("Version") %>
						</th>--%>
                        <%--<th data-options="field:'ConfigVersion',sortable:true">
							<%: Html.Language("ConfigVersion") %>
						</th>--%>
						<th data-options="field:'RegisterDate',sortable:true">
							<%: Html.Language("RegistrationDate")%>
						</th>
						<%--<th data-options="field:'IP',sortable:true">
							<%: Html.Language("IP")%>
						</th>--%>
						<th data-options="field:'Remark'">
							<%: Html.Language("Remark") %>
						</th>
						<th data-options="field:'ProductKey'">
							<%: Html.Language("ProductKey")%>
						</th>
						<th data-options="field:'IotId'">
							IotId
						</th>
					</tr>
				</thead>
			</table>
		</div>        

		<div style="width:270px;border-left:1px solid #95B8E7;" data-options="region:'east',split: true,border: false">
			<div class="easyui-layout" data-options="fit:true">
				<div data-options="region:'center',border:false">
					<table id="groupTree" class="easyui-treegrid"
						data-options="
							url: '/Group/LoadGroupTree/',
							method: 'post',
							idField: 'ID',
							treeField: 'Name',
							fit: true,
							fitColumns: true,
							animate: true,
							border: false,
							bodyCls: 'easyui-treegrid-no-icon',
							loadMsg: '<%: Html.Language("Loading") %>',
                            onLoadSuccess: function (row, data) {if (data[0] != null) {$('#groupTree').treegrid('select', data[0].ID);}},
							onSelect: groupTreeOnSelect
						">
						<thead>
							<tr>
								<th data-options="field:'Name',width:160"><%: Html.Language("Name") %></th>
								<th data-options="field:'Sort',align:'center',width:40"><%: Html.Language("Sort") %></th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div> 
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <style type="text/css">
		#uploadForm table th {
			font-weight: normal;
			cursor: default;
		}
	</style>
	<script src="/Scripts/group.js" type="text/javascript"></script>
    <% 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; } %>
	<script src="/Scripts/host-index.js" type="text/javascript"></script>
</asp:Content>
