add site
This commit is contained in:
410
Site/MachineDeviceManagement/MachineGroups.aspx
Normal file
410
Site/MachineDeviceManagement/MachineGroups.aspx
Normal file
@ -0,0 +1,410 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/MachineDeviceManagement/DeviceManagementBase.master" AutoEventWireup="true" CodeFile="MachineGroups.aspx.cs" Inherits="MachineDeviceManagement_MachineGroups" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
::-ms-clear, ::-ms-reveal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.selectinput {
|
||||
width: 150px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.a {
|
||||
text-decoration: none;
|
||||
color: #2140fb;
|
||||
}
|
||||
|
||||
.ctl_button {
|
||||
font-family: 'CalciteWebCoreIcons';
|
||||
display: block;
|
||||
margin: 6px auto;
|
||||
width: 60px;
|
||||
height: 22px;
|
||||
line-height: 21px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#dialog_machinegroup {
|
||||
width: 860px;
|
||||
top: 60px;
|
||||
left: 150px;
|
||||
}
|
||||
|
||||
.inputbox {
|
||||
width: 564px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
#dialog_description {
|
||||
padding: 2px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.group_table .main_table {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.group_table .main_table thead tr {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.group_table .main_table tbody {
|
||||
height: 280px;
|
||||
display: block;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.group_table .main_table th {
|
||||
width: 160px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.group_table .main_table td {
|
||||
width: 160px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.group_table .main_table td div {
|
||||
width: 160px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
word-break: keep-all;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="<%=GetFileUrlWithVersion("../Security/js/controls.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../Maintenance/js/inputdatactr.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var machineGroups = [];
|
||||
|
||||
function devicerequest(method, param, callback, error) {
|
||||
_network.request("MachineDeviceManagement/ManageMachines.aspx", -1, method, param, callback, error || function (e) {
|
||||
console.log(e);
|
||||
showmaskbg(false, true);
|
||||
showAlert(GetTextByKey('P_AG_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_AG_QUERY', 'Query'));
|
||||
});
|
||||
}
|
||||
|
||||
function CloseDialog(type) {
|
||||
$('#dialog_machinegroup1').hideDialog();
|
||||
if (type == 1) {
|
||||
OnRefresh();
|
||||
}
|
||||
else {
|
||||
showmaskbg(false);
|
||||
}
|
||||
}
|
||||
|
||||
function ShowMachineGroupDialog(type) {
|
||||
showmaskbg(true);
|
||||
$('#dialog_machinegroup1')
|
||||
.attr('act', type)
|
||||
.showDialogRight();
|
||||
}
|
||||
|
||||
function OnDelete(group) {
|
||||
if (!group) {
|
||||
return;
|
||||
}
|
||||
var alerttitle = GetTextByKey("P_AG_DELETEASSETGROUP", 'Delete Asset Group');
|
||||
showConfirm(GetTextByKey("P_AG_DOYOUWANTTODELETETHEASSETGROUP", 'Do you want to delete the Asset Group?'), alerttitle, function () {
|
||||
showmaskbg(true);
|
||||
devicerequest("DeleteAssetGroup", group.Id, function (data) {
|
||||
if (data !== "OK") {
|
||||
showAlert(GetTextByKey("P_AG_NOTDELETEASSETGROUP", 'Asset Group can not be deleted because it is in use.'), alerttitle);
|
||||
} else
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_AG_DELETEASSETGROUPFAILED", 'Failed to delete this Asset Group.'), alerttitle);
|
||||
showmaskbg(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function OnAdd() {
|
||||
machineGroupID = undefined;
|
||||
|
||||
ShowMachineGroupDialog('add');
|
||||
execIframeFunc("init", [], "iframe_machinegroup");
|
||||
return;
|
||||
}
|
||||
|
||||
var machineGroupID;
|
||||
var indexInEdit = -1;
|
||||
function OnEdit() {
|
||||
indexInEdit = grid_dt.selectedIndex;
|
||||
if (indexInEdit < 0) {
|
||||
showAlert(GetTextByKey("P_AG_PLEASESELECTAMACHINEGROUP", "Please select a Machine Group."), GetTextByKey("P_AG_EDITMACHINEGROUP", "Edit Machine Group"));
|
||||
return;
|
||||
}
|
||||
var group = grid_dt.source[indexInEdit].Values;
|
||||
if (!group) {
|
||||
machineGroupID = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
machineGroupID = group.Id;
|
||||
|
||||
ShowMachineGroupDialog('edit');
|
||||
execIframeFunc("init", [machineGroupID, grid_dt.source, indexInEdit], "iframe_machinegroup");
|
||||
return;
|
||||
}
|
||||
|
||||
function OnDblClick(e) {
|
||||
OnEdit();
|
||||
}
|
||||
|
||||
var opened = false;
|
||||
var refreshed = false;
|
||||
|
||||
function Opened() {
|
||||
opened = true;
|
||||
if (refreshed) {
|
||||
showmaskbg(false);
|
||||
}
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
devicerequest("GetAssetGroups", "" + String.fromCharCode(170) + searchtxt, function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_AG_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (data && data.length > 0)
|
||||
machineGroups = data;
|
||||
else
|
||||
machineGroups = [];
|
||||
showMachineGroups(data);
|
||||
|
||||
refreshed = true;
|
||||
if (opened) {
|
||||
showloading(false);
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function showMachineGroups(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
$('#btnEdit').attr("disabled", "disabled");
|
||||
|
||||
grid_dt = new GridView('#grouplist');
|
||||
grid_dt.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
var list_columns = [
|
||||
{ name: 'Name', caption: GetTextByKey("P_AG_GROUPNAME", "Group Name"), valueIndex: 'Name', css: { 'width': 360, 'text-align': 'left' } },
|
||||
{ name: 'Description', caption: GetTextByKey("P_AG_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 360, 'text-align': 'left' } },
|
||||
{ name: 'Code', caption: GetTextByKey("P_AG_CODE", "Code"), valueIndex: 'Code', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Edit") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf044";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnEdit();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_AG_EDIT", 'Edit') };
|
||||
}
|
||||
else if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_AG_DELETE", 'Delete') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnEdit;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
machineGroupID = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeGridSelectIndex(index) {
|
||||
grid_dt.selectedIndexes = [index];
|
||||
grid_dt.scrollToIndex(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_ASSETGROUPS", "Asset Groups"), true);
|
||||
$("#iframe_machinegroup").attr("src", "AddMachineGroup.aspx");
|
||||
InitGridData();
|
||||
OnRefresh();
|
||||
|
||||
$('#dialog_machinegroup').prop('iframe', true).dialog(function () {
|
||||
showmaskbg(false);
|
||||
});
|
||||
|
||||
$('#dialog_machinegroup').dialog(function () {
|
||||
showmaskbg(false);
|
||||
});
|
||||
|
||||
$('#searchinputtxt').keydown(searchEnter);
|
||||
|
||||
$(window).resize(function () {
|
||||
$("#grouplist").css("height", $(window).height() - $("#grouplist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
|
||||
if (!canExport) {
|
||||
$('#spExport').hide();
|
||||
}
|
||||
});
|
||||
|
||||
function searchEnter(e) {
|
||||
if (e.keyCode == 13 || e.keyCode == 9) {
|
||||
OnRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
function OnExport() {
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var param = htmlencode(searchtxt);
|
||||
window.open("../ExportToFile.aspx?type=assetgroups¶m=" + param);
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div id="recordcontent" style="padding: 0px; margin: 0px;">
|
||||
<div class="page_title" data-lgid="P_ASSETGROUPS">Asset Groups</div>
|
||||
<div class="search_bar">
|
||||
<input type="password" autocomplete="new-password" style="display: none" />
|
||||
<input type="text" id="searchinputtxt" autocomplete="off" />
|
||||
<input id="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_AG_SEARCH" style="margin-left: 5px;"/>
|
||||
</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_AG_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_AG_REFRESH">Refresh</span>
|
||||
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_UTILITY_EXPORTTOEXCEL">Export to Excel</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="grouplist"></div>
|
||||
</div>
|
||||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||||
|
||||
<div class="dialog" id="dialog_machinegroup" style="display: none;">
|
||||
<div class="dialog-title"><span class="title">Add Asset Group</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<div class="dialog-subheader">Asset Group Properties</div>
|
||||
<table class="group_table">
|
||||
<tr>
|
||||
<td class="label">Group Name:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_groupname" class="inputbox" maxlength="200" tabindex="1" style="width: 300px;" />
|
||||
</td>
|
||||
<td class="label" style="width: 50px; text-align: right;">Code:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_groupcode" class="inputbox" maxlength="50" tabindex="1" style="width: 200px;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Description:</td>
|
||||
<td colspan="3">
|
||||
<textarea id="dialog_description" class="inputbox" maxlength="1000" tabindex="2"></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="dialog-subheader">Group Assets</div>
|
||||
|
||||
<div style="margin-top: 5px; margin-bottom: 5px;">
|
||||
<span>Type: </span>
|
||||
<select id="sel_machine_type" style="min-width: 120px;"></select>
|
||||
<input type="text" id="txt_machine_key" />
|
||||
<input type="button" class="ybutton" id="button_machine_filter" value="Filter" />
|
||||
</div>
|
||||
<table id="tab_groupmachine" class="group_table" style="min-height: 300px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Available Assets</td>
|
||||
<td></td>
|
||||
<td>Assigned Group Assets
|
||||
<input type="checkbox" id="chk_showallassignedassets" title="When checked, all associated or linked items will display regardless of filter. " /><label for="chk_showallassignedassets">Show All Assigned</label>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 380px;">
|
||||
<div id="availablemachinelist" style="height: 300px;"></div>
|
||||
</td>
|
||||
<td style="text-align: center; vertical-align: middle; width: 80px;">
|
||||
<input class="ctl_button" type="button" value="" tabindex="3" onclick="OnEditorAdd();" />
|
||||
<input class="ctl_button" type="button" value="" tabindex="4" onclick="OnEditorAddAll();" />
|
||||
<input class="ctl_button" type="button" value="" tabindex="5" onclick="OnEditorRemove();" />
|
||||
<input class="ctl_button" type="button" value="" tabindex="6" onclick="OnEditorRemoveAll();" />
|
||||
</td>
|
||||
<td style="width: 380px;">
|
||||
<div id="selectedmachinelist" style="height: 300px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func">
|
||||
<input type="button" value="Cancel" class="dialog-close" tabindex="18" />
|
||||
<input type="button" onclick="OnDialogOK();" value="OK" tabindex="17" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="maskbg" style="display: none;"></div>
|
||||
</div>
|
||||
|
||||
<div class="dialog" id="dialog_machinegroup1" style="display: none; height: 100%; border-bottom: 0; border-top: 0; z-index: 2">
|
||||
<iframe id="iframe_machinegroup" style="width: 100%; height: 100%; display: block; border: none"></iframe>
|
||||
<div class="maskbg" style="display: none"></div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
Reference in New Issue
Block a user