<%@ 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("RoomControl")%>
</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">
				<a href="javascript:void(0)" class="toolbar-button tb-icon-refresh" onclick="$('#dg').datagrid('reload');"><%: Html.Language("Refresh")%></a> 
				<a href="javascript:void(0)" class="toolbar-button tb-icon-add" onclick="addRoomControrl()"><%: Html.Language("New")%></a>
				<a href="javascript:void(0)" class="toolbar-button tb-icon-edit" onclick="editRoomControrl()"><%: Html.Language("Edit")%></a>
				<a href="javascript:void(0)" class="toolbar-button tb-icon-remove" onclick="del()"><%: Html.Language("Delete")%></a>
				<a href="javascript:void(0)" class="toolbar-button tb-icon-apply" onclick="setActiveIndicator()"><%: Html.Language("StartAndStop")%></a>
			</div>
		</div>
        <div data-options="region:'center',border:false">
        <table id="dg" class="easyui-datagrid" style="width:100%; height:auto;"
				data-options="
						border: false,
						pagination: true,
						pageSize: 20,
						rownumbers: true,
						sortName: 'ID',
						sortOrder: 'desc',
						fit: true,
						fitColumns: true,
						striped: true,
						idField: 'ID',
						url: '/RoomControl/LoadByRoomControl/',
						method: 'POST',
						frozenColumns: [[ { field: 'ID', checkbox: true } ]],
						onDblClickRow: function(index, row) { editRoomControrl(row); },
					">
				<thead>
					<tr>
						<th data-options="field:'ActiveIndicator',align:'center',resizable:false,formatter:function(val,rec){return val==true ? lang.Yes : lang.No;}">
							<%: Html.Language("StartAndStop")%>
						</th>
						<%--<th data-options="field:'GroupName',sortable:true,resizable:false">
							<%: Html.Language("Floor")%>
						</th>--%>
						<th data-options="field:'RoomTypeName',sortable:true,resizable:false">
							<%: Html.Language("RoomType")%>
						</th>
						<th data-options="field:'RoomNumbers',sortable:true,resizable:false,width:200">
							<%: Html.Language("RoomNumber")%>
						</th>
						<th data-options="field:'RoomStatusID',align:'center',sortable:true,resizable:false,formatter:function(val){
                            switch(val){
                                case 2: return lang.Rented;
                                case 4: return lang.NoRented;
                                case 8: return lang.CheckOut;
                                case 16: return lang.EmptyRoom;
                                default: return ''
                            }
                        }">
							<%: Html.Language("RoomStatus")%>
						</th>
						<th data-options="field:'RoomCardTypeName',sortable:true,resizable:false">
							<%: Html.Language("CardType")%>
						</th>
						<th data-options="field:'RoomTypeSceneName',sortable:true,resizable:false">
							<%: Html.Language("SceneName")%>
						</th>
						<th data-options="field:'TimingType',align:'center',sortable:true,resizable:false,formatter:function(val){
                            switch(val){
                                case 1: return lang.EveryWeek;
                                case 2: return lang.EveryMonth;
                                default: return lang.EveryDay;
                            }
                        }">
                            <%: Html.Language("TimingType")%>
                        </th>
						<th data-options="field:'TimingDay',align:'center',sortable:true,resizable:false">
							<%: Html.Language("Date")%>
						</th>
						<th data-options="field:'Timing',align:'center',sortable:true,resizable:false">
							<%: Html.Language("Time")%>
						</th>
                        <th data-options="field:'ExecStatus',align:'center',sortable:true,resizable:false,formatter: function(val) { return val == true ? lang.Executed : lang.NonExecution; }">
							<%: Html.Language("ExecStatus")%>
						</th>
                        <th data-options="field:'ExecTime',sortable:true,resizable:false">
							<%: Html.Language("ExecTime")%>
						</th>
					</tr>
				</thead>
			</table>
		</div>
    </div>

    <div id="dialog" class="easyui-window" style="padding: 5px;" data-options="closed: true,modal: true,collapsible: false,minimizable: false,maximizable: false">
		<div class="easyui-panel dlg-content" style="margin-bottom:5px;"></div>
		<div class="dlg-footer" style="text-align:right; padding:5px 5px 0 0;">
			<a class="easyui-linkbutton dlg-btn-save" data-options="iconCls:'icon-save'" href="javascript:void(0)"><%: Html.Language("Save")%></a>
			<a class="easyui-linkbutton dlg-btn-cancel" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#dialog').window('close');"><%: Html.Language("Cancel")%></a>
		</div>
	</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
<script type="text/javascript" src="/Scripts/room-control-index.js"></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; } %>
</asp:Content>
