Subversion Repositories SmartDukaan

Rev

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

Rev 27755 Rev 29667
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;
5
			debugger;
6
				var fileSelector = $('#imeiactivations')[0];
6
			var fileSelector = $('#imeiactivations')[0];
7
				if (fileSelector != undefined
7
			if (fileSelector != undefined
8
						&& fileSelector.files[0] != undefined) {
8
				&& fileSelector.files[0] != undefined) {
9
					if (confirm("Confirm Upload?")) {
9
				if (confirm("Confirm Upload?")) {
10
						doAjaxUploadRequestHandler(context + "/imei/upload",
10
					doAjaxUploadRequestHandler(context + "/imei/upload",
11
								"POST", fileSelector.files[0], function(
11
						"POST", fileSelector.files[0], function(
12
										response) {
12
							response) {
13
									if (response) {
13
						if (response) {
14
										alert("Content updated successfully");
14
							alert("Content updated successfully");
15
									}
15
						}
16
								});
-
 
17
					}
16
					});
18
				} else {
-
 
19
					alert("Please upload file!");
-
 
20
				}
17
				}
-
 
18
			} else {
-
 
19
				alert("Please upload file!");
-
 
20
			}
21
				return false;
21
			return false;
22
			});
22
		});
23
 
23
 
24
	$(document).on('click', ".focused_model",
24
	$(document).on('click', ".focused_model",
25
			function() {
25
		function() {
26
				loadModel("main-content");
26
			loadModel("main-content");
27
 
27
 
28
				$(document).on('click', "#focused-model-paginated .next",
28
			$(document).on('click', "#focused-model-paginated .next",
29
						function() {
29
				function() {
30
							loadPaginatedNextItems('/getPaginatedFocusedModel',
30
					loadPaginatedNextItems('/getPaginatedFocusedModel',
31
									null, 'focused-model-paginated',
31
						null, 'focused-model-paginated',
32
									'focused-model-table',
32
						'focused-model-table',
33
									'focused-model-container');
33
						'focused-model-container');
34
 
34
 
35
							$(this).blur();
35
					$(this).blur();
36
						});
36
				});
37
 
37
 
38
				$(document).on('click', "#focused-model-paginated .previous",
38
			$(document).on('click', "#focused-model-paginated .previous",
39
						function() {
39
				function() {
40
 
40
 
41
							loadPaginatedPreviousItems(
41
					loadPaginatedPreviousItems(
42
									'/getPaginatedFocusedModel', null,
42
						'/getPaginatedFocusedModel', null,
43
									'focused-model-paginated',
43
						'focused-model-paginated',
44
									'focused-model-table',
44
						'focused-model-table',
45
									'focused-model-container');
45
						'focused-model-container');
46
 
46
 
47
							$(this).blur();
47
					$(this).blur();
48
						});
48
				});
49
 
49
 
50
			});
50
		});
51
 
51
 
52
	$(document).on('click', ".add-model",
52
	$(document).on('click', ".add-model",
53
			function() {
53
		function() {
54
				var catalogId = itemCatalogId;
54
			var catalogId = itemCatalogId;
55
				var recommended = $('#recommended').val();
55
			var recommended = $('#recommended').val();
56
				var minimumQty = $('#minimumQuantity').val();
56
			var minimumQty = $('#minimumQuantity').val();
-
 
57
 
-
 
58
 
-
 
59
			var obvRecommended = $('#obvrecommended').val();
-
 
60
			var obvMinimumQty = $('#obvminimumQuantity').val();
-
 
61
 
-
 
62
 
57
				var regionId = $('#regionType').val();
63
			var regionId = $('#regionType').val();
-
 
64
 
58
 
65
 
59
				if (catalogId === null && recommended === ""
66
			if (catalogId === null) {
-
 
67
				alert("please choose item");
-
 
68
				return;
-
 
69
			}
-
 
70
 
60
						&& minimumQty === "") {
71
			if (recommended != "" && minimumQty == "") {
61
					alert("Field can't be empty");
72
				alert("please fill minimumQty qty");
62
					return;
73
				return;
63
				}
74
			}
64
 
75
 
65
				if (recommended === "") {
76
			if (recommended == "" && minimumQty != "") {
66
					alert("recommended quantity is required");
77
				alert("please fill recommended qty");
67
					return;
78
				return;
68
				}
79
			}
-
 
80
 
-
 
81
 
69
				if (minimumQty === "") {
82
			if (obvRecommended != "" && obvMinimumQty == "") {
70
					alert("minimumQty is required");
83
				alert("please fill obvMinimum qty");
-
 
84
				return;
-
 
85
			}
-
 
86
 
-
 
87
			if (obvRecommended == "" && obvMinimumQty != "") {
-
 
88
				alert("please fill obvRecommended qty");
71
					return;
89
				return;
72
				}
90
			}
-
 
91
 
73
				if (catalogId === null) {
92
			if (regionId == "") {
74
					alert("please choose item");
93
				alert("Select Region");
75
					return;
94
				return;
76
				}
95
			}
77
				var params = {
96
			var params = {
78
					"catalogId" : catalogId,
97
				"catalogId": catalogId,
79
					"recommended" : recommended,
98
				"recommended": recommended,
80
					"minimumQty" : minimumQty,
99
				"minimumQty": minimumQty,
-
 
100
				"obvrecommend": obvRecommended,
-
 
101
				"obvminimum": obvMinimumQty,
81
					"regionId" : regionId
102
				"regionId": regionId,
-
 
103
 
82
				}
104
			}
83
				if (confirm("Are you sure you want to add item!") == true) {
105
			if (confirm("Are you sure you want to add item!") == true) {
84
					doPostAjaxRequestWithParamsHandler(context
106
				doPostAjaxRequestWithParamsHandler(context
85
							+ "/focusedModel", params, function(response) {
107
					+ "/focusedModel", params, function(response) {
86
						alert("Add Item Successfully");
108
						alert("Add Item Successfully");
87
						loadModel("main-content");
109
						loadModel("main-content");
88
					});
110
					});
89
				}
111
			}
90
			});
112
		});
91
 
113
 
92
	$(document).on('click', ".remove-model",
114
	$(document).on('click', ".remove-model",
93
					function() {
115
		function() {
94
						if (confirm("Are you sure you want to Remove the Item") == true) {
116
			if (confirm("Are you sure you want to Remove the Item") == true) {
95
							id = $(this).data('requestid');
117
				id = $(this).data('requestid');
96
							console.log(id);
118
				console.log(id);
97
							doDeleteAjaxRequestHandler(context
119
				doDeleteAjaxRequestHandler(context
98
									+ "/removeItem?id=" + id,
120
					+ "/removeItem?id=" + id,
99
									function(response) {
121
					function(response) {
100
										if (response == 'true') {
122
						if (response == 'true') {
101
											alert("successfully Removed");
123
							alert("successfully Removed");
102
											loadModel("main-content");
124
							loadModel("main-content");
103
										}
-
 
104
 
-
 
105
									});
-
 
106
						}
125
						}
107
 
126
 
108
					});
127
					});
-
 
128
			}
-
 
129
 
-
 
130
		});
109
});
131
});
110
 
132
 
111
function loadModel(domId) {
133
function loadModel(domId) {
112
	doGetAjaxRequestHandler(context + "/getFocusedModel", function(response) {
134
	doGetAjaxRequestHandler(context + "/getFocusedModel", function(response) {
113
		$('#' + domId).html(response);
135
		$('#' + domId).html(response);