add site
This commit is contained in:
		
							
								
								
									
										786
									
								
								Site/Maintenance/AlertAutomationManagement.aspx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										786
									
								
								Site/Maintenance/AlertAutomationManagement.aspx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,786 @@ | ||||
| <%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="AlertAutomationManagement.aspx.cs" Inherits="AlertAutomationManagement" %> | ||||
|  | ||||
|  | ||||
| <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"> | ||||
|     <style type="text/css"> | ||||
|         ::-ms-clear, ::-ms-reveal { | ||||
|             display: none; | ||||
|         } | ||||
|  | ||||
|         .tab-header { | ||||
|             float: left; | ||||
|             padding: 2px 6px; | ||||
|             cursor: pointer; | ||||
|             border: 1px solid #fff; | ||||
|             border-bottom: none; | ||||
|         } | ||||
|  | ||||
|             .tab-header:hover { | ||||
|                 background: #eee; | ||||
|             } | ||||
|  | ||||
|             .tab-header.selected { | ||||
|                 border-color: #d8d8d8; | ||||
|                 cursor: default; | ||||
|             } | ||||
|  | ||||
|                 .tab-header.selected:hover { | ||||
|                     background: #fff; | ||||
|                 } | ||||
|  | ||||
|         .label { /*cover tab.css*/ | ||||
|             display: table-cell; | ||||
|         } | ||||
|  | ||||
|         .login_lable { | ||||
|             height: 24px; | ||||
|             line-height: 24px; | ||||
|             vertical-align: top; | ||||
|         } | ||||
|  | ||||
|         .sbutton { | ||||
|             font-weight: 200; | ||||
|         } | ||||
|  | ||||
|         .msgdiv { | ||||
|             border: solid 1px lightgray; | ||||
|             margin-top: 5px; | ||||
|             padding-left: 5px; | ||||
|             padding-right: 10px; | ||||
|             padding-top: 3px; | ||||
|             padding-bottom: 3px; | ||||
|             line-height: 24px; | ||||
|             white-space: normal; | ||||
|             word-break: break-word; | ||||
|             overflow: hidden; | ||||
|         } | ||||
|  | ||||
|         .msgtime { | ||||
|             text-align: right; | ||||
|         } | ||||
|  | ||||
|         .dialog, .data-column-header-filter-panel, .data-column-header-filter-bg { | ||||
|             z-index: 700; | ||||
|         } | ||||
|  | ||||
|         .subtitle { | ||||
|             margin: 20px 40px 5px 0px; | ||||
|             font-size: 16px; | ||||
|             color: gray; | ||||
|         } | ||||
|  | ||||
|             .subtitle span { | ||||
|                 margin-left: 10px; | ||||
|             } | ||||
|  | ||||
|             .subtitle hr { | ||||
|                 background-color: #d8d8d8; | ||||
|                 border: none; | ||||
|                 height: 1px; | ||||
|             } | ||||
|  | ||||
|         .dialog-content table td.label { | ||||
|             width: 120px; | ||||
|         } | ||||
|  | ||||
|         .dialog-content table td input[type="text"], .dialog-content table td textarea { | ||||
|             width: 320px; | ||||
|         } | ||||
|  | ||||
|         .div_filter .dropdown { | ||||
|             width: 322px; | ||||
|             margin: 2px 0 0 0px; | ||||
|         } | ||||
|  | ||||
|         .div_panel { | ||||
|             min-width: 322px; | ||||
|         } | ||||
|     </style> | ||||
|  | ||||
|     <link href="<%=GetFileUrlWithVersion("../css/tabcontrol.css")%>" rel="stylesheet" /> | ||||
|     <link href="<%=GetFileUrlWithVersion("../css/spectrum.css")%>" rel="stylesheet" type="text/css" /> | ||||
|     <script src="../js/spectrum.js?v=1" type="text/javascript"></script> | ||||
|     <script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script> | ||||
|     <script src="<%=GetFileUrlWithVersion("../js/utility.js")%>" type="text/javascript"></script> | ||||
|     <script src="<%=GetFileUrlWithVersion("../js/language.js")%>" type="text/javascript"></script> | ||||
|     <script src="<%=GetFileUrlWithVersion("../js/modulelang.js")%>" type="text/javascript"></script> | ||||
|     <script type="text/javascript">    | ||||
|         var alerttypeparam; | ||||
|         var assetgroupparam; | ||||
|         var jobsitesparam; | ||||
|         var assigntosparam; | ||||
|         var alerttype_editmultiselect; | ||||
|         var assetgroup_editmultiselect; | ||||
|         var jobsite_editmultiselect; | ||||
|         var assignto_editmultiselect; | ||||
|  | ||||
|         function alertrequest(method, param, callback, error) { | ||||
|             _network.request("Maintenance/AlertAutomationManagement.aspx", -1, method, param, callback, error || function (e) { | ||||
|                 console.log(e); | ||||
|                 showmaskbg(false, true); | ||||
|                 showAlert(GetTextByKey('P_UM_PAGEERROR', 'An unknown error occurred.  Please refresh page.'), GetTextByKey('P_UM_QUERY', 'Query')); | ||||
|             }); | ||||
|         } | ||||
|         function worequest(method, param, callback, error) { | ||||
|             _network.request("Maintenance/WorkOrderMaintenance.aspx", -1, method, param, callback, error || function (e) { | ||||
|                 console.log(e); | ||||
|                 showmaskbg(false, true); | ||||
|                 showAlert(GetTextByKey('P_UM_PAGEERROR', 'An unknown error occurred.  Please refresh page.'), GetTextByKey('P_UM_QUERY', 'Query')); | ||||
|             }); | ||||
|         } | ||||
|          | ||||
|  | ||||
|         function showstatusmask(flag) { | ||||
|             if (flag) { | ||||
|                 $('#statusmask').fadeIn(100); | ||||
|             } else { | ||||
|                 $('#statusmask').fadeOut(100); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         function OnExit() { | ||||
|             window.parent.CloseAlertAutomationDialog(); | ||||
|         } | ||||
|  | ||||
|         //******************************Begin Auto Acknowledge**********************************// | ||||
|  | ||||
|         function showAutoAcknowledge(data) { | ||||
|             var rows = []; | ||||
|             for (var i = 0; i < data.length; i++) { | ||||
|                 var r = data[i]; | ||||
|                 var fr = { Values: r }; | ||||
|                 rows.push(fr); | ||||
|             } | ||||
|  | ||||
|             autoacknowledge_dt.setData(rows); | ||||
|         } | ||||
|         var autoacknowledge_dt; | ||||
|         function InitAutoAcknowledgeGridData() { | ||||
|             autoacknowledge_dt = new GridView('#div_autoacknowledgelist'); | ||||
|             autoacknowledge_dt.lang = { | ||||
|                 all: GetTextByKey("P_GRID_ALL", "(All)"), | ||||
|                 ok: GetTextByKey("P_GRID_OK", "OK"), | ||||
|                 reset: GetTextByKey("P_GRID_RESET", "Reset") | ||||
|             }; | ||||
|             var list_columns = [ | ||||
|                 { name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } }, | ||||
|                 { name: 'Value', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'Value', css: { 'width': 300, 'text-align': 'left' } } | ||||
|             ]; | ||||
|             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; | ||||
|                 col.allowFilter = list_columns[hd].allowFilter; | ||||
|                 if (list_columns[hd].type) { | ||||
|                     col.type = list_columns[hd].type; | ||||
|                 } | ||||
|                 columns.push(col); | ||||
|             } | ||||
|             autoacknowledge_dt.canMultiSelect = false; | ||||
|             autoacknowledge_dt.columns = columns; | ||||
|             autoacknowledge_dt.init(); | ||||
|         } | ||||
|  | ||||
|         var alerttypesdata; | ||||
|         function GetAlertTypes() { | ||||
|             alertrequest('GetAlertTypes', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey("P_AM_ERROR", 'Error')); | ||||
|                     return; | ||||
|                 } | ||||
|                 data.splice(0, 0, { Key: "", Value: GetTextByKey("P_XXXXX", '(Blank)') }); | ||||
|                 alerttypesdata = data; | ||||
|                 alerttypeparam = { | ||||
|                     items: data, | ||||
|                     selectedvalue: [] | ||||
|                 }; | ||||
|                 alerttypesdata = data; | ||||
|                 alerttype_editmultiselect = editmultiselect(alerttypeparam); | ||||
|                 $('#div_alerttype').append(alerttype_editmultiselect); | ||||
|                 GetAutoAcknowledgeAlertTypes(); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function GetAssetGroups() { | ||||
|             alertrequest('GetAssetGroups', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey("P_AM_ERROR", 'Error')); | ||||
|                     return; | ||||
|                 } | ||||
|                 assetgroupparam = { | ||||
|                     items: data, | ||||
|                     selectedvalue: [] | ||||
|                 }; | ||||
|                 assetgroup_editmultiselect = editmultiselect(assetgroupparam); | ||||
|                 $('#div_assetgroup').append(assetgroup_editmultiselect); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function GetJobsites() { | ||||
|             alertrequest('GetJobsites', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey("P_AM_ERROR", 'Error')); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 jobsitesparam = { | ||||
|                     items: data, | ||||
|                     selectedvalue: [] | ||||
|                 }; | ||||
|                 jobsite_editmultiselect = editmultiselect(jobsitesparam); | ||||
|                 $('#div_jobsites').append(jobsite_editmultiselect); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function GetAssigntos() { | ||||
|             alertrequest('GetAssignTos', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey("P_AM_ERROR", 'Error')); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 assigntosparam = { | ||||
|                     items: data, | ||||
|                     selectedvalue: [] | ||||
|                 }; | ||||
|                 assignto_editmultiselect = editmultiselect(assigntosparam); | ||||
|                 $('#div_assigntos').append(assignto_editmultiselect); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function GetWorkOrderStatuses() { | ||||
|             worequest('GetWorkOrderStatuses', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey("P_AM_ERROR", 'Error')); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 if (data && data.length > 0) { | ||||
|                     $("#dialog_wostatus").empty(); | ||||
|                     for (var i = 0; i < data.length; i++) { | ||||
|                         var kv = data[i]; | ||||
|                         var op = $("<option></option>").val(kv.Id).text(kv.Name); | ||||
|                         $("#dialog_wostatus").append(op); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function GetAutoAcknowledgeAlertTypes() { | ||||
|             alertrequest('GetAutoAcknowledgeAlertTypes', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey("P_AM_ERROR", 'Error')); | ||||
|                     return; | ||||
|                 } | ||||
|                 var types = []; | ||||
|                 for (var i = 0; i < alerttypesdata.length; i++) { | ||||
|                     var t = alerttypesdata[i]; | ||||
|                     if (t.Key === "Preventative Maintenance" || t.Key === "Yellow-Inspect" || t.Key === "Red-Inspect") | ||||
|                         continue; | ||||
|  | ||||
|                     t.Selected = false; | ||||
|                     if (data.indexOf(alerttypesdata[i].Key) >= 0) | ||||
|                         t.Selected = true; | ||||
|                     types.push(t); | ||||
|                 } | ||||
|                 showAutoAcknowledge(types); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function OnViewAutoAcknowledChangeHistory() { | ||||
|             window.open("AutoAcknowledChangeHistory.aspx"); | ||||
|         } | ||||
|  | ||||
|         function onSaveAutoAcknowledgeAlertTypes() { | ||||
|             var alerttypes = []; | ||||
|             for (var i = 0; i < autoacknowledge_dt.source.length; i++) { | ||||
|                 var ct = autoacknowledge_dt.source[i].Values; | ||||
|                 if (ct.Selected) | ||||
|                     alerttypes.push(ct.Key); | ||||
|             } | ||||
|  | ||||
|             alertrequest('SaveAutoAcknowledgeAlertTypes', htmlencode(JSON.stringify(alerttypes)), function (data) { | ||||
|                 if (data !== "OK") { | ||||
|                     showAlert(data, GetTextByKey("P_MV_ERROR", 'Error')); | ||||
|                 } | ||||
|                 else { | ||||
|                     showAlert(GetTextByKey('P_WO_SAVSUCCESSFULLY', 'Saved successfully.'), GetTextByKey("P_AM_AUTOACKNOWLEDGE", 'Auto-Acknowledge')); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         //******************************End Auto Acknowledge**********************************// | ||||
|  | ||||
|  | ||||
|  | ||||
|         //******************************Begin Work Order Generator**********************************// | ||||
|  | ||||
|         var wogeneratorgrid_dt; | ||||
|         function InitWOGeneratorGridData() { | ||||
|             wogeneratorgrid_dt = new GridView('#wogeneratorlist'); | ||||
|             wogeneratorgrid_dt.lang = { | ||||
|                 all: GetTextByKey("P_GRID_ALL", "(All)"), | ||||
|                 ok: GetTextByKey("P_GRID_OK", "OK"), | ||||
|                 reset: GetTextByKey("P_GRID_RESET", "Reset") | ||||
|             }; | ||||
|             var list_columns = [ | ||||
|                 { name: 'AlertTypesStr', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertTypesStr', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'AssetGroupsStr', caption: GetTextByKey("P_AM_ASSETGROUP", "Asset Group"), valueIndex: 'AssetGroupsStr', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'JobSitesStr', caption: GetTextByKey("P_UM_JOBSITES", "Jobsite(s)"), valueIndex: 'JobSitesStr', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'AssignTosStr', caption: GetTextByKey("P_JS_ASSIGNEDTO", "Assigned To"), valueIndex: 'AssignTosStr', css: { 'width': 200, 'text-align': 'left' } }, | ||||
|                 { name: 'StatusAssignmentName', caption: GetTextByKey("P_AM_STATUSASSIGNMENT", "Status Assignment"), valueIndex: 'StatusAssignmentName', css: { 'width': 150, 'text-align': 'left' } }, | ||||
|                 { name: 'IncludeAllAlerts', caption: GetTextByKey("P_AM_INCLUDEALLALERTS", "Include All Alerts"), valueIndex: 'IncludeAllAlerts', css: { 'width': 150, 'text-align': 'left' } }, | ||||
|                 { name: 'EmailWorkorder', caption: GetTextByKey("P_AM_EMAILWORKORDER", "Email Work Order"), valueIndex: 'EmailWorkorder', css: { 'width': 150, 'text-align': 'left' } }, | ||||
|                 { name: 'EmailFrom', caption: GetTextByKey("P_AM_XXX", "Email From"), valueIndex: 'EmailFrom', css: { 'width': 150, 'text-align': 'left' } }, | ||||
|                 { name: 'Description', caption: GetTextByKey("P_AM_XXX", "Description"), valueIndex: 'Description', css: { 'width': 150, '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; | ||||
|                 col.allowFilter = list_columns[hd].allowFilter; | ||||
|                 col.type = list_columns[hd].type; | ||||
|  | ||||
|                 if (col.name === "Edit") { | ||||
|                     col.isurl = true; | ||||
|                     col.text = "\uf044"; | ||||
|                     col.sortable = false; | ||||
|                     col.events = { | ||||
|                         onclick: function () { | ||||
|                             OnEditWOGenerator(); | ||||
|                         } | ||||
|                     }; | ||||
|                     col.classFilter = function (e) { | ||||
|                         return "icon-col"; | ||||
|                     } | ||||
|                     col.attrs = { 'title': GetTextByKey("P_UM_EDIT", 'Edit') }; | ||||
|                 } | ||||
|                 else if (col.name === "Delete") { | ||||
|                     col.isurl = true; | ||||
|                     col.text = "\uf00d"; | ||||
|                     col.sortable = false; | ||||
|                     col.events = { | ||||
|                         onclick: function () { | ||||
|                             OnDeleteWOGenerator(this); | ||||
|                         } | ||||
|                     }; | ||||
|                     col.classFilter = function (e) { | ||||
|                         return "icon-col"; | ||||
|                     }; | ||||
|                     col.styleFilter = function (e) { | ||||
|                         if (e.Id == 100) | ||||
|                             return { "display": "none" }; | ||||
|                     }; | ||||
|                     col.attrs = { 'title': GetTextByKey("P_UM_DELETE", 'Delete') }; | ||||
|                 } | ||||
|                 columns.push(col); | ||||
|             } | ||||
|             wogeneratorgrid_dt.canMultiSelect = false; | ||||
|             wogeneratorgrid_dt.columns = columns; | ||||
|             wogeneratorgrid_dt.init(); | ||||
|             wogeneratorgrid_dt.rowdblclick = OnEditWOGenerator; | ||||
|         } | ||||
|  | ||||
|         function GetWorkOrderGenerators() { | ||||
|             alertrequest('GetWorkOrderGenerators', '', function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, GetTextByKey('P_AM_ALERTAUTOMATION', "Alert Automation")); | ||||
|                     showstatusmask(false); | ||||
|                     return; | ||||
|                 } | ||||
|                 showWorkOrderGenerators(data); | ||||
|             }, function (err) { | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|  | ||||
|         function showWorkOrderGenerators(data) { | ||||
|             var rows = []; | ||||
|             for (var i = 0; i < data.length; i++) { | ||||
|                 var r = data[i]; | ||||
|                 var desctype = parseInt(r.DescType); | ||||
|                 var desc = ""; | ||||
|                 if (desctype === 0) | ||||
|                     desc = 'Trigger Alerts'; | ||||
|                 else if (desctype === 1) | ||||
|                     desc = 'All Alerts'; | ||||
|                 else if (desctype === 10) | ||||
|                     desc = r.Description; | ||||
|  | ||||
|                 for (var j in r) { | ||||
|                     if (j === "IncludeAllAlerts") { | ||||
|                         r[j] = { DisplayValue: r.IncludeAllAlerts ? "Yes" : "No", Value: r[j] }; | ||||
|                     } | ||||
|                     if (j === "EmailWorkorder") { | ||||
|                         r[j] = { DisplayValue: r.EmailWorkorder ? "Yes" : "No", Value: r[j] }; | ||||
|                     } | ||||
|                     if (j === "AlertTypesStr") { | ||||
|                         r[j] = { DisplayValue: r.AlertTypesStr === "" ? "All" : r.AlertTypesStr, Value: r[j] }; | ||||
|                     } | ||||
|                     if (j === "AssetGroupsStr") { | ||||
|                         r[j] = { DisplayValue: r.AssetGroupsStr === "" ? "All" : r.AssetGroupsStr, Value: r[j] }; | ||||
|                     } | ||||
|                     if (j === "JobSitesStr") { | ||||
|                         r[j] = { DisplayValue: r.JobSitesStr === "" ? "All" : r.JobSitesStr, Value: r[j] }; | ||||
|                     } | ||||
|                     if (j === "AssignTosStr") { | ||||
|                         r[j] = { DisplayValue: r.AssignTosStr === "" ? "All" : r.AssignTosStr, Value: r[j] }; | ||||
|                     } | ||||
|                     if (j === "Description") { | ||||
|                         r[j] = { DisplayValue: desc, Value: r[j] }; | ||||
|                     } | ||||
|                 } | ||||
|                 var fr = { Values: r }; | ||||
|                 rows.push(fr); | ||||
|             } | ||||
|  | ||||
|             wogeneratorgrid_dt.setData(rows); | ||||
|         } | ||||
|  | ||||
|         function OnAddWOGenerator() { | ||||
|             $('#tr_desc').hide(); | ||||
|             generatorid = undefined; | ||||
|             var alerttitle = GetTextByKey("P_AM_ADDWORKORDERGENERATOR", 'Add Work Order Generator') | ||||
|             alerttype_editmultiselect.setValues([]); | ||||
|             assetgroup_editmultiselect.setValues([]); | ||||
|             jobsite_editmultiselect.setValues([]); | ||||
|             assignto_editmultiselect.setValues([]); | ||||
|             $('#dialog_wostatus').val(""); | ||||
|             $('#dialog_includeallalerts').prop('checked', false); | ||||
|             $('#dialog_emailworkorder').prop('checked', false); | ||||
|             $('#dialog_emailfrom').val(""); | ||||
|             $('#dialog_desctype').val(""); | ||||
|             $('#dialog_desc').val(""); | ||||
|  | ||||
|             $('#dialog_wogenerator .dialog-title span.title').text(alerttitle); | ||||
|             $('#mask_bg').show(); | ||||
|             $('#dialog_wogenerator') | ||||
|                 .css({ | ||||
|                     'top': (document.documentElement.clientHeight - $('#dialog_wogenerator').height()) / 3, | ||||
|                     'left': (document.documentElement.clientWidth - $('#dialog_wogenerator').width()) / 3 | ||||
|                 }).showDialogfixed(); | ||||
|         } | ||||
|  | ||||
|         var generatorid; | ||||
|         function OnEditWOGenerator() { | ||||
|             var index = wogeneratorgrid_dt.selectedIndex; | ||||
|             if (index < 0) return; | ||||
|  | ||||
|             var generator = wogeneratorgrid_dt.source[index].Values; | ||||
|             generatorid = generator.Id; | ||||
|             alerttype_editmultiselect.setValues(generator.AlertTypes || []); | ||||
|             assetgroup_editmultiselect.setValues(generator.AssetGroups || []); | ||||
|             jobsite_editmultiselect.setValues(generator.JobSites || []); | ||||
|             assignto_editmultiselect.setValues(generator.AssignTos || []); | ||||
|             $('#dialog_wostatus').val(generator.StatusAssignment); | ||||
|             $('#dialog_includeallalerts').prop('checked', generator.IncludeAllAlerts.Value); | ||||
|             $('#dialog_emailworkorder').prop('checked', generator.EmailWorkorder.Value); | ||||
|  | ||||
|             $('#dialog_emailfrom').val(generator.EmailFrom); | ||||
|             $('#dialog_desctype').val(generator.DescType); | ||||
|             if (parseInt(generator.DescType) === 10) { | ||||
|                 $('#tr_desc').show(); | ||||
|                 $('#dialog_desc').val(generator.Description.Value); | ||||
|             } | ||||
|             else { | ||||
|                 $('#tr_desc').hide(); | ||||
|                 $('#dialog_desc').val(""); | ||||
|             } | ||||
|  | ||||
|             $('#dialog_wogenerator .dialog-title span.title').text(GetTextByKey("P_AM_EDITWORKORDERGENERATOR", 'Edit Work Order Generator')); | ||||
|             $('#mask_bg').show(); | ||||
|             $('#dialog_wogenerator') | ||||
|                 .css({ | ||||
|                     'top': (document.documentElement.clientHeight - $('#dialog_wogenerator').height()) / 3, | ||||
|                     'left': (document.documentElement.clientWidth - $('#dialog_wogenerator').width()) / 3 | ||||
|                 }).showDialogfixed(); | ||||
|         } | ||||
|  | ||||
|         function onSaveWorkOrderGenerator() { | ||||
|             showstatusmask(true); | ||||
|             var alerttypes = []; | ||||
|             if (alerttypeparam) { | ||||
|                 alerttypes = alerttypeparam.selectedvalue; | ||||
|             } | ||||
|  | ||||
|             var assetgroups = []; | ||||
|             if (assetgroupparam) { | ||||
|                 assetgroups = assetgroupparam.selectedvalue; | ||||
|             } | ||||
|  | ||||
|             var jobsites = []; | ||||
|             if (jobsitesparam) { | ||||
|                 jobsites = jobsitesparam.selectedvalue; | ||||
|             } | ||||
|  | ||||
|             var assigntos = []; | ||||
|             if (assigntosparam) { | ||||
|                 assigntos = assigntosparam.selectedvalue; | ||||
|             } | ||||
|  | ||||
|             var item = { | ||||
|                 'StatusAssignment': $('#dialog_wostatus').val(), | ||||
|                 'AlertTypes': alerttypes, | ||||
|                 'AssetGroups': assetgroups, | ||||
|                 'JobSites': jobsites, | ||||
|                 'AssignTos': assigntos, | ||||
|                 'IncludeAllAlerts': $('#dialog_includeallalerts').prop('checked'), | ||||
|                 'EmailWorkorder': $('#dialog_emailworkorder').prop('checked'), | ||||
|                 'EmailFrom': $('#dialog_emailfrom').val(), | ||||
|                 'DescType': $('#dialog_desctype').val(), | ||||
|                 'Description': $('#dialog_desc').val() | ||||
|             }; | ||||
|  | ||||
|             var alerttitle; | ||||
|             if (generatorid || generatorid == 0) { | ||||
|                 item.Id = generatorid; | ||||
|                 alerttitle = GetTextByKey("P_AM_EDITWORKORDERGENERATOR", "Edit Work Order Generator"); | ||||
|             } else { | ||||
|                 item.Id = -1; | ||||
|                 alerttitle = GetTextByKey("P_AM_ADDWORKORDERGENERATOR", "Add Work Order Generator"); | ||||
|             } | ||||
|  | ||||
|             if (item.AssignTos.length == 0) { | ||||
|                 showAlert(GetTextByKey("P_WO_XXX", 'Assigned to cannot be empty.'), alerttitle, undefined, function () { | ||||
|                     showstatusmask(false); | ||||
|  | ||||
|                 }); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             if (!item.StatusAssignment) { | ||||
|                 showAlert(GetTextByKey("P_WO_XXX", 'Status assignment cannot be empty.'), alerttitle, undefined, function () { | ||||
|                     showstatusmask(false); | ||||
|                 }); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             if (item.EmailFrom !== "" && !isEmail(item.EmailFrom)) { | ||||
|                 showAlert(GetTextByKey("P_WO_XXX", 'Email from is not a valid.'), alerttitle, undefined, function () { | ||||
|                     showstatusmask(false); | ||||
|                 }); | ||||
|                 return; | ||||
|             } | ||||
|             if (!item.DescType) | ||||
|                 item.DescType = -1; | ||||
|  | ||||
|             param = htmlencode(JSON.stringify(item)); | ||||
|             alertrequest("SaveWorkOrderGenerator", param, function (data) { | ||||
|                 if (typeof (data) === "string") { | ||||
|                     showAlert(data, alerttitle, undefined, function () { | ||||
|                         showstatusmask(false); | ||||
|                     }); | ||||
|                 } else { | ||||
|                     $('#dialog_wogenerator').hideDialog(); | ||||
|                     showstatusmask(false); | ||||
|                     showmaskbg(false); | ||||
|                     GetWorkOrderGenerators(); | ||||
|                 } | ||||
|             }, function (err) { | ||||
|                 showAlert(GetTextByKey("P_AM_FAILEDTOSAVEWORKORDERGENERATOR", 'Failed to save work order generator.'), alerttitle); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         function OnDeleteWOGenerator(c) { | ||||
|             if (!c) { | ||||
|                 return; | ||||
|             } | ||||
|             var alerttitle = GetTextByKey("P_AM_DELETEWORKORDERGENERATOR", 'Delete Work Order Generator'); | ||||
|             showConfirm(GetTextByKey("P_AM_DOYOUWANTTODELETETHISWORKORDERGENERATOR", 'Do you want to delete this work order generator?'), alerttitle, function () { | ||||
|                 alertrequest('DeleteWorkOrderGenerator', c.Id, function (data) { | ||||
|                     if (typeof (data) === "string") { | ||||
|                         showAlert(data, alerttitle); | ||||
|                     } else { | ||||
|                         GetWorkOrderGenerators(); | ||||
|                     } | ||||
|                 }, function (err) { | ||||
|                     showAlert(GetTextByKey('P_AM_FAILEDTODELETEWORKORDERGENERATOR', 'Failed to delete this work order generator.'), alerttitle); | ||||
|                 }); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         //******************************End Work Order Generator**********************************// | ||||
|  | ||||
|  | ||||
|         $(function () { | ||||
|             InitAutoAcknowledgeGridData(); | ||||
|             InitWOGeneratorGridData(); | ||||
|  | ||||
|             GetAlertTypes(); | ||||
|             GetWorkOrderGenerators(); | ||||
|             GetAssetGroups(); | ||||
|             GetJobsites(); | ||||
|             GetAssigntos(); | ||||
|             GetWorkOrderStatuses(); | ||||
|  | ||||
|             $('#dialog_wogenerator').dialog(function () { | ||||
|                 showmaskbg(false); | ||||
|             }); | ||||
|  | ||||
|             $('#div_container').tab(); | ||||
|  | ||||
|             $("#dialog_desctype").change(function () { | ||||
|                 var desctype = $('#dialog_desctype').val(); | ||||
|                 if (parseInt(desctype) === 10) { | ||||
|                     $('#tr_desc').show(); | ||||
|                 } | ||||
|                 else { | ||||
|                     $('#tr_desc').hide(); | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|             $(window).resize(function () { | ||||
|                 $("#div_autoacknowledgelist").css("height", $(window).height() - $("#div_autoacknowledgelist").offset().top - 4); | ||||
|                 autoacknowledge_dt && autoacknowledge_dt.resize(); | ||||
|  | ||||
|                 $("#wogeneratorlist").css("height", $(window).height() - $("#wogeneratorlist").offset().top - 4); | ||||
|                 wogeneratorgrid_dt && wogeneratorgrid_dt.resize(); | ||||
|             }).resize(); | ||||
|  | ||||
|         }); | ||||
|  | ||||
|         function reshowgrid() { | ||||
|             setTimeout(function () { | ||||
|                 $("#div_autoacknowledgelist").css("height", $(window).height() - $("#div_autoacknowledgelist").offset().top - 4); | ||||
|                 autoacknowledge_dt && autoacknowledge_dt.resize(); | ||||
|  | ||||
|                 $("#wogeneratorlist").css("height", $(window).height() - $("#wogeneratorlist").offset().top - 4); | ||||
|                 wogeneratorgrid_dt && wogeneratorgrid_dt.resize(); | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|  | ||||
|     </script> | ||||
| </asp:Content> | ||||
| <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> | ||||
|     <div id="div_container"> | ||||
|         <ul id="ul_container" class="tab_header"> | ||||
|             <li id="li_autoacknowledge" data-href="tab_autoacknowledge" onclick="reshowgrid();" class="selected" data-lgid="P_AM_AUTOACKNOWLEDGE">Auto-Acknowledge</li> | ||||
|             <%if (AllowWorkOrderGenerator) | ||||
|                 { %> | ||||
|             <li data-href="tab_workordergenerator" onclick="reshowgrid();" data-lgid="P_AM_WORKORDERGENERATOR">Work Order Generator</li> | ||||
|             <%} %> | ||||
|         </ul> | ||||
|         <div id="tab_autoacknowledge" data-page="tab_autoacknowledge"> | ||||
|             <div class="function_title"> | ||||
|                 <span class="sbutton iconsave" onclick="onSaveAutoAcknowledgeAlertTypes();" data-lgid="P_WO_SAVE">Save</span> | ||||
|                 <span class="sbutton iconview" onclick="OnViewAutoAcknowledChangeHistory();" data-lgid="P_AM_VIEWCHANGEHIS">View Change History</span> | ||||
|                 <span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_WO_SAVE2">Exit Without Saving</span> | ||||
|             </div> | ||||
|             <div class="clear"></div> | ||||
|             <div id="div_autoacknowledgelist"></div> | ||||
|         </div> | ||||
|  | ||||
|         <div id="tab_workordergenerator" data-page="tab_workordergenerator"> | ||||
|             <div class="function_title"> | ||||
|                 <span class="sbutton iconadd" onclick="OnAddWOGenerator();" data-lgid="P_AM_ADDWORKORDERGENERATOR">Add Work Order Generator</span> | ||||
|                 <span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_WO_SAVE2">Exit Without Saving</span> | ||||
|             </div> | ||||
|             <div class="clear"></div> | ||||
|             <div id="wogeneratorlist"> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
|     <div id="mask_bg" style="display: none;"> | ||||
|         <div class="loading_holder"> | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
|     <div class="dialog" id="dialog_wogenerator" style="display: none;"> | ||||
|         <div class="dialog-title"><span class="title" data-lgid="P_AM_ADDWORKORDERGENERATOR">Add Work Order Generator</span><em class="dialog-close"></em></div> | ||||
|         <div class="dialog-content"> | ||||
|             <table style="line-height: 30px; table-layout: fixed; width: 500px;"> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_ALERTTYPE_COLON">Alert Type:</span></td> | ||||
|                     <td> | ||||
|                         <div id="div_alerttype"></div> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_ASSETGROUP_COLON">Asset Group:</span></td> | ||||
|                     <td> | ||||
|                         <div id="div_assetgroup"></div> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_JOBSITES_COLON">Jobsites:</span></td> | ||||
|                     <td> | ||||
|                         <div id="div_jobsites"></div> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_WO_ASSIGNEDTO_COLON">Assign To:</span></td> | ||||
|                     <td> | ||||
|                         <div id="div_assigntos"></div> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_STATUSASSIGNMENT_COLON">Status Assignment:</span></td> | ||||
|                     <td> | ||||
|                         <select id="dialog_wostatus" tabindex="1" style="width: 322px;"></select> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_INCLUDEALLALERTS_COLON">Include All Alerts:</span></td> | ||||
|                     <td> | ||||
|                         <input type="checkbox" id="dialog_includeallalerts" style="width: auto;" tabindex="1" /> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_EMAILWORKORDER_COLON">Email Work Order:</span></td> | ||||
|                     <td> | ||||
|                         <input type="checkbox" id="dialog_emailworkorder" style="width: auto;" tabindex="1" /> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_XXX">Email From:</span></td> | ||||
|                     <td> | ||||
|                         <input type="text" id="dialog_emailfrom" maxlength="200" tabindex="1" /> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr> | ||||
|                     <td class="label"><span data-lgid="P_AM_XXX">Description:</span></td> | ||||
|                     <td> | ||||
|                         <select id="dialog_desctype" tabindex="1" style="width: 324px;"> | ||||
|                             <option value="-1"></option> | ||||
|                             <option value="0">Trigger Alerts</option> | ||||
|                             <option value="1">All Alerts</option> | ||||
|                             <option value="10">Other</option> | ||||
|                         </select> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 <tr id="tr_desc" style="display: none;"> | ||||
|                     <td class="label"></td> | ||||
|                     <td> | ||||
|                         <textarea id="dialog_desc" maxlength="2000" tabindex="1" style="height: 80px;"></textarea> | ||||
|                     </td> | ||||
|                 </tr> | ||||
|             </table> | ||||
|         </div> | ||||
|         <div class="dialog-func"> | ||||
|             <input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" /> | ||||
|             <input type="button" onclick="onSaveWorkOrderGenerator();" value="OK" data-lgid="P_UM_OK" tabindex="17" /> | ||||
|             <div style="clear: both;"></div> | ||||
|         </div> | ||||
|         <div class="maskbg" id="statusmask" style="display: none;"></div> | ||||
|     </div> | ||||
|  | ||||
| </asp:Content> | ||||
		Reference in New Issue
	
	Block a user