Subversion Repositories SmartDukaan

Rev

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

Rev 27022 Rev 27355
Line 25... Line 25...
25
			+ errorObject.rejectedValue + '\n' + 'message : '
25
			+ errorObject.rejectedValue + '\n' + 'message : '
26
			+ errorObject.message);
26
			+ errorObject.message);
27
}
27
}
28
 
28
 
29
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
29
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
30
	if (typeof loaderDialogObj != "undefined")
30
	if (typeof loaderDialogObj != "undefined") {
31
		{
-
 
32
			loaderDialogObj.modal('hide');
31
		loaderDialogObj.modal('hide');
33
			//$('div.modal-backdrop.fade').remove();
32
		// $('div.modal-backdrop.fade').remove();
34
		}
33
	}
35
	if (jqxhr.status == 400) {
34
	if (jqxhr.status == 400) {
36
		// $('#error-prompt-model').modal();
35
		// $('#error-prompt-model').modal();
37
		badRequestAlert(jqxhr);
36
		badRequestAlert(jqxhr);
38
	} else {
37
	} else {
39
		internalServerErrorAlert(jqxhr);
38
		internalServerErrorAlert(jqxhr);
Line 41... Line 40...
41
});
40
});
42
 
41
 
43
$(document).ajaxComplete(function() {
42
$(document).ajaxComplete(function() {
44
	if (typeof loaderDialogObj != "undefined") {
43
	if (typeof loaderDialogObj != "undefined") {
45
		loaderDialogObj.modal('hide');
44
		loaderDialogObj.modal('hide');
46
		//$('div.modal-backdrop.fade').remove();
45
		// $('div.modal-backdrop.fade').remove();
47
	}
46
	}
48
});
47
});
49
function ajaxStartHandler() {
48
function ajaxStartHandler() {
50
	if (typeof loaderDialogObj != "undefined")
49
	if (typeof loaderDialogObj != "undefined")
51
		loaderDialogObj.modal('show');
50
		loaderDialogObj.modal('show');
Line 262... Line 261...
262
			}
261
			}
263
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
262
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
264
			// Trick for making downloadable link
263
			// Trick for making downloadable link
265
			if (typeof loaderDialogObj != "undefined") {
264
			if (typeof loaderDialogObj != "undefined") {
266
				loaderDialogObj.modal('hide');
265
				loaderDialogObj.modal('hide');
267
				//$('div.modal-backdrop.fade').remove();
266
				// $('div.modal-backdrop.fade').remove();
268
			}
267
			}
269
			
268
 
270
			a = document.createElement('a');
269
			a = document.createElement('a');
271
			a.href = window.URL.createObjectURL(xhttp.response);
270
			a.href = window.URL.createObjectURL(xhttp.response);
272
			// Give filename you wish to download
271
			// Give filename you wish to download
273
			a.download = fileName;
272
			a.download = fileName;
274
			a.style.display = 'none';
273
			a.style.display = 'none';
275
			document.body.appendChild(a);
274
			document.body.appendChild(a);
276
			a.click();
275
			a.click();
277
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
276
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
278
			if (typeof loaderDialogObj != "undefined") {
277
			if (typeof loaderDialogObj != "undefined") {
279
				loaderDialogObj.modal('hide');
278
				loaderDialogObj.modal('hide');
280
				//$('div.modal-backdrop.fade').remove();
279
				// $('div.modal-backdrop.fade').remove();
281
			}
280
			}
282
			badRequestAlert(xhttp);
281
			badRequestAlert(xhttp);
283
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
282
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
284
			if (typeof loaderDialogObj != "undefined") {
283
			if (typeof loaderDialogObj != "undefined") {
285
				loaderDialogObj.modal('hide');
284
				loaderDialogObj.modal('hide');
286
				//$('div.modal-backdrop.fade').remove();
285
				// $('div.modal-backdrop.fade').remove();
287
			}
286
			}
288
			internalServerErrorAlert(xhttp);
287
			internalServerErrorAlert(xhttp);
289
		}
288
		}
290
	};
289
	};
291
	// Post data to URL which handles post request
290
	// Post data to URL which handles post request
Line 397... Line 396...
397
	startMoment = start;
396
	startMoment = start;
398
	endMoment = end;
397
	endMoment = end;
399
	startDate = start.format(moment.HTML5_FMT.DATE);
398
	startDate = start.format(moment.HTML5_FMT.DATE);
400
	endDate = end.format(moment.HTML5_FMT.DATE);
399
	endDate = end.format(moment.HTML5_FMT.DATE);
401
}
400
}
402
//Custom formatters should be handled specifically at the controller side
401
// Custom formatters should be handled specifically at the controller side
403
function dateRangeCallback(start, end) {
402
function dateRangeCallback(start, end) {
404
	startMoment = start;
403
	startMoment = start;
405
	endMoment = end;
404
	endMoment = end;
406
	startDate = start.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
405
	startDate = start.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
407
	endDate = end.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
406
	endDate = end.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
Line 444... Line 443...
444
					moment().subtract(1, 'days') ],
443
					moment().subtract(1, 'days') ],
445
			'Last 7 Days' : [ moment().subtract(6, 'days'), moment() ],
444
			'Last 7 Days' : [ moment().subtract(6, 'days'), moment() ],
446
			'Last 30 Days' : [ moment().subtract(29, 'days'), moment() ],
445
			'Last 30 Days' : [ moment().subtract(29, 'days'), moment() ],
447
			'This Month' : [ moment().startOf('month'), moment().endOf('month') ],
446
			'This Month' : [ moment().startOf('month'), moment().endOf('month') ],
448
			'Last Month' : [ moment().subtract(1, 'month').startOf('month'),
447
			'Last Month' : [ moment().subtract(1, 'month').startOf('month'),
449
					moment()],
448
					moment() ],
450
			'Last 3 Months' : [ moment().subtract(3, 'month').startOf('month'),
449
			'Last 3 Months' : [ moment().subtract(3, 'month').startOf('month'),
451
			moment()],
450
					moment() ],
452
			'Last 6 Months' : [ moment().subtract(6, 'month').startOf('month'),
451
			'Last 6 Months' : [ moment().subtract(6, 'month').startOf('month'),
453
				moment()]
452
					moment() ]
454
		}
453
		}
455
	}
454
	}
456
	return rangedDatePicker;
455
	return rangedDatePicker;
457
}
456
}
458
function showPosition(position) {
457
function showPosition(position) {
Line 625... Line 624...
625
}
624
}
626
$(".price_drop").live('click', function() {
625
$(".price_drop").live('click', function() {
627
	loadPriceDrop("main-content");
626
	loadPriceDrop("main-content");
628
});
627
});
629
 
628
 
-
 
629
$("#description-offer").live(
-
 
630
		"click",
-
 
631
		function(e) {
-
 
632
			var offerid = $(this).data('offerId');
-
 
633
			console.log(offerid);
-
 
634
			doGetAjaxRequestHandler(context + "/getOfferMargins?offerId="
-
 
635
					+ offerid, function(response) {
-
 
636
				$('.offer-margin-container .modal-content').html(response);
-
 
637
			});
-
 
638
		});
-
 
639
 
630
function notifyTypeChange(messageType) {
640
function notifyTypeChange(messageType) {
631
	var messageQueryString = "?messageType=" + messageType;
641
	var messageQueryString = "?messageType=" + messageType;
632
	if (messageType == null) {
642
	if (messageType == null) {
633
		messageQueryString = "";
643
		messageQueryString = "";
634
	}
644
	}