<%@ 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("RoomTypeSetting")%>
</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('load',{});">
                    <%: Html.Language("Refresh") %></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-add"
                        onclick="add()">
                        <%: Html.Language("New") %></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-edit"
                            onclick="edit()">
                            <%: Html.Language("Edit") %></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-remove"
                                onclick="delData()">
                                <%: Html.Language("Delete")%></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-apply"
                                    onclick="copy()">
                                    <%: Html.Language("Copy")%></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-upgrade"
                                        onclick="programFile()">
                                        <%: Html.Language("ProgramFile")%></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-relation"
                                            onclick="roomTypeModal()">
                                            <%: Html.Language("Circuit")%></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-air"
                                                onclick="sceneMgmt()">
                                                <%: Html.Language("Scene")%></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-connect-room"
                                                    onclick="weiXinMgmt()">
                                                    <%: Html.Language("WeiXinMgmt")%></a> <a href="javascript:void(0)" class="toolbar-button tb-icon-network"
                                                        onclick="channelMgmt()">
                                                        <%: Html.Language("TVChannelMgmt")%></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,
						singleSelect: true,
						pagination: true,
						pageSize: 20,
						rownumbers: true,
						striped: true,
						sortName: 'ID',
						sortOrder: 'asc',
						fit: true,
						fitColumns: true,
						idField: 'ID',
						url: '/RoomType/LoadAllByPage/',
						method: 'POST',
						onDblClickRow: function(index, row) { edit(row); }
					">
                <thead>
                    <tr>
                        <th data-options="field:'Code',sortable:true,resizable:false">
                            <%: Html.Language("ID")%>
                        </th>
                        <th data-options="field:'HostName',sortable:true,resizable:false">
                            <%: Html.Language("Name")%>
                        </th>
                        <th data-options="field:'Name',sortable:true,resizable:false">
                            <%: Html.Language("CustomName")%>
                        </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>
    <div id="dialog2" class="easyui-window" data-options="closed: true,modal: true,collapsible: false,minimizable: false,maximizable: false">
        <div class="easyui-panel dlg-content" style="margin-bottom: 5px;">
        </div>
    </div>
    <div id="dialog3" class="easyui-window" data-options="closed: true,modal: true,collapsible: false,minimizable: false,maximizable: false">
        <div class="easyui-panel dlg-content" style="margin-bottom: 5px;">
        </div>
    </div>
    <div id="updateHost" class="easyui-window" title='<%: Html.Language("ProgramFile")%>'
        style="width: 650px; height: 400px;" data-options="
				closed: true,
				modal: true,
				collapsible: false,
				minimizable: false,
				maximizable: false
			">
        <div class="easyui-layout" fit="true">
            <div style="border-right: 1px solid #95B8E7;" data-options="region:'center',border:false">
                <table id="dgUpdateHost" class="easyui-datagrid" style="width: 100%; height: auto;"
                    data-options="
								toolbar: '#updateHostToolbar',
								border: false,
								singleSelect: true,
								pagination: true,
								pageSize: 50,
                                pageList: [10, 20, 50, 100],
								rownumbers: true,
								sortName: 'UploadTime',
								sortOrder: 'desc',
								fit: true,
								fitColumns: true,
								idField: 'ID',
								frozenColumns: [[
									{ field: 'ID', checkbox: true }
								]],
								method: 'post'
							">
                    <thead>
                        <tr>
                            <th data-options="field:'FileName',width:120,sortable:true,formatter:$.tools.formatCellTooltip">
                                <%: Html.Language("ProgramFile")%>
                            </th>
                            <th data-options="field:'FileType',sortable:true,formatter:function(value){ if(value == 0) { return lang.ProgramFile; } else if(value == 1 || value == 3) { return lang.ConfigurationFile; } else if(value == 2) { return lang.RCUFile; } else { return ''; } }">
                                <%: Html.Language("DocumentType")%>
                            </th>
                            <th data-options="field:'Size',sortable:true,formatter:function(value){ return (value / 1024.0 / 1024.0).toFixed(2); }">
                                <%: Html.Language("Size")%>(MB)
                            </th>
                            <th data-options="field:'UploadTime',sortable:true,formatter:$.tools.formatDateTime">
                                <%: Html.Language("UploadDate")%>
                            </th>
                            <th data-options="field:'Account',sortable:true">
                                <%: Html.Language("UploadPeople")%>
                            </th>
                            <th data-options="field:'Href',sortable:true,formatter:downloadFile">
                                <%: Html.Language("Operation")%>
                            </th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div id="updateHostToolbar" style="vertical-align: middle;">
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-upload',plain:true"
                onclick="$('#uploadForm').form('reset');$('#hidRoomTypeID').val($('#dg').datagrid('getSelected').ID);$('#uploadFile').window('open')">
                <%: Html.Language("Upload")%></a> <a href="javascript:void(0)" class="easyui-linkbutton"
                    data-options="iconCls:'icon-remove',plain:true" onclick="delProgramFile()">
                    <%: Html.Language("Delete")%></a>
        </div>
    </div>
    <div id="uploadFile" class="easyui-window" title='<%: Html.Language("ProgramFile")%>'
        style="width: 400px; height: 180px; padding: 5px;" data-options="
				closed: true,
				modal: true,
				collapsible: false,
				minimizable: false,
				maximizable: false
			">
        <div class="easyui-layout" fit="true">
            <div style="padding-top: 25px;" data-options="region:'center'">
                <form id="uploadForm" method="post" enctype="multipart/form-data">
                <input id="hidRoomTypeID" name="RoomTypeID" type="hidden" value="0" />
                <table style="width: 100%;">
                    <tr>
                        <th>
                            <%: Html.Language("DocumentType")%>
                        </th>
                        <td>
                            <select id="cbxFileType" name="FileType" class="easyui-combobox" data-options="requried:true,editable:false,panelHeight:'auto'">
                                <option value="0"><%: Html.Language("ProgramFile")%></option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <%: Html.Language("SelectingFiles")%>
                        </th>
                        <td>
                            <input class="easyui-filebox" id="uf" name="file" style="width: 90%;" data-options="buttonText:lang.Browse" />
                        </td>
                    </tr>
                </table>
                </form>
            </div>
            <div data-options="region:'south',border:false" style="text-align: right; padding: 5px 0 0;">
                <a class="easyui-linkbutton" data-options="iconCls:'icon-save'" href="javascript:void(0)"
                    onclick="uploadFile();"><%: Html.Language("Upload")%></a> 
                    <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'"
                        href="javascript:void(0)" onclick="$('#uploadFile').window('close');"><%: Html.Language("Cancel")%></a>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript" src="/Scripts/room-type-index.js"></script>
</asp:Content>
