";
lineHeader = lineHeader + ""+innerItem.header+""+innerItem.subHeader+"
";
lineHeader = lineHeader + ""+
" Description "+
" Catalog Number "+
" Availability "+
" Unit "+
" Your Price "+
" Savings "+
"Qty
"
$(lineHeader).appendTo("#index"+index);
}
var lines="
"+innerItem.displayName+"
";
lines=lines+""+ innerItem.catNumber + " ";
lines=lines+" ";
lines=lines+""+innerItem.uomDescription+" ";
lines=lines+""+ innerItem.contractPrice+" ";
lines=lines+""+ innerItem.totalSavings + " " + "(" + innerItem.savingsPerUnit + " " + innerItem.componentUOM + ") ";
lines=lines+" ";
lines=lines+" ";
lines=lines+" ";
lines=lines+" ";
lines=lines+" ";
jsonAvailability(innerItem.alterSkuId);
$(lines).appendTo("#csmAlter"+index);
});
}
});
});
}
function callCostSavingEventNotificationDetail(skuId){
$.getJSON(
'/store/services/pricing/json/costSavingEventNotification.jsp?originalSkuId='+skuId+'&cheapestAlternativeSkuId='+cheapestAlternativeSkuId+'&type=displayedSuggestionDetail',
function(data){
});
}
function jsonPrice(sku){
var thridPartyAvailabilityParam="";
$.getJSON(
'/store/services/pricing/json/skuPricingAndAvailability.jsp?skuIds='+sku,
function(data){
$.each(data, function(index, item){
item.skuId = item.skuId.replace( /(:|\.|\[|\])/g, "\\\$1" );
if(item.leadTime > 0 && !false){
$("#AVAL"+item.skuId).html('Lead Time: '+ item.leadTime+' Days');
}
else{
$("#AVAL"+item.skuId).html('Call for availability check');
$("#AVAL"+item.skuId).html(item.availabilityDisplayText);
if(shippedFromSupplierFromSupplierTxt==item.availabilityDisplayText){
if ("true" == item.available) {
$("#AVAL"+jqEscapeId(item.skuId.replace(' ','_'))).html('In Stock at Supplier');
}else{
if (thridPartyAvailabilityParam == "") {
thridPartyAvailabilityParam = item.skuId + "~1";
} else {
thridPartyAvailabilityParam += "," + item.skuId + "~1";
}
}
}
}
});
if (thridPartyAvailabilityParam != "") {
$.getJSON(
'/store/services/pricing/json/thirdPartyAvailability.jsp?skuIds=' + thridPartyAvailabilityParam,
function(data){
$.each(data, function(index, item){
if (item.availabilityStatus == 1) {
$("#AVAL"+jqEscapeId(item.skuId.replace(' ','_'))).html('In Stock at Supplier');
} else {
$("#AVAL"+jqEscapeId(item.skuId.replace(' ','_'))).html('Backordered');
}
});
});
}
});
}
function jsonAvailability(sku){
var thridPartyAvailabilityParam1="";
$.getJSON(
'/store/services/pricing/json/skuAvailability.jsp?skuIds='+sku,
function(data){
$.each(data, function(index, item){
item.skuId = item.skuId.replace( /(:|\.|\[|\])/g, "\\\$1" );
if(item.leadTime >0 && !false){
$("#TOD"+item.skuId).html('Lead Time: '+ item.leadTime+' Days');
}
else{
$("#TOD"+item.skuId).html('Call for availability check');
$("#TOD"+item.skuId).html(item.availabilityDisplayText);
if(shippedFromSupplierFromSupplierTxt==item.availabilityDisplayText){
if ("true" == item.available) {
$("#TOD"+jqEscapeId(item.skuId.replace(' ','_'))).html('In Stock at Supplier');
} else{
if (thridPartyAvailabilityParam1 == "") {
thridPartyAvailabilityParam1 = item.skuId + "~1";
} else {
thridPartyAvailabilityParam1 += "," + item.skuId + "~1";
}
}
}
}
});
if (thridPartyAvailabilityParam1 != "") {
$.getJSON(
'/store/services/pricing/json/thirdPartyAvailability.jsp?skuIds=' + thridPartyAvailabilityParam1,
function(data){
$.each(data, function(index, item){
if (item.availabilityStatus == 1) {
$("#TOD"+jqEscapeId(item.skuId.replace(' ','_'))).html('In Stock at Supplier');
} else {
$("#TOD"+jqEscapeId(item.skuId.replace(' ','_'))).html('Backordered');
}
});
});
}
});
}
function showMore() {
$('tr.ShowAdditionalProducts').hide();
$('tr.AdditionalProducts').show();
//$(".CompareTextShowMore").hide();
//$(".CompareTextShowLess").show();
$("#showLess").show();
}
function showLess() {
$('tr.ShowAdditionalProducts').show();
$('tr.AdditionalProducts').hide();
//$(".CompareTextShowMore").show();
//$(".CompareTextShowLess").hide();
$("#showLess").hide();
}
function checkCSMqty() {
var b;
var c = false;
var count = 0;
var errorMessage = "";
var isBtnSubmitted=$("#isBtnSubmitted").val();
if(false == true){
var originalSkuQty = $('#originalProductQty').val();
}else{
var originalSkuQty = $('#'+costSavingSkuId).val();
}
$(".inputboxCSM").each(function() {
var a = $(this).val();
var currId = $(this).attr('id');
if (a == 0) {
b = false;
} else {
c = true;
if(isBtnSubmitted == "false"){
if(currId!=costSavingSkuId){
setTimeout(function(){
$.getJSON(
'/store/services/pricing/json/costSavingEventNotification.jsp?originalSkuId='+costSavingSkuId+'&originalSkuQty='+originalSkuQty+'&selectedAlternativeSkuId='+currId+'&selectedSkuQty='+a+'&cheapestAlternativeSkuId='+cheapestAlternativeSkuId+'&type=addedSuggestionToCart',
function(data){
});
count++;
},100);
}
}
}
});
if (c == false) {
errorMessage='Please Enter Quantity atleast one product.';
$('#errorMsgCSM').html(errorMessage);
$('#errorMsgCSM').css("font-size", "12px");
$('#errorMsgCSM').css("color", "red");
return false;
}
if(isBtnSubmitted == "false" && c == true){
$("#isBtnSubmitted").val("true");
return true;
}else{
return false;
}
}
function goToComparepage(sourcePage) {
var count = 0;
var catNums = "";
var alternativeSkuIds = "";
var thumbnail = "";
var errorMessage = "";
var qty = $("#originalProductQty").val();
$("input[name='checkbox1']")
.each(
function() {
if (this.checked) {
count++;
if (count > 3) {
errorMessage='Please select no more then three Products to Compare.';
$('#errorMsgCSM')
.html(errorMessage);
$('#errorMsgCSM').css(
"font-size", "12px");
$('#errorMsgCSM').css("color",
"red");
catNums = "";
return false;
}
if (count 31 && (charCode 57)) {
return false;
} else {
return true;
}
}