Subversion Repositories SmartDukaan

Rev

Rev 11971 | Rev 12027 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11971 Rev 12026
Line 46... Line 46...
46
			var installment = sellingPrice*r*Math.pow(1+r,opt.tenure)/(Math.pow(1+r,opt.tenure) - 1);
46
			var installment = sellingPrice*r*Math.pow(1+r,opt.tenure)/(Math.pow(1+r,opt.tenure) - 1);
47
			bankTenure.monthlyEmi =  (Math.round(installment*100)/100).toFixed(2);
47
			bankTenure.monthlyEmi =  (Math.round(installment*100)/100).toFixed(2);
48
			bankTenure.interestRate = opt.interestRate;
48
			bankTenure.interestRate = opt.interestRate;
49
			if(minEmi > installment){
49
			if(minEmi > installment){
50
				minEmi = installment;
50
				minEmi = installment;
-
 
51
				EMI.interestRate = r;
-
 
52
				EMI.tenure = opt.tenure; 
51
				EMI.lowestEmiBank = opt.bankId;
53
				EMI.lowestEmiBank = opt.bankId;
52
			}
54
			}
53
			bank.emis[opt.id] = bankTenure;
55
			bank.emis[opt.id] = bankTenure;
54
		}
56
		}
55
	});
57
	});
Line 63... Line 65...
63
		}
65
		}
64
	});
66
	});
65
	
67
	
66
	bankEle.find("input[type='radio']").click(onBankClicked);
68
	bankEle.find("input[type='radio']").click(onBankClicked);
67
		
69
		
68
	jQuery("#emi_more").click(function(){
70
	jQuery("#emi_more,#emi_more1").click(function(){
69
		
71
		
70
		$.colorbox({
72
		$.colorbox({
71
			inline:true, 
73
			inline:true, 
72
			href:"#emiLightBox",
74
			href:"#emiLightBox",
73
    		width:"600px",
75
    		width:"600px",
Line 363... Line 365...
363
		    }
365
		    }
364
		});
366
		});
365
	}
367
	}
366
}
368
}
367
function onColorSelectorChange(itemid){
369
function onColorSelectorChange(itemid){
-
 
370
	if(typeof privateDeals[itemid]== "undefined") {
-
 
371
		sellingPrice = Number(PARAMETERS[itemid].SP); 
368
	if($('#sp').length>0){
372
		if($('#sp').length>0){
369
		$('#sp').html(PARAMETERS[itemid].SP);
373
			$('#sp').html(PARAMETERS[itemid].SP);
370
		$('#mrp').html(PARAMETERS[itemid].MRP);
374
			$('#mrp').html(PARAMETERS[itemid].MRP);
371
		$('#saving').html(PARAMETERS[itemid].SAVING);
375
			$('#saving').html(PARAMETERS[itemid].SAVING);
372
		$("#item_id").val(itemid);
376
			$("#item_id").val(itemid);
-
 
377
		}
-
 
378
		$('div.mk_deal').fadeout('fast');
-
 
379
		$('div.mk_nodeal').show();
-
 
380
	} else {
-
 
381
		var itemp = privateDeals[itemid];
-
 
382
		sellingPrice = itemp.dealPojo.dealPrice;
-
 
383
		var installment = sellingPrice*r*Math.pow(1+r,opt.tenure)/(Math.pow(1+r,opt.tenure) - 1); 
-
 
384
		if(typeof itemp.mrp == "undefined" or itemp.mrp =="") itemp.mrp = itemp.sellingPrice
-
 
385
		var percentoff = Math.round((1-itemp.dealPojo.dealPrice/itemp.mrp)*100);
-
 
386
		var dealLeft = '';
-
 
387
		var dealRight = '';
-
 
388
		if(itemp.dealPojo.dealTextOption==0){
-
 
389
			dealRight = itemp.bestDealText;
-
 
390
		}else if(itemp.dealPojo.dealTextOption==1){
-
 
391
			dealLeft=itemp.bestDealText;
-
 
392
		}else {
-
 
393
			dealRight=itemp.bestDealText;
-
 
394
			dealLeft = itemp.dealPojo.dealText
-
 
395
		}
-
 
396
		
-
 
397
		var html = [];
-
 
398
		html.push('<div style="color:yellow;padding:3px">');
-
 
399
		html.push('<div class="left"><div><b>Only for You: </b><spap class="red">Rs.' + itemp.selling + '</span> (' + percentoff + '% Off) </div>');
-
 
400
		<div class="red" style="font-weight:bold;padding-bottom:6px">Get Free 8GB MicroSD card &amp; Leather Pouch.</div>
-
 
401
		if(dealLeft != ''){
-
 
402
			html.push('<div class="red" style="font-weight:bold;padding-bottom:6px">' + dealLeft +'</div>');
-
 
403
		}
-
 
404
		html.push('<div class="red" style="font-weight:bold;padding-bottom:6px">Use Coupon: saholicdeals</div>');
-
 
405
		html.push('</div>');
-
 
406
		html.push('<div class="right">');
-
 
407
		html.push('<div class="left rupeeimage"></div><span class="mrp bold">'+ itemp.mrp +'</span>');
-
 
408
		if(itemp.mrp!=itemp.sellingPrice) {
-
 
409
			html.push('<span class="mrp bold">'+ itemp.sellingPrice +'</span>');
-
 
410
		}
-
 
411
		if(dealRight != ''){
-
 
412
			html.push('<div style="font-weight:bold;padding-bottom:6px;text-decoration:line-through">' + dealRight +'</div>');
-
 
413
		}
-
 
414
		html.push('<div><span class="mk_emi" style="font-size: 14px;"> | EMIs from <span class="red">Rs.' + installment +'</span> per month<a style="padding-left:2px" href="javascript:void(0)" id="emi_more1"><img style="vertical-align: middle;" src="/unversioned/images/quesmark.png"></a></span></div>')
-
 
415
		html.push('</div>');
-
 
416
		html.push('</div>');
373
	}
417
	}
374
}
418
}
375
 
419
 
376
banks = {};
420
banks = {};
377
var first = true;
421
var first = true;
Line 408... Line 452...
408
         ++count;
452
         ++count;
409
      }
453
      }
410
   }
454
   }
411
   return count;
455
   return count;
412
}
456
}
413
 
-
 
-
 
457
privateDeals={};
414
if(typeof prodJson!="undefined"){
458
if(typeof prodJson!="undefined"){
415
	privateDeals=[];
-
 
416
	for(i in prodJson.response.itemPojos){
459
	for(i in prodJson.response.itemPojos){
417
		var deal = prodJson.response.itemPojos[i].dealPojo;
460
		var deal = prodJson.response.itemPojos[i].dealPojo;
418
		if (typeof deal != "undefined"){
461
		if (typeof deal != "undefined"){
419
			privateDeals.push(deal);
462
			privateDeals[itemPojos[i].id] = itemPojos[i];
420
		}
463
		}
421
	}
464
	}
-
 
465
}
-
 
466
 
422
	if(privateDeals.length>0){
467
function highlightDeal(){
423
	}
468
		
424
}
469
}
425
470