Subversion Repositories SmartDukaan

Rev

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