Subversion Repositories SmartDukaan

Rev

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

Rev 24976 Rev 24992
Line 38... Line 38...
38
 
38
 
39
$(document).ajaxComplete(function() {
39
$(document).ajaxComplete(function() {
40
	if (typeof loaderDialogObj != "undefined")
40
	if (typeof loaderDialogObj != "undefined")
41
		loaderDialogObj.modal('hide');
41
		loaderDialogObj.modal('hide');
42
});
42
});
43
function ajaxStartHandler(){
43
function ajaxStartHandler() {
44
	if (typeof loaderDialogObj != "undefined")
44
	if (typeof loaderDialogObj != "undefined")
45
		loaderDialogObj.modal('show');
45
		loaderDialogObj.modal('show');
46
	if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
46
	if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
47
			&& $('#order-details').length == 0) {
47
			&& $('#order-details').length == 0) {
48
		var investmentDialog = bootbox.dialog({
48
		var investmentDialog = bootbox
-
 
49
				.dialog({
49
				title : '<h3	class="text-danger">ATTENTION!! ORDERING THROUGH APP MAY BE BLOCKED DUE TO LOW INVESTMENTS!</h3>',
50
					title : '<h3	class="text-danger">ATTENTION!! ORDERING THROUGH APP MAY BE BLOCKED DUE TO LOW INVESTMENTS!</h3>',
50
				message : "<h3>Dear Partner, your investments are low by "
51
					message : "<h3>Dear Partner, your investments are low by "
51
						+ shortPercentage
52
							+ shortPercentage
52
						+ "%</h3>"
53
							+ "%</h3>"
53
						+ "<dl>"
54
							+ "<dl>"
54
						+ "<dt>Investment Should be</dt><dd>- "
55
							+ "<dt>Investment Should be</dt><dd>- "
55
						+ minimumInvestmentAmount
56
							+ minimumInvestmentAmount
56
						+ "</dd>"
57
							+ "</dd>"
57
						+ "<dt>Total Invested Amount</dt><dd>-"
58
							+ "<dt>Total Invested Amount</dt><dd>-"
58
						+ totalInvestedAmount
59
							+ totalInvestedAmount
59
						+ "</dd>"
60
							+ "</dd>"
60
						+ '<dt>Investment Amount Short By</dt><dd class="text-danger lead">-  '
61
							+ '<dt>Investment Amount Short By</dt><dd class="text-danger lead">-  '
61
						+ shortAmount
62
							+ shortAmount
62
						+ '</dd></dl>'
63
							+ '</dd></dl>'
63
						+ '<pre class="text-danger" style="font-size:18px;"><strong>To unblock your Billing, please \nadd Rs.'
64
							+ '<pre class="text-danger" style="font-size:18px;"><strong>To unblock your Billing, please \nadd Rs.'
64
						+ minAmountToBeAdded
65
							+ minAmountToBeAdded
65
						+ ' to wallet immediately.</strong></pre>',
66
							+ ' to wallet immediately.</strong></pre>',
66
				buttons : {
67
					buttons : {
67
					cancel : {
68
						cancel : {
68
						label : "OK",
69
							label : "OK",
69
						className : 'btn-primary'
70
							className : 'btn-primary'
-
 
71
						}
70
					}
72
					}
71
				}
-
 
72
		});
73
				});
73
		investmentDialog.on('shown.bs.modal', function() {
74
		investmentDialog.on('shown.bs.modal', function() {
74
				var dialogEl = investmentDialog
75
			var dialogEl = investmentDialog.find('.modal-content')[0];
75
						.find('.modal-content')[0];
-
 
76
				var dialogRect = dialogEl
-
 
77
						.getBoundingClientRect();
76
			var dialogRect = dialogEl.getBoundingClientRect();
78
				var height = window.innerHeight
77
			var height = window.innerHeight - dialogRect.height;
79
						- dialogRect.height;
-
 
80
				var width = window.innerWidth
78
			var width = window.innerWidth - dialogRect.width;
81
						- dialogRect.width;
-
 
82
				var left = Math
-
 
83
						.floor(Math.random() * width)
79
			var left = Math.floor(Math.random() * width) - dialogRect.left
84
						- dialogRect.left
-
 
85
				var top = Math
-
 
86
						.floor(Math.random() * height)
80
			var top = Math.floor(Math.random() * height) - dialogRect.top
87
						- dialogRect.top
-
 
88
				$(dialogEl).css("left", left).css("top",
81
			$(dialogEl).css("left", left).css("top", top);
89
						top);
-
 
90
		});
82
		});
91
	}
83
	}
92
}
84
}
93
$(document).ajaxStart(ajaxStartHandler);
85
$(document).ajaxStart(ajaxStartHandler);
94
 
86
 
Line 367... Line 359...
367
	});
359
	});
368
 
360
 
369
}
361
}
370
 
362
 
371
function numberToComma(x) {
363
function numberToComma(x) {
372
	x = parseInt(x);
-
 
-
 
364
 
373
	x = x.toString();
365
	x = x.toString();
-
 
366
	x = x.split('.');
-
 
367
	var x1 = x[0];
-
 
368
	var x2 = x.length > 1 ? '.' + x[1] : '';
374
	var lastThree = x.substring(x.length - 3);
369
	var lastThree = x1.substring(x1.length - 3);
-
 
370
	console.log(lastThree)
375
	var otherNumbers = x.substring(0, x.length - 3);
371
	var otherNumbers = x1.substring(0, x1.length - 3);
376
	if (otherNumbers != '')
372
	if (otherNumbers != '')
377
		lastThree = ',' + lastThree;
373
		lastThree = ',' + lastThree;
378
	return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
374
	return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
-
 
375
			+ x2;
-
 
376
 
379
}
377
}
380
 
378
 
381
function dateRangeCallback(start, end) {
379
function dateRangeCallback(start, end) {
382
	startMoment = start;
380
	startMoment = start;
383
	endMoment = end;
381
	endMoment = end;