Subversion Repositories SmartDukaan

Rev

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

Rev 23921 Rev 23946
Line 18... Line 18...
18
		'message : '+errorObject.message);
18
		'message : '+errorObject.message);
19
}
19
}
20
 
20
 
21
$( document ).ajaxError(function(event, jqxhr, settings, thrownError) {
21
$( document ).ajaxError(function(event, jqxhr, settings, thrownError) {
22
	// $( ".log" ).text( "Triggered ajaxError handler." );
22
	// $( ".log" ).text( "Triggered ajaxError handler." );
-
 
23
	loaderDialogObj.modal('hide');
23
	if(jqxhr.status == 400){
24
	if(jqxhr.status == 400){
24
		// $('#error-prompt-model').modal();
25
		// $('#error-prompt-model').modal();
25
		badRequestAlert(jqxhr);	
26
		badRequestAlert(jqxhr);	
26
	}else{
27
	}else{
27
		internalServerErrorAlert(jqxhr);
28
		internalServerErrorAlert(jqxhr);
28
	}
29
	}
29
});
30
});
30
 
31
 
-
 
32
$(document).ajaxComplete(function(){
-
 
33
	loaderDialogObj.modal('hide');
-
 
34
});
-
 
35
 
31
$( document ).ajaxStart(function() {
36
$( document ).ajaxStart(function() {
-
 
37
		loaderDialogObj.modal('show');
32
		if(typeof showAlert !="undefined" && showAlert && $('#order-details').length == 0) {
38
		if(typeof showAlert !="undefined" && showAlert && $('#order-details').length == 0) {
33
			bootbox.dialog({
39
			var investmentDialog = bootbox.dialog({
34
				title: '<h3	class="text-danger">ATTENTION! LOW INVESTMENT ALERT!</h3>',
40
				title: '<h3	class="text-danger">ATTENTION! LOW INVESTMENT ALERT!</h3>',
35
				message : "<h3>Dear Partner, your investment is below 90%</h3>"
41
				message : "<h3>Dear Partner, your investment is below 90%</h3>"
36
					+  "<dl>"
42
					+  "<dl>"
37
					+  "<dt>Total Investment Required</dt><dd>- " + minimumInvestmentAmount +"</dd>"
43
					+  "<dt>Total Investment Required</dt><dd>- " + minimumInvestmentAmount +"</dd>"
38
					+ "<dt>Total Invested Amount</dt><dd>-" + totalInvestedAmount +"</dd>"
44
					+ "<dt>Total Invested Amount</dt><dd>-" + totalInvestedAmount +"</dd>"
Line 42... Line 48...
42
			 			cancel: {
48
			 			cancel: {
43
			 				label: "OK",
49
			 				label: "OK",
44
			 		        className: 'btn-primary'
50
			 		        className: 'btn-primary'
45
			 			}
51
			 			}
46
			 		},
52
			 		},
47
			 	
53
			});
-
 
54
			investmentDialog.on('shown.bs.modal', function(){
-
 
55
				var dialogEl = investmentDialog.find('.modal-content')[0];
-
 
56
				var dialogRect = dialogEl.getBoundingClientRect();
-
 
57
				var height = window.innerHeight - dialogRect.height;
-
 
58
				var width = window.innerWidth - dialogRect.width;
-
 
59
				var left = Math.floor(Math.random()*width) - dialogRect.left
-
 
60
				var top = Math.floor(Math.random()*height) - dialogRect.top
-
 
61
				$(dialogEl).css("left",left).css("top",top);
48
			});
62
			});
49
		}
63
		}
50
	});
64
	});
51
 
65
 
52
 
66
 
Line 358... Line 372...
358
         }
372
         }
359
	}
373
	}
360
	return rangedDatePicker;
374
	return rangedDatePicker;
361
}
375
}
362
$(function(){
376
$(function(){
-
 
377
	if (typeof latitude=="undefined" && navigator.geolocation && typeof latitude=="undefined") {
-
 
378
        navigator.geolocation.getCurrentPosition(showPosition);
-
 
379
    } else { 
-
 
380
        console.log("Geolocation is not supported by browser.");
-
 
381
    }
363
	dateRangeCallback(moment(),moment());
382
	dateRangeCallback(moment(),moment());
364
})
-
 
365
383
	loaderDialogObj = bootbox.dialog({
-
 
384
	    message: '<div class="container text-center"><i class="text-large fa fa-spinner"></i>Loading...</4>',
-
 
385
	    show: false	
-
 
386
	});
-
 
387
});
-
 
388
 
-
 
389
function showPosition(position) {
-
 
390
	var coords = {latitude:position.coords.latitude, longitude:position.coords.longitude}
-
 
391
	doAjaxRequestWithJsonHandler('partner/location', 'PUT', JSON.stringify(coords), function(){location.reload()});
-
 
392
}
-
 
393
366
394