Subversion Repositories SmartDukaan

Rev

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

Rev 6903 Rev 6912
Line 6... Line 6...
6
		changeEstimate();
6
		changeEstimate();
7
	}
7
	}
8
	
8
	
9
	$('.wantInsurance').change( function() {
9
	$('.wantInsurance').change( function() {
10
		productId = $(this).parents('tr').prev().attr('id');
10
		productId = $(this).parents('tr').prev().attr('id');
-
 
11
		if(this.checked) {
-
 
12
			trackEventWithGA('Insurance', 'Want Insurance', productId);
-
 
13
		}
11
		totalPrice = $('#totalAmountColumn').text();
14
		totalPrice = $('#totalAmountColumn').text();
12
		var initialPrice = parseFloat(totalPrice.replace(/,/g, ''));
15
		var initialPrice = parseFloat(totalPrice.replace(/,/g, ''));
13
		var initalNetPrice = 0.0;
16
		var initalNetPrice = 0.0;
14
		if($('#discountedAmount').length != 0) {
17
		if($('#discountedAmount').length != 0) {
15
			initalNetPrice = parseFloat($('#discountedAmount').text().replace(/,/g, ''));
18
			initalNetPrice = parseFloat($('#discountedAmount').text().replace(/,/g, ''));
Line 92... Line 95...
92
	
95
	
93
	$('.agreeInsuranceTnc').change(function() {
96
	$('.agreeInsuranceTnc').change(function() {
94
		$('.agreeInsuranceTnc').attr('disabled', 'disabled');
97
		$('.agreeInsuranceTnc').attr('disabled', 'disabled');
95
		$('.wantInsurance').attr('disabled', 'disabled');
98
		$('.wantInsurance').attr('disabled', 'disabled');
96
		productId = $(this).attr('itemId');
99
		productId = $(this).attr('itemId');
-
 
100
		if(this.checked){
-
 
101
			trackEventWithGA('Insurance', 'Agreed to Terms', productId);
-
 
102
		}
97
		jQuery.ajax({
103
		jQuery.ajax({
98
			type: "POST",
104
			type: "POST",
99
			url: "/cart!insureItem",
105
			url: "/cart!insureItem",
100
			data: "toInsure=" + this.checked + "&productId=" + productId + "&quantity=" + $(this).attr('quantity'),
106
			data: "toInsure=" + this.checked + "&productId=" + productId + "&quantity=" + $(this).attr('quantity'),
101
			success: function(response){
107
			success: function(response){
Line 277... Line 283...
277
    		}
283
    		}
278
    	});
284
    	});
279
	});
285
	});
280
	
286
	
281
	$('#proceedToPay').click(function(){
287
	$('#proceedToPay').click(function(){
-
 
288
		if($('#insuranceDetailsForm:hidden').length == 0) {
-
 
289
			alert("Please submit the insurance details first");
-
 
290
			return false;
-
 
291
		}
-
 
292
		
282
		if(($('#store-addresses').find('.default-address').attr('zone') !=  $('#zone-selector').val()) && ($("#tabSelector").val() == "HotSpot")) {
293
		if(($('#store-addresses').find('.default-address').attr('zone') !=  $('#zone-selector').val()) && ($("#tabSelector").val() == "HotSpot")) {
283
			alert("Please select one store address");
294
			alert("Please select one store address");
284
			return false;
295
			return false;
285
		}
296
		}
286
		var canProceedToPay = parseInt($('#canProceedToPay').val());
297
		var canProceedToPay = parseInt($('#canProceedToPay').val());
Line 347... Line 358...
347
			});
358
			});
348
		}
359
		}
349
	});
360
	});
350
	
361
	
351
	$('#submitAddress').click(function(){
362
	$('#submitAddress').click(function(){
-
 
363
		if($('#guardianName').length > 0 && $('#guardianName').val() === '') {
-
 
364
			alert('Please enter the name of your Father/Husband');
-
 
365
			return false;
-
 
366
		}
-
 
367
		if($('#dob').length > 0 && ($('#dob').val() === '' || $('#dob').val() === 'Example: 18/08/1986')) {
-
 
368
			alert('Please enter your date of birth');
-
 
369
			return false;
-
 
370
		}
-
 
371
		
-
 
372
		if($('#dob').length > 0) {
-
 
373
			if(!validateDob()) {
-
 
374
				return false;
-
 
375
			}
-
 
376
		}
-
 
377
		
-
 
378
		
352
		$('#frmShippingAddress').submit();
379
		$('#frmShippingAddress').submit();
353
	});
380
	});
354
	
381
	
355
	$('#addAddress').live('click', function(){
382
	$('#addAddress').live('click', function(){
356
		showAddAddressForm();
383
		showAddAddressForm();