Subversion Repositories SmartDukaan

Rev

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

Rev 24649 Rev 24976
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
 
-
 
44
$(document)
-
 
45
		.ajaxStart(
43
function ajaxStartHandler(){
46
				function() {
-
 
47
					if (typeof loaderDialogObj != "undefined")
44
	if (typeof loaderDialogObj != "undefined")
48
						loaderDialogObj.modal('show');
45
		loaderDialogObj.modal('show');
49
					if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
46
	if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
50
							&& $('#order-details').length == 0) {
47
			&& $('#order-details').length == 0) {
51
						var investmentDialog = bootbox
48
		var investmentDialog = bootbox.dialog({
52
								.dialog({
-
 
53
									title : '<h3	class="text-danger">ATTENTION!! ORDERING THROUGH APP MAY BE BLOCKED DUE TO LOW INVESTMENTS!</h3>',
49
				title : '<h3	class="text-danger">ATTENTION!! ORDERING THROUGH APP MAY BE BLOCKED DUE TO LOW INVESTMENTS!</h3>',
54
									message : "<h3>Dear Partner, your investments are low by "
50
				message : "<h3>Dear Partner, your investments are low by "
55
											+ shortPercentage
51
						+ shortPercentage
56
											+ "%</h3>"
52
						+ "%</h3>"
57
											+ "<dl>"
53
						+ "<dl>"
58
											+ "<dt>Investment Should be</dt><dd>- "
54
						+ "<dt>Investment Should be</dt><dd>- "
59
											+ minimumInvestmentAmount
55
						+ minimumInvestmentAmount
60
											+ "</dd>"
56
						+ "</dd>"
61
											+ "<dt>Total Invested Amount</dt><dd>-"
57
						+ "<dt>Total Invested Amount</dt><dd>-"
62
											+ totalInvestedAmount
58
						+ totalInvestedAmount
63
											+ "</dd>"
59
						+ "</dd>"
64
											+ '<dt>Investment Amount Short By</dt><dd class="text-danger lead">-  '
60
						+ '<dt>Investment Amount Short By</dt><dd class="text-danger lead">-  '
65
											+ shortAmount
61
						+ shortAmount
66
											+ '</dd></dl>'
62
						+ '</dd></dl>'
67
											+ '<pre class="text-danger" style="font-size:18px;"><strong>To unblock your Billing, please \nadd Rs.'
63
						+ '<pre class="text-danger" style="font-size:18px;"><strong>To unblock your Billing, please \nadd Rs.'
68
											+ minAmountToBeAdded
64
						+ minAmountToBeAdded
69
											+ ' to wallet immediately.</strong></pre>',
65
						+ ' to wallet immediately.</strong></pre>',
70
									buttons : {
66
				buttons : {
71
										cancel : {
67
					cancel : {
72
											label : "OK",
68
						label : "OK",
73
											className : 'btn-primary'
69
						className : 'btn-primary'
74
										}
-
 
75
									},
-
 
76
								});
-
 
77
						investmentDialog.on('shown.bs.modal',
-
 
78
								function() {
-
 
79
									var dialogEl = investmentDialog
-
 
80
											.find('.modal-content')[0];
-
 
81
									var dialogRect = dialogEl
-
 
82
											.getBoundingClientRect();
-
 
83
									var height = window.innerHeight
-
 
84
											- dialogRect.height;
-
 
85
									var width = window.innerWidth
-
 
86
											- dialogRect.width;
-
 
87
									var left = Math
-
 
88
											.floor(Math.random() * width)
-
 
89
											- dialogRect.left
-
 
90
									var top = Math
-
 
91
											.floor(Math.random() * height)
-
 
92
											- dialogRect.top
-
 
93
									$(dialogEl).css("left", left).css("top",
-
 
94
											top);
-
 
95
								});
-
 
96
					}
70
					}
-
 
71
				}
97
				});
72
		});
-
 
73
		investmentDialog.on('shown.bs.modal', function() {
-
 
74
				var dialogEl = investmentDialog
-
 
75
						.find('.modal-content')[0];
-
 
76
				var dialogRect = dialogEl
-
 
77
						.getBoundingClientRect();
-
 
78
				var height = window.innerHeight
-
 
79
						- dialogRect.height;
-
 
80
				var width = window.innerWidth
-
 
81
						- dialogRect.width;
-
 
82
				var left = Math
-
 
83
						.floor(Math.random() * width)
-
 
84
						- dialogRect.left
-
 
85
				var top = Math
-
 
86
						.floor(Math.random() * height)
-
 
87
						- dialogRect.top
-
 
88
				$(dialogEl).css("left", left).css("top",
-
 
89
						top);
-
 
90
		});
-
 
91
	}
-
 
92
}
-
 
93
$(document).ajaxStart(ajaxStartHandler);
98
 
94
 
99
function doAjaxRequestWithParamsHandler(urlString, httpType, params,
95
function doAjaxRequestWithParamsHandler(urlString, httpType, params,
100
		callback_function) {
96
		callback_function) {
101
	$.ajax({
97
	$.ajax({
102
		url : urlString,
98
		url : urlString,
Line 265... Line 261...
265
			} else {
261
			} else {
266
				xhttp.responseType = "text";
262
				xhttp.responseType = "text";
267
			}
263
			}
268
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
264
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
269
			// Trick for making downloadable link
265
			// Trick for making downloadable link
-
 
266
			if (typeof loaderDialogObj != "undefined")
-
 
267
				loaderDialogObj.modal('hide');
270
			a = document.createElement('a');
268
			a = document.createElement('a');
271
			a.href = window.URL.createObjectURL(xhttp.response);
269
			a.href = window.URL.createObjectURL(xhttp.response);
272
			// Give filename you wish to download
270
			// Give filename you wish to download
273
			a.download = fileName;
271
			a.download = fileName;
274
			a.style.display = 'none';
272
			a.style.display = 'none';
275
			document.body.appendChild(a);
273
			document.body.appendChild(a);
276
			a.click();
274
			a.click();
277
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
275
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
-
 
276
			if (typeof loaderDialogObj != "undefined")
-
 
277
				loaderDialogObj.modal('hide');
278
			badRequestAlert(xhttp);
278
			badRequestAlert(xhttp);
279
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
279
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
-
 
280
			if (typeof loaderDialogObj != "undefined")
-
 
281
				loaderDialogObj.modal('hide');
280
			internalServerErrorAlert(xhttp);
282
			internalServerErrorAlert(xhttp);
281
		}
283
		}
282
	};
284
	};
283
	// Post data to URL which handles post request
285
	// Post data to URL which handles post request
284
	xhttp.open(httpType, urlString);
286
	xhttp.open(httpType, urlString);