Subversion Repositories SmartDukaan

Rev

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

Rev 29667 Rev 30017
Line 1... Line 1...
1
$(function() {
1
$(function () {
2
 
2
 
3
	$(document).on('click', 'button.imeiactivationsupload',
3
	$(document).on('click', 'button.imeiactivationsupload',
4
		function() {
4
		function () {
5
			debugger;
-
 
6
			var fileSelector = $('#imeiactivations')[0];
5
			var fileSelector = $('#imeiactivations')[0];
7
			if (fileSelector != undefined
6
			if (fileSelector != undefined
8
				&& fileSelector.files[0] != undefined) {
7
				&& fileSelector.files[0] != undefined) {
9
				if (confirm("Confirm Upload?")) {
8
				if (confirm("Confirm Upload?")) {
10
					doAjaxUploadRequestHandler(context + "/imei/upload",
9
					doAjaxUploadRequestHandler(context + "/imei/upload",
11
						"POST", fileSelector.files[0], function(
10
						"POST", fileSelector.files[0], function (
12
							response) {
11
							response) {
13
						if (response) {
12
							if (response) {
14
							alert("Content updated successfully");
13
								alert("Content updated successfully");
15
						}
14
							}
16
					});
15
						});
17
				}
16
				}
18
			} else {
17
			} else {
19
				alert("Please upload file!");
18
				alert("Please upload file!");
20
			}
19
			}
21
			return false;
20
			return false;
22
		});
21
		});
23
 
22
 
24
	$(document).on('click', ".focused_model",
23
	$(document).on('click', ".focused_model",
25
		function() {
24
		function () {
26
			loadModel("main-content");
25
			loadModel("main-content");
27
 
26
 
28
			$(document).on('click', "#focused-model-paginated .next",
27
			$(document).on('click', "#focused-model-paginated .next",
29
				function() {
28
				function () {
30
					loadPaginatedNextItems('/getPaginatedFocusedModel',
29
					loadPaginatedNextItems('/getPaginatedFocusedModel',
31
						null, 'focused-model-paginated',
30
						null, 'focused-model-paginated',
32
						'focused-model-table',
31
						'focused-model-table',
33
						'focused-model-container');
32
						'focused-model-container');
34
 
33
 
35
					$(this).blur();
34
					$(this).blur();
36
				});
35
				});
37
 
36
 
38
			$(document).on('click', "#focused-model-paginated .previous",
37
			$(document).on('click', "#focused-model-paginated .previous",
39
				function() {
38
				function () {
40
 
39
 
41
					loadPaginatedPreviousItems(
40
					loadPaginatedPreviousItems(
42
						'/getPaginatedFocusedModel', null,
41
						'/getPaginatedFocusedModel', null,
43
						'focused-model-paginated',
42
						'focused-model-paginated',
44
						'focused-model-table',
43
						'focused-model-table',
Line 48... Line 47...
48
				});
47
				});
49
 
48
 
50
		});
49
		});
51
 
50
 
52
	$(document).on('click', ".add-model",
51
	$(document).on('click', ".add-model",
53
		function() {
52
		function () {
54
			var catalogId = itemCatalogId;
53
			var catalogId = itemCatalogId;
55
			var recommended = $('#recommended').val();
54
			var recommended = $('#recommended').val();
56
			var minimumQty = $('#minimumQuantity').val();
55
			var minimumQty = $('#minimumQuantity').val();
57
 
56
 
58
 
57
 
Line 102... Line 101...
102
				"regionId": regionId,
101
				"regionId": regionId,
103
 
102
 
104
			}
103
			}
105
			if (confirm("Are you sure you want to add item!") == true) {
104
			if (confirm("Are you sure you want to add item!") == true) {
106
				doPostAjaxRequestWithParamsHandler(context
105
				doPostAjaxRequestWithParamsHandler(context
107
					+ "/focusedModel", params, function(response) {
106
					+ "/focusedModel", params, function (response) {
108
						alert("Add Item Successfully");
107
					alert("Add Item Successfully");
109
						loadModel("main-content");
108
					loadModel("main-content");
110
					});
109
				});
111
			}
110
			}
112
		});
111
		});
113
 
112
 
114
	$(document).on('click', ".remove-model",
113
	$(document).on('click', ".remove-model",
115
		function() {
114
		function () {
116
			if (confirm("Are you sure you want to Remove the Item") == true) {
115
			if (confirm("Are you sure you want to Remove the Item") == true) {
117
				id = $(this).data('requestid');
116
				id = $(this).data('requestid');
118
				console.log(id);
117
				console.log(id);
119
				doDeleteAjaxRequestHandler(context
118
				doDeleteAjaxRequestHandler(context
120
					+ "/removeItem?id=" + id,
119
					+ "/removeItem?id=" + id,
121
					function(response) {
120
					function (response) {
122
						if (response == 'true') {
121
						if (response == 'true') {
123
							alert("successfully Removed");
122
							alert("successfully Removed");
124
							loadModel("main-content");
123
							loadModel("main-content");
125
						}
124
						}
126
 
125
 
Line 129... Line 128...
129
 
128
 
130
		});
129
		});
131
});
130
});
132
 
131
 
133
function loadModel(domId) {
132
function loadModel(domId) {
134
	doGetAjaxRequestHandler(context + "/getFocusedModel", function(response) {
133
	doGetAjaxRequestHandler(context + "/getFocusedModel", function (response) {
135
		$('#' + domId).html(response);
134
		$('#' + domId).html(response);
136
	});
135
	});
137
}
136
}