Subversion Repositories SmartDukaan

Rev

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

Rev 26763 Rev 26802
Line 4... Line 4...
4
	});
4
	});
5
 
5
 
6
	$("#schemes-paginated .next").live(
6
	$("#schemes-paginated .next").live(
7
			'click',
7
			'click',
8
			function() {
8
			function() {
-
 
9
				var category = $('#partner-category').val();
9
				var searchText = $("#scheme-item-search-text").val();
10
				var searchText = $("#scheme-item-search-text").val();
10
				// var searchTxt=$("#scheme-search-text").val();
-
 
11
				console.log(searchText);
-
 
-
 
11
 
12
				var category = $('#partner-category').val();
12
				var category = $('#partner-category').val();
13
				if (typeof (searchText) == "undefined" || !searchText) {
13
				if (typeof (searchText) == "undefined" || !searchText) {
14
					searchText = "";
14
					searchText = "";
15
				}
15
				}
-
 
16
				if (typeof (category) == "undefined" || !category) {
-
 
17
					category = "";
-
 
18
				}
-
 
19
 
-
 
20
				if ((searchText) && (category)) {
16
 
21
 
17
				if ((searchText)) {
-
 
18
					var params = {};
22
					var params = {};
19
					params['searchItem'] = searchText;
23
					params['searchItem'] = currentItem.itemId;
-
 
24
					params['partnerType'] = category
20
					loadPaginatedNextItems('/searchItemSchemePanigated',
25
					loadPaginatedNextItems('/getPaginatedSchemes', params,
21
							params, 'schemes-paginated', 'schemes-table',
26
							'schemes-paginated', 'schemes-table',
22
							'scheme-details-container');
27
							'scheme-details-container');
23
				} else if (category) {
-
 
24
 
28
 
-
 
29
				} else if ((searchText)) {
25
					var params = {};
30
					var params = {};
26
					params['category'] = category;
31
					params['searchItem'] = currentItem.itemId;
27
					loadPaginatedNextItems('/getSchemeByCategoryPaginated',
32
					loadPaginatedNextItems('/getPaginatedSchemes', params,
28
							params, 'schemes-paginated', 'schemes-table',
33
							'schemes-paginated', 'schemes-table',
29
							'scheme-details-container');
34
							'scheme-details-container');
-
 
35
 
30
				} else {
36
				} else {
31
					loadPaginatedNextItems('/getPaginatedSchemes', null,
37
					loadPaginatedNextItems('/getPaginatedSchemes', null,
32
							'schemes-paginated', 'schemes-table',
38
							'schemes-paginated', 'schemes-table',
33
							'scheme-details-container');
39
							'scheme-details-container');
34
				}
40
				}
Line 43... Line 49...
43
				// var searchTxt=$("#scheme-search-text").val();
49
				// var searchTxt=$("#scheme-search-text").val();
44
				console.log(searchText);
50
				console.log(searchText);
45
				if (typeof (searchText) == "undefined" || !searchText) {
51
				if (typeof (searchText) == "undefined" || !searchText) {
46
					searchText = "";
52
					searchText = "";
47
				}
53
				}
-
 
54
				if (typeof (category) == "undefined" || !category) {
-
 
55
					category = "";
-
 
56
				}
-
 
57
 
-
 
58
				console.log(searchText)
-
 
59
 
-
 
60
				if ((searchText) && (category)) {
48
 
61
 
49
				if ((searchText)) {
-
 
50
					var params = {};
62
					var params = {};
51
					params['searchItem'] = searchText;
63
					params['searchItem'] = currentItem.itemId;
-
 
64
					params['partnerType'] = category
52
					loadPaginatedPreviousItems('/searchItemSchemePanigated',
65
					loadPaginatedPreviousItems('/getPaginatedSchemes', params,
53
							params, 'schemes-paginated', 'schemes-table',
66
							'schemes-paginated', 'schemes-table',
54
							'scheme-details-container');
67
							'scheme-details-container');
55
				} else if (category) {
-
 
56
 
68
 
-
 
69
				} else if ((searchText)) {
57
					var params = {};
70
					var params = {};
58
					params['category'] = category;
71
					params['searchItem'] = currentItem.itemId;
59
					loadPaginatedNextItems('/getSchemeByCategoryPaginated',
72
					loadPaginatedPreviousItems('/getPaginatedSchemes', params,
60
							params, 'schemes-paginated', 'schemes-table',
73
							'schemes-paginated', 'schemes-table',
61
							'scheme-details-container');
74
							'scheme-details-container');
62
				}
-
 
63
 
75
 
64
				else {
76
				} else {
65
					loadPaginatedPreviousItems('/getPaginatedSchemes', null,
77
					loadPaginatedPreviousItems('/getPaginatedSchemes', null,
66
							'schemes-paginated', 'schemes-table',
78
							'schemes-paginated', 'schemes-table',
67
							'scheme-details-container');
79
							'scheme-details-container');
68
				}
80
				}
69
				$(this).blur();
81
				$(this).blur();
Line 180... Line 192...
180
			console.log(schemeId);
192
			console.log(schemeId);
181
			console.log(itemId);
193
			console.log(itemId);
182
			deleteScheme(schemeId, itemId);
194
			deleteScheme(schemeId, itemId);
183
		}
195
		}
184
	});
196
	});
-
 
197
 
185
	$("#scheme-search-button").live('click', function() {
198
	$("#scheme-search-button").live(
-
 
199
			'click',
-
 
200
			function() {
186
		var searchText = $("#scheme-search-text").val();
201
				var searchText = $("#scheme-search-text").val();
187
		if (typeof (searchText) == "undefined" || !searchText) {
202
				if (typeof (searchText) == "undefined" || !searchText) {
188
			searchText = "";
203
					searchText = "";
189
		}
204
				}
-
 
205
				doGetAjaxRequestHandler(context + "/getSchemes/?searchTerm="
190
		loadSchemeSearchInfo(searchText);
206
						+ searchText, function(response) {
-
 
207
					$('#' + "main-content").html(response);
-
 
208
				});
191
	});
209
			});
192
 
210
 
193
	$("#scheme-search-text").live("keyup", function(e) {
211
	$("#scheme-search-text").live("keyup", function(e) {
194
		var keyCode = e.keyCode || e.which;
212
		var keyCode = e.keyCode || e.which;
195
		if (keyCode == 13) {
213
		if (keyCode == 13) {
196
			$("#scheme-search-button").click();
214
			$("#scheme-search-button").click();
Line 210... Line 228...
210
			'click',
228
			'click',
211
			function() {
229
			function() {
212
				var category = $('#partner-category').val();
230
				var category = $('#partner-category').val();
213
				console.log(category);
231
				console.log(category);
214
 
232
 
215
				doGetAjaxRequestHandler(context
233
				doGetAjaxRequestHandler(context + "/getSchemes/?partnerType="
216
						+ "/searchSchemeByCategory?category=" + category,
-
 
217
						function(response) {
234
						+ category, function(response) {
218
							$('#' + "main-content").html(response);
235
					$('#' + "main-content").html(response);
-
 
236
					$('#partner-category').val(category);
219
							window.dispatchEvent(new Event('resize'));
237
					window.dispatchEvent(new Event('resize'));
220
						});
238
				});
221
 
239
 
222
			});
240
			});
223
 
241
 
224
	$("#scheme-item-search-text").live("keyup", function(e) {
242
	$("#scheme-item-search-text").live("keyup", function(e) {
225
		var keyCode = e.keyCode || e.which;
243
		var keyCode = e.keyCode || e.which;
Line 404... Line 422...
404
			+ search_text, function(response) {
422
			+ search_text, function(response) {
405
		$('#' + domId).html(response);
423
		$('#' + domId).html(response);
406
	});
424
	});
407
}
425
}
408
function loadSearchItemScheme(domId, selected_item) {
426
function loadSearchItemScheme(domId, selected_item) {
409
	doGetAjaxRequestHandler(context + "/searchScheme/?searchItem="
-
 
410
			+ selected_item.itemId, function(response) {
427
	var category = $('#partner-category').val();
411
		$('#' + domId).html(response);
-
 
412
		$('#scheme-item-search-text').val(selected_item.itemDescription);
428
	var searchText = $("#scheme-item-search-text").val();
413
 
429
 
-
 
430
	var category = $('#partner-category').val();
-
 
431
	if (typeof (searchText) == "undefined" || !searchText) {
-
 
432
		searchText = "";
-
 
433
	}
-
 
434
	if (typeof (category) == "undefined" || !category) {
-
 
435
		category = "";
-
 
436
	}
-
 
437
	if ((searchText) && (category)) {
-
 
438
		doGetAjaxRequestHandler(context + "/getSchemes/?searchItem="
-
 
439
				+ selected_item.itemId + "&partnerType=" + category, function(
-
 
440
				response) {
-
 
441
			$('#' + domId).html(response);
-
 
442
			$('#partner-category').val(category);
-
 
443
			$('#scheme-item-search-text').val(selected_item.itemDescription);
-
 
444
 
414
	});
445
		});
-
 
446
	} else if ((searchText))
-
 
447
		doGetAjaxRequestHandler(context + "/getSchemes/?searchItem="
-
 
448
				+ selected_item.itemId, function(response) {
-
 
449
			$('#' + domId).html(response);
-
 
450
			$('#scheme-item-search-text').val(selected_item.itemDescription);
-
 
451
 
-
 
452
		});
415
}
453
}
416
function loadSchemeSearchInfo(search_text) {
454
function loadSchemeSearchInfo(search_text) {
417
	loadSearchScheme("main-content", search_text);
455
	loadSearchScheme("main-content", search_text);
418
}
456
}
419
function loadSchemeItemSearchInfo(selectedItem) {
457
function loadSchemeItemSearchInfo(selectedItem) {