fleet-contractor/Site/Maintenance/WorkOrderMaintenance.aspx
2024-03-26 15:56:31 +08:00

2374 lines
102 KiB
Plaintext

<%@ 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;
}
.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%;
position: relative;
}
.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
}
html::-webkit-scrollbar {
width: 8px;
height: 8px;
}
html::-webkit-scrollbar-thumb {
background-color: rgba(168, 168, 168, 0.9);
border-radius: 4px;
}
.wrapper-flex {
display: flex;
}
.workorder-spliter {
background-color: gray;
position: relative;
}
#workorderspliter {
height: 6px;
cursor: ns-resize;
margin: 6px 0 4px;
}
#workorderspliter_right {
width: 6px;
cursor: ew-resize;
margin: 0 4px 0 6px;
}
.workorder-spliter.collapsed {
cursor: default;
background-color: transparent;
}
.workorder-spliter > div {
position: absolute;
background-color: white;
border: 1px solid gray;
cursor: pointer;
overflow: hidden;
}
#workorderspliter > div {
top: -4px;
left: 50%;
width: 40px;
height: 12px;
margin-left: -20px;
}
#workorderspliter_right > div {
left: -4px;
top: 50%;
width: 12px;
height: 40px;
margin-top: -20px;
}
.workorder-spliter > div > span {
display: block;
width: 10px;
height: 10px;
border-right: 1px solid gray;
border-bottom: 1px solid gray;
position: absolute;
}
#workorderspliter > div > span {
left: 14px;
top: -3px;
transform: rotate(45deg);
}
#workorderspliter_right > div > span {
top: 14px;
left: -3px;
transform: rotate(-45deg);
}
.workorder-spliter.collapsed > div > span {
transform: rotate(-135deg);
top: 4px;
}
.workorder-detail {
position: relative;
overflow: auto;
}
.workorder-detail::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.workorder-detail::-webkit-scrollbar-thumb {
background-color: rgba(168, 168, 168, 0.9);
border-radius: 4px;
}
.workorder-detail > .ui-popup-mask {
position: absolute;
}
#workorderdetail_right > .ui-tab-page {
position: relative;
background-color: transparent;
}
#workorderdetail_right > .ui-tab-page > .ui-popup-container {
min-width: unset;
width: 100%;
height: 100%;
position: static;
}
.data-column-header-filter-panel {
z-index: 500;
}
</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 src="<%=GetFileUrlWithVersion("../js/lib/amrnb.js")%>"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/vue.min.js")%>"></script>
<script>Vue.config.productionTip = false; Vue.config.silent = true; var GridView = window['lib-ui'].Grid;</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/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.min.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 CanViewMR = <%=CanViewMR ?"true":"false"%>;
var AllowReassignWorkorders = <%=AllowReassignWorkorders ?"true":"false"%>;
var AllowDeleteAtta = <%=AllowDeleteAtta ?"true":"false"%>;
var WorkOrderListApiAddress = "<%=WorkOrderListApiAddress %>";
var CompanyID = "<%=CompanyID%>";
var WorkorderParams = {};
var wowidgetobj = null;
var widgetdata = [];
if (AllowCommunicate) {
widgetdata.push({ Category: 'WorkOrder', WidgetId: 'CustomerCommunication', WidgetName: GetTextByKey('P_WO_CUSTOMERCOMMUNICATION', 'Customer Communication'), Visible: false });
}
widgetdata.push({ Category: 'WorkOrder', WidgetId: 'InternalComments', WidgetName: GetTextByKey('P_WO_INTERNALCOMMENTS', 'Internal Comments'), Visible: false },
{ Category: 'WorkOrder', WidgetId: 'Alerts', WidgetName: GetTextByKey('P_WO_ALERTS', 'Alerts'), Visible: false },
{ Category: 'WorkOrder', WidgetId: 'Segments', WidgetName: GetTextByKey('P_WO_SEGMENTS', 'Segments'), Visible: false },
{ Category: 'WorkOrder', WidgetId: 'Attachments', WidgetName: GetTextByKey('P_WO_ATTACHMENTS', 'Attachments'), Visible: false });
if (AllowInspection) {
widgetdata.push({ Category: 'WorkOrder', WidgetId: 'Inspections', WidgetName: GetTextByKey('P_WO_INSPECTIONS', 'Inspections'), Visible: false });
}
if (AllowCustomer) {
widgetdata.push(
{ Category: 'WorkOrder', WidgetId: 'Estimates', WidgetName: GetTextByKey('P_WO_ESTIMATES', 'Estimates'), Visible: false },
{ Category: 'WorkOrder', WidgetId: 'Invoices', WidgetName: GetTextByKey('P_WO_INVOICES', 'Invoices'), Visible: false },
{ Category: 'WorkOrder', WidgetId: 'CustomerRecordComments', WidgetName: GetTextByKey('P_CR_CUSTOMERRECORDCOMMENT', 'Customer Record Comment'), 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];
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];
if (!wo) {
workOrderID = undefined;
return;
}
workOrderID = wo.Id.Value;
if (wo.MaintenanceID) {
return;
//if (CanViewMR) {
// 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;
var SPLIT_CHAR170 = String.fromCharCode(170);
var SPLIT_CHAR171 = String.fromCharCode(171);
var SPLIT_CHAR172 = String.fromCharCode(172);
var SPLIT_CHAR175 = String.fromCharCode(175);
var SPLIT_CHAR180 = String.fromCharCode(180);
var SPLIT_CHAR181 = String.fromCharCode(181);
var SPLIT_CHAR182 = String.fromCharCode(182);
var SPLIT_CHAR183 = String.fromCharCode(183);
function OnRefresh1(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();
if (CanViewMR) {
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
}
else
p.ShowMaintenance = true;
p.Completed = parseInt($('#selcompleted').val());
saveTempFilters();
_network.apipost(WorkOrderListApiAddress, CompanyID, 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 (data) {
var data_str = data.split(SPLIT_CHAR181);
var workorders_str = data_str[0];
if (workorders_str !== "") {
workOrders = ConvertWorkOrders(workorders_str);
}
else
workOrders = [];
var workorderstatus_str = data_str[1];
if (workorderstatus_str !== "") {
workOrderStatus = ConvertWorkoOrderStatus(workorderstatus_str);
}
var workordertypes_str = data_str[2];
if (workordertypes_str !== "") {
workOrderTypes = workordertypes_str.split(SPLIT_CHAR180);
}
var woadvisors_str = data_str[3];
if (woadvisors_str !== "") {
woAdvisors = ConvertStringKeyValues(woadvisors_str, SPLIT_CHAR180)
}
var deleteandrestoreworkorder = [];
var deleteandrestorewo_str = data_str[4];
if (deleteandrestorewo_str !== "") {
deleteandrestoreworkorder = ConvertStringKeyValue(deleteandrestorewo_str, SPLIT_CHAR175);
}
if (serchbtn) {
ManageDeleteAndRestore(p.SearchText, 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 OnRefresh(serchbtn) {
if (WorkOrderListApiAddress) {
OnRefresh1(serchbtn);
return;
}
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();
if (CanViewMR) {
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
}
else
p.ShowMaintenance = true;
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 (data) {
var data_str = data.split(SPLIT_CHAR181);
var workorders_str = data_str[0];
if (workorders_str !== "") {
workOrders = ConvertWorkOrders(workorders_str);
}
else
workOrders = [];
var workorderstatus_str = data_str[1];
if (workorderstatus_str !== "") {
workOrderStatus = ConvertWorkoOrderStatus(workorderstatus_str);
}
var workordertypes_str = data_str[2];
if (workordertypes_str !== "") {
workOrderTypes = workordertypes_str.split(SPLIT_CHAR180);
}
var woadvisors_str = data_str[3];
if (woadvisors_str !== "") {
woAdvisors = ConvertStringKeyValues(woadvisors_str, SPLIT_CHAR180)
}
var deleteandrestoreworkorder = [];
var deleteandrestorewo_str = data_str[4];
if (deleteandrestorewo_str !== "") {
deleteandrestoreworkorder = ConvertStringKeyValue(deleteandrestorewo_str, SPLIT_CHAR175);
}
if (serchbtn) {
ManageDeleteAndRestore(p.SearchText, 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 ConvertWorkOrders(str) {
var wos = [];
var wos_array = str.split(SPLIT_CHAR180);
if (wos_array && wos_array.length > 0) {
for (var i = 0; i < wos_array.length; i++) {
var index = 0;
var array = wos_array[i].split(SPLIT_CHAR170);
var wo = {};
wo.Id = parseInt(array[index]);
wo.WorkOrderType = array[++index];
wo.AssignedToName = array[++index];
wo.Status = parseInt(array[++index]);
wo.AssetId = parseInt(array[++index]);
wo.AssetName = array[++index];
wo.Description = array[++index];
wo.InvoiceNumber = array[++index];
wo.CustomerName = array[++index];
wo.DueDate = array[++index];
wo.CompleteDate = array[++index];
wo.NextFollowUpDate = array[++index];
wo.StatusName = array[++index];
wo.StatusColor = array[++index];
wo.CreateDate = array[++index];
wo.CustomerCode = array[++index];
wo.Notes = array[++index];
wo.CurrentJobsites = array[++index];
wo.Make = array[++index];
wo.Model = array[++index];
wo.Location = array[++index];
wo.Department = array[++index];
wo.AdvisorId = array[++index];
wo.LastCommunication = array[++index];
wo.LastCommunicationDate = array[++index];
wo.LastCommunicationBy = array[++index];
wo.VIN = array[++index];
wo.InspectionCount = parseFloat(array[++index]);
wo.AssignedTo = array[++index];
wo.MeterType = array[++index];
wo.HourMeter = parseFloat(array[++index]);
wo.Odometer = parseFloat(array[++index]);
wo.OdometerUnits = array[++index];
wo.WorkOrderNumber = array[++index];
wo.PartsExpectedDate = array[++index];
wo.LastLaborDate = array[++index];
wo.HoursToComplete = parseFloat(array[++index]);
wo.StatusType = parseInt(array[++index]);
wo.InspectionRequired = parseInt(array[++index]) == 1;
wo.LocationId = parseInt(array[++index]);
wo.DepartmentId = parseInt(array[++index]);
wo.AlternateStatus = array[++index];
if (array[++index] !== "") {
wo.Contacts = ConvertContacts(array[index]);
}
wo.AdvisorName = array[++index];
wo.EstimateStatus = parseInt(array[++index]);
wo.PublishedEstimates = parseInt(array[++index]);
wo.ApprovedEstimates = parseInt(array[++index]);
wo.RejectedEstimates = parseInt(array[++index]);
wo.PendingEstimates = parseInt(array[++index]);
wo.CommunicationAcknowledged = parseInt(array[++index]) == 1;
wo.CreationDate = array[++index];
wo.AutoText = parseInt(array[++index]) == 1;
wo.Component = array[++index];
wo.Billable = parseInt(array[++index]) == 1;
wo.BillToJob = parseInt(array[++index]);
wo.BillToJobName = array[++index];
wo.AddedBy = array[++index];
wo.PartsOrderNumber = array[++index];
wo.PartsStatus = array[++index];
wo.TextMessageStatus = parseInt(array[++index]);
wo.EstimateAcknowledged = parseInt(array[++index]) == 1;
wo.AssetGroups = array[++index].split(SPLIT_CHAR172);
wo.JobSites = array[++index].split(SPLIT_CHAR172);
wo.SalespersonId = array[++index];
wo.SalespersonName = array[++index];
wo.InspectionTemplateId = parseInt(array[++index]);
wo.InspectionTemplateName = array[++index];
wo.RequiredInspectionCompleted = parseInt(array[++index]) == 1;
wo.LastInternalCommunication = array[++index];
wo.LastInternalCommunicationDate = array[++index];
wo.LastInternalCommunicationBy = array[++index];
wo.CanClose = parseInt(array[++index]) == 1;
wo.CanDeleteAndRestore = parseInt(array[++index]) == 1;
wo.CustomerId = parseInt(array[++index]);
wo.PONumber = array[++index];
wo.DueDateStr = array[++index];
wo.CompleteDateStr = array[++index];
wo.NextFollowUpDateStr = array[++index];
wo.CreateDateStr = array[++index];
wo.CreationDateStr = array[++index];
wo.LastCommunicationDateStr = array[++index];
wo.LastInternalCommunicationDateStr = array[++index];
wo.PartsExpectedDateStr = array[++index];
wo.LastLaborDateStr = array[++index];
wo.MaintenanceID = array[++index];
var workorderstatusstr = array[++index];
if (workorderstatusstr !== "") {
wo.WorkOrderStatus = ConvertWorkoOrderStatus(workorderstatusstr);
}
var assignedtousersstr = array[++index];
if (assignedtousersstr !== "") {
wo.AssignedToUsers = ConvertAssignedToUsers(assignedtousersstr);
}
var departmentsstr = array[++index];
if (departmentsstr !== "") {
wo.Departments = ConvertDepartments(departmentsstr);
}
var locationsstr = array[++index];
if (locationsstr !== "") {
wo.Locations = ConvertLocations(locationsstr);
}
var salespersonsstr = array[++index];
if (salespersonsstr !== "") {
wo.Salespersons = ConvertSalespersons(salespersonsstr);
}
wo.ContactsStr = array[++index];
wo.Completed = parseInt(array[++index]) == 1;
wos.push(wo);
}
}
return wos;
}
function ConvertContacts(str) {
var contacts = [];
var array2 = str.split(SPLIT_CHAR171);
if (array2 && array2.length > 0) {
for (var i = 0; i < array2.length; i++) {
var array = array2[i].split(SPLIT_CHAR172);
var ci = {};
ci.Id = parseInt(array[0]);
ci.WorkOrderId = parseInt(array[1]);
ci.Name = array[2];
ci.Email = array[3];
ci.MobilePhone = array[4];
ci.ContactPreference = parseInt(array[5]);
ci.Notes = array[6];
ci.OptOut = parseInt(array[7]) > 0;
if (array.length > 8) {
ci.OptOut_BC = parseInt(array[8]) > 0;
}
if (array.length > 9) {
ci.SurveyOptOut_BC = parseInt(array[9]) > 0;
}
if (array.length > 10)//反序列化暂不需要MobilePhoneDisplayText。后续属性需注意索引
ci.MobilePhoneDisplayText = array[10];
contacts.push(ci);
}
}
return contacts;
}
function ConvertWorkoOrderStatus(str) {
var wostatus = [];
var wos_array = str.split(SPLIT_CHAR180);
if (wos_array && wos_array.length > 0) {
for (var i = 0; i < wos_array.length; i++) {
var array = wos_array[i].split('|');
var wos = {};
wos.Id = parseInt(array[0]);
wos.Color = array[1];
wos.Name = array[2];
wos.AutoText = parseInt(array[4]) == 1 ? true : false;
wos.TechniciansAvailable = parseInt(array[3]) == 1 ? true : false;
wos.Message = array[5];
wos.StatusType = parseInt(array[6]);
wos.DefaultOnOpen = parseInt(array[7]) == 1;
if (array.length > 8) {
wos.InUse = parseInt(array[8]) == 1;
}
if (array.length > 9) {
wos.StatusCode = array[9];
}
if (array.length > 10) {
wos.FollowUpMessage = array[10];
}
if (array.length > 11) {
wos.WaitingPeriod = parseInt(array[11]);
}
if (array.length > 12) {
wos.WaitingPeriodUom = array[12];
}
if (array.length > 13) {
wos.Repeating = parseInt(array[13]);
}
wostatus.push(wos);
}
}
return wostatus;
}
function ConvertAssignedToUsers(str) {
var users = [];
var arrays = str.split(SPLIT_CHAR182);
if (arrays && arrays.length > 0) {
for (var i = 0; i < arrays.length; i++) {
var array = arrays[i].split(SPLIT_CHAR183);
var u = {};
u.IID = array[0];
u.DisplayName = array[1];
users.push(u);
}
}
return users;
}
function ConvertDepartments(str) {
var depts = [];
var arrays = str.split(SPLIT_CHAR182);
if (arrays && arrays.length > 0) {
for (var i = 0; i < arrays.length; i++) {
var array = arrays[i].split(SPLIT_CHAR183);
var dept = {};
dept.Id = parseInt(array[0]);
dept.Name = array[1];
depts.push(dept);
}
}
return depts;
}
function ConvertLocations(str) {
var locs = [];
var arrays = str.split(SPLIT_CHAR182);
if (arrays && arrays.length > 0) {
for (var i = 0; i < arrays.length; i++) {
var array = arrays[i].split(SPLIT_CHAR183);
var loc = {};
loc.ID = parseInt(array[0]);
loc.Name = array[1];
locs.push(loc);
}
}
return locs;
}
function ConvertSalespersons(str) {
var kvs = [];
var all_array = str.split(SPLIT_CHAR182);
if (all_array && all_array.length > 0) {
for (var i = 0; i < all_array.length; i++) {
var kv = ConvertStringKeyValue(all_array[i], SPLIT_CHAR183);
kvs.push(kv);
}
}
return kvs;
}
function ConvertStringKeyValues(str, split_char) {
var kvs = [];
var all_array = str.split(split_char);
if (all_array && all_array.length > 0) {
for (var i = 0; i < all_array.length; i++) {
var kv = ConvertStringKeyValue(all_array[i], SPLIT_CHAR175);
kvs.push(kv);
}
}
return kvs;
}
function ConvertStringKeyValue(str, split_char) {
var array = str.split(split_char);
var kv = {
Key: array[0],
Value: array[1]
};
return kv;
}
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_WOHASBEENDELETEDCONTACTADMINISTRATORTORESTORE', 'Work Order {0} has been deleted.Contact Administrator to restore.').replace('{0}', wonumber), alerttitle);
}
else {
showConfirm(GetTextByKey("P_WO_WOHASBEENDELETEDWOULDYOULIKETORESTOREIT", '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_HIS_FAILEDTORESTORETHISWORKORDER", '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];
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
})
.showDialogfixed();
$('#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 = [];
var tempsource = grid_dtsm.source;
for (var i = 0; i < tempsource.length; i++) {
var m = tempsource[i];
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 < tempsource.length; j++) {
var m1 = tempsource[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 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
}
}
rows.push(r);
}
grid_dtam.setData(rows);
}
var grid_dtam;
function InitGridAvailableMachines() {
grid_dtam = createGridView('#availablemachinelist');
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.multiSelect = true;
grid_dtam.columns = columns;
grid_dtam.init();
grid_dtam.onRowDblClicked = function (rowindex) {
var rowdata = grid_dtam.removeItem(rowindex);
if (rowdata != null) {
grid_dtsm.addItem(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 ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
}
}
rows.push(r);
}
grid_dtsm.setData(rows);
}
var grid_dtsm;
function InitGridSelectedMachines() {
grid_dtsm = createGridView('#selectedmachinelist');
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.multiSelect = true;
grid_dtsm.columns = columns;
grid_dtsm.init();
grid_dtsm.onRowDblClicked = function (rowindex) {
var rowdata = grid_dtsm.removeItem(rowindex);
if (rowdata) {
grid_dtam.addItem(rowdata);
}
};
}
function OnEditorAdd() {
var indexes = grid_dtam.selectedIndexes;
if (indexes.length <= 0)
return;
var array = grid_dtam.removeItems(indexes);
grid_dtsm.addItems(array);
}
function OnEditorAddAll() {
var array = grid_dtam.removeItems();
grid_dtsm.addItems(array);
}
function OnEditorRemove() {
var indexes = grid_dtsm.selectedIndexes;
if (indexes.length <= 0)
return;
var array = grid_dtsm.removeItems(indexes);
grid_dtam.addItems(array);
}
function OnEditorRemoveAll() {
var array = grid_dtsm.removeItems();
grid_dtam.addItems(array);
}
function AssignedAlertsToWorkOrder() {
if (!workOrderID)
return;
var alertids = [];
var tempsource = grid_dtsm.source;
for (var i = 0; i < tempsource.length; i++) {
var m = tempsource[i];
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********************************/
/*****************************************************************************/
//*********************************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();
if (CanViewMR) {
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
}
else
p.ShowMaintenance = true;
p.Completed = $('#selcompleted').val();
var filters = JSON.stringify(p);
filters = htmlencode(filters);
window.localStorage["WorkOrderFilters_" + CID] = filters;
}
function getTempFilters() {
p = window.localStorage["WorkOrderFilters_" + CID];
if (!p) return false;
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;
var spliterProps = JSON.parse(localStorage.getItem('spliter_props'));
if (spliterProps == null) {
spliterProps = {
collapsed: false,
widgetHeight: 300,
collapsed_right: false,
widgetWidth: 300
};
} else {
if (isNaN(spliterProps.widgetHeight) || spliterProps.widgetHeight < 100 || spliterProps.widgetHeight > 1000) {
spliterProps.widgetHeight = 300;
}
if (isNaN(spliterProps.widgetWidth) || spliterProps.widgetWidth < 100 || spliterProps.widgetWidth > 1000) {
spliterProps.widgetWidth = 300;
}
}
$(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();
InitGridSelectedAttachments();
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 () {
var list = $('#workorderlist');
var top = list.offset().top;
var height = $(window).height() - top - 10;
$('.wrapper-flex').css('height', height);
var widgets = wowidgetobj?.workorderwidgets;
if (widgets?.length > 0) {
if (widgets.find(function (w) { return w.InBottom }) != null) {
height -= 10;
if (!spliterProps.collapsed) {
height -= spliterProps.widgetHeight;
}
}
}
list.css('height', height);
grid_dt && grid_dt.resize(false, true);
//if (widget) {
// $('#workorderdetail').css('height', top + height + 6);
//}
}).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_selecteattachments').dialog(function () {
$('#statuschange_maskbg').hide();
});
$('#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();
}
$('input[placeholder=Search]').attr("placeholder", GetTextByKey("P_AM_SEARCH", "Search"));
var list = document.querySelector('#workorderlist');
var detail = document.querySelector('#workorderdetail');
detail.style.height = spliterProps.widgetHeight + 'px';
var detail_right = document.querySelector('#workorderdetail_right');
detail_right.style.width = spliterProps.widgetWidth + 'px';
var spliter = document.querySelector('#workorderspliter');
var spliter_right = document.querySelector('#workorderspliter_right');
if (spliterProps.collapsed) {
detail.style.display = 'none';
spliter.classList.add('collapsed');
}
if (spliterProps.collapsed_right) {
detail_right.style.display = 'none';
spliter_right.classList.add('collapsed');
}
spliter.addEventListener('mousedown', function (e) {
if (e.buttons !== 1 || spliterProps.collapsed) {
return;
}
var oy = e.clientY;
var oheight = spliterProps.widgetHeight;
var parent = document.body;
var top = list.offsetTop;
var windowHeight = window.innerHeight;
var move = function (e2) {
if (e2.buttons !== 1) {
parent.dispatchEvent(new MouseEvent('mouseup'));
return;
}
var y = e2.clientY - oy;
var height = oheight - y;
if (height > 100) {
spliterProps.widgetHeight = height;
detail.style.height = spliterProps.widgetHeight + 'px';
height = windowHeight - top - 10 - height - 10 - 8;
list.style.height = height + 'px';
}
};
parent.addEventListener('mousemove', move, { passive: false });
var up = function () {
grid_dt?.reload(true);
parent.removeEventListener('mousemove', move, { passive: false });
parent.removeEventListener('mouseup', up);
localStorage.setItem('spliter_props', JSON.stringify(spliterProps));
};
parent.addEventListener('mouseup', up);
});
spliter.querySelector('div').addEventListener('click', function () {
spliterProps.collapsed = !spliterProps.collapsed;
$(window).resize();
document.querySelector('#workorderdetail').style.display = spliterProps.collapsed ? 'none' : '';
if (spliterProps.collapsed) {
document.querySelector('#workorderspliter').classList.add('collapsed');
} else {
document.querySelector('#workorderspliter').classList.remove('collapsed');
}
localStorage.setItem('spliter_props', JSON.stringify(spliterProps));
});
spliter_right.addEventListener('mousedown', function (e) {
if (e.buttons !== 1 || spliterProps.collapsed_right) {
return;
}
var ox = e.clientX;
var oWidth = spliterProps.widgetWidth;
var parent = document.body;
var move = function (e2) {
if (e2.buttons !== 1) {
parent.dispatchEvent(new MouseEvent('mouseup'));
return;
}
var x = e2.clientX - ox;
var width = oWidth - x;
if (width > 200) {
spliterProps.widgetWidth = width;
detail_right.style.width = spliterProps.widgetWidth + 'px';
}
};
parent.addEventListener('mousemove', move, { passive: false });
var up = function () {
grid_dt?.reload(true);
parent.removeEventListener('mousemove', move, { passive: false });
parent.removeEventListener('mouseup', up);
localStorage.setItem('spliter_props', JSON.stringify(spliterProps));
};
parent.addEventListener('mouseup', up);
});
spliter_right.querySelector('div').addEventListener('click', function () {
spliterProps.collapsed_right = !spliterProps.collapsed_right;
$(window).resize();
document.querySelector('#workorderdetail_right').style.display = spliterProps.collapsed_right ? 'none' : '';
if (spliterProps.collapsed_right) {
document.querySelector('#workorderspliter_right').classList.add('collapsed');
} else {
document.querySelector('#workorderspliter_right').classList.remove('collapsed');
}
localStorage.setItem('spliter_props', JSON.stringify(spliterProps));
});
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);
}
async function OnExportSource1() {
grid_dt.loading = true;
try {
var formData = await fetchRequest('ExportGridData', grid_dt);
grid_dt.loading = false;
var response = await fetch('./WorkOrderMaintenance.aspx', {
method: 'POST',
body: formData
});
if (response.status !== 200 || response.body == null) {
showAlert('Network error.', 'Error');
return;
}
if (!response.headers.get('Content-Type')?.includes('application/json')) {
var message = await response.text();
showAlert(message, 'Error');
return;
}
var disposition = response.headers.get('Content-Disposition');
var filename = decodeURIComponent(disposition?.split('=')?.[1] ?? '') ?? 'source.json';
var blob = await response.blob();
var a = document.createElement('a');
a.download = filename;
var href = URL.createObjectURL(blob);
a.href = href;
a.click();
URL.revokeObjectURL(href);
} catch (e) {
showAlert(e.message, 'Error');
grid_dt.loading = false;
}
}
function OnExportSource() {
var start = performance.now();
grid_dt.export().then(function (result) {
var end = performance.now();
console.log(`compression costs ${end - start} ms.`);
var formData = new FormData();
formData.append('MethodName', 'ExportGridData');
formData.append('compressed', result.type === 'compressed' ? 1 : 0);
formData.append('data', new Blob([result.data]));
return formData;
}).then(function (form) {
return fetch('./WorkOrderMaintenance.aspx', {
method: 'POST',
body: form
});
}).then(function (response) {
if (response.status !== 200 || response.body == null) {
showAlert('Network error.', 'Error');
return;
}
if (!response.headers.get('Content-Type')?.includes('application/json')) {
response.text().then(function (message) {
showAlert(message, 'Error');
});
return;
}
response.blob().then(function (blob) {
var disposition = response.headers.get('Content-Disposition');
var filename = decodeURIComponent(disposition?.split('=')?.[1] ?? '') ?? 'source.json';
// 前端模拟下载
var a = document.createElement('a');
a.download = filename;
var href = URL.createObjectURL(blob);
a.href = href;
a.click();
URL.revokeObjectURL(href);
});
}).catch(function (e) {
showAlert(e.message, 'Error');
});
}
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();
if (CanViewMR) {
var showmaintenance = $('#chkshowmaintenance').prop("checked");
p.ShowMaintenance = showmaintenance;
}
else
p.ShowMaintenance = true;
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 = assetid > 0 ? -1 : parseInt($('#selcompleted').val());
worequest("GetWorkOrderListItem", htmlencode(JSON.stringify(p)), function (data) {
loadingWorkOrderItem = false;
if (data) {
showWorkOrderItem(data);
}
else {
removeWorkOrderItem(woid);
}
if (notificationWorkOrderQueue.length > 0) {
var tempwoid = notificationWorkOrderQueue.shift();
setTimeout(function () {
getWorkOrderItem(tempwoid);
}, 10);
}
}, function (err) {
loadingWorkOrderItem = false;
if (notificationWorkOrderQueue.length > 0) {
var tempwoid = notificationWorkOrderQueue.shift();
setTimeout(function () {
getWorkOrderItem(tempwoid);
}, 10);
}
});
}
function showWorkOrderItem(data) {
var wos = ConvertWorkOrders(data)
var r = wos[0];
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].startsWith('FI') ? r[j].replace('FI', '') : 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"] ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
}
else if (j === "AutoText") {
r[j] = { DisplayValue: r["AutoText"] ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "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.Id.Value > 0 ? (r["Billable"] ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No")) : "", Value: r.Id.Value > 0 ? (r["Billable"] ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No")) : "" };
}
}
var shown = false;
var source = grid_dt.source;
if (!source) return;
for (var i = 0; i < source.length; i++) {
var wo = source[i];
if (wo.Id.Value == r.Id.Value) {
grid_dt.setItem(i, r);
shown = true;
break;
}
}
if (!shown) {
grid_dt.addItem(r);
}
//if (grid_dt.selectedIndex >= 0)
// grid_dt.source.selectedIndexes = [grid_dt.selectedIndex];
//grid_dt && grid_dt.reload();
}
function removeWorkOrderItem(woid) {
var tempsource = grid_dt.source;
for (var i = 0; i < tempsource.length; i++) {
var wo = tempsource[i];
if (wo.Id.Value == woid) {
grid_dt.removeItem(i);
//var top = grid_dt.scrollTop;
//grid_dt.source.splice(i, 1);
//grid_dt.setData(grid_dt.source);
//grid_dt.selectedIndexes = [];
//grid_dt && grid_dt.resize();
//setTimeout(function () {
// grid_dt.scrollTop = top;
//}, 100);
return;
}
}
}
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 == "504" || data.Code == "505"//add, update, sms,
|| data.Code == "506"//contacts
|| data.Code == "511"//Inspection
|| data.Code == "512") //Estimates
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]);
}
}
}
var loadingCount = 0;
function showLoading(flag) {
if (flag) {
loadingCount++;
$("#dialogattmask").show();
}
else {
loadingCount--;
if (loadingCount === 0)
$("#dialogattmask").hide();
}
}
function hideLoading() {
loadingCount--;
if (loadingCount === 0)
$("#dialogattmask").hide();
}
</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_WORKORDERTYPE_COLON">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_OPENWORKORDERSONLY">Open Work Orders Only</option>
<option value="1" data-lgid="P_WO_COMPLETEDWORKORDERSONLY">Completed Work Orders Only</option>
<option value="-1" data-lgid="P_WO_ACTIVECOMPLETEDWORKORDERS">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">
<%if (CanOpenWO && !WOReadOnly)
{%>
<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_IPT_RESETPIVOTS">Reset Pivots</span>
<span id="spWdigets" class="sbutton iconwidget" data-lgid="P_WO_WIDGETS">Widgets</span>
<span id="spExportSource" class="sbutton iconexport" onclick="OnExportSource();">Export Source</span>
</div>
<div class="clear"></div>
<div class="wrapper-flex">
<div id="content_flex" style="flex: 1 1 auto">
<div id="workorderlist" class="fixedgrid"></div>
<div id="workorderspliter" class="workorder-spliter" style="display: none">
<div><span></span></div>
</div>
<div id="workorderdetail" class="workorder-detail" style="display: none"></div>
</div>
<div id="workorderspliter_right" class="workorder-spliter" style="flex: 0 0 auto; display: none">
<div><span></span></div>
</div>
<div id="workorderdetail_right" class="workorder-detail" style="flex: 0 0 auto; display: none"></div>
</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"><span data-lgid="P_WO_METERTYPE_COLON">Meter Type:</span><span class="span_required redasterisk">*</span></td>
<td class="cont">
<select id="dialog_metertype" tabindex="1" style="height: 22px; width: 320px;">
<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" style="width: 120px;"><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="14">[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: auto; 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>
<tr class="tr_sendmsg" style="display: none;">
<td>
<div style="font-size: 20px; margin-right: 5px; float: right;" onclick="openSelectAttachment()"><em class="spanbtn iconlink" style="font-weight: 900; font-size: 14px; cursor: pointer; padding-left: 0; padding-right: 3px; padding-top: 0;" data-title-lgid="P_WO_SELECTATTACHMENT"></em></div>
</td>
<td>
<span id="span_attachmentname" style="float: left; width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: pre;"></span>
<span id="span_attachmentdelete" onclick="onRemoveSelectedAttachment()" style="display: none;">
<em class="spanbtn icondelete" style="font-weight: 900; font-size: 14px; cursor: default; padding-left: 5px; padding-right: 3px; padding-top: 0;"></em></span>
</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 id="statuschange_maskbg" class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_selecteattachments" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_SELECTATTACHMENT">Select Attachment</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div id="div_selectattachmentlist" style="height: 320px; width: 400px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="1" />
<input type="button" onclick="onSetSelectAttachment();" value="Attach" data-lgid="P_WO_ATTACH" tabindex="1" />
<div style="clear: both;"></div>
</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: 510px;">
<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 colspan="2" 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 colspan="2">
<div id="iccontactlist" style="height: 240px; width: 440px; margin-left: 10px; margin-right: 10px;"></div>
</td>
</tr>
<tr>
<td colspan="2" data-lgid="P_WO_EMAILADDRESSESTIPS">Separate multiple manually entered email addresses with a semi-colon (;).</td>
</tr>
<tr>
<td style="text-align: right; padding-right: 5px;"><span data-lgid="P_WO_OTHEREMAILADDRESS">Other Email Address</span>
</td>
<td>
<input type="text" id="sendic_otheremailaddress" style="width: 350px;" autocomplete="off" /></td>
</tr>
<tr>
<td style="text-align: right; padding-right: 5px;"><span data-lgid="P_WO_PHONENUMBER">Phone Number</span>
</td>
<td>
<input type="text" id="sendic_phonenumber" style="width: 350px;" 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" src="AddMaintenanceRecord.aspx" 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>
<iframe id="ifdiv" style="height: 1px; width: 1px; display: none;"></iframe>
</asp:Content>