Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
25721 tejbeer 1
$(function() {
26281 amit.gupta 2
 
26289 amit.gupta 3
	$('button.imeiactivationsupload').live('click', function() {
26281 amit.gupta 4
		debugger;
5
		var fileSelector = $('#imeiactivations')[0];
6
		if(fileSelector != undefined && fileSelector.files[0] != undefined) {
7
			if(confirm("Confirm Upload?")) {
8
				doAjaxUploadRequestHandler(context + "/imei/upload", "POST", fileSelector.files[0], function(response){
9
					if(response) {
10
						alert("Content updated successfully");
11
					}
12
				});
13
			}
14
		} else {
15
			alert("Please upload file!");
16
		}
17
		return false;
18
	});
19
 
20
 
25721 tejbeer 21
	$(".focused_model").live('click', function() {
22
		loadModel("main-content");
25736 tejbeer 23
 
24
		$("#focused-model-paginated .next").live(
25
				'click',
26
				function() {
27
					loadPaginatedNextItems('/getPaginatedFocusedModel', null,
28
							'focused-model-paginated', 'focused-model-table',
29
							'focused-model-container');
30
 
31
					$(this).blur();
32
				});
33
 
34
		$("#focused-model-paginated .previous").live(
35
				'click',
36
				function() {
37
 
38
					loadPaginatedPreviousItems('/getPaginatedFocusedModel', null,
39
							'focused-model-paginated', 'focused-model-table',
40
							'focused-model-container');
41
 
42
					$(this).blur();
43
				});
44
 
25721 tejbeer 45
	});
46
 
47
	$(".add-model").live(
48
			'click',
49
			function() {
50
				var catalogId = itemCatalogId;
51
				var recommended = $('#recommended').val();
52
				var minimumQty = $('#minimumQuantity').val();
53
 
54
				if (catalogId === null && recommended === ""
55
						&& minimumQty === "") {
56
					alert("Field can't be empty");
57
					return;
58
				}
59
 
60
				if (recommended === "") {
61
					alert("recommended quantity is required");
62
					return;
63
				}
64
				if (minimumQty === "") {
65
					alert("minimumQty is required");
66
					return;
67
				}
68
				if (catalogId === null) {
69
					alert("please choose item");
70
					return;
71
				}
72
				var params = {
73
					"catalogId" : catalogId,
74
					"recommended" : recommended,
75
					"minimumQty" : minimumQty
76
				}
77
				if (confirm("Are you sure you want to add item!") == true) {
78
					doPostAjaxRequestWithParamsHandler(context
79
							+ "/focusedModel", params, function(response) {
80
						alert("Add Item Successfully");
81
						loadModel("main-content");
82
					});
83
				}
84
			});
85
 
86
	$(".remove-model")
87
			.live(
88
					'click',
89
					function() {
90
						if (confirm("Are you sure you want to Remove the Item") == true) {
91
							catalogId = $(this).data('requestid');
92
							console.log(catalogId);
93
							doDeleteAjaxRequestHandler(context
94
									+ "/removeItem?catalogId=" + catalogId,
95
									function(response) {
96
										if (response == 'true') {
97
											alert("successfully Removed");
98
											loadModel("main-content");
99
										}
100
 
101
									});
102
						}
103
 
104
					});
105
});
106
 
107
function loadModel(domId) {
108
	doGetAjaxRequestHandler(context + "/getFocusedModel", function(response) {
109
		$('#' + domId).html(response);
110
	});
111
}