This commit is contained in:
2023-05-30 17:34:56 +08:00
parent e728c66786
commit 9da1c4cf30
194 changed files with 10680 additions and 9060 deletions

View File

@ -478,7 +478,7 @@
$('#dialog_canopenwo').prop('checked', false);
$('#dialog_contact .dialog-title span.title').text(alerttitle);
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_contact')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_contact').height()) / 3,
@ -504,7 +504,7 @@
$('#dialog_canopenwo').prop('checked', contact.CanOpenWO);
$('#dialog_contact .dialog-title span.title').text(GetTextByKey("P_CR_EDITCONTACT", 'Edit Contact'));
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_contact')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_contact').height()) / 3,
@ -803,7 +803,7 @@
searchFollower(true);
$('#addfollowerpopupdialog .dialog-title span.title').text(alerttitle);
$('#mask_bg').show();
showmaskbg(true);
$('#addfollowerpopupdialog')
.css({
'top': (document.documentElement.clientHeight - $('#addfollowerpopupdialog').height()) / 3,
@ -901,11 +901,7 @@
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none; z-index: 500"><div class="loading c-spin"></div></div>
<div>
<div id="dialogmask" class="maskbg" style="display: none; z-index: 500;">
<div class="loading_icon icon c-spin"></div>
</div>
<div class="function_title">
<%if (!CRReadOnly)
{%>
@ -1048,8 +1044,13 @@
</div>
</div>
</div>
<div id="dialogmask" class="maskbg" style="display: none;">
<div class="loading_icon icon c-spin"></div>
</div>
</div>
<div id="mask_bg" style="display: none; "><div class="loading c-spin"></div></div>
<div class="dialog" id="dialog_contact" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_CR_ADDCONTACT">Add Contact</span><em class="dialog-close"></em></div>
<div class="dialog-content">
@ -1114,7 +1115,7 @@
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: unset;" />
<input type="button" onclick="onSaveContact();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div style="clear: both;"></div>
</div>
@ -1132,7 +1133,7 @@
<div id="salespersonlist" style="width: 650px; height: 400px; margin: 10px 0 4px"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: unset;" />
<input type="button" onclick="onSetSalesperson();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div style="clear: both;"></div>
</div>

View File

@ -86,26 +86,6 @@
color: gray;
}
#mask_over_bg {
top: 32px;
left: 0;
right: 0;
bottom: 0;
position: fixed;
background: #000;
opacity: 0.2;
}
#att_mask_bg {
top: 0;
left: 0;
right: 0;
bottom: 0;
position: fixed;
background: #000;
opacity: 0.2;
}
#divcontent {
margin: 8px;
}
@ -293,7 +273,7 @@
getAttachments();
$('.function_title>.sbutton-ui').removeClass('disabled');
$('#mask_over_bg').hide();
showloading(false);
}
var IsInteger = /^[0-9]+$/;
@ -504,7 +484,7 @@
fuelid = fl.FuelID;
fuel = fl;
setEnable(fl.IsComesFromAPI);
$('#mask_over_bg').show();
showloading(true);
GetMachines(OnEdit);
}
else {
@ -585,9 +565,9 @@
//*************************Start Notes********************************//
function getFuelRecordComments() {
$('#mask_over_bg').show();
showloading(true);
fuelrequest("GetFuelRecordComments", fuelid, function (data) {
$('#mask_over_bg').hide();
showloading(false);
if (typeof (data) === "string") {
return;
}
@ -601,7 +581,7 @@
}
$("#divcomments")[0].scrollTop = $("#divcomments")[0].scrollHeight;
}, function (err) {
$('#mask_over_bg').hide();
showloading(false);
});
}
@ -626,9 +606,9 @@
var param = JSON.stringify([fuelid, comment]);
param = htmlencode(param);
$('#mask_over_bg').show();
showloading(true);
fuelrequest("AddFuelRecordComment", param, function (data) {
$('#mask_over_bg').hide();
showloading(false);
if (data !== "") {
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
return;
@ -636,7 +616,7 @@
$('#dialog_comments').val("");
getFuelRecordComments();
}, function (err) {
$('#mask_over_bg').hide();
showloading(false);
});
}
@ -755,10 +735,6 @@
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none;">
<%--<div class="loading c-spin"></div>
--%>
</div>
<div>
<div class="function_title">
<span class="sbutton iconsave sbutton-ui" onclick="OnSave(0,this);" data-lgid="P_FR_SAVE">Save</span>
@ -1000,13 +976,9 @@
</div>
</div>
</div>
<%--<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>--%>
</div>
</div>
<div id="mask_over_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div id="att_mask_bg" style="display: none;">
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>

View File

@ -129,11 +129,11 @@
}
function getSurveyTemplateInfo(copy) {
showLoading();
showloading(true);
$('#questionlist').empty();
wosurveyCtrl = undefined;
worequest("GetSurveyTemplateInfo", surveyid, function (data) {
hideLoading();
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WOS_ERROR", 'Error'));
return;
@ -157,7 +157,7 @@
}
}, function (err) {
hideLoading();
showloading(false);
});
}
@ -255,14 +255,6 @@
}
}
function showLoading() {
$("#dialogmask").show();
}
function hideLoading() {
$("#dialogmask").hide();
}
$(function () {
init();
@ -277,11 +269,7 @@
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none; z-index: 500"><div class="loading c-spin"></div></div>
<div>
<div id="dialogmask" class="maskbg" style="display: none; z-index: 500;">
<div class="loading_icon icon c-spin"></div>
</div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave(0);" data-lgid="P_UM_SAVE">Save</span>
<span class="sbutton iconsave" onclick="OnSave(1);" data-lgid="P_UM_SAVE1">Save and Exit</span>
@ -326,4 +314,5 @@
</div>
</div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
</asp:Content>

File diff suppressed because it is too large Load Diff

View File

@ -164,7 +164,7 @@
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 45, 'text-align': 'center' } },
{ name: 'Value', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'Value', css: { 'width': 300, 'text-align': 'left' } }
];
var columns = [];
@ -470,7 +470,7 @@
$('#dialog_desc').val("");
$('#dialog_wogenerator .dialog-title span.title').text(alerttitle);
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_wogenerator')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_wogenerator').height()) / 3,
@ -505,7 +505,7 @@
}
$('#dialog_wogenerator .dialog-title span.title').text(GetTextByKey("P_AM_EDITWORKORDERGENERATOR", 'Edit Work Order Generator'));
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_wogenerator')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_wogenerator').height()) / 3,
@ -776,7 +776,7 @@
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: unset;" />
<input type="button" onclick="onSaveWorkOrderGenerator();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div style="clear: both;"></div>
</div>

View File

@ -123,6 +123,11 @@
content: '\f56e';
}
.exit:before {
font-family: CalciteWebCoreIcons, FontAwesome;
content: '\f08b';
}
#div_autoacknowledgelist input[type="checkbox"] {
width: unset;
}
@ -829,7 +834,7 @@
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 45, 'text-align': 'center' } },
{ name: 'WorkOrderID', caption: GetTextByKey("P_AM_WORKORDERID", "Work Order ID"), valueIndex: 'WorkOrderID', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'WorkOrderStatus', caption: GetTextByKey("P_AM_WORKORDERSTATUS", "Work Order Status"), valueIndex: 'WorkOrderStatus', allowFilter: true, css: { 'width': 140, 'text-align': 'left' } },
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', css: { 'width': 180, 'text-align': 'left' } },
@ -1225,7 +1230,11 @@
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title">
<span data-lgid="P_ALERTSMANAGEMENT">Alerts Management</span>
<span id="spExport" class="export" style="float: right; font-size: 14px; margin-right: 10px; cursor: pointer;" onclick="OnExport();">
<span class="exit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>;float: right; font-size: 14px; margin-right: 10px; cursor: pointer;">
<label data-lgid="P_WO_EXIT" style="padding-left: 2px;">Exit</label>
</span>
<span id="spExport" class="export" style="float: right; font-size: 14px;margin-right: 10px; cursor: pointer;" onclick="OnExport();">
<label data-lgid="P_AM_EXPORT" style="padding-left: 2px;">Export</label>
</span>
<span class="autoacknowledge" style="<%=InDialog?"display:none;": ""%>; float: right; font-size: 14px; margin-right: 15px; cursor: pointer;" onclick="openOpenAutoAcknowled();">
@ -1278,7 +1287,6 @@
<span class="sbutton iconadd" id="btnassignworkorder" onclick="AssignedWorkOrder();" data-lgid="P_AM_CREATEWORKORDER">Create Work Order</span>
<span class="sbutton iconrefresh" onclick="GetAlerts();" data-lgid="P_AM_REFRESH">Refresh</span>
<span class="sbutton iconexpand" id="btnExpandAll" onclick="ExpandAll(this);" data-lgid="P_AM_EXPANDALL">Expand All</span>
<span class="sbutton iconexit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>" data-lgid="P_WO_EXIT">Exit</span>
</div>
<div class="clear"></div>
<div id="alertviewlist" style="min-width: 1280px;"></div>
@ -1328,7 +1336,7 @@
<tr>
<td class="label" data-lgid="P_AM_COMMENT_COLON">Comment:</td>
<td>
<textarea id="dialog_acknowledgmentcomment" class="inputbox" maxlength="1000" tabindex="1" style="width: 400px; height: 120px;"></textarea>
<textarea id="dialog_acknowledgmentcomment" maxlength="1000" tabindex="1" style="width: 400px; height: 120px;"></textarea>
</td>
</tr>
</table>

View File

@ -144,6 +144,9 @@
}
$(function () {
if (!canExport) {
$('#spExport').hide();
}
InitGridData();
OnRefresh();
@ -162,7 +165,7 @@
</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_AM_REFRESH">Refresh</span>
<span class="sbutton iconexport" onclick="OnExport();" data-lgid="P_AM_EXPORT">Export to Excel</span>
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_AM_EXPORT">Export to Excel</span>
</div>
<div class="clear"></div>
<div id="autoacknowledgelist"></div>

View File

@ -71,18 +71,6 @@
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}

View File

@ -47,6 +47,11 @@
text-decoration: none;
color: #2140fb;
}
.exit:before {
font-family: CalciteWebCoreIcons, FontAwesome;
content: '\f08b';
}
</style>
<script src="../js/jquery.datetimepicker.full.js"></script>
<script src="<%=GetFileUrlWithVersion("js/inputdatactr.js")%>" type="text/javascript"></script>
@ -67,7 +72,7 @@
showmaskbg(false, true);
showAlert(GetTextByKey('P_FR_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_FR_QUERY', 'Query'));
});
}
}
function enterKeydown(e) {
if (e.keyCode == 13) {
@ -359,7 +364,12 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_FUELRECORDS">Fuel Records</div>
<div class="page_title">
<span data-lgid="P_FUELRECORDS">Fuel Records</span>
<span class="exit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>; float: right; font-size: 14px; margin-right: 10px; cursor: pointer;">
<label data-lgid="P_WO_EXIT" style="padding-left: 2px;">Exit</label>
</span>
</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_FR_BEGINDATE_COLON">Begin Date:&nbsp;</span>
@ -377,7 +387,6 @@
<span class="sbutton iconedit" onclick="OnEdit();" style="<%=InDialog?"display:none;": ""%>;" data-lgid="P_FR_EDIT">Edit</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_FR_REFRESH">Refresh</span>
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>
<span class="sbutton iconexit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>;" data-lgid="P_WO_EXIT">Exit</span>
</div>
<div class="clear"></div>
<div id="recordlist"></div>

View File

@ -435,7 +435,6 @@
GetRecordesbymachineID();
}
}
$('#mask_bg').css('height', $(document).height())
},
error: function (msg) {
showAlert(msg.statusText, GetTextByKey("P_MRM_ERROR", 'Error'));

View File

@ -93,8 +93,6 @@
$('.content_main').css('min-height', $(window).height() - $('.content_main').offset().top - 4);
if ($('#listDiv').length > 0)
$('#listDiv').css('min-height', $(window).height() - $('#listDiv').offset().top - 4);
$('#mask_bg').height($(document).outerHeight(false)).width($(document).outerWidth(false));
}
$(window).resize(function () {

View File

@ -355,24 +355,24 @@
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
</div>
<div class="dialog" id="dialog_interval" style="display: none; z-index: 500;">
<div class="dialog" id="dialog_interval" style="display: none; ">
<div class="dialog-title"><span class="title" data-lgid="P_PM_ADDABSOLUTEHOURSINTERVAL">Add Absolute Hours Interval</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table class="dialog_table">
<tr>
<td class="label" data-lgid="P_PM_SERVICENAME_COLON">Service Name:</td>
<td>
<input type="text" class="inputbox intervalinput" id="dig_name" tabindex="1" maxlength="50" /></td>
<input type="text" class="intervalinput" id="dig_name" tabindex="1" maxlength="50" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_INTERVAL_COLON">Interval:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput" id="dig_interval" tabindex="2" maxlength="10" /></td>
<input type="text" class="intervalinput" id="dig_interval" tabindex="2" maxlength="10" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_NOTIFICATIONPERIOD_COLON">Notification Period:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput" id="dig_period" tabindex="3" maxlength="10" /></td>
<input type="text" class="intervalinput" id="dig_period" tabindex="3" maxlength="10" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_RECURRING_COLON">Recurring:</td>
@ -387,12 +387,12 @@
<tr>
<td class="label" data-lgid="P_PM_EXPECTEDCOST_COLON">Expected Cost:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput inp_expectedcost" id="dig_expectedcost" tabindex="5" maxlength="12" /></td>
<input type="text" class="intervalinput inp_expectedcost" id="dig_expectedcost" tabindex="5" maxlength="12" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_PRIORITY_COLON">Priority:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput inp_priority" id="dig_priority" tabindex="6" maxlength="5" /></td>
<input type="text" class="intervalinput inp_priority" id="dig_priority" tabindex="6" maxlength="5" /></td>
</tr>
</table>
</div>

View File

@ -407,24 +407,24 @@
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
</div>
<div class="dialog" id="dialog_interval" style="display: none; z-index: 500;">
<div class="dialog" id="dialog_interval" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_PM_ADDINTERVAL">Add Interval</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table class="dialog_table">
<tr>
<td class="label" data-lgid="P_PM_SERVICENAME_COLON">Service Name:</td>
<td>
<input type="text" class="inputbox intervalinput" id="dig_name" tabindex="1" maxlength="50" autocomplete="off" /></td>
<input type="text" class="intervalinput" id="dig_name" tabindex="1" maxlength="50" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_INTERVAL_COLON">Interval:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput" id="dig_interval" tabindex="2" maxlength="10" autocomplete="off" /></td>
<input type="text" class="intervalinput" id="dig_interval" tabindex="2" maxlength="10" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_NOTIFICATIONPERIOD_COLON">Notification Period:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput" id="dig_period" tabindex="3" maxlength="10" autocomplete="off" /></td>
<input type="text" class="intervalinput" id="dig_period" tabindex="3" maxlength="10" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_RECURRING_COLON">Recurring:</td>
@ -439,12 +439,12 @@
<tr>
<td class="label" data-lgid="P_PM_EXPECTEDCOST_COLON">Expected Cost:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput inp_expectedcost" id="dig_expectedcost" tabindex="5" maxlength="12" autocomplete="off" /></td>
<input type="text" class="intervalinput inp_expectedcost" id="dig_expectedcost" tabindex="5" maxlength="12" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_PM_PRIORITY_COLON">Priority:<b class="red">*</b></td>
<td>
<input type="text" class="inputbox intervalinput inp_priority" id="dig_priority" tabindex="7" maxlength="5" autocomplete="off" /></td>
<input type="text" class="intervalinput inp_priority" id="dig_priority" tabindex="7" maxlength="5" autocomplete="off" /></td>
</tr>
</table>
</div>

View File

@ -496,7 +496,7 @@
</div>
</div>
<div id="mask_bg" style="display: none; z-index: 500">
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>

View File

@ -186,14 +186,6 @@
GetWorkOrderSurveyResult();
}
function showLoading() {
$("#dialogmask").show();
}
function hideLoading() {
$("#dialogmask").hide();
}
$(function () {
vm = new Vue({
el: '#divresult',
@ -224,11 +216,7 @@
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none; z-index: 500"><div class="loading c-spin"></div></div>
<div>
<div id="dialogmask" class="maskbg" style="display: none; z-index: 500;">
<div class="loading_icon icon c-spin"></div>
</div>
<div class="function_title">
<span class="sbutton icondelete" onclick="OnExit(0);" style="margin-left: 756px; font-size: 16px;"></span>
</div>
@ -256,4 +244,5 @@
</div>
</div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
</asp:Content>

View File

@ -71,18 +71,6 @@
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}
@ -250,7 +238,7 @@
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 45, 'text-align': 'center' } },
{ name: 'WorkOrderNumber', caption: GetTextByKey("P_WO_WORKORDERNUMBER", "Work Order Number"), valueIndex: 'WorkOrderNumber', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'SurveyName', caption: GetTextByKey("P_WOS_SURVEYNAME", "Survey Name"), valueIndex: 'SurveyName', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Status', caption: GetTextByKey("P_WO_STATUS", "Status"), valueIndex: 'Status', allowFilter: true, css: { 'width': 160, 'text-align': 'left' } },

View File

@ -71,18 +71,6 @@
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}

View File

@ -71,18 +71,6 @@
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}

View File

@ -71,18 +71,6 @@
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}
@ -725,7 +713,7 @@
}
$(document.body).css('overflow', 'hidden');
getContacts();
showmaskbg(true);
$('#sendemailpopupmask').css('height', $('#dialog_workorder').height());
$('#sendemailpopupmask').css('min-width', $('#divcontent').width());
$('#sendemailpopupmask').show();
@ -737,6 +725,7 @@
}
function hideSendEmailPopup() {
showmaskbg(false);
$('#sendemailpopupmask').hide();
$('#sendemailpopupdialog').hide();
$(document.body).css('overflow', '');

View File

@ -72,18 +72,6 @@
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}

View File

@ -1,6 +1,7 @@
<%@ 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;
@ -31,31 +32,6 @@
height: 60px;
}
.dialog-content table td.label {
width: unset;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: middle;
}
.dialog-content table td input,
.dialog-content table td textarea {
width: 300px;
border: 1px solid #a9a9a9;
height: 18px;
padding: 1px;
}
.dialog-content table td select {
width: 403px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
#dialogdatatb td {
padding-top: 30px;
}
@ -130,6 +106,66 @@
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" />
@ -146,6 +182,9 @@
<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 = [];
@ -157,17 +196,42 @@
var assetid = "<%=AssetID %>";
var gridLayoutID = "WorkOrder";
var IsCustomerRecordAllow = <%=IsCustomerRecordAllow ?"true":"false"%>;
var HasCustomerRecord = <%=HasCustomerRecord ?"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) {
@ -176,6 +240,13 @@
});
}
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);
@ -195,6 +266,17 @@
});
}
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) {
@ -893,12 +975,14 @@
var filters = JSON.stringify(p);
filters = htmlencode(filters);
setCookie("WorkOrderFilters_" + CID, 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)));
@ -925,12 +1009,15 @@
//*********************************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();
@ -938,8 +1025,21 @@
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();
@ -1241,6 +1341,25 @@
}
}
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);
@ -1255,6 +1374,8 @@
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)
@ -1266,12 +1387,15 @@
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px; min-width: 1600px;">
<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; margin-right: 15px; cursor: pointer;" onclick="openWOStatus();">
<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>
@ -1300,20 +1424,24 @@
<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 iconexit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>" data-lgid="P_WO_EXIT">Exit</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 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>
@ -1488,6 +1616,43 @@
</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>
@ -1505,5 +1670,10 @@
<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>

View File

@ -14,14 +14,18 @@ public partial class Maintenance_WorkOrderMaintenance : WorkOrderBasePage
public bool InDialog = false;
public bool AllowWorkOrderConfiguration = false;
public bool IsCustomerRecordAllow = false;
public bool HasCustomerRecord = false;
public bool AllowCustomer = false;
public bool AllowReopenWorkorders = false;
public bool AllowWorkOrderSurveys = false;
protected string MSGWebSocketURL = "";
public string NowDate = "";
public bool WOReadOnly = false;
public bool CRReadOnly = false;
public bool COMMReadOnly = false;
public bool AllowCommunicate = false;
public bool AllowInspection = false;
public bool AllowReassignWorkorders = false;
public bool AllowDeleteAtta = false;
protected string CID = "";
protected void Page_Load(object sender, EventArgs e)
{
@ -50,13 +54,19 @@ public partial class Maintenance_WorkOrderMaintenance : WorkOrderBasePage
IsCustomerRecordAllow = SystemParams.HasLicense("CustomerRecord");
bool crpermission = CheckRight(SystemParams.CompanyID, Feature.CUSTOMER_RECORD);
HasCustomerRecord = IsCustomerRecordAllow && crpermission;
AllowCustomer = IsCustomerRecordAllow && crpermission;
AllowReopenWorkorders = !WOReadOnly && CheckRight(SystemParams.CompanyID, Feature.REOPENWORKORDERS);
AllowWorkOrderSurveys = !WOReadOnly && CheckRight(SystemParams.CompanyID, Feature.WORKORDERSURVEYS);
CRReadOnly = WOReadOnly || CheckReadonly(SystemParams.CompanyID, Feature.CUSTOMER_RECORD);
COMMReadOnly = WOReadOnly || CheckReadonly(SystemParams.CompanyID, Feature.COMMUNICATEWITHCUSTOMER);
AllowCommunicate = CheckRight(SystemParams.CompanyID, Feature.COMMUNICATEWITHCUSTOMER);
license = SystemParams.HasLicense("Inspection");
AllowInspection = license && CheckRight(SystemParams.CompanyID, Feature.INSPECTION_REPORTS);
AllowReassignWorkorders = !WOReadOnly && CheckRight(SystemParams.CompanyID, Feature.REASSIGN_WORKORDERS);
AllowDeleteAtta = !WOReadOnly && CheckRight(SystemParams.CompanyID, Feature.WORKORDERDELETEATTACHMENT);
AllowCommunicate = IsCustomerRecordAllow && AllowCommunicate;
AssetID = Request.Params["mid"] ?? "";

View File

@ -386,7 +386,7 @@
$('#dialog_fuvariables').val('');
$('#dialog_status .dialog-title span.title').text(alerttitle);
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_status')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_status').height()) / 3,
@ -426,7 +426,7 @@
$('#dialog_fuvariables').val('');
$('#dialog_status .dialog-title span.title').text(GetTextByKey("P_WO_EDITSTATUS", 'Edit Status'));
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_status')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_status').height()) / 3,
@ -893,9 +893,6 @@
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="mask_bg" style="display: none; z-index: 500">
<div class="loading c-spin"></div>
</div>
<div id="div_container">
<ul id="ul_container" class="tab_header">
<li data-href="tab_statussetting" onclick="reshowgrid();" class="selected" data-lgid="P_WO_STATUSSETTING">Status Setting</li>
@ -1086,6 +1083,9 @@
</div>
</div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_status" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_ADDSTATUS">Add Status</span><em class="dialog-close"></em></div>
@ -1191,7 +1191,7 @@
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: unset;" />
<input type="button" onclick="onSaveStatus();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div style="clear: both;"></div>
</div>

View File

@ -2,71 +2,92 @@
cursor: default !important;
color: #ccc;
}
a.disabled:hover {
text-decoration: none;
}
a.disabled:hover {
text-decoration: none;
}
.table_intervals {
width: 100%;
color: #666;
border-collapse: collapse;
table-layout:fixed;
}
.table_intervals thead tr {
background: #f9f9f9;
/*font-weight: bold;*/
}
.table_intervals thead tr:hover { background: #f9f9f9; }
.table_intervals td input {
width: 60px;
border: 1px solid #fff;
}
.table_intervals td input.focused,
.table_intervals td input:hover {
border-color: #666;
}
.table_intervals td input:disabled,
.table_intervals td input:disabled:hover,
.table_intervals tr:hover td input:disabled {
background: #ddd;
color: #ddd;
border-color: #ddd;
}
.table_intervals .editing { display: none; }
.table_intervals .editing input {
width: auto;
cursor: pointer;
background: rgb(249, 189, 117);
margin-left: 6px;
border: none;
padding: 5px 14px;
}
.table_intervals .editing input:hover { background: #d7690E; }
.table_intervals td textarea {
border: 1px solid #fff;
table-layout: fixed;
}
.table_intervals td textarea.focused,
.table_intervals td textarea:hover {
border-color: #666;
}
.table_intervals td textarea:disabled,
.table_intervals td textarea:disabled:hover,
.table_intervals tr:textarea td input:disabled {
background: #ddd;
color: #ddd;
border-color: #ddd;
}
.table_intervals .editing textarea {
width: auto;
cursor: pointer;
background: rgb(249, 189, 117);
margin-left: 6px;
border: none;
padding: 5px 14px;
}
.table_intervals .editing textarea:hover { background: #d7690E; }
.table_intervals thead tr {
background: #f9f9f9;
/*font-weight: bold;*/
}
.table_intervals thead tr:hover {
background: #f9f9f9;
}
.table_intervals td input {
width: 60px;
border: 1px solid #fff;
}
.table_intervals td input.focused,
.table_intervals td input:hover {
border-color: #666;
}
.table_intervals td input:disabled,
.table_intervals td input:disabled:hover,
.table_intervals tr:hover td input:disabled {
background: #ddd;
color: #ddd;
border-color: #ddd;
}
.table_intervals .editing {
display: none;
}
.table_intervals .editing input {
width: auto;
cursor: pointer;
background: rgb(249, 189, 117);
margin-left: 6px;
border: none;
padding: 5px 14px;
}
.table_intervals .editing input:hover {
background: #d7690E;
}
.table_intervals td textarea {
border: 1px solid #fff;
}
.table_intervals td textarea.focused,
.table_intervals td textarea:hover {
border-color: #666;
}
.table_intervals td textarea:disabled,
.table_intervals td textarea:disabled:hover,
.table_intervals tr:textarea td input:disabled {
background: #ddd;
color: #ddd;
border-color: #ddd;
}
.table_intervals .editing textarea {
width: auto;
cursor: pointer;
background: rgb(249, 189, 117);
margin-left: 6px;
border: none;
padding: 5px 14px;
}
.table_intervals .editing textarea:hover {
background: #d7690E;
}
@ -75,39 +96,526 @@ a.disabled:hover {
padding: 0;
font-weight: normal;
}
.maintenance .td_funcs:last-child {
padding-right: 8px;
}
.maintenance .td_funcs a {
white-space: nowrap;
float: left;
cursor: pointer;
margin-left: 20px;
}
.maintenance .td_funcs a:first-child {
margin-left: 2px;
}
.maintenance .td_funcs:last-child {
padding-right: 8px;
}
.maintenance .td_funcs a {
white-space: nowrap;
float: left;
cursor: pointer;
margin-left: 20px;
}
.maintenance .td_funcs a:first-child {
margin-left: 2px;
}
.maintenance .item_name {
margin-left: 24px;
width: 340px;
}
.maintenance .item_type {
width: 100px;
}
.maintenance .item_desc {
max-width: 320px;
}
.maintenance .item_desc,
.maintenance .item_type,
.maintenance .item_name {
overflow: hidden;
text-overflow: ellipsis;
}
.servicedescription {
height:120px;
width:250px;
}
.intervalinput {
width:250px;
height: 120px;
width: 250px;
}
.intervalinput {
width: 250px;
}
.edit-content table {
border-collapse: collapse;
width: 100%;
}
.edit-content table td.label {
width: 200px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: middle;
}
.edit-content table td.cont {
width: 250px;
}
.edit-content table td input[type="text"], .edit-content table td textarea {
border: 1px solid #a9a9a9;
width: 240px;
height: 28px;
text-indent: 3px;
box-sizing: border-box;
border-radius: 2px;
}
.edit-content table td input[type="checkbox"] {
border: none;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.tab_estimates table td.label,
.tab_invoices table td.label {
width: 167px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: middle;
}
.tab_estimates table td input[type="text"], .tab_estimates table td textarea,
.tab_invoices table td input[type="text"], .tab_invoices table td textarea {
border: 1px solid #a9a9a9;
width: 150px;
height: 28px;
text-indent: 3px;
box-sizing: border-box;
border-radius: 2px;
}
.estimates_div,
.estimates_table {
min-width: 1300px;
}
.subtitle {
margin: 20px 40px 5px 0px;
font-size: 16px;
color: gray;
}
.subtitle span {
margin-left: 10px;
}
.subtitle hr {
background-color: #d8d8d8;
border: none;
height: 1px;
}
#host_main {
overflow: hidden;
}
.tab_segments {
position: relative;
}
.tab_segments table td.label {
width: 130px;
vertical-align: top;
text-align: right;
}
.tab_segments table td input,
.tab_segments table td textarea {
border: 1px solid #a9a9a9;
width: 320px;
height: 28px;
text-indent: 3px;
box-sizing: border-box;
border-radius: 2px;
}
.tab_segments table td select {
width: 324px;
}
.tab_segments table td input[type="checkbox"] {
border: none;
width: unset;
height: unset;
}
.tab_segments table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.segments_table {
margin-top: 10px;
line-height: 25px;
min-width: 1050px;
}
.workorder_table {
table-layout: fixed;
line-height: 30px;
}
.dialog-content table td.label {
width: 120px;
vertical-align: middle;
}
.dialog-content table td input[type="text"], .dialog-content table td textarea {
width: 320px;
height: 24px;
box-sizing: border-box;
border-radius: 2px;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 170px;
text-align: right;
padding-right: 10px;
line-height: 28px;
height: 24px;
vertical-align: top;
}
.divattp {
width: 300px;
margin-right: 10px;
float: left;
position: relative;
}
.divatt {
width: 300px;
height: 300px;
margin-top: 5px;
margin-bottom: 5px;
margin-right: 10px;
cursor: pointer;
border: 1px solid #b0b0b0;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.4);
text-align: center;
float: left;
position: relative;
}
.picture {
max-height: 100%;
max-width: 100%;
margin: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.download {
line-height: 300px;
font-size: 200px;
margin: 0 auto;
font-family: 'Fontawesome';
color: silver;
}
.download::before {
content: '\f15c';
}
.wolist_download {
font-size: 60px;
margin: 0 auto;
font-family: 'Fontawesome';
color: silver;
}
.wolist_download::before {
content: '\f15c';
}
.file-word::before {
content: '\f1c2';
}
.file-excel::before {
content: '\f1c3';
}
.file-ppt::before {
content: '\f1c4';
}
.file-pdf::before {
content: '\f1c1';
}
.file-video::before {
content: '\f1c8';
}
.file-zip::before {
content: '\f1c6';
}
.file-msg::before {
content: '\f0e0';
}
.delete {
position: absolute;
vertical-align: top;
font-size: 20px;
font-family: 'Fontawesome';
color: rgb(123,28,33);
right: 8px;
}
.delete::before {
content: '\f00d';
}
.attadownload {
position: absolute;
vertical-align: top;
font-size: 16px;
font-family: 'Fontawesome';
color: rgb(123,28,33);
right: 5px;
bottom: 5px;
}
.attadownload::before {
content: '\f019';
}
.attaprint {
position: absolute;
vertical-align: top;
font-size: 16px;
font-family: 'Fontawesome';
color: rgb(123,28,33);
right: 30px;
bottom: 5px;
}
.attaprint::before {
content: '\f02f';
}
.attaedit {
font-size: 14px;
font-family: 'Fontawesome';
color: rgb(123,28,33);
padding: 3px;
}
.attaedit::before {
content: '\f044';
}
.attasave {
font-size: 18px;
font-family: 'Fontawesome';
color: rgb(123,28,33);
margin-left: 3px;
}
.attasave::before {
content: '\f00c';
}
.dialog .dialog-func input {
width: unset;
}
.noinspection {
color: #444;
height: 30px;
line-height: 30px;
margin-top: 8px;
padding-left: 10px;
padding-right: 10px;
font-size: 20px;
font-style: italic;
}
.dropdown {
width: 240px;
}
.dropdown .dropdown-wrapper {
border-color: #a9a9a9;
}
.dropdown .dropdown-wrapper > .dropdown-header {
min-height: 26px;
}
.dropdown .dropdown-wrapper > .dropdown-header > .dropdown-text {
line-height: 26px;
}
.subtitle .dropdown .dropdown-wrapper > .dropdown-header {
min-height: 24px;
}
.subtitle .dropdown .dropdown-wrapper > .dropdown-header > .dropdown-text {
line-height: 22px;
height: 22px;
min-height: 22px;
}
.maintenance {
table-layout: fixed;
border-bottom: none;
width: auto;
min-width: 100%;
}
.maintenance tr {
border-bottom: 1px solid #e6e6e6;
}
.main_table .td_intervals {
padding: 0 0 0 60px;
}
.main_table .tr_intervals {
border-bottom: none;
}
.main_table .tr_intervals:hover {
background: none;
}
.icon {
float: left;
font-style: normal;
width: 20px;
font-size: 11px;
height: 16px;
line-height: 16px;
}
.expand:before {
content: '\e608';
}
.collapse:before {
content: '\e607';
}
.dialog_table {
width: 100%;
}
.dialog_table tr {
height: 40px;
}
.item_name {
width: unset;
font-size: 16px;
}
.wolist_picture {
width: 60px;
height: 60px;
margin: 0 auto;
}
.wolist_icon {
font-size: 14px;
font-family: 'Fontawesome';
color: rgb(123,28,33);
margin-left: 20px;
cursor: pointer;
}
.wolist_delete::before {
content: '\f00d';
}
.wolist_attadownload::before {
content: '\f019';
}
.wolist_attaprint::before {
content: '\f02f';
}
.divattp input {
width: 60px;
border: 1px solid #fff;
}
.divattp input.focused,
.divattp input:hover {
border-color: #666;
}
.divattp input:disabled,
.divattp input:disabled:hover,
.divattp td input:disabled {
background: #ddd;
color: #ddd;
border-color: #ddd;
}
.inp_name {
height: 24px;
}
.loading_icon {
font-family: CalciteWebCoreIcons;
cursor: default;
left: 50%;
top: 48%;
}
.lable_attuploadname {
color: white;
max-height: 800px;
text-align: center;
line-height: 40px;
font-size: 16px;
position: absolute;
left: 50%;
top: 50%;
margin: -50px 0 0 -35px;
}
/*override*/
.ui-tooltip-content {
white-space: nowrap !important;
/*min-width: 160px;*/
}
#mask_bg, #dialogattmask, .dialog {
z-index: 1000;
}

View File

@ -28,7 +28,7 @@ $(function () {
grid_dtassets.setData(grid_dtassets.innerSource.concat(items));
if (ids.length > 0)
assignAssets(ids);
$('#mask_bg').hide();
showmaskbg(false);
};
});
@ -63,7 +63,7 @@ function InitGridSelectedMachines() {
// checkbox
name: 'check',
key: 'selected',
width: 30,
width: 45,
align: 'center',
sortable: false,
allcheck: true,
@ -152,7 +152,6 @@ function OnAssetAdd() {
return s.Values.ID;
});
dialogAUAssets.showSelector();
$('#mask_bg').css('height', '100%');
}
function OnMachineDelete() {
@ -264,7 +263,7 @@ function onOpenSalesperson() {
$('#sp_searchinputtxt').val('');
GetSalespersons();
$('#dialog_salesperson .dialog-title span.title').text(alerttitle);
$('#mask_bg').show();
showmaskbg(true);
$('#dialog_salesperson')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_salesperson').height()) / 3,

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,6 @@ function OnMachineAdd() {
return s.Values.ID;
});
dialogAssets.showSelector();
$('#mask_bg').css('height', '100%');
}
var _selectedMachines = [];
@ -196,7 +195,7 @@ function InitGridSelectedMachines() {
// checkbox
name: 'check',
key: 'selected',
width: 30,
width: 45,
align: 'center',
sortable: false,
allcheck: true,

View File

@ -16,20 +16,20 @@ function onSaveAttachment(files) {
fileupload_errors = "";
if (!fuelid) {
OnSave(0, this, function () {
$('#att_mask_bg').show();
showloading(true);
if (filesinuploading.length > 0) {
for (var i = 0; i < files.length; i++)
filesinuploading.push(fuelid, files[i]);
}
else {
filesinuploading = files;
filesinuploading = files;
DoUploadAttachments(fuelid);
}
});
return;
}
else {
$('#att_mask_bg').show();
showloading(true);
if (filesinuploading.length > 0) {
for (var i = 0; i < files.length; i++)
filesinuploading.push(files[i]);
@ -55,7 +55,7 @@ function DoUploadAttachments(fid) {
getAttachments();
if (fileupload_errors !== "")
showAlert(fileupload_errors, GetTextByKey("P_WO_XXXXX", 'Upload failed'));
$('#att_mask_bg').hide();
showloading(false);
return;
}
var file = filesinuploading[uploadingindex];

View File

@ -193,7 +193,7 @@ function InitGridData() {
|| item.TextMessageStatus == 412)//Landline
return '#FFC107';
if (!item.CommunicationAcknowledged)
return '#1E88E5';
return '#79B6FF';
if (!item.EstimateAcknowledged) {
if (item.ApprovedEstimates > 0)
return '#07FF93';
@ -202,13 +202,28 @@ function InitGridData() {
}
}
};
var styleFilter = function (item) {
if (item.Id.Value > 0 && IsAdvisor) {
if (item.TextMessageStatus == 0//Undelivered
|| item.TextMessageStatus == 9//Failed
|| item.TextMessageStatus == 10//Opt-Out
|| item.TextMessageStatus == 412//Landline
|| !item.CommunicationAcknowledged
|| (!item.EstimateAcknowledged && (item.ApprovedEstimates > 0 || item.RejectedEstimates > 0))
)
return { "font-weight": "bold" };
}
return {};
}
if (col.name !== 'Edit' && col.name !== "Print" && col.name !== "Delete" && col.name !== "AssetAlert")
col.styleFilter = styleFilter;
if (!IsCustomerRecordAllow && (col.name === "Customer")) {
continue;
}
if (!AllowWorkOrderSurveys && (col.name === "Surveys")) {
continue;
}
if (!HasCustomerRecord && (col.name === "Advisor" || col.name === "CustomerCode" || col.name === "Contacts"
if (!AllowCustomer && (col.name === "Advisor" || col.name === "CustomerCode" || col.name === "Contacts"
|| col.name === "LastCommunication" || col.name === "LastCommunicationDate" || col.name === "LastCommunicationBy"
|| col.name === "AlternateStatus" || col.name === "EstimateStatus" || col.name === "Surveys"
|| col.name === "PublishedEstimates" || col.name === "ApprovedEstimates" || col.name === "RejectedEstimates" || col.name === "PendingEstimates"
@ -292,8 +307,8 @@ function InitGridData() {
return selector;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "WorkOrderType") {
@ -333,8 +348,8 @@ function InitGridData() {
updateWorkOrder(item);
});
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "Advisor") {
@ -376,8 +391,8 @@ function InitGridData() {
}
});
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "AssignedToName") {
@ -463,8 +478,8 @@ function InitGridData() {
});
return selector;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "DueDate") {
@ -502,8 +517,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "CompleteDate") {
@ -537,8 +552,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "NextFollowUpDate") {
@ -552,7 +567,7 @@ function InitGridData() {
var color = !item.Completed && item.NextFollowUpDate.Value && new Date(item.NextFollowUpDate.Value) < new Date(currentdate) ? 'red' : null;
return $('<span class="margin-input-span status-cell"></span>').css({
'background-color': color,
'color': 'white'
//'color': 'white'
}).text(item.NextFollowUpDateStr);
};
col.editFilter = function (item) {
@ -560,7 +575,7 @@ function InitGridData() {
var color = !item.Completed && item.NextFollowUpDate.Value && new Date(item.NextFollowUpDate.Value) < new Date(currentdate) ? 'red' : null;
return $('<span class="margin-input-span status-cell"></span>').css({
'background-color': color,
'color': 'white'
//'color': 'white'
}).text(item.NextFollowUpDateStr);
}
@ -596,8 +611,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "Description") {
@ -647,9 +662,9 @@ function InitGridData() {
}
}
else if (col.name === 'AssetName') {
col.styleFilter = function () {
return { 'white-space': 'pre-line', 'line-height': '20px' };
};
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { 'white-space': 'pre-line', 'line-height': '20px' });
}
}
else if (col.name === 'InspectionCount') {
col.styleFilter = function (item) {
@ -826,12 +841,12 @@ function InitGridData() {
return tb;
}
};
col.styleFilter = function () {
return {
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), {
'margin-top': '3px',
'margin-bottom': '0px',
};
}
});
};
}
else if (col.name === "PartsExpectedDate") {
col.allowHtml = true;
@ -868,8 +883,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "LastLaborDate") {
@ -907,8 +922,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "InspectionRequired") {
@ -933,8 +948,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%" };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%" });
}
}
else if (col.name === "AutoText") {
@ -959,8 +974,8 @@ function InitGridData() {
}
return ipt;
}
col.styleFilter = function () {
return { "width": "100%" };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%" });
}
}
else if (col.name === "Department") {
@ -1049,8 +1064,8 @@ function InitGridData() {
});
return selector;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "Location") {
@ -1139,8 +1154,8 @@ function InitGridData() {
});
return selector;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "SalespersonName") {
@ -1210,8 +1225,8 @@ function InitGridData() {
});
return selector;
}
col.styleFilter = function () {
return { "width": "100%", 'padding': 0 };
col.styleFilter = function (item) {
return Object.assign({}, styleFilter(item), { "width": "100%", 'padding': 0 });
}
}
else if (col.name === "LastCommunication") {
@ -1276,7 +1291,10 @@ function InitGridData() {
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
if (rowdata && rowdata.Values.Id.Value > 0) {
if (!wowidgetobj)
wowidgetobj = new WorkOrderWidget();
wowidgetobj.changeWorkOrder(rowdata.Values);
}
}

View File

@ -77,7 +77,6 @@ function resetComments() {
internal.text = '';
internal.load();
}
}
@ -119,168 +118,6 @@ function getCommunications(reset) {
});
}
function showCommunication(txt, isfirst) {
var commoentctrl = $("#divcommunications");
var div = $("<div class='txtdiv'></div>").appendTo(commoentctrl);
if (isfirst)
div.css("margin-top", 0);
var name = "";
if (txt.IsReply) {
for (var i = 0; i < customercontacts.length; i++) {
var contact = customercontacts[i];
if (isEmail(txt.Sender)) {
if (contact.Email === txt.Sender) {
name = contact.Name;
break;
}
}
else {
if (contact.MobilePhone === txt.Sender) {
name = contact.Name;
break;
}
}
}
}
if (name !== "") {
$("<div style='font-weight:bold;'></div>").text(name).appendTo(div);
}
var sendto = "";
if (!txt.IsReply && txt.OriPhoneNumbers && txt.OriPhoneNumbers.length > 0) {
for (var i = 0; i < txt.OriPhoneNumbers.length; i++) {
var oriph = txt.OriPhoneNumbers[i];
if (customercontacts && customercontacts.length > 0) {
var cname = "";
for (var j = 0; j < customercontacts.length; j++) {
var contact = customercontacts[j];
if (isEmail(oriph)) {
if (contact.Email === oriph) {
cname = contact.Email + " - " + contact.Name + "\r\n";
break;
}
}
else {
if (contact.MobilePhone === oriph) {
cname = contact.MobilePhone + " - " + contact.Name + "\r\n";
break;
}
}
}
if (cname === "") {
for (var j = 0; j < followers.length; j++) {
var follower = followers[j];
if (isEmail(oriph)) {
if (follower.Email === oriph) {
cname = follower.Email + " - " + follower.Name + "\r\n";
break;
}
}
else {
if (follower.MobilePhone === oriph) {
cname = follower.MobilePhone + " - " + follower.Name + "\r\n";
break;
}
}
}
}
if (cname === "")
sendto += oriph + "\r\n";
else
sendto += cname;
}
else {
sendto += oriph + "\r\n";
}
}
}
if (sendto !== "")
sendto = GetTextByKey("P_WO_SENTTO_COLON", "Send To :") + "\r\n" + sendto;
$("<div class='txttime'></div>").text(((txt.IsReply && $.trim(txt.FormatSender) !== "") ? txt.FormatSender : txt.Sender) + " - " + txt.TimeStr).attr('title', txt.IsReply ? "" : sendto).appendTo(div);
var contentctrl = $("<div></div>").appendTo(div);
if (txt.Message.toLowerCase().indexOf("http://") >= 0 || txt.Message.toLowerCase().indexOf("https://") >= 0) {
contentctrl.html(formatUrl(txt.Message));
}
else {
contentctrl.text(txt.Message);
}
if (txt.IsReply)
contentctrl.addClass("txtother");
else {
contentctrl.addClass("txtself");
var status = getMsgStatus(txt);
if (status.Status != -100) {
var statustext = "";
if (status.Status == 0) {
statustext = GetTextByKey("P_WO_XXXXXX", "Pending");
contentctrl.css("background-color", "#FFC107");
}
else if (status.Status == 1) {
statustext = GetTextByKey("P_WO_XXXXXX", "Sent");
}
else if (status.Status == 9) {
statustext = GetTextByKey("P_WO_XXXXXX", "Failed");
contentctrl.css("background-color", "#FFC107");
}
else if (status.Status == 10) {
statustext = GetTextByKey("P_WO_XXXXXX", "Opt-Out");
contentctrl.css("background-color", "#FFC107");
}
else if (status.Status == 412) {
statustext = GetTextByKey("P_WO_XXXXXX", "Landline");
contentctrl.css("background-color", "#FFC107");
}
else {
statustext = GetTextByKey("P_WO_XXXXXX", "Undelivered");
contentctrl.css("background-color", "#FFC107");
}
var divstatus = $("<div style='text-align:right;margin-top:3px;font-weight:bold;margin-right:-12px;font-size:10px;'>Failed</div>").text(statustext);
if (status.Status == -10)
divstatus.attr('title', status.StatusMsg)
}
contentctrl.append(divstatus);
div.css("text-align", "right");
}
}
function getMsgStatus(txt) {
var status = -100;//没有状态,页面上不显示
var ls = [];
var statusmsg = "";
if (!txt.StatusIncorrect && txt.Participator != null && txt.Participator.length > 0) {
for (var i = 0; i < txt.Participator.length; i++) {
var p = txt.Participator[i];
if (!isEmail(p.CustomerNumber)) {
if (ls.indexOf(p.Status) < 0)
ls.push(p.Status);
if (statusmsg == "")
statusmsg = p.CustomerNumber + ": ";
else
statusmsg += "\r\n" + p.CustomerNumber + ": ";
if (p.Status == 0) {
statusmsg += GetTextByKey("P_WO_XXXXXX", "Undelivered");
}
else if (p.Status == 1) {
statusmsg += GetTextByKey("P_WO_XXXXXX", "Sent");
}
else if (p.Status == 9) {
statusmsg += GetTextByKey("P_WO_XXXXXX", "Failed");
}
}
}
}
if (ls.length == 1)
status = ls[0];
else if (ls.length > 1)
status = -10;//多种状态
return { Status: status, StatusMsg: statusmsg };
}
function addWorkOrderCommunication() {
var pmemails = customer?.contacts;
if (pmemails == null || pmemails.length === 0) {
@ -324,36 +161,4 @@ function resetCommunications() {
customer.text = '';
customer.load();
}
}
function setPhoneNumber() {
if (customercontacts) {
var names = "";
for (var i = 0; i < customercontacts.length; i++) {
var c = customercontacts[i];
if (c.OptOut || c.OptOut_BC) continue;
var mp = $.trim(c.MobilePhone);
var email = $.trim(c.Email);
if ((c.ContactPreference == "0" && (checkPhoneNumber(mp))
|| (c.ContactPreference == "1" && isEmail(email)))) {
if (names == "")
names = c.Name;
else
names += ";" + c.Name;
}
}
if (typeof customer !== 'undefined') {
customer.contacts = customercontacts;
}
$('#dialog_est_phonenum').val(names);
$('#dialog_invoice_phonenum').val(names);
}
else {
if (typeof customer !== 'undefined') {
customer.contacts = null;
}
$('#dialog_est_phonenum').val("");
$('#dialog_invoice_phonenum').val('');
}
}

View File

@ -1,720 +0,0 @@

function showAllAlerts(alerts) {
if (alerts.DTCAlerts && alerts.DTCAlerts.length > 0) {
_DTCAlerts = alerts.DTCAlerts;
$("#divdtcalerts").show();
showAlerts(_DTCAlerts, grid_dtcalertdt);
}
else {
_DTCAlerts = [];
showAlerts(_DTCAlerts, grid_dtcalertdt);
}
if (alerts.PMAlerts && alerts.PMAlerts.length > 0) {
_PMAAlerts = alerts.PMAlerts;
//$("#divpmaalerts").show();
showAlerts(_PMAAlerts, grid_pmaalertdt);
$('#dialog_expectedcost').val(alerts.AllExpectedCost === 0 ? '' : alerts.AllExpectedCost);
}
else {
_PMAAlerts = [];
showAlerts(_PMAAlerts, grid_pmaalertdt);
}
if (alerts.InspectAlerts && alerts.InspectAlerts.length > 0) {
_InspectAlerts = alerts.InspectAlerts;
$("#divinspectalerts").show();
showAlerts(_InspectAlerts, grid_inspectalertdt);
}
else {
_InspectAlerts = [];
showAlerts(_InspectAlerts, grid_inspectalertdt);
}
if (alerts.OilAlerts && alerts.OilAlerts.length > 0) {
_OilAlerts = alerts.OilAlerts;
$("#divoilalerts").show();
showAlerts(_OilAlerts, grid_oilalertdt);
}
else {
_OilAlerts = [];
showAlerts(_OilAlerts, grid_oilalertdt);
}
}
function showAlerts(data, grid_dt) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
alertids.push(r.AlertID);
if (r.RepeatedAlerts) {
for (var j = 0; j < r.RepeatedAlerts.length; j++) {
alertids.push(r.RepeatedAlerts[j]);
}
}
for (var j in r) {
r["EngineHoursObj"] = { DisplayValue: r["EngineHours"] == 0 ? "" : r["EngineHours"], Value: r["EngineHours"] };
r["AlertLocalTime"] = { DisplayValue: r["AlertLocalTimeStr"], Value: r["AlertLocalTime"] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
}
var grid_dtcalertdt;
function InitDTCAlertGridData() {
grid_dtcalertdt = new GridView('#dtcalertslist');
grid_dtcalertdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'EngineHours', caption: GetTextByKey("P_WO_HOURS", "Hours"), valueIndex: 'EngineHoursObj', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_WO_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 480, 'text-align': 'left' } },
//{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_WO_COUNT", "Count"), valueIndex: 'AlertCount', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AlertLocalTime', caption: GetTextByKey("P_WO_LATESTDATETIME", "Latest DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.type = list_columns[hd].type;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
if (col.name === "Selected") {
col.allcheck = true;
}
}
grid_dtcalertdt.canMultiSelect = false;
grid_dtcalertdt.columns = columns;
grid_dtcalertdt.init();
grid_dtcalertdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtcalertdt.source[rowindex];
if (rowdata) {
}
}
}
var grid_pmaalertdt;
function InitPMAAlertGridData() {
grid_pmaalertdt = new GridView('#pmaalertslist');
grid_pmaalertdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'EngineHours', caption: GetTextByKey("P_WO_HOURS", "Hours"), valueIndex: 'EngineHoursObj', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_WO_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'ExpectedCost', caption: GetTextByKey("P_PM_EXPECTEDCOST", "Expected Cost"), valueIndex: 'ExpectedCost', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_WO_COUNT", "Count"), valueIndex: 'AlertCount', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AlertLocalTime', caption: GetTextByKey("P_WO_LATESTDATETIME", "Latest DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.type = list_columns[hd].type;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
if (col.name === "Selected") {
col.allcheck = true;
}
}
grid_pmaalertdt.canMultiSelect = false;
grid_pmaalertdt.columns = columns;
grid_pmaalertdt.init();
grid_pmaalertdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_pmaalertdt.source[rowindex];
if (rowdata) {
}
}
}
var grid_inspectalertdt;
function InitInspectAlertGridData() {
grid_inspectalertdt = new GridView('#inspectalertslist');
grid_inspectalertdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'EngineHours', caption: GetTextByKey("P_WO_HOURS", "Hours"), valueIndex: 'EngineHoursObj', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_WO_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 480, 'text-align': 'left' } },
//{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_WO_COUNT", "Count"), valueIndex: 'AlertCount', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AlertLocalTime', caption: GetTextByKey("P_WO_LATESTDATETIME", "Latest DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.type = list_columns[hd].type;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
if (col.name === "Selected") {
col.allcheck = true;
}
}
grid_inspectalertdt.canMultiSelect = false;
grid_inspectalertdt.columns = columns;
grid_inspectalertdt.init();
grid_inspectalertdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_inspectalertdt.source[rowindex];
if (rowdata) {
}
}
}
var grid_oilalertdt;
function InitOilAlertGridData() {
grid_oilalertdt = new GridView('#oilalertslist');
grid_oilalertdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'EngineHours', caption: GetTextByKey("P_WO_HOURS", "Hours"), valueIndex: 'EngineHoursObj', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_WO_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 480, 'text-align': 'left' } },
//{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_WO_COUNT", "Count"), valueIndex: 'AlertCount', css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AlertLocalTime', caption: GetTextByKey("P_WO_LATESTDATETIME", "Latest DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.type = list_columns[hd].type;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
if (col.name === "Selected") {
col.allcheck = true;
}
}
grid_oilalertdt.canMultiSelect = false;
grid_oilalertdt.columns = columns;
grid_oilalertdt.init();
grid_oilalertdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_oilalertdt.source[rowindex];
if (rowdata) {
}
}
}
function showNoneAssienedAlerts(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "EngineHours")
r[j] = { DisplayValue: r[j] == 0 ? "" : r[j], Value: r[j] };
else if (j === "AlertLocalTime")
r[j] = { DisplayValue: r["AlertLocalTimeStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_noneassignedalertdt.setData(rows);
}
var grid_noneassignedalertdt;
function InitNoneAssignedAlertGridData() {
grid_noneassignedalertdt = new GridView('#noneassignedalertlist');
grid_noneassignedalertdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'EngineHours', caption: GetTextByKey("P_WO_HOURS", "Hours"), valueIndex: 'EngineHours', css: { 'width': 80, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_WO_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_WO_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'ServiceDescription', caption: GetTextByKey("P_WO_SERVICEDESCRIPTION", "Service Description"), valueIndex: 'ServiceDescription', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AlertTime', caption: GetTextByKey("P_WO_LATESTDATETIME", "Latest DateTime"), valueIndex: 'AlertTime', css: { 'width': 125, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.type = list_columns[hd].type;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
if (col.name === "Selected") {
col.allcheck = true;
}
}
grid_noneassignedalertdt.canMultiSelect = false;
grid_noneassignedalertdt.columns = columns;
grid_noneassignedalertdt.init();
grid_noneassignedalertdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_noneassignedalertdt.source[rowindex];
if (rowdata) {
}
}
}
function clearAlertData() {
_DTCAlerts = [];
_PMAAlerts = [];
_InspectAlerts = [];
_OilAlerts = [];
grid_dtcalertdt.setData([]);
grid_pmaalertdt.setData([]);
grid_inspectalertdt.setData([]);
grid_oilalertdt.setData([]);
}
var _DTCAlerts = [];
var _PMAAlerts = [];
var _InspectAlerts = [];
var _OilAlerts = [];
function getAlerts() {
$("#divdtcalerts").hide();
//$("#divpmaalerts").hide();
$("#divinspectalerts").hide();
$("#divoilalerts").hide();
clearAlertData();
alertrequest("GETWORKORDERALERTS", workorderid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
showAllAlerts(data);
}, function (err) {
});
}
function getAssetAlerts(mid) {
$("#divdtcalerts").hide();
//$("#divpmaalerts").hide();
$("#divinspectalerts").hide();
$("#divoilalerts").hide();
clearAlertData();
if (!mid)
mid = machineid;
showloading(true);
alertrequest("GETASSETALERTS", mid + String.fromCharCode(170) + JSON.stringify(alertids), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
showAllAlerts(data);
}, function (err) {
showloading(false);
});
}
function reshowgrid() {
setTimeout(function () {
$("#dtcalertslist").css("height", 240);
grid_dtcalertdt && grid_dtcalertdt.resize();
$("#pmaalertslist").css("height", 240);
grid_pmaalertdt && grid_pmaalertdt.resize();
$("#inspectalertslist").css("height", 240);
grid_inspectalertdt && grid_inspectalertdt.resize();
$("#oilalertslist").css("height", 240);
grid_oilalertdt && grid_oilalertdt.resize();
});
}
function showAlertPopup() {
$('#alertpopupmask').show();
$('#alertpopupdialog').show();
$('#alertpopupdialog').css({
"top": ($("#alertpopupmask").height() - $('#alertpopupdialog').height()) / 2,
"left": ($("#alertpopupmask").width() - $('#alertpopupdialog').width()) / 2
});
//$("#noneassignedalertlist").css("height", $('#alertpopupdialog').height() - $("#alertpopupdialog").offset().top - 4);
grid_noneassignedalertdt && grid_noneassignedalertdt.resize();
}
function hideAlertPopup() {
$('#alertpopupdialog').hide();
$('#alertpopupmask').hide();
}
function OnAddAlerts() {
if (!workorderid || workorderid === "") {
showAlert(GetTextByKey("P_WO_SAVEWORKORDERFIRST", "Please save work order first."), GetTextByKey("P_WO_ADDALERTS", 'Add Alerts'));
return;
}
getNoneAssignedAlerts();
}
var noneassignedalerts = [];
function getNoneAssignedAlerts() {
var mid;
if (typeof editableSelectMachine != "undefined") {
var machine = editableSelectMachine.selecteditem();
if (machine)
mid = machine.Id;
}
else
mid = machineid;
if (!mid) {
showAlert(GetTextByKey("P_WO_PLEASESELECTANASSET", "Please select an Asset."), GetTextByKey("P_WO_SENDEMAIL", "Send Email"));
$('#dialog_machine').focus();
return;
}
worequest("GetNoneAssignedAlerts", mid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
showAlertPopup();
noneassignedalerts = data;
showNoneAssienedAlerts(noneassignedalerts);
}, function (err) {
});
}
function AddOrRemoveAlertsFromWorkOrder(isadd, alertids) {
worequest("AddOrRemoveAlertsFromWorkOrder", workorderid + String.fromCharCode(170) + JSON.stringify(alertids) + String.fromCharCode(170) + isadd, function (data) {
if (isadd)
hideAlertPopup();
getAlerts();
}, function (err) {
});
}
function OnRemoveAlerts() {
var alerts = [];
alertids = [];
if (_DTCAlerts.length > 0) {
for (var i = _DTCAlerts.length - 1; i >= 0; i--) {
var alert = _DTCAlerts[i];
if (alert.Selected) {
alerts.push(alert.AlertID);
_DTCAlerts.splice(i, 1);
//if (alertids.indexOf(alert.AlertID) >= 0)
// alertids.splice(alertids.indexOf(alert.AlertID), 1);
if (alert.RepeatedAlerts) {
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
alerts.push(alert.RepeatedAlerts[j]);
//alertids.splice(alertids.indexOf(alert.RepeatedAlerts[j]), 1);
}
}
}
}
showAlerts(_DTCAlerts, grid_dtcalertdt);
}
if (_PMAAlerts.length > 0) {
for (var i = _PMAAlerts.length - 1; i >= 0; i--) {
var alert = _PMAAlerts[i];
if (alert.Selected) {
alerts.push(alert.AlertID);
_PMAAlerts.splice(i, 1);
//if (alertids.indexOf(alert.AlertID) >= 0)
// alertids.splice(alertids.indexOf(alert.AlertID), 1);
if (alert.RepeatedAlerts) {
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
alerts.push(alert.RepeatedAlerts[j]);
//alertids.splice(alertids.indexOf(alert.RepeatedAlerts[j]), 1);
}
}
}
}
showAlerts(_PMAAlerts, grid_pmaalertdt);
//grid_pmaalertdt.setData(_PMAAlerts);
}
if (_InspectAlerts.length > 0) {
for (var i = _InspectAlerts.length - 1; i >= 0; i--) {
var alert = _InspectAlerts[i];
if (alert.Selected) {
alerts.push(alert.AlertID);
_InspectAlerts.splice(i, 1);
//if (alertids.indexOf(alert.AlertID) >= 0)
// alertids.splice(alertids.indexOf(alert.AlertID), 1);
if (alert.RepeatedAlerts) {
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
alerts.push(alert.RepeatedAlerts[j]);
//alertids.splice(alertids.indexOf(alert.RepeatedAlerts[j]), 1);
}
}
}
}
showAlerts(_InspectAlerts, grid_inspectalertdt);
}
if (_OilAlerts.length > 0) {
for (var i = _OilAlerts.length - 1; i >= 0; i--) {
var alert = _OilAlerts[i];
if (alert.Selected) {
alerts.push(alert.AlertID);
_OilAlerts.splice(i, 1);
//if (alertids.indexOf(alert.AlertID) >= 0)
// alertids.splice(alertids.indexOf(alert.AlertID), 1);
if (alert.RepeatedAlerts) {
for (var j = 0; j < alert.RepeatedAlerts.length; j++) {
alerts.push(alert.RepeatedAlerts[j]);
//alertids.splice(alertids.indexOf(alert.RepeatedAlerts[j]), 1);
}
}
}
}
showAlerts(_OilAlerts, grid_oilalertdt);
}
if (alerts.length == 0) {
showAlert(GetTextByKey("P_WO_PLEASESELECTANALERT", "Please select an Alert."), GetTextByKey("P_WO_REMOVEALERTS", "Remove Alerts"));
return;
}
if (workorderid && workorderid !== "") {
AddOrRemoveAlertsFromWorkOrder(false, alerts);
}
}
function OnSaveAlerts() {
var alerts = [];
if (noneassignedalerts.length > 0) {
for (var i in noneassignedalerts) {
var alert = noneassignedalerts[i];
if (alert.Selected) {
alerts.push(alert.ID);
}
}
}
if (alerts.length == 0) {
showAlert(GetTextByKey("P_WO_PLEASESELECTANALERT", "Please select an Alert."), GetTextByKey("P_WO_ADDALERTS", "Add Alerts"));
return;
}
AddOrRemoveAlertsFromWorkOrder(true, alerts);
}
//**********************************Add PM Alerts (Alerts not yet triggered)***********************************************/
function showAllPMSchedules(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
}
var fr = { Values: r };
rows.push(fr);
}
grid_pmschedulesdt.setData(rows);
}
var grid_pmschedulesdt;
function InitAllPMSchedulesGridData() {
grid_pmschedulesdt = new GridView('#allpmpmalertslist');
grid_pmschedulesdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Name', caption: GetTextByKey("P_MV_SCHEDULENAME", "Schedule Name"), valueIndex: 'Name', css: { 'width': 300, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.type = list_columns[hd].type;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
if (col.name === "Selected") {
col.allcheck = true;
}
}
grid_pmschedulesdt.canMultiSelect = false;
grid_pmschedulesdt.columns = columns;
grid_pmschedulesdt.init();
grid_pmschedulesdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_pmschedulesdt.source[rowindex];
if (rowdata) {
}
}
}
function showAllPMSchedulePopup() {
$('#allpmschedulepopupmask').show();
$('#allpmschedulepopupdialog').show();
$('#allpmschedulepopupdialog').css({
"top": ($("#allpmschedulepopupmask").height() - $('#allpmschedulepopupdialog').height()) / 2,
"left": ($("#allpmschedulepopupmask").width() - $('#allpmschedulepopupdialog').width()) / 2
});
grid_pmschedulesdt && grid_pmschedulesdt.resize();
}
function hideAllPMSchedulePopup() {
$('#allpmschedulepopupdialog').hide();
$('#allpmschedulepopupmask').hide();
}
function OnAddAllPMSchedules() {
if (!workorderid || workorderid === "") {
showAlert(GetTextByKey("P_WO_SAVEWORKORDERFIRST", "Please save work order first."), GetTextByKey("P_WO_ADDALERTS", 'Add Alerts'));
return;
}
GetPMSchedulesByAsset();
}
var allpmschedules = [];
function GetPMSchedulesByAsset() {
var mid;
if (typeof editableSelectMachine != "undefined") {
var machine = editableSelectMachine.selecteditem();
if (machine)
mid = machine.Id;
}
else
mid = machineid;
if (!mid) {
showAlert(GetTextByKey("P_WO_PLEASESELECTANASSET", "Please select an Asset."), GetTextByKey("P_WO_SENDEMAIL", "Send Email"));
$('#dialog_machine').focus();
return;
}
showAllPMSchedulePopup();
worequest("GetPMSchedulesByAsset", mid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
allpmschedules = data;
showAllPMSchedules(allpmschedules);
}, function (err) {
});
}
function GenerateManualPMAlerts() {
var schids = [];
if (allpmschedules.length > 0) {
for (var i in allpmschedules) {
var pmsch = allpmschedules[i];
if (pmsch.Selected) {
schids.push(pmsch.Id);
}
}
}
if (schids.length == 0) {
showAlert(GetTextByKey("P_WO_PLEASESELECTAPLAN", "Please select a plan."), GetTextByKey("P_WO_ADDALERTS", "Add Alerts"));
return;
}
var mid;
if (typeof editableSelectMachine != "undefined") {
var machine = editableSelectMachine.selecteditem();
if (machine)
mid = machine.Id;
}
else
mid = machineid;
if (!mid) {
showAlert(GetTextByKey("P_WO_PLEASESELECTANASSET", "Please select an Asset."), GetTextByKey("P_WO_SENDEMAIL", "Send Email"));
$('#dialog_machine').focus();
return;
}
worequest("GenerateManualPMAlerts", JSON.stringify([mid, workorderid, JSON.stringify(schids)])
, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
else {
var msg = "";
for (var i = 0; i < data.length; i++) {
var r = data[i];
if (r.Status == -1)
msg += GetTextByKey("P_WO_FAILEDTOGENERATEALERT", "Failed to generate alert.") + " (" + r.ScheduleName + ")\r\n";
else if (r.Status == 1)
msg += GetTextByKey("P_WO_FAILEDTOGENERATEALERT1", "Unable to generate alert because there already exists an unmaintained alert.") + " (" + r.ScheduleName + ")\r\n";
else if (r.Status == 2) {
if (r.UOM == "hour(s)")
msg += GetTextByKey("P_WO_FAILEDTOGENERATEALERT2", "Unable to generate alert until Hour Meter is higher than ") + r.NextTargetValue.toLocaleString() + " " + r.UOM + " (" + r.ScheduleName + ")\r\n";
else if (r.UOM == "day(s)")
msg += GetTextByKey("P_WO_FAILEDTOGENERATEALERT3", "Unable to generate alert until {0} later {1}").replace('{0}', r.NextTargetValue.toLocaleString() + " " + r.UOM).replace('{1}', " (" + r.ScheduleName + ")\r\n");
else
msg += GetTextByKey("P_WO_FAILEDTOGENERATEALERT4", "Unable to generate alert until odometer is higher than ") + r.NextTargetValue.toLocaleString() + " " + r.UOM + " (" + r.ScheduleName + ")\r\n";
}
}
if (msg !== "")
showAlert(msg, GetTextByKey("P_WO_ERROR", 'Error'));
}
hideAllPMSchedulePopup();
getAlerts();
}, function (err) {
});
}

View File

@ -1,801 +0,0 @@

function UpLoadWorkOrderAttachment() {
var file = $('<input type="file" style="display: none;" multiple="multiple" />');
file.change(function () {
var files = this.files;
if (files.length > 0) {
onSaveWOAttachment(files);
}
}).click();
}
var filesinuploading = [];
var uploadingindex = -1;
var fileupload_errors = "";
function onSaveWOAttachment(files) {
fileupload_errors = "";
if (!workorderid) {
OnSave(0, function () {
showLoading();
$('.span_attupload').show();
$('.span_vieuploadmsg').css('margin-left', 0);
$('.span_vieuploadmsg').show();
if (filesinuploading.length > 0) {
for (var i = 0; i < files.length; i++)
filesinuploading.push(workorderid, files[i]);
showUplpadingStatus(0);
}
else {
filesinuploading = files;
DoUploadWorkOrderAttachments(workorderid);
}
});
}
else {
showLoading();
$('.span_attupload').show();
$('.span_vieuploadmsg').css('margin-left', 0);
$('.span_vieuploadmsg').show();
if (filesinuploading.length > 0) {
for (var i = 0; i < files.length; i++)
filesinuploading.push(files[i]);
showUplpadingStatus(0);
}
else {
filesinuploading = files;
DoUploadWorkOrderAttachments(workorderid);
}
}
}
function DoUploadWorkOrderAttachments(woid) {
if (woid != workorderid) {
filesinuploading = [];
uploadingindex = -1;
return;
}
uploadingindex++;
if (uploadingindex >= filesinuploading.length) {
uploadingindex--;
showUplpadingStatus(3);
filesinuploading = [];
uploadingindex = -1;
$('.span_attupload').hide();
$('.span_vieuploadmsg').css('margin-left', 200);
getWorkOrderAttachments();
hideLoading();
if (fileupload_errors !== "")
showAlert(fileupload_errors, GetTextByKey("P_WO_XXXXX", 'Upload failed'));
return;
}
var file = filesinuploading[uploadingindex];
if (file.name.length > 200) {
showUplpadingStatus(2, GetTextByKey("P_WO_XXX", "Attachment name length cannot be greater than 200."));
DoUploadWorkOrderAttachments(woid);
return;
}
if (file.size == 0) {
showUplpadingStatus(2, GetTextByKey("P_WO_ATTACHMENTSTIPS", "Attachment size is 0kb, uploading failed."));
DoUploadWorkOrderAttachments(woid);
return;
}
if (file.size > 50 * 1024 * 1024) {
showUplpadingStatus(2, GetTextByKey("P_WO_ATTACHMENTSTIPS1", "Attachment is too large. Maximum file size is 50 MB."));
DoUploadWorkOrderAttachments(woid);
return;
}
showUplpadingStatus(0);
var top = $(window).height() / 2 - 100;
var left = $(window).width() / 2 - 100;
var width = $('#dialogattmask .lable_attuploadname').width();
$('#dialogattmask .loading_icon').css({ top: top, left: left });
$('#dialogattmask .lable_attuploadname').css({ top: top + 70, left: ($(window).width() - width - 100) / 2 });
var p = JSON.stringify([workorderid, ""]);
var formData = new FormData();
formData.append("iconFile", file);
formData.append("MethodName", "AddAttachment");
formData.append("ClientData", p);
var url = 'AddWorkOrder.aspx';
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
processData: false,
contentType: false,
data: formData,
async: true,
success: function (data) {
if (data !== 'OK') {
showAlert(GetTextByKey("P_WO_XXXXX", 'Upload failed'), GetTextByKey("P_WO_ATTACHMENTFILE", 'Attachment File'));
}
showUplpadingStatus(1);
DoUploadWorkOrderAttachments(woid);
},
error: function (err) {
showUplpadingStatus(2, GetTextByKey("P_WO_XXXXX", 'Upload failed'));
DoUploadWorkOrderAttachments(woid);
}
});
}
function showUplpadingStatus(status, msg) {
if (filesinuploading.length == 0) return;
var filename = filesinuploading[uploadingindex].name;
if (filename.length > 50)
filename = filename.substring(0, 49) + "...";
var statustxt = "";
if (status == 0) {
statustxt = "Uploading " + filename + " (" + (uploadingindex + 1) + "/" + filesinuploading.length + ")";
$('.lable_attuploadname').text(statustxt);
}
else if (status == 1) {
statustxt = filename;
$('#attupload_ul').append('<li style="padding-left: 0;height:unset;line-height:24px;"><span class="sbutton iconattsuc">' + statustxt + '</span></li>');
}
else if (status == 2) {
statustxt = filename + " - " + msg;
$('#attupload_ul').append('<li style="padding-left: 0;height:unset;line-height:24px;"><span class="sbutton iconatterror">' + statustxt + '</span></li>');
if (fileupload_errors === "")
fileupload_errors = statustxt;
else
fileupload_errors = fileupload_errors + " \n " + statustxt;
}
else if (status == 3) {
statustxt = "Upload Completed";
statustxt = "";
$('.lable_attuploadname').text(statustxt);
}
}
function deleteAttachment(attID) {
if (confirm(GetTextByKey("P_WO_DELETEATTACHMENTTIPS", "Are you sure you want to delete the attachment?"))) {
worequest("DeleteAttachment", attID, function (data) {
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_WO_DELETEATTACHMENT", 'Delete Attachment'));
}
else {
getWorkOrderAttachments();
}
}, function (err) {
showAlert(GetTextByKey("P_WO_FAILEDDELETEATTACHMENT", 'Failed to delete this attachment.'), GetTextByKey("P_WO_DELETEATTACHMENT", 'Delete Attachment'));
});
}
}
var allAttachments;
var viewtype = 0;
function onViewAttachment(type) {
viewtype = type;
if (typeof setCookie === "function")
setCookie("woattachmentviewtype", viewtype);
$(".woattafoldicon").removeClass("iconchevronright").addClass("iconchevrondown");
$(".woattafoldtr").show();
showWOAttachments();
}
function showWOAttachments() {
$('#div_woatts').empty();
$('#div_atts').empty();
$('#div_iatts').empty();
$('#woattslist_tbody').empty();
$('#woassetattslist_tbody').empty();
$('#woiptattslist_tbody').empty();
if (!viewtype)
viewtype = 0;
if (parseInt(viewtype) === 1) {
$('#div_attlarge').hide();
$('#div_attlist').show();
showAttachmentList(allAttachments);
}
else {
$('#div_attlarge').show();
$('#div_attlist').hide();
showWorkOrderAttachments(allAttachments);
}
$('#dialogattmask').height($(document).outerHeight(false)).width($(document).outerWidth(false));
}
function getWorkOrderAttachments(next) {
if (workorderid) {
worequest('GetAttachments', JSON.stringify([workorderid, machineid]), function (data) {
if (data && typeof data != "string") {
allAttachments = data;
if (next)
next();
else {
showWOAttachments(allAttachments);
}
}
});
}
}
var imgTypes = [".jfif", ".jpg", ".jpeg", ".bmp", ".png", ".tiff", ".gif"];
var printTypes = ['.pdf', ".jfif", ".jpg", ".jpeg", ".bmp", ".png", ".tiff", ".gif"];//types to be loaded to print
function showWorkOrderAttachments(attas) {
var div_aatts = $('#div_aatts');
div_aatts.empty();
var div_woatts = $('#div_woatts');
div_woatts.empty();
var div_iatts = $('#div_iatts');
div_iatts.empty();
if (attas.AssetAttachments && attas.AssetAttachments.length > 0) {
for (var i = 0; i < attas.AssetAttachments.length; i++) {
var att = attas.AssetAttachments[i];
if (imgTypes.indexOf(att.FileType.toLowerCase()) >= 0)
att.ThumbnailUrl = att.Url + "&thumb=1";
var div = createAttaDiv(att);
if ($.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
var sprint = $('<span class="attaprint"></span>').attr('title', GetTextByKey("P_WO_PRINT", 'Print')).click(att, function (e) {
openPrintFrame(e.data.AttachmentType, e.data.AttachmentIdStr);
});
div.append(sprint);
}
if (att.FileType.toLowerCase() != "url") {
var sdownload = $('<span class="attadownload"></span>').attr('title', GetTextByKey("P_WO_DOWNLOAD", 'Download')).click(att, function (e) {
openDownloadFrame(e.data.Url + "&d=1");
});
div.append(sdownload);
}
div_aatts.append(div);
}
}
if (attas.WorkOrderAttachments && attas.WorkOrderAttachments.length > 0) {
for (var i = 0; i < attas.WorkOrderAttachments.length; i++) {
var att = attas.WorkOrderAttachments[i];
var pdiv = $('<div class="divattp"></div>');
var div = createAttaDiv(att, true);
var div1 = $('<div style=" margin-top: 15px;"></div>');
var ext_span = $('<span style="font-weight:500;"></span>').text(GetTextByKey("P_WO_AVAILABLETOCUSTOMER", 'Available to Customer'));
var ext_chk = $('<input type="checkbox" />').prop('checked', att.AvailableToCustomer).click(att, function (e) {
updateWOAttachmentExtension(e.data.AttachmentId, $(this).prop('checked'));
});
div1.append(ext_chk).append(ext_span);
pdiv.append(div1);
if (AllowDeleteAtta) {
var sdel = $('<span class="delete"></span>').attr('title', GetTextByKey("P_WO_DELETE", 'Delete')).click(att, function (e) {
deleteAttachment(e.data.AttachmentId);
});
div.append(sdel);
}
if ($.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
var sprint = $('<span class="attaprint"></span>').attr('title', GetTextByKey("P_WO_PRINT", 'Print')).click(att, function (e) {
openPrintFrame(e.data.AttachmentType, e.data.AttachmentIdStr);
});
div.append(sprint);
}
var sdownload = $('<span class="attadownload"></span>').attr('title', GetTextByKey("P_WO_DOWNLOAD", 'Download')).click(att, function (e) {
openDownloadFrame(e.data.Url + "&d=1");
});
div.append(sdownload);
pdiv.append(div);
var caption = att.Notes === "" ? att.FileName : att.Notes;
var div3 = $('<div style="text-align:center;clear:both;height:25px;"></div>');
var iptcaption = $('<input type="text" style="width: 296px;" class="inp_name" style="height:24px;" maxlength="200"/>').attr('data-ori', caption).val(caption);
iptcaption.data('attdata', att);
div3.append(iptcaption);
iptcaption.focus({ AttachmentId: att.AttachmentId, iptcaption: iptcaption }, function (e) {
e.data.iptcaption.addClass('focused');
});
iptcaption.blur({ div: div, AttachmentId: att.AttachmentId, iptcaption: iptcaption, caption: caption }, function (e) {
e.data.iptcaption.removeClass('focused');
updateWOAttachmentCaption(e.data);
});
iptcaption.keydown({ div: div, AttachmentId: att.AttachmentId, iptcaption: iptcaption, caption: caption }, function (e) {
if (e.keyCode == 13 || e.keyCode == 9) {
e.data.iptcaption.blur();
}
});
pdiv.append(div3);
div_woatts.append(pdiv);
}
}
if (attas.InspectionAttachments && attas.InspectionAttachments.length > 0) {
for (var i = 0; i < attas.InspectionAttachments.length; i++) {
var att = attas.InspectionAttachments[i];
var div = createAttaDiv(att);
if ($.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
var sprint = $('<span class="attaprint"></span>').attr('title', GetTextByKey("P_WO_PRINT", 'Print')).click(att, function (e) {
openPrintFrame(e.data.AttachmentType, e.data.AttachmentIdStr);
});
div.append(sprint);
}
var sdownload = $('<span class="attadownload"></span>').attr('title', GetTextByKey("P_WO_DOWNLOAD", 'Download')).click(att, function (e) {
openDownloadFrame(e.data.Url + "&d=1");
});
div.append(sdownload);
div_iatts.append(div);
}
}
}
function createAttaDiv(att, iswoatta) {
var div = $('<div class="divatt"></div>').attr('title', att.FileName);
if (iswoatta)
div.attr('title', att.Notes === "" ? att.FileName : att.Notes)
if (!att.FileType || att.FileType == "") att.FileType = ".jpg";
if (imgTypes.indexOf(att.FileType.toLowerCase()) >= 0) {
var pic = $('<img class="picture"></img>').attr('src', att.ThumbnailUrl);
pic.click(att, function (e) {
window.open(e.data.Url, "_blank")
});
div.append(pic);
}
else {
var sdown = $('<img class="picture" />').click(att, function (e) {
window.open(e.data.Url);
});
setAttachemntIcon(att.FileType, sdown);
div.append(sdown);
}
return div
}
function updateWOAttachmentExtension(attID, chk) {
var item = {
'Key': "1",
'Value': chk
};
var param = JSON.stringify(item);
param = htmlencode(param);
worequest('UpdateWOAttachmentExtension', JSON.stringify([attID, param]), function (data) {
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_WO_AVAILABLETOCUSTOMER", 'Available to Customer'));
}
if (allAttachments && allAttachments.WorkOrderAttachments) {
for (var i = 0; i < allAttachments.WorkOrderAttachments.length; i++) {
if (allAttachments.WorkOrderAttachments[i].AttachmentId == attID) {
allAttachments.WorkOrderAttachments[i].AvailableToCustomer = chk;
break;
}
}
}
}, function (err) {
});
}
var grid_panddattachments
function InitPAndDGrid() {
grid_panddattachments = new GridView('#dialog_wopanddattachmentlist');
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'ThumbnailUrl', caption: "", valueIndex: 'ThumbnailUrl', css: { 'width': 42, 'text-align': 'center' } },
{ name: 'FileName', caption: GetTextByKey("P_WO_NAME", "Name"), valueIndex: 'FileName', css: { 'width': 280, 'text-align': 'left' } }
];
var columns = [];
for (var hd in list_columns) {
var col = {};
if (list_columns[hd].type) {
col.type = list_columns[hd].type;
}
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);
if (col.name == "Selected") {
col.allcheck = true;
col.sortable = false;
}
else if (col.name == "ThumbnailUrl") {
col.allowHtml = true;
col.filterCustom = true;
col.filter = function (item) {
if (imgTypes.indexOf(item.FileType.toLowerCase()) >= 0)
return $('<img style="height:30px;width:30px;"></img>').attr('src', item.ThumbnailUrl);
else {
var sdown = $('<img style="height:30px;width:30px;line-height:40px;" />')
setAttachemntIcon(item.FileType, sdown);
return sdown;
}
}
col.styleFilter = function () {
return { "width": "100%", 'margin': 0 };
}
}
}
grid_panddattachments.canMultiSelect = true;
grid_panddattachments.columns = columns;
grid_panddattachments.init();
}
function openPAndDGDialog(type) {
if (!allAttachments) return;
var d = $("#dialog_panddattachments");
if (!d.data("loaded")) {
d.data("loaded", true);
InitPAndDGrid();
}
if (type == 0) {
$("#btnPrintWOAttachments").show();
$("#btnDownloadWOAttachments").hide();
}
else {
$("#btnPrintWOAttachments").hide();
$("#btnDownloadWOAttachments").show();
}
var data = [];
if (allAttachments.AssetAttachments && allAttachments.AssetAttachments.length > 0)
data = data.concat(allAttachments.AssetAttachments);
if (allAttachments.WorkOrderAttachments && allAttachments.WorkOrderAttachments.length > 0)
data = data.concat(allAttachments.WorkOrderAttachments);
if (allAttachments.InspectionAttachments && allAttachments.InspectionAttachments.length > 0)
data = data.concat(allAttachments.InspectionAttachments);
var count = 0;
var rows = [];
for (var i = 0; i < data.length; i++) {
var att = data[i];
if (att.FileType.toLowerCase() == "url") continue;
if (type == 1 || $.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
var fr = {
Values: {
FileName: att.Notes === "" ? att.FileName : att.Notes,
FileType: att.FileType,
Url: att.Url,
ThumbnailUrl: att.ThumbnailUrl,
AttachmentType: att.AttachmentType,
AttachmentIdStr: att.AttachmentIdStr,
Selected: false,
}
};
rows.push(fr);
count++;
}
}
$('#dialog_panddattachments .dialog-title span.title').text(GetTextByKey("P_WO_ATTACHMENTS", 'Attachments') + " (" + count + ")");
showmaskbg(true);
d.css({
'top': (document.documentElement.clientHeight - d.height()) / 3,
'left': (document.documentElement.clientWidth - d.width()) / 2
}).showDialogfixed();
setTimeout(function () {
grid_panddattachments.setData(rows);
});
}
function getSelectedPAndDAttas() {
var sels = [];
if (grid_panddattachments && grid_panddattachments.source) {
for (var i = 0; i < grid_panddattachments.source.length; i++) {
var a = grid_panddattachments.source[i].Values;
if (a.Selected)
sels.push(a);
}
}
return sels;
}
function printWOAttachments() {
var sels = getSelectedPAndDAttas();
if (!sels || sels.length == 0) return;
if (sels && sels.length > 0) {
for (var i = 0; i < sels.length; i++) {
var att = sels[i];
if ($.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
openPrintFrame(att.AttachmentType, att.AttachmentIdStr);
}
}
}
showmaskbg(false);
$('#dialog_panddattachments').hideDialog();
}
function openPrintFrame(attatype, id) {
var frame = $("<iframe style='display:none;'></iframe>");
$(document.body).after(frame);
//frame.attr("src", url);
frame.attr("src", _network.root + "Print.aspx?pt=3&at=" + attatype + "&id=" + id);
frame.on('load', function () {
setTimeout(function () {
frame.contents().find("body").css("text-align", "center");
//frame.contents().find("img").css("max-height", window.screen.availHeight).css("max-width", window.screen.availWidth);
frame.contents().find("img").css("max-height", "98%").css("max-width", "98%");
frame[0].contentWindow.print();
});
setTimeout(function () {
frame.remove();
}, 60000);
});
}
function downloadWOAttachments() {
var sels = getSelectedPAndDAttas();
if (!sels || sels.length == 0) return;
if (sels && sels.length > 0) {
for (var i = 0; i < sels.length; i++) {
var att = sels[i];
openDownloadFrame(att.Url + "&d=1");
}
}
showmaskbg(false);
$('#dialog_panddattachments').hideDialog();
}
function openDownloadFrame(url) {
var frame = $("<iframe style='display:none;'></iframe>");
$(document.body).after(frame);
frame.attr("src", url);
var timer = setInterval(function () {
if (frame[0].contentDocument && (frame[0].contentDocument.readyState == "complete" || frame[0].contentDocument.readyState == 4)) {
frame.remove();
clearInterval(timer);
}
}, 5000);
}
function updateWOAttachmentCaption(edata) {
var attid = edata.AttachmentId;
var caption = edata.iptcaption.val();
if (caption === "") {
var pcap = edata.caption;
if (edata.iptcaption.data('caption'))
pcap = edata.iptcaption.data('caption');
edata.iptcaption.val(pcap);
return;
}
var att = edata.iptcaption.data('attdata');
att.Notes = caption;
if (allAttachments && allAttachments.WorkOrderAttachments) {
for (var i = 0; i < allAttachments.WorkOrderAttachments.length; i++) {
if (allAttachments.WorkOrderAttachments[i].AttachmentId == att.AttachmentId) {
allAttachments.WorkOrderAttachments[i] = att;
break;
}
}
}
worequest('UpdateWorkOrderAttachmentCaption', JSON.stringify([attid, htmlencode(caption)]), function (data) {
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_WO_XXX", 'Update Caption'));
}
else {
if (edata.div)
edata.div.attr('title', caption);
edata.iptcaption.data('caption', caption);
}
}, function (err) {
});
}
//***********************************Begin Attachment List************************************//
function showAttachmentList(data) {
$('#woattslist_tbody').empty();
$('#woassetattslist_tbody').empty();
$('#woiptattslist_tbody').empty();
if (data.WorkOrderAttachments && data.WorkOrderAttachments.length > 0) {
for (var i = 0; i < data.WorkOrderAttachments.length; i++) {
var att = data.WorkOrderAttachments[i];
var tr = createWOAttachmentTr(att);
$('#woattslist_tbody').append(tr);
}
}
if (data.AssetAttachments && data.AssetAttachments.length > 0) {
for (var i = 0; i < data.AssetAttachments.length; i++) {
var att = data.AssetAttachments[i];
if (imgTypes.indexOf(att.FileType.toLowerCase()) >= 0)
att.ThumbnailUrl = att.Url + "&thumb=1";
var tr = createWOOtherAttachmentTr(att);
$('#woassetattslist_tbody').append(tr);
}
}
if (data.InspectionAttachments && data.InspectionAttachments.length > 0) {
for (var i = 0; i < data.InspectionAttachments.length; i++) {
var att = data.InspectionAttachments[i];
var tr = createWOOtherAttachmentTr(att);
$('#woiptattslist_tbody').append(tr);
}
}
}
function createWOAttachmentTr(att) {
var caption = att.Notes === "" ? att.FileName : att.Notes;
var tr = $('<tr></tr>').attr('data-id', att.AttachmentId);
var td;
tr.append('<td></td>');
td = $('<td></td>');
if (!att.FileType || att.FileType == "")
att.FileType = ".jpg";
var divpic = $('<div style="width:60px;height:60px;text-align:center;"></div>');
td.append(divpic);
if (imgTypes.indexOf(att.FileType.toLowerCase()) >= 0) {
var pic = $('<img class="wolist_picture"></img>').attr('src', att.ThumbnailUrl);
pic.click(att, function (e) {
window.open(e.data.Url, "_blank")
});
divpic.append(pic);
}
else {
var sdown = $('<img class="wolist_picture" />').click(att, function (e) {
window.open(e.data.Url);
});
setAttachemntIcon(att.FileType, sdown);
divpic.append(sdown);
}
tr.append(td);
td = $('<td style="padding-left:20px;"></td>');
var iptcaption = $('<input type="text" class="inp_name" maxlength="200" style="height:24px;"/>').css('width', '100%').attr('data-ori', caption).val(caption);
iptcaption.data('attdata', att);
td.append(iptcaption);
iptcaption.focus({ AttachmentId: att.AttachmentId, iptcaption: iptcaption }, function (e) {
e.data.iptcaption.addClass('focused');
});
iptcaption.blur({ AttachmentId: att.AttachmentId, iptcaption: iptcaption, caption: caption }, function (e) {
e.data.iptcaption.removeClass('focused');
updateWOAttachmentCaption(e.data);
});
iptcaption.keydown({ AttachmentId: att.AttachmentId, iptcaption: iptcaption, caption: caption }, function (e) {
if (e.keyCode == 13 || e.keyCode == 9) {
e.data.iptcaption.blur();
}
});
tr.append(td);
td = $('<td></td>');
var chk_tocust = $('<input type="checkbox" class="inp_recurring"/>').attr('data-ori', att.AvailableToCustomer).prop('checked', att.AvailableToCustomer);
td.append(chk_tocust);
chk_tocust.click(att, function (e) {
updateWOAttachmentExtension(e.data.AttachmentId, $(this).prop('checked'));
});
tr.append(td);
td = $('<td class="td_funcs"></td>');
var sdel = $('<span class="wolist_icon wolist_delete"></span>').attr('title', GetTextByKey("P_WO_DELETE", 'Delete')).click(att, function (e) {
deleteAttachment(e.data.AttachmentId);
});
td.append(sdel);
var sdownload = $('<span class="wolist_icon wolist_attadownload"></span>').attr('title', GetTextByKey("P_WO_DOWNLOAD", 'Download')).click(att, function (e) {
openDownloadFrame(e.data.Url + "&d=1");
});
td.append(sdownload);
if ($.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
var sprint = $('<span class="wolist_icon wolist_attaprint"></span>').attr('title', GetTextByKey("P_WO_PRINT", 'Print')).click(att, function (e) {
openPrintFrame(e.data.AttachmentType, e.data.AttachmentIdStr);
});
td.append(sprint);
}
tr.append(td);
return tr;
}
function createWOOtherAttachmentTr(att) {
var tr = $('<tr></tr>').attr('data-id', att.AttachmentId);
var td;
tr.append('<td></td>');
td = $('<td></td>');
if (!att.FileType || att.FileType == "")
att.FileType = ".jpg";
var divpic = $('<div style="width:60px;height:60px;text-align:center;"></div>');
td.append(divpic);
if (imgTypes.indexOf(att.FileType.toLowerCase()) >= 0) {
var pic = $('<img class="wolist_picture"></img>').attr('src', att.ThumbnailUrl);
pic.click(att, function (e) {
window.open(e.data.Url, "_blank")
});
divpic.append(pic);
}
else {
var sdown = $('<img class="wolist_picture" />').click(att, function (e) {
window.open(e.data.Url);
});
setAttachemntIcon(att.FileType, sdown);
divpic.append(sdown);
}
tr.append(td);
td = $('<td style="padding-left:20px;"></td>').text(att.FileName);
tr.append(td);
tr.append('<td></td>');
td = $('<td class="td_funcs"></td>');
if (att.FileType.toLowerCase() != "url") {
var sdownload = $('<span class="wolist_icon wolist_attadownload"></span>').attr('title', GetTextByKey("P_WO_DOWNLOAD", 'Download')).click(att, function (e) {
openDownloadFrame(e.data.Url + "&d=1");
});
td.append(sdownload);
}
if ($.inArray(att.FileType.toLowerCase(), printTypes) >= 0) {
var sprint = $('<span class="wolist_icon wolist_attaprint"></span>').attr('title', GetTextByKey("P_WO_PRINT", 'Print')).click(att, function (e) {
openPrintFrame(e.data.AttachmentType, e.data.AttachmentIdStr);
});
td.append(sprint);
}
tr.append(td);
return tr;
}
//***********************************End Attachment List************************************//
function dragOverWOAttachment(ev) {
ev.preventDefault();
ev.dataTransfer.dropEffect = 'link';
//$('#dialogattdragmask').css({ height: $('#tb_woattlarge').height(), top: $('#tb_woattlarge').offset().top });
//$('#dialogattdragmask').show();
}
function dropWOAttachment(ev) {
//$('#dialogattdragmask').hide();
ev.preventDefault();
ev.stopPropagation();
var df = ev.dataTransfer;
var files = [];
if (df.items !== undefined) {
for (var i = 0; i < df.items.length; i++) {
var item = df.items[i];
if (item.kind === "file" && (item.webkitGetAsEntry() == null || item.webkitGetAsEntry().isFile)) {
var file = item.getAsFile();
files.push(file);
}
}
}
if (files.length > 0)
onSaveWOAttachment(files);
}
function cutWOAttachment(ev) {
ev.stopPropagation();
var df = ev.clipboardData;
var files = [];
if (df.items !== undefined) {
for (var i = 0; i < df.items.length; i++) {
var item = df.items[i];
if (item.kind === "file" && (item.webkitGetAsEntry() == null || item.webkitGetAsEntry().isFile)) {
var file = item.getAsFile();
files.push(file);
}
}
}
if (files.length > 0)
onSaveWOAttachment(files);
}

View File

@ -1,444 +0,0 @@
$(function () {
$("#dialog_segmenthour").keydown(numberinput);
$("#dialog_segmentcost").keydown(numberinput);
});
function numberinput(e) {
var keyCode = e.which;
if (keyCode === 9//tab
|| keyCode === 8 || keyCode === 46 //delete
|| keyCode === 110 || keyCode === 190//.
|| keyCode === 37 || keyCode === 39//left right
|| keyCode === 55 || keyCode === 56//home end
|| (keyCode >= 48 && keyCode <= 57)
|| (keyCode >= 96 && keyCode <= 105))
return true;
else
return false;
}
function GetSegmentDataSource(next) {
worequest("GetSegmentDataSource", '', function (data) {
if (data.Users && data.Users.length > 0) {
userdata = data.Users;
$('#dialog_segmentuser').dropdownSource(userdata);
}
if (data.JobSites && data.JobSites.length > 0) {
var jss = [{ ID: '-1', Name: ' ', html: '&nbsp;' }];
for (var js of data.JobSites) {
jss.push(js);
}
jobsitedata = jss;
$("#dialog_segmentjobsite").dropdownSource(jobsitedata);
}
if (data.Components && data.Components.length > 0) {
var source = [];
for (var type of data.Components) {
source.push({ value: type });
}
components = source;
$("#dialog_segmentcomponent").dropdownSource(components);
}
if (data.SegmentTypes && data.SegmentTypes.length > 0) {
var source = [];
for (var type of data.SegmentTypes) {
source.push({ value: type });
}
segmenttypes = source;
$("#dialog_segmenttype").dropdownSource(segmenttypes);
}
if (next)
next();
}, function (err) {
console.log(err);;
});
}
function GetSegmentDataSource1(next) {
worequest("GetSegmentDataSource1", '', function (data) {
if (data.Components && data.Components.length > 0) {
var source = [];
for (var type of data.Components) {
source.push({ value: type });
}
components = source;
$("#dialog_segmentcomponent").dropdownSource(components);
}
if (data.SegmentTypes && data.SegmentTypes.length > 0) {
var source = [];
for (var type of data.SegmentTypes) {
source.push({ value: type });
}
segmenttypes = source;
$("#dialog_segmenttype").dropdownSource(segmenttypes);
}
if (next)
next();
}, function (err) {
console.log(err);;
});
}
function SetCompleted(index) {
var date = $('#dialog_segmentcompleteddate' + index).val();
if (date.length > 0 && checkDate(date)) {
$('#dialog_segmentcompleted' + index).prop('checked', true);
}
}
var segmentdata = [];
function initControl(index) {
$('#dialog_segmentcompleteddate' + index).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_segmentuser' + index).dropdown(userdata || [], {
search: true,
valueKey: 'IID',
textKey: 'DisplayName'
});
$("#dialog_segmentjobsite" + index).dropdown(jobsitedata || [], {
search: true,
valueKey: 'ID',
textKey: 'Name'
});
$("#dialog_segmenttype" + index).dropdown(segmenttypes || [], {
input: true,
maxlength: 50,
textKey: 'value'
});
$("#dialog_segmentcomponent" + index).dropdown(components || [], {
input: true,
maxlength: 40,
textKey: 'value'
});
}
function getSegments(callbake) {
segmentindex = 0;
$('#tab_segments .segments_table').remove();
if (!workorderid || workorderid == "") return;
worequest("GetSegments", workorderid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
if (data && data.length > 0) {
//$('#dialog_workordercosts').attr('disabled', true);
segmentdata = data;
var wocost = 0;
for (var i = 0; i < segmentdata.length; i++) {
wocost += segmentdata[i].Cost;
showSegment(segmentdata[i]);
}
$('#dialog_workordercosts').val(wocost);
}
else {
//$('#dialog_workordercosts').attr('disabled', false);
if (workorderdata)
$('#dialog_workordercosts').val(workorderdata.WorkOrderTotalCost == 0 ? "" : workorderdata.WorkOrderTotalCost);
segmentdata = [];
if (callbake)
callbake();
}
}, function (err) {
});
}
var segmentindex = 0;
function showSegment(segment) {
segmentindex++;
var div_segments = $('#tab_segments');
var table = $('<table id="tabsegment_' + segmentindex + '" class="segments_table"></table>');
table.data('index', segmentindex);
var tr1 = $('<tr></tr>');
var tr1_td1 = $('<td class="label" style="font-size:14px;font-weight:500;text-align:left;">' + GetTextByKey("P_WO_SEGMENT", "Segment") + " " + segmentindex + '</td>"');
if (!WOReadOnly) {
var s_del = $('<span class="sbutton icondelete" onclick="DeleteSegment(' + segmentindex + ');"></span>');
tr1_td1.append(s_del);
}
var tr1_td2 = $('<td></td>"');
tr1.append(tr1_td1).append(tr1_td2);
table.append(tr1);
var tr = $('<tr></tr>');
var td1 = $('<td class="label">' + GetTextByKey("P_WO_USER_COLON", " User:") + '</td>"');
var td2 = $('<td></td>"');
var sel_user = $('<div id="dialog_segmentuser' + segmentindex + '" class="dropdown"></div>').css("width", 320);
td2.append(sel_user);
var td3 = $('<td class="label">' + GetTextByKey("P_WO_COMPLETED_COLON", "Completed:") + '</td>"');
var td4 = $('<td></td>"');
var chk_completed = $('<input type="checkbox" id="dialog_segmentcompleted' + segmentindex + '" class="inputbox" />');
td4.append(chk_completed);
tr.append(td1).append(td2).append(td3).append(td4);
table.append(tr);
tr = $('<tr></tr>');
td1 = $('<td class="label">' + GetTextByKey("P_WO_HOURS_COLON", "Hours:") + '</td>"');
td2 = $('<td></td>"');
var input_hour = $('<input type="text" id="dialog_segmenthour' + segmentindex + '" class="inputbox" maxlength="12" />')
.keydown(numberinput);
td2.append(input_hour);
td3 = $('<td class="label">' + GetTextByKey("P_WO_COMPLETEDDATE_COLON", "Completed Date:") + '</td>"');
td4 = $('<td></td>"');
var input_completeddate = $('<input type="text" id="dialog_segmentcompleteddate' + segmentindex + '" class="inputbox" onchange="SetCompleted(' + segmentindex + ')" />');
td4.append(input_completeddate);
tr.append(td1).append(td2).append(td3).append(td4);
table.append(tr);
tr = $('<tr></tr>');
td1 = $('<td class="label">' + GetTextByKey("P_WO_JOBSITE_COLON", "Jobsite:") + '</td>"');
td2 = $('<td></td>"');
var sel_jobsite = $('<div id="dialog_segmentjobsite' + segmentindex + '" class="dropdown"></div>').css("width", 320);
td2.append(sel_jobsite);
td3 = $('<td class="label"><span>' + GetTextByKey("P_WO_DESCRIPTION_COLON", "Description:") + '</span><span class="redasterisk">*</span></td>"');
td4 = $('<td></td>"');
var input_desc = $('<input type="text" id="dialog_segmentdesc' + segmentindex + '" class="inputbox" maxlength="200" />');
td4.append(input_desc);
tr.append(td1).append(td2).append(td3).append(td4);
table.append(tr);
tr = $('<tr></tr>');
td1 = $('<td class="label">' + GetTextByKey("P_WO_COST_COLON", "Cost:") + '</td>"');
td2 = $('<td></td>"');
var input_cost = $('<input type="text" id="dialog_segmentcost' + segmentindex + '" class="inputbox" />')
.keydown(numberinput);
td2.append(input_cost);
td3 = $('<td class="label">' + GetTextByKey("P_WO_NOTES_COLON", "Notes:") + '</td>"');
td4 = $('<td rowspan="4"></td>"').css("vertical-align", "top");
var textarea_notes = $('<textarea id="dialog_segmentnotes' + segmentindex + '" class="inputbox" maxlength="500" style="width: 450px; height: 120px;"></textarea>')
td4.append(textarea_notes);
tr.append(td1).append(td2).append(td3).append(td4);
table.append(tr);
tr = $('<tr></tr>');
td1 = $('<td class="label">' + GetTextByKey("P_WO_XXXXXX_COLON", "Segment Type:") + '</td>"');
td2 = $('<td></td>"');
var sel_segmenttype = $('<div id="dialog_segmenttype' + segmentindex + '" class="dropdown"></div>').css("width", 320);
td2.append(sel_segmenttype);
tr.append(td1).append(td2);
table.append(tr);
tr = $('<tr></tr>');
td1 = $('<td class="label">' + GetTextByKey("P_WO_COMPONENT_COLON", "Component:") + '</td>"');
td2 = $('<td></td>"');
var sel_component = $('<div id="dialog_segmentcomponent' + segmentindex + '" class="dropdown"></div>').css("width", 320);
td2.append(sel_component);
tr.append(td1).append(td2);
table.append(tr);
tr = $('<tr></tr>');
td1 = $('<td class="label">' + GetTextByKey("P_WO_XXXXXX_COLON", "Billable:") + '</td>"');
td2 = $('<td></td>"');
var chk_billable = $('<input type="checkbox" id="dialog_segmentbillable' + segmentindex + '" class="inputbox" />');
td2.append(chk_billable);
tr.append(td1).append(td2);
table.append(tr);
if (!WOReadOnly) {
tr = $('<tr></tr>');
td1 = $('<td colspan="4" style="text-align: right;"></td>"');
var input_save = $('<input type="button" value="Save" style="width:80px;height:25px;" id="btn_savesegment' + segmentindex + '" onclick="SaveSegment(' + segmentindex + ')" />').val(GetTextByKey("P_WO_SAVE", "Save"));
var input_cancel = $('<input type="button" value="Cancel" style="width:80px;height:25px;margin-left:10px;" onclick="CancelSegment(' + segmentindex + ')"/>').val(GetTextByKey("P_WO_CANCEL", "Cancel"));
td1.append(input_save).append(input_cancel);
tr.append(td1);
table.append(tr);
}
div_segments.append(table);
initControl(segmentindex);
$('#tabsegment_' + segmentindex).data('segment', segment);
$('#dialog_segmentuser' + segmentindex).dropdownVal(segment.UserIID);
$('#dialog_segmentdesc' + segmentindex).val(segment.Description);
$('#dialog_segmenthour' + segmentindex).val(segment.Hours === 0 ? "" : segment.Hours);
$('#dialog_segmentnotes' + segmentindex).val(segment.Notes);
$('#dialog_segmentjobsite' + segmentindex).dropdownVal(segment.JobsiteID);
$('#dialog_segmentcost' + segmentindex).val(segment.Cost === 0 ? "" : segment.Cost);
$('#dialog_segmenttype' + segmentindex).dropdownVal(segment.SegmentType);
$('#dialog_segmentcompleted' + segmentindex).prop('checked', segment.Completed);
$('#dialog_segmentcompleteddate' + segmentindex).val(segment.CompletedDateStr);
$('#dialog_segmentcomponent' + segmentindex).dropdownVal(segment.Component);
$('#dialog_segmentbillable' + segmentindex).prop('checked', segment.Billable);
}
function OnAddSegment() {
if (!workorderid || workorderid === "") {
showAlert(GetTextByKey("P_WO_SAVEWORKORDERFIRST", "Please save work order first."), GetTextByKey("P_WO_ADDSEGMENT", "Add Segment"));
return;
}
$('#dialog_segmentuser').dropdownVal('');
$('#dialog_segmentdesc').val('');
$('#dialog_segmenthour').val('');
$('#dialog_segmentnotes').val('');
$('#dialog_segmentjobsite').dropdownVal('');
$('#dialog_segmentcost').val('');
$('#dialog_segmentcompleted').prop('checked', false);
$('#dialog_segmentcompleteddate').val('');
$('#dialog_segmenttype').dropdownVal('');
$('#dialog_segmentcomponent').dropdownVal('');
$('#dialog_segmentbillable').prop('checked', false);
showPopup();
}
function DeleteSegment(index) {
var segment = $('#tabsegment_' + index).data('segment');
if (!segment)
return;
showConfirm(GetTextByKey("P_WO_DOYOUWANTTODELETETHESEGMENT", 'Do you want to delete the segment?'), GetTextByKey("P_WO_DELETESEGMENT", 'Delete Segment'), function () {
worequest("DeleteSegment", segment.SegmentID, function (data) {
GetSegmentDataSource1(function () {
getSegments(getTotalCost);
});
}, function (err) {
showAlert(GetTextByKey("P_WO_FAILEDDELETESEGMENT", 'Failed to delete this segment.'), GetTextByKey("P_WO_DELETESEGMENT", 'Delete Segment'));
});
});
}
function CancelSegment(index) {
var segment = $('#tabsegment_' + index).data('segment');
if (!segment)
return;
$('#dialog_segmentuser' + index).dropdownVal(segment.UserIID);
$('#dialog_segmentdesc' + index).val(segment.Description);
$('#dialog_segmenthour' + index).val(segment.Hours);
$('#dialog_segmentnotes' + index).val(segment.Notes);
$('#dialog_segmentjobsite' + index).dropdownVal(segment.JobsiteID);
$('#dialog_segmentcost' + index).val(segment.Cost);
$('#dialog_segmentcompleted' + index).prop('checked', segment.Completed);
$('#dialog_segmentcompleteddate' + index).val(segment.CompletedDateStr);
$('#dialog_segmenttype' + index).dropdownVal(segment.SegmentType);
$('#dialog_segmentcomponent' + index).dropdownVal(segment.Component);
$('#dialog_segmentbillable' + index).prop('checked', segment.Billable);
}
function SaveSegment(index) {
$('#btn_savesegment' + index).attr('disabled', true);
var segmentid = -1;
var alerttitle = GetTextByKey("P_WO_ADDSEGMENT", "Add Segment");
if (index !== "") {
var alerttitle = GetTextByKey("P_WO_EDITSEGMENT", "Edit Segment");
var segment = $('#tabsegment_' + index).data('segment');
if (!segment)
return;
segmentid = segment.SegmentID;
}
var item = {
'SegmentID': segmentid,
'WorkOrderID': workorderid,
'UserIID': $('#dialog_segmentuser' + index).dropdownVal(),
'Description': $('#dialog_segmentdesc' + index).val(),
'Hours': $('#dialog_segmenthour' + index).val(),
'Notes': $('#dialog_segmentnotes' + index).val(),
'JobsiteID': $('#dialog_segmentjobsite' + index).dropdownVal(),
'Cost': $('#dialog_segmentcost' + index).val(),
'Completed': $('#dialog_segmentcompleted' + index).prop('checked'),
'CompletedDate': $('#dialog_segmentcompleteddate' + index).val(),
'SegmentType': $('#dialog_segmenttype' + index).dropdownVal(),
'Component': $('#dialog_segmentcomponent' + index).dropdownVal(),
'Billable': $('#dialog_segmentbillable' + index).prop('checked')
};
if (item.Description === "" || item.Description.length == 0) {
showAlert(GetTextByKey("P_WO_DESCRIPTIONREQUIRED", 'Description is required.'), alerttitle);
$('#btn_savesegment' + index).attr('disabled', false);
return;
}
if (item.Hours !== "") {
if (isNaN(item.Hours)) {
showAlert(GetTextByKey("P_WO_HOURSFORMATERROR", 'Hours format error.'), alerttitle);
$('#btn_savesegment' + index).attr('disabled', false);
return;
}
else {
if (item.Hours <= 0) {
showAlert(GetTextByKey("P_WO_HOURSMUSTBEGREATERTHAN0", 'Hours must be greater than 0.'), alerttitle);
$('#btn_savesegment' + index).attr('disabled', false);
return;
}
}
}
if (item.Cost !== "") {
if (isNaN(item.Cost)) {
showAlert(GetTextByKey("P_WO_COSTFORMATERROR", 'Cost format error.'), alerttitle);
$('#btn_savesegment' + index).attr('disabled', false);
return;
}
else {
if (item.Cost <= 0) {
showAlert(GetTextByKey("P_WO_COSTMUSTBEGREATERTHAN0", 'Cost must be greater than 0.'), alerttitle);
$('#btn_savesegment' + index).attr('disabled', false);
return;
}
}
}
if (item.Cost === "")
item.Cost = -1;
if (item.Hours === "")
item.Hours = -1;
var param = JSON.stringify(item);
param = htmlencode(param);
worequest("SaveSegment", param, function (data) {
if (typeof (data) === "string") {
$('#btn_savesegment' + index).attr('disabled', false);
showAlert(data, alerttitle);
} else {
$('#btn_savesegment' + index).attr('disabled', false);
if (index !== "") {
showAlert(GetTextByKey("P_WO_SAVSUCCESSFULLY", "Saved successfully."), alerttitle);
}
GetSegmentDataSource1(function () {
getSegments(getTotalCost);
});
hidePopup();
}
}, function (err) {
$('#btn_savesegment' + index).attr('disabled', false);
console.log(err);
showAlert(GetTextByKey("P_WO_FAILEDTOSAVESEGMENT", 'Failed to save segment.'), alerttitle);
});
}
function showPopup() {
$('#popupmask').css('height', $('#dialog_workorder').height());
$('#popupmask').show();
$('#popupdialog').show();
$('#popupdialog').css({
"top": ($("#popupmask").height() - $('#popupdialog').height()) / 2,
"left": ($("#popupmask").width() - $('#popupdialog').width()) / 2
});
$('#dialog_segmentuser').focus();
}
function hidePopup() {
$('#popupmask').hide();
$('#popupdialog').hide();
}

View File

@ -18,6 +18,13 @@
showICContactList(false);
});
$('#sendemailpopupdialog').dialog(function () {
showmaskbg(false);
});
$('#sendicemailpopupdialog').dialog(function () {
showmaskbg(false);
});
});
var machineContacts = [];
@ -40,7 +47,7 @@ function getMachineContacts(assetid) {
function showContactList(newopen) {
var rows = [];
if (machineContacts && machineContacts.length > 0) {
var filter = $('#sendworkorder_search').val().trim().toLowerCase();
var filter = $('#sendworkorder_search').val()?.trim()?.toLowerCase();
var assignedto = $.trim($('#dialog_assignto').val());
for (var i = 0; i < machineContacts.length; i++) {
var r = machineContacts[i];
@ -74,6 +81,7 @@ function showContactList(newopen) {
}
}
}
rows = rows.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });
grid_contactdt.setData(rows);
}
@ -149,19 +157,16 @@ function openSendEmail() {
}
getMachineContacts(mid);
$('#sendemailpopupmask').css('height', $('#dialog_workorder').height());
$('#sendemailpopupmask').css('min-width', $('#divcontent').width());
$('#sendemailpopupmask').show();
$('#sendemailpopupdialog').show();
showmaskbg(true);
$('#sendemailpopupdialog').css({
"top": ($("#sendemailpopupmask").height() - $('#sendemailpopupdialog').height()) / 2,
"left": ($("#sendemailpopupmask").width() - $('#sendemailpopupdialog').width()) / 2
});
'top': (document.documentElement.clientHeight - $('#sendemailpopupdialog').height()) / 3,
'left': (document.documentElement.clientWidth - $('#sendemailpopupdialog').width()) / 2
}).showDialogfixed();
}
function hideSendEmailPopup() {
$('#sendemailpopupmask').hide();
showmaskbg(false);
$('#sendemailpopupdialog').hide();
}
@ -293,6 +298,7 @@ function showICContactList(newopen) {
}
}
}
rows = rows.sort(function (a, b) { return ((b.Text || b.Email) ? 1 : 0) - ((a.Text || a.Email) ? 1 : 0) });
grid_iccontactdt.setData(rows);
}
@ -321,19 +327,16 @@ function openSendICEmail() {
}
getMachineContacts(mid);
$('#sendicemailpopupmask').css('height', $('#dialog_workorder').height());
$('#sendicemailpopupmask').css('min-width', $('#divcontent').width());
$('#sendicemailpopupmask').show();
$('#sendicemailpopupdialog').show();
showmaskbg(true);
$('#sendicemailpopupdialog').css({
"top": ($("#sendicemailpopupmask").height() - $('#sendicemailpopupdialog').height()) / 2,
"left": ($("#sendicemailpopupmask").width() - $('#sendicemailpopupdialog').width()) / 2
});
'top': (document.documentElement.clientHeight - $('#sendicemailpopupdialog').height()) / 3,
'left': (document.documentElement.clientWidth - $('#sendicemailpopupdialog').width()) / 2
}).showDialogfixed();
}
function hideSendICEmailPopup() {
$('#sendicemailpopupmask').hide();
showmaskbg(false);
$('#sendicemailpopupdialog').hide();
}
@ -393,7 +396,10 @@ function onSendInternalComments() {
internal.text = '';
}
hideSendICEmailPopup();
getComments();
if (typeof wowidgetobj != 'undefined')
wowidgetobj.reloaddata("InternalComments");
else
getComments();
}, function (err) {
hideSendICEmailPopup();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,407 @@
var $wowidgetselector = function (id) {
this.containerId = id;
this.title = GetTextByKey("P_XXX", 'Widgets');
this.companyId = null;;
this.forceSingle = false;
this.exceptShareAsset = false;
this.onOK = null;
this.onDialogClosed = null;
this.includechild = true;
this.allowhidden = true;
this.uid = null;
};
(function () {
var __proto = $wowidgetselector.prototype;
function initWidgetsGrid(parent) {
var grid = new GridView(parent);
grid.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var styleFilter = function (item) {
if (item.Suggested) {
return {
//'background-color': 'yellow',
'display': 'block',
'margin': 0,
'box-sizing': 'border-box',
'padding': '0 4px',
'height': '27px',
'line-height': '27px',
'overflow': 'hidden',
'text-overflow': 'ellipsis'
};
}
};
var bgFilter = function (item) {
if (item.Suggested)
return 'yellow';
};
var columns = [];
columns.push({
// checkbox
name: 'check',
key: 'Visible',
width: 45,
align: 'center',
sortable: false,
allcheck: true,
type: 3
},
{
key: 'WidgetName',
caption: 'Name',
width: 300,
styleFilter: styleFilter,
bgFilter: bgFilter
});
//grid.canMultiSelect = true;
grid.columns = columns;
grid.init();
this.gridWidgets = grid;
}
function createDialog() {
var dialog = $('<div class="dialog" style="display: none; width: 550px; height: 440px">').attr('id', this.containerId);
var title = $('<div class="dialog-title"></div>').appendTo(dialog);
title.append($('<span class="title"></span>').text(this.title));
title.append('<em class="dialog-close"></em>');
var content = $('<div class="dialog-content"></div>').appendTo(dialog);
var labeldiv = $('<div style="margin: 4px 0 0 10px; line-height: 25px"></div>').appendTo(content);
$('<span></span>').text(GetTextByKey("P_XXX", 'Which Widgets Should be Displayed?')).appendTo(labeldiv);
this.widgetList = $('<div style="width: 520px; height: 320px; margin: 10px 0 4px"></div>').appendTo(content);
var dialogFunction = $('<div class="dialog-func"></div>').appendTo(dialog);
$('<input type="button" value="' + GetTextByKey("P_SELECTASSETS_CANCEL", "Cancel") + '" class="dialog-close" />').appendTo(dialogFunction).css("height", 'unset');
$('<input type="button" value="' + GetTextByKey("P_SELECTASSETS_OK", "OK") + '" />').click(onOKClick.bind(this)).appendTo(dialogFunction);
$('<div class="clear"></div>').appendTo(dialogFunction);
$('<div class="maskbg" style="display: none"><div class="loading_icon icon c-spin"></div></div>').appendTo(dialog);
// init
initWidgetsGrid.call(this, this.widgetList);
$(document.body).append(dialog);
dialog.dialog(this.onDialogClosed);
return dialog;
}
__proto.showSelector = function (topRatio, force) {
var dialog;
if (force) {
$('#' + this.containerId).remove();
dialog = createDialog.call(this);
} else {
dialog = $('#' + this.containerId);
if (!dialog.length) {
dialog = createDialog.call(this);
}
}
this.dialog = dialog;
dialog.attr('init', '1').css({
'top': (document.documentElement.clientHeight - dialog.height()) / (topRatio || 3),
'left': (document.documentElement.clientWidth - dialog.width()) / 2
}).showDialogfixed();
this.gridWidgets.setData(widgetdata);
onSearch.call(this);
};
function worequest(method, param, callback, error) {
var path = "";
if (_network.root != null && _network.root.length > 0) {
path = "Maintenance/";
}
_network.request(path + "WorkOrderMaintenance.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
});
}
function onSearch() {
var maskbg = this.dialog.find('.maskbg');
maskbg.show();
var gridWidgets = this.gridWidgets;
var title = this.title;
worequest("GetWorkOrderWidgets", "", function (data) {
if (typeof data === 'string') {
showAlert(GetTextByKey("P_XXX", 'Error'), title);
maskbg.hide();
return;
}
var items = [];
for (var i = 0; i < widgetdata.length; i++) {
var item = widgetdata[i].Values;
for (var j = 0; j < data.length; j++) {
if (item.WidgetId == data[j].WidgetId) {
item.Visible = true;
break;
}
}
items.push({ Values: item });
}
gridWidgets.setData(items);
maskbg.hide();
}, function () {
showAlert(GetTextByKey("P_XXXX", 'Failed to get the work order widget list.'), title);
maskbg.hide();
});
}
function onOKClick() {
var widgets = [];
for (var i = 0; i < this.gridWidgets.source.length; i++) {
widgets.push(this.gridWidgets.source[i].Values);
}
var _this = this;
var alerttitle = GetTextByKey("P_WO_XXX", "Save Widgets");
var param = JSON.stringify(widgets);
param = htmlencode(param);
worequest("SaveWorkOrderWidgets", param, function (data) {
if (data !== 'OK') {
showAlert(data, alerttitle);
return;
}
_this.onOK && _this.onOK();
_this.dialog.hideDialog();
showmaskbg(false);
}, function (err) {
});
}
})();
var WorkOrderWidget = function () {
this.workorderid = null;
this.assetid = null;
this.workorderwidgets = null;
this.widgets = {};
this.popups = {};
var _this = this;
this.getWorkOrderWidgets = function () {
this.workorderwidgets = null;
var title = GetTextByKey("P_XXX", 'Widget');
worequest("GetWorkOrderWidgets", "", function (data) {
if (typeof data === 'string') {
showAlert(GetTextByKey("P_XXX", 'Error'), title);
return;
}
_this.workorderwidgets = data;
_this.showWorkOrderWidgets();
_this.getWorkOrderContacts(_this.workorderid);
}, function () {
showAlert(GetTextByKey("P_XXXX", 'Failed to get the work order widget list.'), title);
});
}
this.changeWorkOrder = function (wo) {
window.workorderid = this.workorderid = wo.Id.Value;
window.machineid = this.assetid = wo.AssetId;
this.wo = wo;
if (!this.workorderwidgets) {
this.getWorkOrderWidgets();
} else {
for (let w of this.workorderwidgets) {
if (Object.prototype.hasOwnProperty.call(this.widgets, w.WidgetId)) {
this.widgets[w.WidgetId].changewo(this.workorderid, this.assetid, wo);
}
}
this.getWorkOrderContacts(this.workorderid);
}
}
this.reloadWidgets = function () {
if (this.workorderwidgets != null) {
for (let w of this.workorderwidgets) {
this.popups[w.WidgetId]?.close(false);
if (this.widgets[w.WidgetId] && typeof this.widgets[w.WidgetId].close == 'function')
this.widgets[w.WidgetId].close();
}
}
this.getWorkOrderWidgets();
};
this.onmsgreceived = function (data) {
if (this.workorderwidgets != null) {
if (data && this.workorderid == data.Message) {
if (data.Code == "501") {
for (let w of this.workorderwidgets) {
this.widgets[w.WidgetId].changewo(this.workorderid);
}
this.getWorkOrderContacts(this.workorderid);
}
else if (data.Code == "503" || data.Code == "504" || data.Code == "507") {
this.widgets['CustomerCommunication']?.changewo(this.workorderid);
this.getWorkOrderContacts(this.workorderid);
}
else if (data.Code == "505") {
this.widgets['InternalComments']?.changewo(this.workorderid);
}
else if (data.Code == "506") {
this.getWorkOrderContacts(this.workorderid);
}
else if (data.Code == "502")//delete
{
for (let w of this.workorderwidgets) {
this.popups[w.WidgetId]?.close(false);
if (this.widgets[w.WidgetId] && typeof this.widgets[w.WidgetId].close == 'function')
this.widgets[w.WidgetId].close();
}
this.workorderwidgets = null;
this.popups = [];
this.widgets = [];
}
}
}
};
this.reloaddata = function (widgetid) {
if (this.workorderwidgets != null) {
this.widgets[widgetid]?.changewo(this.workorderid);
}
this.getWorkOrderContacts(this.workorderid);
};
this.showWorkOrderWidgets = function () {
this.defX = 0;
this.defY = 0;
this.currentZIndex = 200 + this.workorderwidgets.length;
for (let w of this.workorderwidgets) {
this.createWidgetDialog(w);
}
}
this.saveWorkOrderWidgets = function (widget, layout) {
widget.Layout = JSON.stringify(layout);
var title = GetTextByKey("P_XXX", 'Widget');
worequest('SaveWorkOrderWidgetLayout', JSON.stringify(widget), function (data) {
if (data === 'OK') {
return;
}
showAlert(data, title);
}, function () {
showAlert(GetTextByKey("P_XXXX", 'Failed to save the work order widget layout.'), title);
});
};
this.getWorkOrderContacts = function (woid) {
worequest('GetWorkOrderContacts', woid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey('P_CUSTOMERRECORD', "Customer Record"));
return;
}
if (_this.workorderwidgets != null) {
for (let w of _this.workorderwidgets) {
if (_this.widgets[w.WidgetId] && typeof _this.widgets[w.WidgetId].updatecontact == 'function')
_this.widgets[w.WidgetId].updatecontact(data);
}
}
}, function () {
});
};
this.createWidgetDialog = function (widget) {
const ui = window['lib-ui'];
let layout = widget.Layout;
if (!layout || layout === '') {
let x = this.defX;
let y = this.defY;
let width = $(document.body).width();
let height = $(document.body).height();
let left = 20 + 320 * x;
if (left + 300 > width) {
x = 0;
left = 20;
y++;
this.defY = y;
}
let top = height - (y == 0 ? 420 : 320 * (y + 1));
x++;
this.defX = x;
layout = { left, top, width: 300, height: 400 };
} else {
layout = JSON.parse(widget.Layout);
}
let zIndex = this.currentZIndex--;
var container = ui.createElement('div', 'class-content');
var _this = this;
const popup = new ui.Popup({
title: widgetdata.find(function (v) { return v.Values.WidgetId == widget.WidgetId })?.Values?.WidgetName,
content: container,
mask: false,
// movable: false,
resizable: true,
collapsable: true,
zIndex,
changeZIndex: true,
minWidth: 210,
minHeight: 200,
buttons: [
//{
// text: 'Loading', trigger: p => {
// p.loading = true;
// setTimeout(() => p.loading = false, 1000);
// return false;
// }
//},
//{ text: 'OK' }
],
onMoveEnded: function () { _this.saveWorkOrderWidgets(widget, popup.rect) },
onResizeEnded: function () { _this.saveWorkOrderWidgets(widget, popup.rect) }
});
popup.show();
popup.rect = layout;
this.popups[widget.WidgetId] = popup;
let options = {
parent: $(container),
canExport: canExport,
showloading: function (flag) {
popup.loading = flag;
}
};
let content;
switch (widget.WidgetId) {
case 'CustomerCommunication':
content = new $wocommunication(options);
let checkLink = ui.createCheckbox({
className: 'check-status-link',
enabled: !content.customer.readonly,
checkedNode: ui.createIcon('fa-regular', 'link'),
uncheckedNode: ui.createIcon('fa-regular', 'unlink'),
onchange: function () {
content.customer.statusLink = this.checked;
ui.setTooltip(checkLink, this.checked ?
GetTextByKey('P_WO_XXXXXX', 'Status Link Included') :
GetTextByKey('P_WO_XXXXXX', 'Status Link Excluded'));
}
});
ui.setTooltip(checkLink, GetTextByKey('P_WO_XXXXXX', 'Status Link Excluded'));
$(checkLink).insertAfter(options.parent.parents('.ui-popup-container').find('.ui-popup-header>.ui-popup-header-title'));
break;
case 'InternalComments': content = new $wointernal(options); break;
case 'Alerts': content = new $woalert(options); break;
case 'Segments': content = new $wosegment(options); break;
case 'Attachments': content = new $woattachment(options); break;
case 'Inspections': content = new $woinspection(options); break;
case 'Estimates': content = new $woestimate(options); break;
case 'Invoices': content = new $woinvoice(options); break;
}
if (content != null) {
this.widgets[widget.WidgetId] = content;
content.changewo(this.workorderid, this.assetid, this.wo);
}
};
}