This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -8,27 +8,6 @@
display: none;
}
.tab-header {
float: left;
padding: 2px 6px;
cursor: pointer;
border: 1px solid #fff;
border-bottom: none;
}
.tab-header:hover {
background: #eee;
}
.tab-header.selected {
border-color: #d8d8d8;
cursor: default;
}
.tab-header.selected:hover {
background: #fff;
}
.label { /*cover tab.css*/
display: table-cell;
}
@ -60,9 +39,9 @@
text-align: right;
}
.dialog, .data-column-header-filter-panel, .data-column-header-filter-bg {
/*.dialog, .data-column-header-filter-panel, .data-column-header-filter-bg {
z-index: 700;
}
}*/
.subtitle {
margin: 20px 40px 5px 0px;
@ -97,7 +76,6 @@
<script src="<%=GetFileUrlWithVersion("js/addcustomerrecord.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var custid = "";
var loadingCount = 0;
var assetid = 0;
var CRReadOnly = <%=CRReadOnly ?"true":"false"%>;
var AllowCanOpenWO = <%=AllowCanOpenWO ?"true":"false"%>;
@ -137,9 +115,9 @@
var customer;
function getCustomerRecordInfo() {
showLoading();
showloading(true);
crrequest("GetCustomerRecordInfo", custid, function (data) {
hideLoading();
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_UM_ERROR", 'Error'));
return;
@ -155,7 +133,7 @@
$('#dialog_salespersonname').val(customer.SalespersonName);
}, function (err) {
hideLoading();
showloading(false);
});
}
@ -191,10 +169,10 @@
return;
}
showmaskbg(true);
showloading(true);
param = htmlencode(JSON.stringify(item));
crrequest("SaveCustomerRecord", param, function (data) {
showmaskbg(false);
showloading(false);
if (typeof (data) === "string") {
showAlert(data, alerttitle);
} else {
@ -215,6 +193,7 @@
OnExit(exit);
}
}, function (err) {
showloading(false);
showAlert(GetTextByKey("P_CR_FAILEDTOSAVECUSTOMER", 'Failed to save customer.'), alerttitle);
});
}
@ -227,6 +206,8 @@
}
var assignmenloaded = false;
var crcomment;
function init(cid, aid) {
custid = cid;
assetid = aid || 0;
@ -237,6 +218,7 @@
$('.comments').hide();
if (custid && custid !== '') {
OnEdit();
createCustomerComment();
getCustomerComments();
$('#tab_header_assignment').show();
$('#btncomments').show();
@ -256,20 +238,40 @@
}
}
function showLoading() {
loadingCount++;
$("#dialogmask").show();
}
function hideLoading() {
loadingCount--;
if (loadingCount === 0)
$("#dialogmask").hide();
}
//*************************Start Comment********************************//
function createCustomerComment() {
crcomment = new window['lib-app'].CustomerRecordComment({
getText: GetTextByKey,
readonly: CRReadOnly,
hasClose: true,
onAddComment: function (comment) {
if ($.trim(comment) == "") {
//showAlert(GetTextByKey("P_FR_PLEASEINPUTTHECOMMENT", "Please input the comment."), GetTextByKey("P_WO_ERROR", 'Error'));
return;
}
var param = JSON.stringify([custid, false, comment]);
param = htmlencode(param);
$('#mask_over_bg').show();
crrequest("SubmitComment", param, function (data) {
$('#mask_over_bg').hide();
if (data !== "") {
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
crcomment.text = '';
getCustomerComments();
}, function () {
$('#mask_over_bg').hide();
});
},
onClose: closeComments
});
$('.comments').empty().append(crcomment.create());
}
function getCustomerComments() {
$('#mask_over_bg').show();
crrequest("GetCustomerComments", custid, function (data) {
@ -278,62 +280,17 @@
return;
}
$("#li_comments").data("loaded", true);
$("#divcomments").empty();
if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) {
var comment = data[i];
showComment(comment, i == 0)
}
}
crcomment.load(data);
}, function (err) {
$('#mask_over_bg').hide();
});
}
function showComment(comment, isfirst) {
var commoentctrl = $("#divcomments");
var div = $("<div class='msgdiv'></div>").appendTo(commoentctrl);
if (isfirst)
div.css("margin-top", 0);
var divuser = $("<div class='msgtime'></div>").appendTo(div);
divuser.append($("<div style='float:left;font-weight: bold;'></div>").text(comment.UserName));
divuser.append($("<div style='float:right;color: #aaa;'></div>").text(comment.SubmitLocalDateStr));
var contentctrl = $("<div style='clear:both;'></div>").appendTo(div);
contentctrl.html(replaceHtmlText(comment.Comment));
}
function addCustomerComment() {
var comment = $('#dialog_comments').val();
if ($.trim(comment) == "") {
showAlert(GetTextByKey("P_FR_PLEASEINPUTTHECOMMENT", "Please input the comment."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
var param = JSON.stringify([custid, false, comment]);
param = htmlencode(param);
$('#mask_over_bg').show();
crrequest("SubmitComment", param, function (data) {
$('#mask_over_bg').hide();
if (data !== "") {
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
$('#dialog_comments').val("");
getCustomerComments();
}, function (err) {
$('#mask_over_bg').hide();
});
}
function OnAddComment() {
addCustomerComment();
}
function openComments() {
if ($('.comments').is(":visible"))
$('.comments').hide();
else
$('.comments').show();
$('.comments').css('display', 'flex');
}
function closeComments() {
@ -345,12 +302,7 @@
//*************************Contact********************************//
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#contactlist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
grid_dt = createGridView('#contactlist');
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_CR_CONTACTNAME", "Contact Name"), valueIndex: 'Name', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'ContactEmail', caption: GetTextByKey("P_CR_CONTACTEMAIL", "Contact Email"), valueIndex: 'Email', css: { 'width': 130, 'text-align': 'left' } },
@ -358,8 +310,8 @@
{ name: 'ContactPreferenceStr', caption: GetTextByKey("P_CR_CONTACTPREFERENCES", "Contact Preferences"), valueIndex: 'ContactPreferenceStr', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'Active', caption: GetTextByKey("P_CR_ACTIVE", "Active"), valueIndex: 'Active', type: 3, css: { 'width': 60, 'text-align': 'center' } },
{ name: 'OptOut', caption: GetTextByKey("P_CR_OPTOUT", "Opt Out"), valueIndex: 'OptOut', type: 3, css: { 'width': 60, 'text-align': 'center' } },
{ name: 'SurveyOptOut', caption: GetTextByKey("P_CR_XXXXXX", "Survey Opt Out"), valueIndex: 'SurveyOptOut', type: 3, css: { 'width': 80, 'text-align': 'center' } },
{ name: 'CanOpenWO', caption: GetTextByKey("P_CR_XXXXXX", "Can Open WO"), valueIndex: 'CanOpenWO', type: 3, css: { 'width': 80, 'text-align': 'center' } },
{ name: 'SurveyOptOut', caption: GetTextByKey("P_CR_SURVEYOPTOUT", "Survey Opt Out"), valueIndex: 'SurveyOptOut', type: 3, css: { 'width': 80, 'text-align': 'center' } },
{ name: 'CanOpenWO', caption: GetTextByKey("P_CR_CANOPENWO", "Can Open WO"), valueIndex: 'CanOpenWO', type: 3, css: { 'width': 80, 'text-align': 'center' } },
{ name: 'Notes', caption: GetTextByKey("P_CR_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
@ -394,9 +346,10 @@
};
}
else if (col.name === "Edit") {
col.isurl = true;
col.text = "\uf044";
col.text = "edit";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.events = {
onclick: function () {
onEditContact();
@ -408,9 +361,10 @@
col.attrs = { 'title': GetTextByKey("P_UM_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "times";
col.events = {
onclick: function () {
onDeleteContact(this);
@ -423,11 +377,11 @@
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.multiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
if (!CRReadOnly)
grid_dt.rowdblclick = onEditContact;
grid_dt.onRowDblClicked = onEditContact;
}
function getContacts() {
@ -448,11 +402,10 @@
var r = data[i];
//for (var j in r) {
// if (j === "Active") {
// r[j] = { DisplayValue: r.Active ? "Yes" : "No", Value: r[j] };
// r[j] = { DisplayValue: r.Active ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No"), Value: r[j] };
// }
//}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_dt.setData(rows);
@ -490,7 +443,7 @@
var index = grid_dt.selectedIndex;
if (index < 0) return;
var contact = grid_dt.source[index].Values;
var contact = grid_dt.source[index];
contactid = contact.Id;
$('#dialog_contactname').val(contact.Name);
$('#dialog_contactpreference').val(contact.ContactPreference);
@ -538,14 +491,22 @@
showAlert(GetTextByKey("P_CR_CONTACTNAMECANNOTBEEMPTY", 'Contact Name cannot be empty.'), alerttitle, undefined, function () { $('#dialog_contactname').focus(); });
return;
}
if ((!item.Email || item.Email.length == 0) && (!item.MobilePhone || item.MobilePhone.length == 0)) {
showAlert(GetTextByKey("P_CR_EMAILANDMOBILEPHONECANNOTBOTHBEEMPTY", 'Email and Mobile Phone cannot both be empty. '), alerttitle);
if ((item.ContactPreference == '0' || item.ContactPreference == '2') && (!item.MobilePhone || item.MobilePhone.length == 0)) {
showAlert(GetTextByKey("P_CR_MOBILECANNOTBEEMPTY", 'Mobile cannot be empty. '), alerttitle, undefined, function () {
$('#dialog_mobile').focus();
});
return;
}
if (item.ContactPreference == '1' && (!item.Email || item.Email.length == 0)) {
showAlert(GetTextByKey("P_CR_EMAILCANNOTBEEMPTY", 'Email cannot both be empty. '), alerttitle, undefined, function () {
$('#dialog_emailaddress').focus();
});
return;
}
if (item.Email !== "" && !isEmail(item.Email)) {
showcontatcmask(true);
showAlert(GetTextByKey("P_CR_EMAILISNOTAVALIDEMAILADDRESS", 'The email address is invalid.'), alerttitle, undefined, function () {
showcontatcmask(false);
$('#dialog_emailaddress').focus();
});
return;
}
@ -596,12 +557,7 @@
var grid_dtfollower;
function InitFollowerGridData() {
grid_dtfollower = new GridView('#followerlist');
grid_dtfollower.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
grid_dtfollower = createGridView('#followerlist');
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_CR_CONTACTNAME", "Contact Name"), valueIndex: 'Name', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'ContactEmail', caption: GetTextByKey("P_CR_CONTACTEMAIL", "Contact Email"), valueIndex: 'Email', css: { 'width': 130, 'text-align': 'left' } },
@ -642,9 +598,10 @@
}
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "times";
col.events = {
onclick: function () {
onDeleteFollower(this);
@ -658,7 +615,7 @@
columns.push(col);
}
grid_dtfollower.canMultiSelect = false;
grid_dtfollower.multiSelect = false;
grid_dtfollower.columns = columns;
grid_dtfollower.init();
}
@ -667,8 +624,7 @@
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_dtfollower.setData(rows);
@ -676,12 +632,7 @@
var grid_allfollower;
function InitAllFollowerGridData() {
grid_allfollower = new GridView('#allfollowerlist');
grid_allfollower.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
grid_allfollower = createGridView('#allfollowerlist');
var list_columns = [
{ name: 'DisplayName', caption: GetTextByKey("P_WO_CONTACTNAME", "Contact Name"), valueIndex: 'DisplayName', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'ContactTypeName', caption: GetTextByKey("P_WO_CONTACTTYPE", "Contact Type"), valueIndex: 'ContactTypeName', css: { 'width': 120, 'text-align': 'left' } },
@ -714,7 +665,7 @@
};
}
}
grid_allfollower.canMultiSelect = false;
grid_allfollower.multiSelect = false;
grid_allfollower.columns = columns;
grid_allfollower.init();
}
@ -730,8 +681,7 @@
r.Text = false;
if (!r.Email)
r.Email = false;
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_allfollower.setData(rows);
@ -790,7 +740,7 @@
}
function onAddFollower() {
var alerttitle = GetTextByKey("P_CR_XXX", 'Add Followers')
var alerttitle = GetTextByKey("P_CR_ADDFOLLOWERS", 'Add Followers')
if (!custid) {
showAlert(GetTextByKey("P_CR_PLEASESAVETHECUSTOMERFIRST", 'Please save the customer first.'), alerttitle, undefined);
return;
@ -817,8 +767,9 @@
function onSaveFollowers() {
var followers = [];
for (var i = 0; i < grid_allfollower.source.length; i++) {
var ct = grid_allfollower.source[i].Values;
var tempsource = grid_allfollower.source;
for (var i = 0; i < tempsource.length; i++) {
var ct = tempsource[i];
if (ct.Email || ct.Text) {
var f = {};
f.Id = -1;
@ -850,11 +801,11 @@
if (!c) {
return;
}
showConfirm(GetTextByKey("P_CR_XXX", 'Do you want to delete this follower?'), GetTextByKey("P_CR_XXXXXX", 'Delete Follower'), function () {
showConfirm(GetTextByKey("P_CR_DOYOUWANTTODELETETHISFOLLOWER", 'Do you want to delete this follower?'), GetTextByKey("P_CR_DELETEFOLLOWERS", 'Delete Follower'), function () {
crrequest('DeleteFollower', c.Id, function (data) {
getFollowers();
}, function (err) {
showAlert(GetTextByKey('P_CR_XXX', 'Failed to delete this follower.'), GetTextByKey("P_CR_DELETECONTACT", 'Delete Contact'));
showAlert(GetTextByKey('P_CR_FAILEDTODELETETHISFOLLOWER', 'Failed to delete this follower.'), GetTextByKey("P_CR_DELETEFOLLOWERS", 'Delete Follower'));
});
});
}
@ -894,6 +845,8 @@
});
$('#sp_searchinputtxt').keydown(searchSalespersonEnter);
$('input[placeholder=Search]').attr("placeholder", GetTextByKey("P_AM_SEARCH", "Search"));
window.onresize = resizeContent;
resizeContent();
});
@ -930,8 +883,8 @@
<input type="text" id="dialog_salespersoncode" tabindex="1" style="width: 296px;" disabled="disabled" autocomplete="off" />
<%if (!CRReadOnly)
{%>
<span class="sbutton iconsearch" style="display: inline; padding: 6px 0px 6px 5px;" onclick="onOpenSalesperson()" data-titlt-lgid="P_CR_SELECTSALESPERSON" title="Select Salesperson"></span>
<span class="sbutton icondelete" style="display: inline; padding: 6px 0px 6px 5px;" onclick="onDeleteSalesperson()" data-titlt-lgid="P_CR_DELETESALESPERSON" title="Delete Salesperson"></span>
<span class="sbutton iconsearch" style="display: inline; padding: 6px 0px 6px 5px;" onclick="onOpenSalesperson()" data-title-lgid="P_CR_SELECTSALESPERSON" title="Select Salesperson"></span>
<span class="sbutton icondelete" style="display: inline; padding: 6px 0px 6px 5px;" onclick="onDeleteSalesperson()" data-title-lgid="P_CR_DELETESALESPERSON" title="Delete Salesperson"></span>
<%}%>
</td>
<td></td>
@ -978,10 +931,10 @@
<div class="subtitle">
<span data-lgid="P_CR_XXX">Following</span>
<span data-lgid="P_CR_FOLLOWING">Following</span>
<%if (!CRReadOnly)
{%>
<span class="sbutton iconadd" style="display: inline;" onclick="onAddFollower()">Add</span>
<span class="sbutton iconadd" style="display: inline;" onclick="onAddFollower()" data-lgid="P_CR_ADD">Add</span>
<%}%>
<hr />
</div>
@ -1012,45 +965,19 @@
<div class="mask_loading dialog" style="display: none;"></div>
<div class="comments" style="display: none; width: 400px; background-color: #f4f4f4; position: absolute; right: 0; top: 0; bottom: 0; box-shadow: #CECACA -4px 0px 6px;">
<div style="padding: 5px 0 5px 10px; background-color: #dcdcdc;">
<span data-lgid="P_CR_COMMENTS">Comments</span>
<em class="spanbtn icondelete" style="float: right; margin-right: 5px; font-size: 14px;" onclick="closeComments()"></em>
</div>
<div style="clear: both;"></div>
<div style="position: absolute; width: 380px; top: 32px; bottom: 1px; right: 10px;">
<div style="left: 2px; top: 5px; height: 106px;">
<table>
<tr>
<td>
<div style="border: solid 1px rgb(123,28,33);">
<textarea id="dialog_comments" maxlength="3000" tabindex="1" style="margin-top: 4px; width: 360px; height: 60px; border: none; outline: none;"></textarea>
<br />
<div style="font-size: 20px; text-align: right; margin-bottom: 3px;">
<%if (!CRReadOnly)
{%>
<span class="spanbtn iconsend" onclick="OnAddComment();"></span>
<%}%>
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="divcomments" style="position: absolute; bottom: 5px; top: 110px; left: 5px; right: 0; overflow: auto;">
</div>
</div>
</div>
<div class="comments" style="display: none; position: absolute; right: 20px; top: 33px; bottom: 0; z-index: 3;"></div>
</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 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">
@ -1090,19 +1017,19 @@
<input type="checkbox" id="dialog_active" checked="checked" tabindex="1" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_CR_XXXXXX">Opt Out:</td>
<td class="label" data-lgid="P_CR_OPTOUT_COLON">Opt Out:</td>
<td>
<input type="checkbox" id="dialog_optout" tabindex="1" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_CR_XXXXXX">Survey Opt Out:</td>
<td class="label" data-lgid="P_CR_SURVEYOPTOUT_COLON">Survey Opt Out:</td>
<td>
<input type="checkbox" id="dialog_surveyoptout" tabindex="1" /></td>
</tr>
<%if (AllowCanOpenWO)
{%>
<tr>
<td class="label" data-lgid="P_CR_XXXXXX">Can Open WO:</td>
<td class="label" data-lgid="P_CR_CANOPENWO_COLON">Can Open WO:</td>
<td>
<input type="checkbox" id="dialog_canopenwo" tabindex="1" /></td>
</tr>
@ -1142,11 +1069,11 @@
<div id="addfollowerpopupmask" class="maskbg" style="display: none;"></div>
<div class="dialog" id="addfollowerpopupdialog" style="display: none; width: 560px;">
<div class="dialog-title"><span class="title" data-lgid="P_WO_XXXXXX">Add Followers</span><em class="dialog-close"></em></div>
<div class="dialog-title"><span class="title" data-lgid="P_CR_ADDFOLLOWERS">Add Followers</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 25px;">
<tr>
<td data-lgid="P_WO_XXXXXX">Who do you want to receive customer notifications?</td>
<td data-lgid="P_CR_WHODOYOUWANTTORECEIVECUSTOMERNOTIFICATIONS">Who do you want to receive customer notifications?</td>
</tr>
<tr>
<td colspan="2">