fleet-contractor/Site/Maintenance/WorkOrderMaintenance.aspx
2023-05-30 17:34:56 +08:00

1680 lines
73 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="WorkOrderMaintenance.aspx.cs" Inherits="Maintenance_WorkOrderMaintenance" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="<%=GetFileUrlWithVersion("css/maintenance.css")%>" rel="stylesheet" />
<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_description {
padding: 2px;
height: 60px;
}
#dialogdatatb td {
padding-top: 30px;
}
.a {
text-decoration: none;
color: #2140fb;
}
.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: auto;*/
}
.group_table .main_table th {
/*width: 120px;*/
}
.group_table .main_table td {
/*width: 120px;*/
white-space: nowrap;
/*word-break: keep-all;*/
text-overflow: ellipsis;
overflow: hidden;
}
.group_table .main_table td div {
/*width: 120px;*/
overflow: hidden;
white-space: nowrap;
word-break: keep-all;
text-overflow: ellipsis;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.div_filter .dropdown {
width: 100px;
}
.statussetting:before {
font-family: CalciteWebCoreIcons, FontAwesome;
content: '\e670';
}
.data-grid .data-grid-header .data-column-header .data-column-header-text {
white-space: unset;
overflow: unset;
text-overflow: unset;
}
.ui-popup-mask .ui-popup-container .ui-popup-body .class-content {
overflow: auto;
height: 100%;
}
.ui-popup-mask .ui-popup-container .ui-popup-body .class-content > .comm {
border: none;
height: 100%;
margin-left: 0;
width: initial;
}
.ui-popup-mask .ui-popup-container .ui-popup-body .class-content > .comm .title-bar {
display: none;
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label {
flex: 0 0 auto;
margin: 0 4px;
box-sizing: border-box;
cursor: pointer;
width: 30px;
height: 30px;
background-color: #fff;
border-radius: 15px;
display: flex;
align-items: center;
justify-content: center;
transition: background-color .2s
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label > svg {
fill: #333;
width: 14px;
height: 14px;
transition: opacity .2s
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label:hover {
background-color: rgba(255, 255, 255, .6)
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label:hover > svg {
opacity: .6
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label.disabled {
cursor: default;
opacity: .6
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label.disabled:hover {
background-color: #fff
}
.ui-popup-mask .ui-popup-container .ui-popup-header > label.disabled:hover > svg {
opacity: 1;
opacity: initial
}
</style>
<link href="<%=GetFileUrlWithVersion("../css/panel.css")%>" rel="stylesheet" />
<link href="<%=GetFileUrlWithVersion("../css/jquery.datetimepicker.css")%>" rel="stylesheet" />
<link href="<%=GetFileUrlWithVersion("../fic/css/datepicker.min.css")%>" rel="stylesheet" />
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/vue.min.js")%>"></script>
<script>Vue.config.productionTip = false; Vue.config.silent = true;</script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../Security/js/controls.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/inputdatactr.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/js/datepicker.min.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/editmultiselect.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/gridlayout.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/manageworkorder.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/workordersendemail.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/workordertabitems.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/workorderwidgets.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var workOrders = [];
var workOrderStatus = [];
var workOrderTypes = [];
var woAdvisors = [];
//var contactparam;
var statusparam;
var CID = "<%=CID %>";
var assetid = "<%=AssetID %>";
var gridLayoutID = "WorkOrder";
var IsCustomerRecordAllow = <%=IsCustomerRecordAllow ?"true":"false"%>;
var IsAdmin =<%=IsAdmin ?"true":"false"%>;
var IsAdvisor =<%=IsAdvisor ?"true":"false"%>;
var AllowReopenWorkorders = <%=AllowReopenWorkorders ?"true":"false"%>;
var AllowWorkOrderSurveys = <%=AllowWorkOrderSurveys ?"true":"false"%>;
var AllowCommunicate =<%=AllowCommunicate ?"true":"false"%>;
var AllowInspection =<%=AllowInspection ?"true":"false"%>;
var AllowCustomer =<%=AllowCustomer ?"true":"false"%>;
var WOReadOnly = <%=WOReadOnly ?"true":"false"%>;
var CRReadOnly =<%=CRReadOnly ?"true":"false"%>;
var COMMReadOnly = <%=COMMReadOnly ?"true":"false"%>;
var AllowReassignWorkorders = <%=AllowReassignWorkorders ?"true":"false"%>;
var AllowDeleteAtta = <%=AllowDeleteAtta ?"true":"false"%>;
var WorkorderParams = {};
var wowidgetobj = null;
var widgetdata = [];
if (AllowCommunicate) {
widgetdata.push({ Values: { Category: 'WorkOrder', WidgetId: 'CustomerCommunication', WidgetName: GetTextByKey('P_WO_CUSTOMERCOMMUNICATION', 'Customer Communication'), Visible: false } });
}
widgetdata.push({ Values: { Category: 'WorkOrder', WidgetId: 'InternalComments', WidgetName: GetTextByKey('P_WO_INTERNALCOMMENTS', 'Internal Comments'), Visible: false } },
{ Values: { Category: 'WorkOrder', WidgetId: 'Alerts', WidgetName: GetTextByKey('P_WO_ALERTS', 'Alerts'), Visible: false } },
{ Values: { Category: 'WorkOrder', WidgetId: 'Segments', WidgetName: GetTextByKey('P_WO_SEGMENTS', 'Segments'), Visible: false } },
{ Values: { Category: 'WorkOrder', WidgetId: 'Attachments', WidgetName: GetTextByKey('P_WO_ATTACHMENTS', 'Attachments'), Visible: false } });
if (AllowInspection) {
widgetdata.push({ Values: { Category: 'WorkOrder', WidgetId: 'Inspections', WidgetName: GetTextByKey('P_WO_INSPECTIONS', 'Inspections'), Visible: false } });
}
if (AllowCustomer) {
widgetdata.push(
{ Values: { Category: 'WorkOrder', WidgetId: 'Estimates', WidgetName: GetTextByKey('P_WO_ESTIMATES', 'Estimates'), Visible: false } },
{ Values: { Category: 'WorkOrder', WidgetId: 'Invoices', WidgetName: GetTextByKey('P_WO_INVOICES', 'Invoices'), Visible: false } });
}
var MSGWebSocketURL = "<%=MSGWebSocketURL%>";
var nowDate = new DateFormatter().formatDate(new Date("<%=NowDate %>"), 'm/d/Y');
var currentdate = "<%=NowDate %>";
const ui = window['lib-ui'];
function worequest(method, param, callback, error) {
_network.request("Maintenance/WorkOrderMaintenance.aspx", -1, method, param, callback, error || function (e) {
showmaskbg(false, true);
showAlert(GetTextByKey('P_WO_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_WO_QUERY', 'Query'));
});
}
function crrequest(method, param, callback, error) {
_network.request("Maintenance/AddCustomerRecord.aspx", -1, method, param, callback, error || function (e) {
showmaskbg(false, true);
showAlert(GetTextByKey('P_UM_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_UM_QUERY', 'Query'));
});
}
function alertrequest(method, param, callback, error) {
_network.request("Maintenance/AlertsManagement.aspx", -1, method, param, callback, error || function (e) {
showmaskbg(false, true);
showAlert(GetTextByKey('P_WO_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_WO_QUERY', 'Query'));
});
}
function showConfirm1(msg, title, fok, fcancel) {
$('#dialog_statuschange .maskbg').css('display', '');
_dialog.showConfirm(msg, title, function (e) {
$('#dialog_statuschange .maskbg').css('display', 'none');
if (typeof fok === 'function') {
fok(e);
}
}, function () {
$('#dialog_statuschange .maskbg').css('display', 'none');
});
}
function getWorkorderParams() {
worequest("GetWorkorderParams", null, function (data) {
if (!data || typeof (data) === "string") {
return;
}
WorkorderParams = data;
}, function (err) {
});
}
function OnDelete() {
var index = grid_dt.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_WO_PLEASESELECTAWORKORDER", "Please select a work order."), GetTextByKey("P_WORKORDER", "Work Order")); return;
}
var wo = grid_dt.source[index].Values;
if (!wo) {
workOrderID = undefined;
return;
}
var alerttitle = GetTextByKey("P_WO_DELETEWORKORDER", "Delete Work Order");
showConfirm(GetTextByKey("P_WO_DOYOUWANTTODELETETHEWORKORDER", 'Do you want to delete the work order?'), alerttitle, function () {
worequest("DeleteWorkOrder", wo.Id.Value, function (data) {
if (data == "-1")
showAlert(GetTextByKey("P_WO_WORKORDERCANNOTBEDELETEDBECAUSEITISINUSE", 'Work order can not be deleted because it is in use.'), alerttitle);
else
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_WO_FAILEDTODELETETHISWORKORDER", 'Failed to delete this work order.'), alerttitle);
});
});
}
function CloseDialog(type) {
$('#dialog_maintenancerecord').hideDialog();
$('#dialog_workorder').hideDialog();
showmaskbg(false);
setPageTitle(GetTextByKey("P_WORKORDER", "Work Order"), true);
}
function ShowWorkOrderDialog(type) {
//$('#dialog_workorder .dialog-title span.title').text(type === "add" ? "Add Work Order" : "Edit Work Order");
showmaskbg(true);
$('#dialog_workorder')
.attr('act', type)
.showDialogRight();
}
function OnAdd() {
$('#iframeworkorder').attr('src', 'AddWorkOrder.aspx?mid=' + assetid);
setPageTitle(GetTextByKey("P_WO_ADDWORKORDER", "Add Work Order"), true);
ShowWorkOrderDialog();
}
var workOrderID;
function OnEdit() {
var index = grid_dt.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_WO_PLEASESELECTAWORKORDER", "Please select a work order."), GetTextByKey("P_WORKORDER", "Work Order")); return;
}
var wo = grid_dt.source[index].Values;
if (!wo) {
workOrderID = undefined;
return;
}
workOrderID = wo.Id.Value;
if (wo.MaintenanceID) {
execIframeFunc("init", [wo.AssetId, wo.MaintenanceID], "iframemaintenancerecord");
showmaskbg(true);
$('#dialog_maintenancerecord')
.attr('act', 'edit')
.showDialogRight();
}
else {
if (!$("#iframeworkorder").attr("src")) {
$("#iframeworkorder").attr("src", 'AddWorkOrder.aspx?woid=' + workOrderID);
}
else {
execIframeFunc("loadworkorder", [workOrderID], "iframeworkorder");
}
ShowWorkOrderDialog();
}
}
var loading = false;
function OnRefresh(serchbtn) {
if (loading)
return;
loading = true;
showloading(true);
var locations = $('#div_locations').dropdownVals();
var departments = $('#div_departments').dropdownVals();
var advisors = $('#div_advisors').dropdownVals();
var ordertypes = $('#div_ordertypes').dropdownVals();
var statuses = $('#div_statuses').dropdownVals();
var p = {
AssetID: assetid == "" ? -1 : eval(assetid),
SearchText: $.trim($('#searchinputtxt').val()),
Contacts: [],
OrderTypes: ordertypes,
Statuses: statuses,
AssetGroups: [],
Locations: locations,
Departments: departments,
Advisors: advisors
};
//if (contactparam)
// p.Contacts = contactparam.selectedvalue;
if (statusparam)
p.Status = statusparam.selectedvalue;
p.AssetGroups = $('#div_assetgroup').dropdownVals();
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
p.Completed = $('#selcompleted').val();
saveTempFilters();
worequest("GetWorkOrders", htmlencode(JSON.stringify(p)), function (data) {
loading = false;
if (!$("#dialog_workorder").is(':visible') && !$("#dialog_maintenancerecord").is(':visible')
&& !$("#dialog_alerts").is(':visible') && !$("#dialog_workorderstatus").is(':visible'))
showloading(false);
$('#tbody_workorder').empty();
currentShownIndex = -1;
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
if (data) {
workOrders = data.WorkOrders;
workOrderStatus = data.WorkOrderStatus;
workOrderTypes = data.WorkOrderTypes;
woAdvisors = data.Advisors;
if (serchbtn) {
ManageDeleteAndRestore(p.SearchText, data.DeleteAndRestoreWorkOrder);
}
}
else
workOrders = [];
showWorkOrders(workOrders);
//if (manageWorkorderCtrl) {
// manageWorkorderCtrl.setData(workOrders);
//}
}, function (err) {
loading = false;
if (!$("#dialog_workorder").is(':visible') && !$("#dialog_maintenancerecord").is(':visible')
&& !$("#dialog_alerts").is(':visible') && !$("#dialog_workorderstatus").is(':visible'))
showloading(false);
});
}
function ManageDeleteAndRestore(wonumber, kv) {
if (!kv)
return;
if (kv.Key !== "") {
var canrestore = parseInt(kv.Value);
var alerttitle = GetTextByKey("P_WORKORDER", "Work Order");
if (canrestore == 0) {
showAlert(GetTextByKey('P_WO_XXX', 'Work Order {0} has been deleted.Contact Administrator to restore.').replace('{0}', wonumber), alerttitle);
}
else {
showConfirm(GetTextByKey("P_WO_XXX", 'Work Order {0} has been deleted.Would you like to restore it?').replace('{0}', wonumber), alerttitle, function () {
worequest("RestoreDeleteWorkOrder", kv.Key, function (data) {
if (data == "OK")
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_WO_XXX", 'Failed to restore this work order.'), alerttitle);
});
});
}
}
}
function OnPrint() {
var index = grid_dt.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_WO_PLEASESELECTAWORKORDER", "Please select a work order."), GetTextByKey("P_WORKORDER", "Work Order")); return;
}
var wo = grid_dt.source[index].Values;
if (!wo) {
workOrderID = undefined;
return;
}
workOrderID = wo.Id.Value;
window.open("../Print.aspx?pt=1&wo=" + workOrderID);
}
/**************************Start Manage Alert********************************/
/*****************************************************************************/
var workorder;
function ManageAlerts(wo) {
if (!wo) {
workOrderID = undefined;
return;
}
workorder = wo;
workOrderID = wo.Id.Value;
showmaskbg(true);
$('#dialog_alerts')
.attr('act', 'add')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_alerts').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_alerts').width()) / 2
})
.showDialog();
$('#editor_mgroups').empty();
$('#editor_availables').empty();
// 加载alert信息
$('#dialog_alerts .maskbg').css('display', '');
worequest('GetAlertsForWorkOrder', JSON.stringify([workOrderID, workorder.AssetId]), function (data) {
if (data && typeof (data) !== "string") {
showSelectedMachine(!data.Alerts ? [] : data.Alerts);
getMatchAvailableMachines(!data.AssetAlerts ? [] : data.AssetAlerts);
}
$('#dialog_alerts .maskbg').css('display', 'none');
}, function (err) {
showAlert(GetTextByKey("P_WO_FAILEDTOLOADALERTS", 'Failed to load alerts.'), GetTextByKey("P_WO_MANAGEALERTS", 'Manage Alerts'));
});
}
function getMatchAvailableMachines(assetAlerts) {
var selected = [];
for (var i = 0; i < grid_dtsm.source.length; i++) {
var m = grid_dtsm.source[i].Values;
selected.push(m.AlertID);
}
var _availableMachines = [];
for (var i = 0; i < assetAlerts.length; i++) {
var m = assetAlerts[i];
if (m.WorkOrderID == 0 && workorder.AssetId == m.MachineID && $.inArray(m.AlertID, selected) < 0) {
var has = false;
for (var j = 0; j < grid_dtsm.source.length; j++) {
var m1 = grid_dtsm.source[j];
if (m1.AlertID == m.AlertID) {
has = true;
break;
}
}
if (!has) {
_availableMachines.push(m);
}
}
}
showAvailableMachine(_availableMachines);
}
function showAvailableMachine(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "Completed" && typeof r[j] !== "object") {
r[j] = { DisplayValue: r.Completed ? "Yes" : "No", Value: r[j] };
}
}
var fr = { Values: r };
rows.push(fr);
}
grid_dtam.setData(rows);
}
var grid_dtam;
function InitGridAvailableMachines() {
grid_dtam = new GridView('#availablemachinelist');
grid_dtam.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'AlertID', caption: GetTextByKey("P_WO_ALERTID", "Alert ID"), valueIndex: 'AlertID', css: { 'width': 70, 'text-align': 'left' } },
{ name: 'Completed', caption: GetTextByKey("P_WO_COMPLETED", "Completed"), valueIndex: 'Completed', css: { 'width': 90, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 145, 'text-align': 'right' } },
{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 145, 'text-align': 'right' } }
];
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;
columns.push(col);
}
grid_dtam.canMultiSelect = true;
grid_dtam.columns = columns;
grid_dtam.init();
grid_dtam.rowdblclick = function (rowindex) {
var rowdata = grid_dtam.source[rowindex];
if (rowdata) {
grid_dtam.source.splice(rowindex, 1);
grid_dtam.setData(grid_dtam.source);
grid_dtsm.source.push(rowdata);
grid_dtsm.setData(grid_dtsm.source);
}
};
grid_dtam.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtam.source[rowindex];
if (rowdata) {
}
}
}
function showSelectedMachine(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "Completed" && typeof r[j] !== "object") {
r[j] = { DisplayValue: r.Completed ? "Yes" : "No", Value: r[j] };
}
}
var fr = { Values: r };
rows.push(fr);
}
grid_dtsm.setData(rows);
}
var grid_dtsm;
function InitGridSelectedMachines() {
grid_dtsm = new GridView('#selectedmachinelist');
grid_dtsm.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'AlertID', caption: GetTextByKey("P_WO_ALERTID", "Alert ID"), valueIndex: 'AlertID', css: { 'width': 70, 'text-align': 'left' } },
{ name: 'Completed', caption: GetTextByKey("P_WO_COMPLETED", "Completed"), valueIndex: 'Completed', css: { 'width': 90, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 145, 'text-align': 'right' } },
{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 145, 'text-align': 'right' } }
];
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 (list_columns[hd].type) {
col.type = list_columns[hd].type;
}
columns.push(col);
}
grid_dtsm.canMultiSelect = true;
grid_dtsm.columns = columns;
grid_dtsm.init();
grid_dtsm.rowdblclick = function (rowindex) {
var rowdata = grid_dtsm.source[rowindex];
if (rowdata) {
grid_dtsm.source.splice(rowindex, 1);
grid_dtsm.setData(grid_dtsm.source);
grid_dtam.source.push(rowdata);
grid_dtam.setData(grid_dtam.source);
}
};
grid_dtsm.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtsm.source[rowindex];
if (rowdata) {
}
}
}
function OnEditorAdd() {
var indexs = grid_dtam.selectedIndexes;
if (indexs.length <= 0)
return;
var rowstemp = [];
for (var i = 0; i < indexs.length; i++) {
var rowindex = indexs[i];
var rowdata = grid_dtam.source[rowindex];
rowstemp.push(rowdata);
}
var index = grid_dtsm.source.length;
for (var i = 0; i < rowstemp.length; i++) {
var rowdata = rowstemp[i];
grid_dtam.source.splice(grid_dtam.source.indexOf(rowdata), 1);
grid_dtsm.source.splice(index, 0, rowdata);
index++;
}
grid_dtam.setData(grid_dtam.source);
grid_dtsm.setData(grid_dtsm.source);
}
function OnEditorAddAll() {
for (var i = 0; i < grid_dtam.source.length; i++) {
var rowindex = grid_dtam.source[i];
var rowdata = grid_dtam.source[i];
grid_dtsm.source.push(rowdata);
}
grid_dtsm.setData(grid_dtsm.source);
grid_dtam.source = [];
grid_dtam.setData(grid_dtam.source);
}
function OnEditorRemove() {
var indexs = grid_dtsm.selectedIndexes;
if (indexs.length <= 0)
return;
var rowstemp = [];
for (var i = 0; i < indexs.length; i++) {
var rowindex = indexs[i];
var rowdata = grid_dtsm.source[rowindex];
rowstemp.push(rowdata);
}
var index = grid_dtam.source.length;
for (var i = 0; i < rowstemp.length; i++) {
var rowdata = rowstemp[i];
grid_dtsm.source.splice(grid_dtsm.source.indexOf(rowdata), 1);
grid_dtam.source.splice(index, 0, rowdata);
index++;
}
grid_dtsm.setData(grid_dtsm.source);
grid_dtam.setData(grid_dtam.source);
}
function OnEditorRemoveAll() {
for (var i = 0; i < grid_dtsm.source.length; i++) {
var rowindex = grid_dtsm.source[i];
var rowdata = grid_dtsm.source[i];
grid_dtam.source.push(rowdata);
}
grid_dtam.setData(grid_dtam.source);
grid_dtsm.source = [];
grid_dtsm.setData(grid_dtsm.source);
}
function AssignedAlertsToWorkOrder() {
if (!workOrderID)
return;
var alertids = [];
for (var i = 0; i < grid_dtsm.source.length; i++) {
var m = grid_dtsm.source[i].Values;
alertids.push(m.AlertID);
}
$('#dialog_alerts .maskbg').css('display', '');
alertrequest("AssignedAlertsToWorkOrder", workOrderID + String.fromCharCode(170) + JSON.stringify(alertids), function (data) {
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_WO_SAVEALERTS", 'Save alerts'));
} else {
$('#dialog_alerts').hideDialog();
showmaskbg(false)
}
$('#dialog_alerts .maskbg').css('display', 'none');
showmaskbg(false);
}, function (err) {
showAlert(GetTextByKey("P_WO_FAILEDTOSAVEALERTS", 'Failed to save alerts.'), GetTextByKey("P_WO_SAVEALERTS", 'Save alerts'));
$('#dialog_alerts .maskbg').css('display', 'none');
showmaskbg(false);
});
}
/**************************End Manage Alert********************************/
/*****************************************************************************/
//function GetContacts() {
// worequest('GetContacts', '', function (data) {
// if (typeof (data) === "string") {
// showAlert(data, 'Error');
// return;
// }
// var contactdata = [];
// for (var i = 0; i < data.length; i++) {
// var contact = {
// Key: data[i].IID, Value: data[i].DisplayName
// };
// contactdata.push(contact);
// }
// contactparam = {
// items: contactdata,
// selectedvalue: []
// };
// var iptalertype = editmultiselect(contactparam);
// $('#div_contact').append(iptalertype);
// });
//}
//function GetStatus() {
// var items = [];
// items.push({ Key: "Assigned", Value: "Assigned" });
// items.push({ Key: "Unassigned", Value: "Unassigned" });
// items.push({ Key: "In Progress", Value: "In Progress" });
// items.push({ Key: "Completed", Value: "Completed" });
// statusparam = {
// items: items,
// selectedvalue: []
// };
// var iptalertype = editmultiselect(statusparam);
// $('#div_status').append(iptalertype);
//}
//function GetAssetGroups() {
// alertrequest('GetAssetGroups', '', function (data) {
// if (typeof (data) === "string") {
// showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
// return;
// }
// $('#div_assetgroup').css('width', 120).dropdown(data, {
// search: true,
// multiselect: true,
// textKey: 'Value',
// valueKey: 'Key'
// });
// var p = getCookie("WorkOrderFilters");
// if (!p) {
// var data = JSON.parse(htmldecode(decodeURIComponent(p)));
// if (data) {
// $('#div_assetgroup').dropdownVals(data.AssetGroups || []);
// }
// }
// });
//}
//*********************************Begin Detault**************************************************//
function GetLocationsAndDepartments() {
$('#div_assetgroup').empty();
$('#div_locations').empty();
$('#div_departments').empty();
$('#div_advisors').empty();
$('#div_ordertypes').empty();
$('#div_statuses').empty();
worequest('GetFilterDataSource', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
$('#div_assetgroup').css('width', 120).dropdown(data.AssetGroups, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
for (var i = 0; i < data.Locations.length; i++) {
var loc = data.Locations[i];
if (loc.PId > 0) {
loc.html = '&nbsp;&nbsp;&nbsp;&nbsp;' + loc.Name;
}
}
$('#div_locations').css('width', 120).dropdown(data.Locations, {
search: true,
multiselect: true,
valueKey: 'ID',
textKey: 'Name'
});
for (var i = 0; i < data.Departments.length; i++) {
var dep = data.Departments[i];
if (dep.PId > 0) {
dep.html = '&nbsp;&nbsp;&nbsp;&nbsp;' + dep.Name;
}
}
//items: JSON.parse(JSON.stringify(data.Departments)),
$('#div_departments').css('width', 120).dropdown(data.Departments, {
search: true,
multiselect: true,
valueKey: 'Id',
textKey: 'Name'
});
//items: JSON.parse(JSON.stringify(data.Advisors)),
$('#div_advisors').css('width', 120).dropdown(data.Advisors, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
$('#div_ordertypes').css('width', 120).dropdown(data.OrderTypes, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
$('#div_statuses').css('width', 120).dropdown(data.Statuses, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
getWorkOrderDefault();
}, function () {
});
}
function getWorkOrderDefault() {
if (getTempFilters()) {
OnRefresh();
return;
}
worequest("GetWorkOrderDefault", '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey('P_JS_ERROR', 'Error'));
return;
}
if (data) {
$('#div_locations').dropdownVals(data.Locations || []);
$('#div_departments').dropdownVals(data.Departments || []);
$('#div_advisors').dropdownVals(data.Advisors || []);
$('#div_ordertypes').dropdownVals(data.OrderTypes || []);
}
OnRefresh();
}, function (err) {
});
}
function onSaveDefault() {
var locations = $('#div_locations').dropdownVals();
var departments = $('#div_departments').dropdownVals();
var advisors = $('#div_advisors').dropdownVals();
var ordertypes = $('#div_ordertypes').dropdownVals();
var item = {
'Locations': locations,
'Departments': departments,
'Advisors': advisors,
'OrderTypes': ordertypes
};
var alerttitle = GetTextByKey("P_WO_SAVEDEFAULT", "Save Default");
var param = JSON.stringify(item);
param = htmlencode(param);
worequest("SetWorkOrderDefault", param, function (data) {
if (data !== 'OK') {
showAlert(data, alerttitle);
}
else {
showAlert(GetTextByKey("P_WO_SAVSUCCESSFULLY", 'Saved successfully.'), alerttitle);
}
}, function (err) {
});
}
function saveTempFilters() {
var locations = $('#div_locations').dropdownVals();
var departments = $('#div_departments').dropdownVals();
var advisors = $('#div_advisors').dropdownVals();
var ordertypes = $('#div_ordertypes').dropdownVals();
var statuses = $('#div_statuses').dropdownVals();
var p = {
AssetID: assetid == "" ? -1 : eval(assetid),
SearchText: $.trim($('#searchinputtxt').val()),
Contacts: [],
Status: [],
AssetGroups: [],
Locations: locations,
Departments: departments,
Advisors: advisors,
OrderTypes: ordertypes,
Statuses: statuses
};
p.AssetGroups = $('#div_assetgroup').dropdownVals();
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
p.Completed = $('#selcompleted').val();
var filters = JSON.stringify(p);
filters = htmlencode(filters);
setCookie("WorkOrderFilters_" + CID, "1");//filters太长在cookie中会丢失此处只存标识,filters存在localStorage中
window.localStorage["WorkOrderFilters_" + CID] = filters;
}
function getTempFilters() {
var p = getCookie("WorkOrderFilters_" + CID);
if (!p) return false;
p = window.localStorage["WorkOrderFilters_" + CID];
try {
var data = JSON.parse(htmldecode(decodeURIComponent(p)));
if (data) {
$('#div_assetgroup').dropdownVals(data.AssetGroups || []);
$('#div_locations').dropdownVals(data.Locations || []);
$('#div_departments').dropdownVals(data.Departments || []);
$('#div_advisors').dropdownVals(data.Advisors || []);
$('#div_ordertypes').dropdownVals(data.OrderTypes || []);
$('#div_statuses').dropdownVals(data.Statuses || []);
$('#searchinputtxt').val(data.SearchText || "");
$('#chkshowmaintenance').prop("checked", data.ShowMaintenance === true);
$('#selcompleted').val(data.Completed);
if ($('#selcompleted').val() === null)
$('#selcompleted').val(0);
return true;
}
}
catch {
return false;
}
return false;
}
//*********************************End Detault**************************************************//
var dialogWidgets;
$(function () {
setPageTitle(GetTextByKey("P_WORKORDER", "Work Order"), true);
$('.iconlayout').on('click', function (ev) {
CreateLayoutMenus(ev.target, gridLayoutID, grid_dt);
return false;
});
//manageWorkorderCtrl = new $manageWorkorderCtrl();
//manageWorkorderCtrl.Init($("#workorderlist"));
InitGridData();
InitGridAvailableMachines();
InitGridSelectedMachines();
dialogWidgets = new $wowidgetselector('dialog_widgets');
dialogWidgets.onDialogClosed = function () {
showmaskbg(false);
};
dialogWidgets.onOK = function (source) {
wowidgetobj && wowidgetobj.reloadWidgets();
};
$("#spWdigets").click(function () {
showmaskbg(true);
dialogWidgets.showSelector();
});
showmaskbg(true);
getWorkorderParams();
//GetContacts();
//GetStatus();
//GetAssetGroups();
$('#searchinputtxt').keydown(searchEnter);
$('#dialog_completeddate').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$('#dialog_metertype').change(function () {
meterType = $('#dialog_metertype').val();
setMeterType();
});
$(window).resize(function () {
$("#workorderlist").css("height", $(window).height() - $("#workorderlist").offset().top - 10);
grid_dt && grid_dt.resize();
}).resize();
$('#dialog_alerts').prop('iframe', true).dialog(function () {
showmaskbg(false);
});
$('#dialog_alerts').dialog(function () {
showmaskbg(false);
});
$('#dialog_statuschange').dialog(function () {
var cancel = $('#dialog_statuschange').data("cancel");
if (cancel)
cancel();
showmaskbg(false);
});
$('#dialog_chksendtextmsg').change(function () {
var checked = $('#dialog_chksendtextmsg').prop('checked');
$('#txtphonenum').prop('disabled', !checked);
$('#dialog_chkIncludeStatusLink').prop('disabled', !checked);
$('#dialog_textmsg').prop('disabled', !checked);
$('#dialog_variables').prop('disabled', !checked);
$('#dialog_insertfield').prop('disabled', !checked);
});
$('#dialog_edittext').dialog(function () {
showmaskbg(false);
});
$('#dialog_sendwosurveys').dialog(function () {
showmaskbg(false);
});
if (!canExport) {
$('#spExport').hide();
}
openmsgwebsocket();
});
var meterType = "";
function setMeterType() {
$('#tr_hourmeter').css('display', 'none');
$('#tr_odometer').css('display', 'none');
if (!meterType || meterType == "")
meterType = "HourMeter";
if (meterType == "HourMeter" || meterType == "Both") {
$('#tr_hourmeter').css('display', '');
}
if (meterType == "Odometer" || meterType == "Both") {
$('#tr_odometer').css('display', '');
}
}
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh(true);
}
}
function changeasset(aid) {
assetid = aid;
OnRefresh();
}
function OnExit() {
window.parent.CloseWorkOrderDialog();
}
function CloseWOStatusDialog(type) {
$('#dialog_workorderstatus').hideDialog();
OnRefresh();
execIframeFunc("refreshstatus", [], "iframeworkorder");
}
function ShowWOStatusDialog(type) {
showmaskbg(true);
$('#dialog_workorderstatus')
.attr('act', type)
.showDialogRight();
}
function openWOStatus() {
$('#iframeworkorderstatus').attr('src', 'WorkOrderStatusManagement.aspx');
ShowWOStatusDialog();
}
function insertfield() {
var field = $("#dialog_variables").find("option:selected").text();
$("#dialog_textmsg").focus();
document.execCommand('insertText', false, field);
}
function OnExport() {
var locations = $('#div_locations').dropdownVals();
var departments = $('#div_departments').dropdownVals();
var advisors = $('#div_advisors').dropdownVals();
var ordertypes = $('#div_ordertypes').dropdownVals();
var statuses = $('#div_statuses').dropdownVals();
var p = {
AssetID: assetid == "" ? -1 : eval(assetid),
SearchText: $.trim($('#searchinputtxt').val()),
Contacts: [],
OrderTypes: ordertypes,
Statuses: statuses,
AssetGroups: [],
Locations: locations,
Departments: departments,
Advisors: advisors
};
p.AssetGroups = $('#div_assetgroup').dropdownVals();
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
p.Completed = $('#selcompleted').val();
var layout = getLayoutOnGrid(grid_dt);
var ps = ["workorders", JSON.stringify(p), JSON.stringify(layout)];
var data = new FormData();
data.append('type', 'set');
data.append('ClientData', JSON.stringify(ps));
$.ajax({
url: "../ExportToFile.aspx",
type: 'POST',
dataType: 'json',
processData: false,
contentType: false,
data: data,
success: function (data) {
if (data && data != "")
window.open("../ExportToFile.aspx?type=exp&key=" + data);
},
error: function (err) {
}
});
//var param = htmlencode(JSON.stringify(p));
//window.open("../ExportToFile.aspx?type=workorders&param=" + param);
}
var loadingWorkOrderItem = false;
var notificationWorkOrderQueue = [];
function getWorkOrderItem(woid) {
if (!grid_dt) return;
if (loadingWorkOrderItem) {
if (notificationWorkOrderQueue.indexOf(woid) < 0)
notificationWorkOrderQueue.push(woid);
return;
}
loadingWorkOrderItem = true;
var locations = $('#div_locations').dropdownVals();
var departments = $('#div_departments').dropdownVals();
var advisors = $('#div_advisors').dropdownVals();
var ordertypes = $('#div_ordertypes').dropdownVals();
var statuses = $('#div_statuses').dropdownVals();
var p = {
WorkOrderID: woid,
SearchText: $.trim($('#searchinputtxt').val()),
Contacts: [],
OrderTypes: ordertypes,
Status: statuses,
AssetGroups: [],
Locations: locations,
Departments: departments,
Advisors: advisors
};
p.AssetGroups = $('#div_assetgroup').dropdownVals();
p.Completed = $('#selcompleted').val();
worequest("GetWorkOrderListItem", htmlencode(JSON.stringify(p)), function (data) {
loadingWorkOrderItem = false;
if (data) {
var r = data;
for (var j in r) {
if (j === "Id") {
r[j] = { DisplayValue: r["Id"] > 0 ? r["Id"] : "MR", Value: r[j] };
}
else if (j === "WorkOrderNumber") {
r[j] = { DisplayValue: r["WorkOrderNumber"], Value: pad(r[j], 50) };
}
else if (j === "DueDate") {
r[j] = { DisplayValue: r["DueDateStr"], Value: r[j] };
}
else if (j === "CompleteDate") {
r[j] = { DisplayValue: r["CompleteDateStr"], Value: r[j] };
}
else if (j === "NextFollowUpDate") {
r[j] = { DisplayValue: r["NextFollowUpDateStr"], Value: r[j] };
}
else if (j === "CreateDate") {
r[j] = { DisplayValue: r["CreateDateStr"], Value: r[j] };
}
else if (j === "CreationDate") {
r[j] = { DisplayValue: r["CreationDateStr"], Value: r[j] };
}
else if (j === "LastCommunicationDate") {
r[j] = { DisplayValue: r["LastCommunicationDateStr"], Value: r[j] };
}
else if (j === "LastInternalCommunicationDate") {
r[j] = { DisplayValue: r["LastInternalCommunicationDateStr"], Value: r[j] };
}
else if (j === "PartsExpectedDate") {
r[j] = { DisplayValue: r["PartsExpectedDateStr"], Value: r[j] };
}
else if (j === "LastLaborDate") {
r[j] = { DisplayValue: r["LastLaborDateStr"], Value: r[j] };
}
else if (j === "InspectionRequired") {
r[j] = { DisplayValue: r["InspectionRequired"] ? "Yes" : "No", Value: r[j] };
}
else if (j === "AutoText") {
r[j] = { DisplayValue: r["AutoText"] ? "Yes" : "No", Value: r[j] };
}
else if (j === "WorkOrderType") {
var wotype = r[j];
if (wotype == "Maintenance Expense")
wotype = GetTextByKey("P_WO_MAINTENANCEEXPENSE", "Maintenance Expense");
else if (wotype == "Repair Expense")
wotype = GetTextByKey("P_WO_REPAIREXPENSE", "Repair Expense");
else if (wotype == "Capitalized Expense")
wotype = GetTextByKey("P_WO_CAPITALIZEDEXPENSE", "Capitalized Expense");
r[j] = wotype;
}
else if (j === "EstimateStatus") {
r[j] = getEstimateStatus(r[j]);
}
else if (j === "Billable") {
r[j] = { DisplayValue: r["Billable"] ? "Yes" : "No", Value: r[j] };
}
}
var shown = false;
for (var i = 0; i < grid_dt.source.length; i++) {
var wo = grid_dt.source[i].Values;
if (wo.Id.Value == r.Id.Value) {
grid_dt.source[i].Values = r;
shown = true;
break;
}
}
if (!shown)
grid_dt.source.push({ Values: r });
if (grid_dt.selectedIndex >= 0)
grid_dt.source[grid_dt.selectedIndex].__selected = true
grid_dt && grid_dt.reload();
}
else {
removeWorkOrderItem(woid);
}
if (notificationWorkOrderQueue.length > 0)
getWorkOrderItem(notificationWorkOrderQueue.shift());
}, function (err) {
loadingWorkOrderItem = false;
if (notificationWorkOrderQueue.length > 0)
getWorkOrderItem(notificationWorkOrderQueue.shift());
});
}
function removeWorkOrderItem(woid) {
for (var i = 0; i < grid_dt.source.length; i++) {
var wo = grid_dt.source[i].Values;
if (wo.Id.Value == woid) {
grid_dt.source.splice(i, 1);
grid_dt && grid_dt.reload();
return;
}
}
}
var loadingCount = 0;
function showLoading() {
loadingCount++;
if (window.parent && typeof window.parent.onmaskbg == 'function') {
window.parent.onmaskbg(true, true);
}
$("#dialogattmask").show();
}
function hideLoading() {
loadingCount--;
if (loadingCount === 0) {
$("#dialogattmask").hide();
if (window.parent && typeof window.parent.onmaskbg == 'function') {
window.parent.onmaskbg(false, true);
}
}
}
var _websocket;
function openmsgwebsocket() {
_websocket = new $websocket(MSGWebSocketURL);
_websocket.onreceive = onmsgreceived;
_websocket.connect();
}
function onmsgreceived(data) {
if (data) {
if (data.Code == "500" || data.Code == "501" || data.Code == "503" || data.Code == "505")//add, update, sms
getWorkOrderItem(data.Message);
else if (data.Code == "502")//delete
removeWorkOrderItem(data.Message);
wowidgetobj?.onmsgreceived(data);
if ($("#dialog_workorder").is(":visible")) {
var fn = document.getElementById("iframeworkorder").contentWindow["onmsgreceived"];
if (fn)
fn.apply(this, [data]);
}
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px; min-width: 1650px;">
<div class="page_title">
<span data-lgid="P_WORKORDER">Work Order</span>
<span class="sbutton iconexit" style="<%=InDialog?"": "display:none;"%>; float: right; font-size: 14px; margin-right: 15px; cursor: pointer;" onclick="OnExit();">
<label data-lgid="P_WO_EXIT">Exit</label>
</span>
<%if (AllowWorkOrderConfiguration)
{%>
<span class="sbutton iconcog" style="float: right; font-size: 14px; cursor: pointer;" onclick="openWOStatus();">
<label data-lgid="P_WO_WORKORDERCONFIGURATION">Work Order Configuration</label></span> <%}%>
<div style="clear: both;"></div>
</div>
<div class="search_bar" style="<%=InDialog?"display:none;": ""%>">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_WO_ASSETGROUP_COLON">Asset Group:</span>
<div id="div_assetgroup"></div>
<span data-lgid="P_WO_LOCATION_COLON">Location:</span>
<div id="div_locations"></div>
<span data-lgid="P_WO_DEPARTMENT_COLON">Department:</span>
<div id="div_departments"></div>
<span data-lgid="P_WO_ADVISOR_COLON">Advisor:</span>
<div id="div_advisors"></div>
<span data-lgid="P_WO_XXXXXX">Order Type:</span>
<div id="div_ordertypes"></div>
<span data-lgid="P_WO_STATUS_COLON">Status:</span>
<div id="div_statuses"></div>
<input style="margin-left: 8px; width: 100px;" type="text" id="searchinputtxt" autocomplete="off" />
<input class="search" type="button" style="margin-left: 5px;" onclick="OnRefresh(true);" value="Search" data-lgid="P_WO_SEARCH" />
<%if (CanViewMR)
{%>
<input id="chkshowmaintenance" type="checkbox" onclick="OnRefresh();" /><label for="chkshowmaintenance" data-lgid="P_WO_VIEWMAINTENANCERECORDS">View Maintenance Records</label>
<%}%>
<select id="selcompleted" onchange="OnRefresh();" style="margin-left: 5px; width: 160px;">
<option value="0" data-lgid="P_WO_XXXXXX">Open Work Orders Only</option>
<option value="1" data-lgid="P_WO_XXXXXX">Completed Work Orders Only</option>
<option value="-1" data-lgid="P_WO_XXXXXX">Active & Completed Work Orders</option>
</select>
<span class="sbutton iconsave" onclick="onSaveDefault();" style="margin-left: 8px; padding-right: 0;" data-title-lgid="P_WO_SAVELOCATIONANDDEPARTMENTSEARCH" title="Save Location, Department, Advisor and Order type Search"></span>
</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_WO_ADD">Add</span>
<span class="sbutton iconedit" onclick="OnEdit();" data-lgid="P_WO_EDIT">Edit</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_WO_REFRESH">Refresh</span>
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_UTILITY_EXPORTTOEXCEL">Export to Excel</span>
<span class="sbutton iconlayout iconmenu" data-lgid="P_MR_LAYOUT">Layout</span>
<span class="sbutton iconfilter" onclick="OnResetPivots();" data-lgid="P_JS_XXX">Reset Pivots</span>
<span id="spWdigets" class="sbutton iconwidget" data-lgid="P_JS_XXX">Widgets</span>
</div>
<div class="clear"></div>
<div id="workorderlist"></div>
<div id="workorderdetail"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_alerts" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_MANAGEALERTS">Manage Alerts</span><em class="dialog-close"></em></div>
<div>
<table class="group_table" style="min-height: 480px;">
<thead>
<tr>
<td data-lgid="P_WO_AVAILABLEALERTS">Available Alerts</td>
<td></td>
<td data-lgid="P_WO_SELECTEDALERTS">Selected Alerts</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<div id="availablemachinelist" style="height: 450px; width: 480px;"></div>
</td>
<td class="td_controller">
<input class="ctl_button" type="button" value="&#xe62b;" onclick="OnEditorAdd();" tabindex="23" />
<input class="ctl_button" type="button" value="&#xe632;" onclick="OnEditorAddAll();" tabindex="24" />
<input class="ctl_button" type="button" value="&#xe62a;" onclick="OnEditorRemove();" tabindex="25" />
<input class="ctl_button" type="button" value="&#xe631;" onclick="OnEditorRemoveAll();" tabindex="26" />
</td>
<td>
<div id="selectedmachinelist" style="height: 450px; width: 480px;"></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="18" />
<input type="button" onclick="AssignedAlertsToWorkOrder();" value="OK" data-lgid="P_WO_OK" tabindex="17" />
<div class="clear"></div>
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_statuschange" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_STATUSCHANGE">Status Change</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; margin-left: 10px; margin-right: 10px;">
<tr class="statuscompleted" style="display: none;">
<td class="label" data-lgid="P_WO_METERTYPE_COLON">Meter Type:</td>
<td class="cont">
<select id="dialog_metertype" tabindex="1" style="height: 22px; width: 324px;">
<option value="HourMeter" data-lgid="P_WO_HOURMETER">Hour Meter</option>
<option value="Odometer" data-lgid="P_WO_ODOMETER">Odometer</option>
<option value="Both" data-lgid="P_WO_BOTH">Both</option>
</select></td>
</tr>
<tr class="statuscompleted" id="tr_hourmeter" style="display: none;">
<td class="label">
<span data-lgid="P_WO_HOURMETER_COLON">Hour Meter:</span><span class="span_required redasterisk">*</span></td>
<td>
<input type="text" id="dialog_hourmeter" maxlength="12" tabindex="1" autocomplete="off" style="width: 320px;" /></td>
</tr>
<tr class="statuscompleted" id="tr_odometer" style="display: none;">
<td class="label">
<span data-lgid="P_WO_ODOMETER_COLON">Odometer:</span><span class="span_required redasterisk">*</span></td>
<td>
<input type="text" id="dialog_odometer" maxlength="12" tabindex="1" style="width: 227px;" autocomplete="off" />
<select id="dig_odometeruom" style="width: 90px; height: 22px;" tabindex="1">
<option value="Mile" data-lgid="P_WO_MILE">Mile</option>
<option value="Kilometre" data-lgid="P_WO_KILOMETER">Kilometer</option>
</select>
</td>
</tr>
<tr class="statuscompleted" style="display: none;">
<td class="label">
<span data-lgid="P_WO_COMPLETEDDATE_COLON">Completed Date:</span><span class="span_required redasterisk">*</span>
</td>
<td>
<input type="text" id="dialog_completeddate" maxlength="200" tabindex="1" autocomplete="off" style="width: 320px;" /></td>
</tr>
<tr class="tr_sendmsg" style="display: none;">
<td style="text-align: right;">
<input id="dialog_chksendtextmsg" type="checkbox" style="width: unset;" /></td>
<td style="text-align: left;">
<label for="dialog_chksendtextmsg" data-lgid="P_WO_SENDUPDATETOCUSTOMER" style="user-select: none;">Send Update To Customer</label></td>
</tr>
<tr class="tr_sendmsg" style="display: none;">
<td>
<div style="font-size: 20px; margin-right: 5px; float: right;"><em class="spanbtn iconmobile" style="font-weight: 900; font-size: 14px; cursor: default; padding-left: 0; padding-right: 3px; padding-top: 0;"></em></div>
</td>
<td>
<input type="text" id="txtphonenum" tabindex="1" autocomplete="off" maxlength="100" style="width: 320px;" />
</td>
</tr>
<tr class="tr_sendmsg" style="display: none;">
<td style="text-align: right;">
<input id="dialog_chkIncludeStatusLink" type="checkbox" style="width: unset;" /></td>
<td style="text-align: left;">
<label for="dialog_chkIncludeStatusLink" data-lgid="P_WO_INCLUDESTATUSLINK" style="user-select: none;">Include Status Link</label></td>
</tr>
<tr class="tr_sendmsg" style="display: none;">
<td class="label"><span data-lgid="P_WO_MESSAGE_COLON">Message:</span></td>
<td>
<select id="dialog_variables" style="width: 156px;">
<option value="0">[Site_Name]</option>
<option value="1">[Location]</option>
<option value="13">[Asset]</option>
<option value="4">[VIN]</option>
<option value="2">[Make]</option>
<option value="3">[Model]</option>
<option value="5">[Id_Phone]</option>
<option value="6">[Advisor]</option>
<option value="7">[Company_Name]</option>
<option value="8">[Contact_Name]</option>
<option value="9">[Contact_First_Name]</option>
<option value="10">[Status_Link]</option>
<option value="11">[Technician_Name]</option>
<option value="12">[Work_Order_Number]</option>
<option value="13">[Parts_Order_Number]</option>
</select>
<input type="button" id="dialog_insertfield" onclick="insertfield();" data-lgid="P_WO_ADD" style="width: 35px; height: auto; margin-left: 5px;" tabindex="1" />
<br />
<textarea id="dialog_textmsg" tabindex="1" style="width: 320px; height: 120px; margin-top: 6px;" maxlength="2000"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="1" />
<input type="button" id="btn_save" onclick="SaveStatusChange(0);" value="Save" data-lgid="P_WO_SAVE" style="width: unset;" tabindex="1" />
<%--<input type="button" id="btn_sendtextandsave" onclick="SaveStatusChange(1);" style="width: unset;" value="Send And Save" data-lgid="P_WO_SENDANDSAVE" tabindex="17" />
<input type="button" id="btn_sendtext" onclick="SaveStatusChange(2);" style="width: unset;" value="Send" data-lgid="P_WO_SEND" tabindex="17" />--%>
<div class="clear"></div>
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_edittext" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_EDITDESCRIPTION">Edit Description</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px;">
<tr>
<td>
<textarea id="dialog_text" tabindex="1" style="width: 480px; height: 200px; margin-top: 6px;" maxlength="2000"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="18" />
<input type="button" onclick="SaveText();" value="Save" data-lgid="P_WO_SAVE" tabindex="17" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_sendwosurveys" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_EDITDESCRIPTION">Edit Description</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; margin-left: 10px; margin-right: 10px;">
<tr>
<td class="label" data-lgid="P_WO_TEMPLATES_COLON">Templates:</td>
<td class="cont">
<select id="dialog_wosurveytemplates" tabindex="1" style="height: 22px; width: 324px;">
</select></td>
</tr>
<tr>
<td class="label" style="vertical-align: top;">
<span data-lgid="P_WO_CONTACTS_COLON">Contacts:</span></td>
<td>
<div id="dialog_wosurveyscontacts" style="max-height: 150px; overflow: auto;"></div>
</td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="18" />
<input type="button" onclick="SendWOSurveys();" value="Send" data-lgid="P_WO_SEND" tabindex="17" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="sendicemailpopupdialog" style="display: none; width: 485px;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_SENDINTERNALCOMMENTS">Send Internal Comments</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 25px;">
<tr>
<td data-lgid="P_WO_SENDTHISTO">Who do you want to send this to? Select from existing relationships or manual entry.</td>
</tr>
<tr>
<td colspan="2">
<input type="text" id="sendinternalcomments_search" style="width: 445px; margin-left: 10px;" placeholder="Search" /></td>
</tr>
<tr>
<td>
<div id="iccontactlist" style="height: 240px; width: 440px; margin-left: 10px; margin-right: 10px;"></div>
</td>
</tr>
<tr>
<td data-lgid="P_WO_EMAILADDRESSESTIPS">Separate multiple manually entered email addresses with a semi-colon (;).</td>
</tr>
<tr>
<td><span data-lgid="P_WO_OTHEREMAILADDRESS">Other Email Address</span>
<input type="text" id="sendic_otheremailaddress" style="width: 332px;" autocomplete="off" /></td>
</tr>
<tr>
<td><span data-lgid="P_WO_PHONENUMBER">Phone Number</span>
<input type="text" id="sendic_phonenumber" style="width: 353px; margin-left: 7px;" autocomplete="off" />
</td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="153" />
<input type="button" onclick="onSendInternalComments();" value="OK" data-lgid="P_WO_OK" tabindex="152" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_workorder" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
<iframe id="iframeworkorder" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_maintenancerecord" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
<iframe id="iframemaintenancerecord" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_workorderstatus" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
<%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
<iframe id="iframeworkorderstatus" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
</div>
<div id="dialogattmask" class="maskbg" style="display: none;">
<%-- 放到最后 Widget中上传WorkOrder附件是使用--%>
<div class="loading c-spin"></div>
<lable class="lable_attuploadname"></lable>
</div>
</asp:Content>