Subversion Repositories SmartDukaan

Rev

Rev 24976 | Rev 25066 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24440 amit.gupta 1
var logosmapping = {
24595 tejbeer 2
	mobile_insurance_providers : {
3
		"0" : context + '/resources/images/icons/provider-logos/iffco.png',
4
		"1" : context + '/resources/images/icons/provider-logos/icici.jpg',
5
		"2" : context + '/resources/images/icons/provider-logos/tataaig.png'
6
	}
24440 amit.gupta 7
}
24595 tejbeer 8
function badRequestAlert(response) {
22956 ashik.ali 9
	console.log(response.responseText);
10
	var errorObject = JSON.parse(response.responseText);
11
	errorObject = errorObject.response;
24595 tejbeer 12
	bootbox.alert('Bad Request\n' + 'rejectedType : '
13
			+ errorObject.rejectedType + '\n' + 'rejectedValue : '
14
			+ errorObject.rejectedValue + '\n' + 'message : '
15
			+ errorObject.message);
22956 ashik.ali 16
}
24595 tejbeer 17
 
18
function internalServerErrorAlert(response) {
22956 ashik.ali 19
	console.log(response.responseText);
20
	var errorObject = JSON.parse(response.responseText);
21
	errorObject = errorObject.response;
24595 tejbeer 22
	bootbox.alert('Internal Server Error\n' + 'rejectedType : '
23
			+ errorObject.rejectedType + '\n' + 'rejectedValue : '
24
			+ errorObject.rejectedValue + '\n' + 'message : '
25
			+ errorObject.message);
22956 ashik.ali 26
}
27
 
24595 tejbeer 28
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
29
	if (typeof loaderDialogObj != "undefined")
24271 amit.gupta 30
		loaderDialogObj.modal('hide');
24595 tejbeer 31
	if (jqxhr.status == 400) {
23872 amit.gupta 32
		// $('#error-prompt-model').modal();
24595 tejbeer 33
		badRequestAlert(jqxhr);
34
	} else {
22956 ashik.ali 35
		internalServerErrorAlert(jqxhr);
36
	}
37
});
38
 
24595 tejbeer 39
$(document).ajaxComplete(function() {
40
	if (typeof loaderDialogObj != "undefined")
24271 amit.gupta 41
		loaderDialogObj.modal('hide');
23946 amit.gupta 42
});
24992 tejbeer 43
function ajaxStartHandler() {
24976 amit.gupta 44
	if (typeof loaderDialogObj != "undefined")
45
		loaderDialogObj.modal('show');
46
	if (typeof isInvestmentOk != "undefined" && !isInvestmentOk
47
			&& $('#order-details').length == 0) {
24992 tejbeer 48
		var investmentDialog = bootbox
49
				.dialog({
50
					title : '<h3	class="text-danger">ATTENTION!! ORDERING THROUGH APP MAY BE BLOCKED DUE TO LOW INVESTMENTS!</h3>',
51
					message : "<h3>Dear Partner, your investments are low by "
52
							+ shortPercentage
53
							+ "%</h3>"
54
							+ "<dl>"
55
							+ "<dt>Investment Should be</dt><dd>- "
56
							+ minimumInvestmentAmount
57
							+ "</dd>"
58
							+ "<dt>Total Invested Amount</dt><dd>-"
59
							+ totalInvestedAmount
60
							+ "</dd>"
61
							+ '<dt>Investment Amount Short By</dt><dd class="text-danger lead">-  '
62
							+ shortAmount
63
							+ '</dd></dl>'
64
							+ '<pre class="text-danger" style="font-size:18px;"><strong>To unblock your Billing, please \nadd Rs.'
65
							+ minAmountToBeAdded
66
							+ ' to wallet immediately.</strong></pre>',
67
					buttons : {
68
						cancel : {
69
							label : "OK",
70
							className : 'btn-primary'
71
						}
24595 tejbeer 72
					}
24992 tejbeer 73
				});
24976 amit.gupta 74
		investmentDialog.on('shown.bs.modal', function() {
24992 tejbeer 75
			var dialogEl = investmentDialog.find('.modal-content')[0];
76
			var dialogRect = dialogEl.getBoundingClientRect();
77
			var height = window.innerHeight - dialogRect.height;
78
			var width = window.innerWidth - dialogRect.width;
79
			var left = Math.floor(Math.random() * width) - dialogRect.left
80
			var top = Math.floor(Math.random() * height) - dialogRect.top
81
			$(dialogEl).css("left", left).css("top", top);
24976 amit.gupta 82
		});
83
	}
84
}
85
$(document).ajaxStart(ajaxStartHandler);
24595 tejbeer 86
 
87
function doAjaxRequestWithParamsHandler(urlString, httpType, params,
88
		callback_function) {
89
	$.ajax({
90
		url : urlString,
91
		async : true,
92
		cache : false,
93
		data : params,
94
		// dataType:'json',
95
		type : httpType,
96
		success : function(response) {
97
			callback_function(response);
98
			$('.currency').each(function(index, ele) {
99
				if (!isNaN(parseInt($(ele).html()))) {
100
					$(ele).html(numberToComma($(ele).html()));
101
				}
23918 amit.gupta 102
			});
103
		}
104
	});
23193 ashik.ali 105
}
106
 
24595 tejbeer 107
function doGetAjaxRequestWithParamsHandler(urlString, params, callback_function) {
23500 ashik.ali 108
	doAjaxRequestWithParamsHandler(urlString, "GET", params, callback_function);
109
}
110
 
24595 tejbeer 111
function doPostAjaxRequestWithParamsHandler(urlString, params,
112
		callback_function) {
23500 ashik.ali 113
	doAjaxRequestWithParamsHandler(urlString, "POST", params, callback_function);
114
}
115
 
24595 tejbeer 116
function doAjaxRequestWithJsonHandler(urlString, httpType, json,
117
		callback_function) {
23032 ashik.ali 118
	$.ajax({
24595 tejbeer 119
		url : urlString,
120
		async : true,
121
		cache : false,
122
		processData : false,
123
		data : json,
124
		contentType : 'application/json',
125
		type : httpType,
126
		success : function(response) {
127
			// console.log("response"+JSON.stringify(data));
128
			callback_function(response);
129
			$('.currency').each(function(index, ele) {
130
				if (!isNaN(parseInt($(ele).html()))) {
131
					$(ele).html(numberToComma($(ele).html()));
132
				}
133
			});
134
		}
23032 ashik.ali 135
	});
136
}
137
 
24595 tejbeer 138
function doPostAjaxRequestWithJsonHandler(urlString, json, callback_function) {
23500 ashik.ali 139
	doAjaxRequestWithJsonHandler(urlString, "POST", json, callback_function);
140
}
23032 ashik.ali 141
 
24595 tejbeer 142
function doPutAjaxRequestWithJsonHandler(urlString, json, callback_function) {
23500 ashik.ali 143
	doAjaxRequestWithJsonHandler(urlString, "PUT", json, callback_function);
144
}
145
 
24595 tejbeer 146
function doAjaxRequestHandler(urlString, httpType, callback_function) {
22982 ashik.ali 147
	$.ajax({
24595 tejbeer 148
		url : urlString,
149
		async : true,
150
		cache : false,
151
		type : httpType,
152
		success : function(response) {
153
			callback_function(response);
154
			$('.currency').each(function(index, ele) {
155
				if (!isNaN(parseInt($(ele).html()))) {
156
					$(ele).html(numberToComma($(ele).html()));
157
				}
158
			});
159
		}
22982 ashik.ali 160
	});
161
}
162
 
24595 tejbeer 163
function doGetAjaxRequestHandler(urlString, callback_function) {
23500 ashik.ali 164
	doAjaxRequestHandler(urlString, "GET", callback_function);
165
}
166
 
24595 tejbeer 167
function doPutAjaxRequestHandler(urlString, callback_function) {
23500 ashik.ali 168
	doAjaxRequestHandler(urlString, "PUT", callback_function);
169
}
170
 
24595 tejbeer 171
function doPostAjaxRequestHandler(urlString, callback_function) {
23629 ashik.ali 172
	doAjaxRequestHandler(urlString, "POST", callback_function);
173
}
174
 
24595 tejbeer 175
function doDeleteAjaxRequestHandler(urlString, callback_function) {
23783 ashik.ali 176
	doAjaxRequestHandler(urlString, "DELETE", callback_function);
177
}
178
 
24595 tejbeer 179
function doAjaxUploadRequest(urlString, httpType, file) {
23347 ashik.ali 180
	var response;
24595 tejbeer 181
	doAjaxUploadRequestHandler(urlString, httpType, file,
182
			function(ajaxResponse) {
183
				response = ajaxResponse;
184
			});
23347 ashik.ali 185
	return response;
186
}
187
 
24595 tejbeer 188
function doAjaxUploadRequestHandler(urlString, httpType, file,
189
		callback_function) {
22982 ashik.ali 190
	var formData = new FormData();
191
	formData.append("file", file);
192
	$.ajax({
24595 tejbeer 193
		url : urlString,
194
		type : httpType,
195
		data : formData,
196
		dataType : 'json',
197
		async : true,
198
		cache : false,
199
		contentType : false,
200
		enctype : 'multipart/form-data',
201
		processData : false,
202
		success : function(response) {
203
			// console.log("response"+JSON.stringify(data));
204
			callback_function(response);
205
		}
22982 ashik.ali 206
	});
207
}
24595 tejbeer 208
function doAjaxUploadRequestJsonHandler(urlString, httpType, file, json,
209
		callback_function) {
24171 govind 210
	var formData = new FormData();
211
	formData.append("file", file);
24595 tejbeer 212
	formData.append('json', new Blob([ json ]));
24171 govind 213
	$.ajax({
24595 tejbeer 214
		url : urlString,
215
		type : httpType,
216
		data : formData,
217
		enctype : 'multipart/form-data',
218
		contentType : false,
219
		processData : false,
220
		success : function(response) {
221
			// console.log("response"+JSON.stringify(data));
222
			callback_function(response);
223
		}
24171 govind 224
	});
225
}
22982 ashik.ali 226
 
24595 tejbeer 227
function uploadDocument(file) {
228
	var url = webApiScheme + '://' + webApiHost + ':' + webApiPort + webApiRoot
229
			+ '/document-upload';
230
	doAjaxUploadRequestHandler(url, 'POST', file, function(response) {
231
		var documentId = response.response.document_id;
232
		console.log("documentId : " + documentId);
23377 ashik.ali 233
		return documentId;
234
	});
23347 ashik.ali 235
}
236
 
24595 tejbeer 237
function doAjaxGetDownload(urlString, fileName) {
238
	console.log("fileName : " + fileName);
23343 ashik.ali 239
	doAjaxDownload(urlString, "GET", null, fileName);
22982 ashik.ali 240
}
241
 
24595 tejbeer 242
function doAjaxPostDownload(urlString, data, fileName) {
23343 ashik.ali 243
	doAjaxDownload(urlString, "POST", data, fileName);
21627 kshitij.so 244
}
245
 
24595 tejbeer 246
function doAjaxDownload(urlString, httpType, data, fileName) {
22488 ashik.ali 247
	xhttp = new XMLHttpRequest();
248
	xhttp.onreadystatechange = function() {
24595 tejbeer 249
		var a;
250
		if (xhttp.readyState === 2) {
251
			if (xhttp.status == 200) {
252
				xhttp.responseType = "blob";
253
			} else {
254
				xhttp.responseType = "text";
255
			}
256
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
257
			// Trick for making downloadable link
24976 amit.gupta 258
			if (typeof loaderDialogObj != "undefined")
259
				loaderDialogObj.modal('hide');
24595 tejbeer 260
			a = document.createElement('a');
261
			a.href = window.URL.createObjectURL(xhttp.response);
262
			// Give filename you wish to download
263
			a.download = fileName;
264
			a.style.display = 'none';
265
			document.body.appendChild(a);
266
			a.click();
267
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
24976 amit.gupta 268
			if (typeof loaderDialogObj != "undefined")
269
				loaderDialogObj.modal('hide');
24595 tejbeer 270
			badRequestAlert(xhttp);
271
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
24976 amit.gupta 272
			if (typeof loaderDialogObj != "undefined")
273
				loaderDialogObj.modal('hide');
24595 tejbeer 274
			internalServerErrorAlert(xhttp);
275
		}
22488 ashik.ali 276
	};
277
	// Post data to URL which handles post request
23343 ashik.ali 278
	xhttp.open(httpType, urlString);
24595 tejbeer 279
	if (httpType == "POST") {
23343 ashik.ali 280
		xhttp.setRequestHeader("Content-Type", "application/json");
281
	}
22488 ashik.ali 282
	// You should set responseType as blob for binary responses
23872 amit.gupta 283
	// xhttp.responseType = 'blob';
22488 ashik.ali 284
	xhttp.send(data);
23405 amit.gupta 285
}
286
 
24595 tejbeer 287
function loadPaginatedNextItems(url, params, paginatedIdentifier,
288
		tableIdentifier, detailsContainerIdentifier) {
289
	var start = $("#" + paginatedIdentifier + " .start").text();
290
	var end = $("#" + paginatedIdentifier + " .end").text();
23629 ashik.ali 291
	url = context + url + "?offset=" + end;
24595 tejbeer 292
 
293
	if (params != null) {
294
		for ( var key in params) {
23629 ashik.ali 295
			if (params.hasOwnProperty(key)) {
23872 amit.gupta 296
				// console.log(key + " -> " + p[key]);
24595 tejbeer 297
				url = url + "&" + key + "=" + params[key];
23629 ashik.ali 298
			}
299
		}
300
	}
24595 tejbeer 301
 
302
	doGetAjaxRequestHandler(url, function(response) {
303
		var size = $("#" + paginatedIdentifier + " .size").text();
304
		if ((parseInt(end) + 10) > parseInt(size)) {
23629 ashik.ali 305
			console.log("(end + 10) > size == true");
24595 tejbeer 306
			$("#" + paginatedIdentifier + " .end").text(size);
307
		} else {
23629 ashik.ali 308
			console.log("(end + 10) > size == false");
24595 tejbeer 309
			$("#" + paginatedIdentifier + " .end").text(+end + +10);
23629 ashik.ali 310
		}
24595 tejbeer 311
		$("#" + paginatedIdentifier + " .start").text(+start + +10);
312
		var last = $("#" + paginatedIdentifier + " .end").text();
313
		var temp = $("#" + paginatedIdentifier + " .size").text();
314
		if (parseInt(last) >= parseInt(temp)) {
315
			$("#" + paginatedIdentifier + " .next").prop('disabled', true);
23872 amit.gupta 316
			// $( "#good-inventory-paginated .end" ).text(temp);
23629 ashik.ali 317
		}
24595 tejbeer 318
		$('#' + tableIdentifier).html(response);
319
		if (detailsContainerIdentifier != null) {
320
			$('#' + detailsContainerIdentifier).html('');
23629 ashik.ali 321
		}
24595 tejbeer 322
		$("#" + paginatedIdentifier + " .previous").prop('disabled', false);
23629 ashik.ali 323
	});
24595 tejbeer 324
 
23629 ashik.ali 325
}
23405 amit.gupta 326
 
24595 tejbeer 327
function loadPaginatedPreviousItems(url, params, paginatedIdentifier,
328
		tableIdentifier, detailsContainerIdentifier) {
329
	var start = $("#" + paginatedIdentifier + " .start").text();
330
	var end = $("#" + paginatedIdentifier + " .end").text();
331
	var size = $("#" + paginatedIdentifier + " .size").text();
332
	if (parseInt(end) == parseInt(size) && parseInt(end) % 10 != 0) {
23629 ashik.ali 333
		var mod = parseInt(end) % 10;
24595 tejbeer 334
		end = parseInt(end) + (10 - mod);
23629 ashik.ali 335
	}
336
	var pre = end - 20;
24595 tejbeer 337
 
23629 ashik.ali 338
	url = context + url + "?offset=" + pre;
24595 tejbeer 339
 
340
	if (params != null) {
341
		for ( var key in params) {
23629 ashik.ali 342
			if (params.hasOwnProperty(key)) {
24595 tejbeer 343
				url = url + "&" + key + "=" + params[key];
23629 ashik.ali 344
			}
345
		}
346
	}
24595 tejbeer 347
 
348
	doGetAjaxRequestHandler(url, function(response) {
349
		$("#" + paginatedIdentifier + " .end").text(+end - +10);
350
		$("#" + paginatedIdentifier + " .start").text(+start - +10);
351
		$('#' + tableIdentifier).html(response);
352
		if (detailsContainerIdentifier != null) {
353
			$('#' + detailsContainerIdentifier).html('');
23629 ashik.ali 354
		}
24595 tejbeer 355
		$("#" + paginatedIdentifier + " .next").prop('disabled', false);
356
		if (parseInt(pre) == 0) {
357
			$("#" + paginatedIdentifier + " .previous").prop('disabled', true);
23629 ashik.ali 358
		}
24595 tejbeer 359
	});
360
 
23629 ashik.ali 361
}
362
 
23405 amit.gupta 363
function numberToComma(x) {
24992 tejbeer 364
 
24595 tejbeer 365
	x = x.toString();
24992 tejbeer 366
	x = x.split('.');
367
	var x1 = x[0];
368
	var x2 = x.length > 1 ? '.' + x[1] : '';
369
	var lastThree = x1.substring(x1.length - 3);
370
	console.log(lastThree)
371
	var otherNumbers = x1.substring(0, x1.length - 3);
24595 tejbeer 372
	if (otherNumbers != '')
373
		lastThree = ',' + lastThree;
24992 tejbeer 374
	return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
375
			+ x2;
376
 
23786 amit.gupta 377
}
23870 amit.gupta 378
 
379
function dateRangeCallback(start, end) {
23886 amit.gupta 380
	startMoment = start;
381
	endMoment = end;
382
	startDate = start.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
383
	endDate = end.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
23872 amit.gupta 384
}
385
 
24595 tejbeer 386
function getSingleDatePicker() {
387
	var singleDatePicker = {
388
		"todayHighlight" : true,
389
		"startDate" : startMoment || moment(),
390
		"autoclose" : true,
391
		"autoUpdateInput" : true,
392
		"singleDatePicker" : true,
393
		"locale" : {
394
			'format' : 'DD/MM/YYYY'
395
		}
396
	};
23872 amit.gupta 397
	return singleDatePicker;
23886 amit.gupta 398
}
399
 
24595 tejbeer 400
function getRangedDatePicker(showRanges) {
401
	if (typeof showRanges == "undefined") {
23886 amit.gupta 402
		showRanges = false;
403
	}
24595 tejbeer 404
	var rangedDatePicker = {
405
		"todayHighlight" : true,
406
		"opens" : "right",
407
		"startDate" : startMoment || moment(),
408
		"endDate" : endMoment || moment(),
409
		"autoclose" : true,
410
		"alwaysShowCalendars" : false,
411
		"autoUpdateInput" : true,
412
		"locale" : {
413
			'format' : 'DD/MM/YYYY'
414
		}
23886 amit.gupta 415
	};
24595 tejbeer 416
	if (showRanges) {
417
		rangedDatePicker['ranges'] = {
418
			'Today' : [ moment(), moment() ],
419
			'Yesterday' : [ moment().subtract(1, 'days'),
420
					moment().subtract(1, 'days') ],
421
			'Last 7 Days' : [ moment().subtract(6, 'days'), moment() ],
422
			'Last 30 Days' : [ moment().subtract(29, 'days'), moment() ],
423
			'This Month' : [ moment().startOf('month'), moment().endOf('month') ],
424
			'Last Month' : [ moment().subtract(1, 'month').startOf('month'),
425
					moment().subtract(1, 'month').endOf('month') ]
426
		}
23886 amit.gupta 427
	}
428
	return rangedDatePicker;
23892 amit.gupta 429
}
23946 amit.gupta 430
function showPosition(position) {
24595 tejbeer 431
	if (typeof latitude == "undefined") {
432
		var coords = {
433
			latitude : position.coords.latitude,
434
			longitude : position.coords.longitude
435
		}
436
		doAjaxRequestWithJsonHandler('partner/location', 'PUT', JSON
437
				.stringify(coords), function() {
24016 amit.gupta 438
			latitude = position.coords.latitude;
439
			longitude = position.coords.longitude;
24052 amit.gupta 440
		});
441
	}
24176 amit.gupta 442
	// distance = getDistance(latitude, longitude, position.coords.latitude,
443
	// position.coords.longitude);
24168 amit.gupta 444
}
445
 
24595 tejbeer 446
function getAuthorisedWarehouses(callback) {
447
	bootBoxObj = {
448
		size : "small",
449
		title : "Choose Warehouse",
450
		callback : callback,
451
		inputType : 'select',
452
		inputOptions : typeof inputOptions == "undefined" ? undefined
453
				: inputOptions
24168 amit.gupta 454
	}
24595 tejbeer 455
	if (typeof inputOptions == "undefined") {
456
		doGetAjaxRequestHandler(context + "/authorisedWarehouses", function(
457
				response) {
24168 amit.gupta 458
			response = JSON.parse(response);
459
			inputOptions = [];
24595 tejbeer 460
			response.forEach(function(warehouse) {
24168 amit.gupta 461
				inputOptions.push({
24595 tejbeer 462
					text : warehouse.name,
463
					value : warehouse.id,
24168 amit.gupta 464
				});
465
			});
466
			bootBoxObj['inputOptions'] = inputOptions;
467
			bootbox.prompt(bootBoxObj);
468
		});
24595 tejbeer 469
	} else if (inputOptions.length == 1) {
24168 amit.gupta 470
		callback(inputOptions[0].warehouse.id);
24595 tejbeer 471
	} else {
24168 amit.gupta 472
		bootbox.prompt(bootBoxObj);
473
	}
24595 tejbeer 474
 
24176 amit.gupta 475
}
24410 amit.gupta 476
function getColorsForItems(catalogId, itemId, description, callback) {
24595 tejbeer 477
	bootBoxObj = {
478
		size : "small",
479
		className : "item-wrapper",
480
		title : description,
481
		callback : callback,
482
		inputType : 'checkbox',
24349 amit.gupta 483
	}
24595 tejbeer 484
	doGetAjaxRequestHandler(context + "/itemsByCatalogId?catalogId="
485
			+ catalogId + "&itemId=" + itemId, function(response) {
24406 amit.gupta 486
		coloredItems = JSON.parse(response);
24595 tejbeer 487
		inputOptions = [ {
488
			text : "All",
489
			value : "0",
490
			onclick : "toggleAll('itemIds')"
491
		} ];
492
		coloredItems.forEach(function(item) {
24406 amit.gupta 493
			inputOptions.push({
24595 tejbeer 494
				text : item.color,
495
				value : item.id,
496
				selected : item.active
24349 amit.gupta 497
			});
498
		});
24406 amit.gupta 499
		bootBoxObj['inputOptions'] = inputOptions;
24349 amit.gupta 500
		bootbox.prompt(bootBoxObj);
24595 tejbeer 501
		$('.item-wrapper').find('input[type="checkbox"]').slice(1).each(
502
				function(index, checkbox) {
503
					checkbox.checked = coloredItems[index].active;
504
				});
24406 amit.gupta 505
	});
506
}
24595 tejbeer 507
$(".item-wrapper").find("input[type='checkbox']:first").live(
508
		'change',
509
		function() {
510
			if (this.value == "0") {
511
				$(this).closest('.item-wrapper').find("input[type='checkbox']")
512
						.slice(1).prop('checked', $(this).prop('checked'));
513
			}
514
		});
24176 amit.gupta 515
function getItemAheadOptions(jqElement, callback) {
516
	jqElement.typeahead('destroy').typeahead({
24595 tejbeer 517
		source : function(q, process) {
518
			if (q.length >= 3) {
519
				return $.ajax(context + "/item", {
520
					global : false,
521
					data : {
522
						query : q
523
					},
524
					success : function(data) {
24191 amit.gupta 525
						queryData = JSON.parse(data);
526
						process(queryData);
24176 amit.gupta 527
					},
528
				});
24378 amit.gupta 529
			}
24176 amit.gupta 530
		},
24595 tejbeer 531
		delay : 400,
532
		items : 20,
533
		displayText : function(item) {
534
			return item.itemDescription;
535
		},
536
		autoSelect : true,
537
		afterSelect : callback
24176 amit.gupta 538
	});
539
}
24349 amit.gupta 540
function getPartnerAheadOptions(jqElement, callback) {
541
	jqElement.typeahead('destroy').typeahead({
24595 tejbeer 542
		source : function(q, process) {
543
			if (q.length >= 3) {
544
				return $.ajax(context + "/partners", {
545
					global : false,
546
					data : {
547
						query : q
548
					},
549
					success : function(data) {
24349 amit.gupta 550
						queryData = JSON.parse(data);
551
						process(queryData);
552
					},
553
				});
554
			}
555
		},
24595 tejbeer 556
		delay : 300,
557
		items : 20,
558
		displayText : function(partner) {
559
			return partner.displayName;
560
		},
561
		autoSelect : true,
562
		afterSelect : callback
24349 amit.gupta 563
	});
564
}
24406 amit.gupta 565
 
24595 tejbeer 566
function loadPriceDrop(domId) {
567
	doGetAjaxRequestHandler(context + "/getItemDescription",
568
			function(response) {
569
				$('#' + domId).html(response);
570
			});
24406 amit.gupta 571
}
572
$(".price_drop").live('click', function() {
573
	loadPriceDrop("main-content");
24595 tejbeer 574
});