Subversion Repositories SmartDukaan

Rev

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

Rev 24171 Rev 24833
Line 5... Line 5...
5
 
5
 
6
	$(".upload-target").live('click', function() {
6
	$(".upload-target").live('click', function() {
7
		console.log("upload target Button Clicked...")
7
		console.log("upload target Button Clicked...")
8
		uploadTarget("main-content");
8
		uploadTarget("main-content");
9
	});
9
	});
-
 
10
	$(".create-partner-target-button").live('click', function() {
-
 
11
		var targetId = $("#partnerTargetdetailsforAddTarget").val();
-
 
12
		var fofoId = $("#partnerNameForTarget").val();
-
 
13
		var targetValue = $(".targetValue").val();
-
 
14
		if(fofoId==""||fofoId==undefined||fofoId==null)
-
 
15
			{
-
 
16
				alert("select partner");
-
 
17
				return false;
-
 
18
			}
-
 
19
		if(targetValue==""||targetValue==undefined||targetValue==null)
-
 
20
		{
-
 
21
			alert("Target value input field can't be empty");
-
 
22
			return false;
-
 
23
		}
-
 
24
		if (confirm("Are you sure you want to create partner target") == true) {
-
 
25
			createPartnerTarget(targetId, fofoId, targetValue);
-
 
26
		}
-
 
27
	});
-
 
28
 
-
 
29
	$("#add-single-partner-target").live('click', function() {
-
 
30
		var id = $(this).data('id');
-
 
31
		addPartnerTarget(id);
-
 
32
	});
-
 
33
	$("#edit-partner-target").live('click', function() {
-
 
34
		var partnerTargetId = $(this).data('targetid');
-
 
35
		getEditPartnerTarget(partnerTargetId);
-
 
36
	});
-
 
37
	$(".modify-partner-target-button")
-
 
38
			.live(
-
 
39
					'click',
-
 
40
					function() {
-
 
41
						var partnerTargetId = $(this).data('id');
-
 
42
						var partnerTargetDetailsId = $("#partnerTargetdetails")
-
 
43
								.val();
-
 
44
						var targetValue = $(".partnerTargetValue").val();
-
 
45
						console.log(partnerTargetId);
-
 
46
						if (confirm("Are you sure you want to modify partner target") == true) {
-
 
47
							modifyPartnerTarget(partnerTargetId,
-
 
48
									partnerTargetDetailsId, targetValue);
-
 
49
						}
-
 
50
					});
-
 
51
 
10
	$(".partner-target").live('click', function() {
52
	$(".partner-target").live('click', function() {
11
		console.log("partner target Button Clicked...")
53
		console.log("partner target Button Clicked...")
12
		partnerTarget("main-content");
54
		partnerTarget("main-content");
13
	});
55
	});
14
	$("#partner-target-details-paginated .next").live(
56
	$("#partner-target-details-paginated .next").live(
Line 178... Line 220...
178
								.toLowerCase();
220
								.toLowerCase();
179
						if ($.inArray(ext, [ 'xlsx' ]) == -1) {
221
						if ($.inArray(ext, [ 'xlsx' ]) == -1) {
180
							alert('invalid extension!');
222
							alert('invalid extension!');
181
							return;
223
							return;
182
						}
224
						}
183
						if (targetName === null ||targetName ==="") {
225
						if (targetName === null || targetName === "") {
184
							alert("targetName Field is not empty");
226
							alert("targetName Field is not empty");
185
							return;
227
							return;
186
						}
228
						}
187
						if (slabName === null ||slabName === "") {
229
						if (slabName === null || slabName === "") {
188
							alert("slabName Field is not empty");
230
							alert("slabName Field is not empty");
189
							return;
231
							return;
190
						}
232
						}
191
						var brandName = $('#target-brands').val();
233
						var brandName = $('#target-brands').val();
192
						console.log(brandName);
234
						console.log(brandName);
Line 251... Line 293...
251
	} else {
293
	} else {
252
		$("#slab-input")
294
		$("#slab-input")
253
				.html(
295
				.html(
254
 
296
 
255
						"<input type=number class=\"form-control input-sm\" id=rewardPercentage placeholder=\"Enter Reward Percentage\">"
297
						"<input type=number class=\"form-control input-sm\" id=rewardPercentage placeholder=\"Enter Reward Percentage\">"
256
								+ "<input type=text class=\"form-control input-sm\" id=slabNameId placeholder=\"Enter Slab Name\">  "+
298
								+ "<input type=text class=\"form-control input-sm\" id=slabNameId placeholder=\"Enter Slab Name\">  "
257
								"<input class=\"btn btn-primary\" type=button value=upload id=uploadExcel>");
299
								+ "<input class=\"btn btn-primary\" type=button value=upload id=uploadExcel>");
258
	}
300
	}
259
}
301
}
260
 
302
 
261
function uploadTarget(domId) {
303
function uploadTarget(domId) {
262
	doGetAjaxRequestHandler(context + "/uploadPartnerTargetPage", function(
304
	doGetAjaxRequestHandler(context + "/uploadPartnerTargetPage", function(
Line 275... Line 317...
275
			function(response) {
317
			function(response) {
276
				$('#' + domId).html(response);
318
				$('#' + domId).html(response);
277
				window.dispatchEvent(new Event('resize'));
319
				window.dispatchEvent(new Event('resize'));
278
			});
320
			});
279
}
321
}
-
 
322
function getEditPartnerTarget(partnerTargetId) {
-
 
323
	doGetAjaxRequestHandler(context + "/getAllPartnerRelatedTarget?id="
-
 
324
			+ partnerTargetId, function(response) {
-
 
325
		$(".edit-partner-target-container .modal-content").html(response);
-
 
326
	});
-
 
327
}
-
 
328
function modifyPartnerTarget(partnerTargetId, partnerTargetDetailsId,
-
 
329
		targetValue) {
-
 
330
	var params = {
-
 
331
		"partnerTargetId" : partnerTargetId,
-
 
332
		"partnerTargetDetailsId" : partnerTargetDetailsId,
-
 
333
		"targetValue" : targetValue,
-
 
334
	}
-
 
335
	doPostAjaxRequestWithParamsHandler(context + "/updatePartnerTarget",
-
 
336
			params, function(response) {
-
 
337
				if (response == "true") {
-
 
338
					alert("Target successfully modified");
-
 
339
					getEditPartnerTarget(partnerTargetId)
-
 
340
				} else {
-
 
341
					alert("Target already defined");
-
 
342
				}
-
 
343
			});
-
 
344
}
-
 
345
function addPartnerTarget(id) {
-
 
346
	doGetAjaxRequestHandler(context + "/addPartnerTarget?id=" + id, function(
-
 
347
			response) {
-
 
348
		$(".add-partner-target-container .modal-content").html(response);
-
 
349
	});
-
 
350
}
-
 
351
function createPartnerTarget(targetId, fofoId, targetValue) {
-
 
352
	var params = {
-
 
353
		"fofoId" : fofoId,
-
 
354
		"partnerTargetDetailsId" : targetId,
-
 
355
		"targetValue" : targetValue,
-
 
356
	}
-
 
357
	console.log(targetValue);
-
 
358
	doPostAjaxRequestWithParamsHandler(context + "/addPartnerTarget", params,
-
 
359
			function(response) {
-
 
360
				if (response == "true") {
-
 
361
					alert("successfully created!");
-
 
362
				}
-
 
363
				else
-
 
364
					{
-
 
365
					alert("You are not authorized to create partner target");
-
 
366
					}
-
 
367
			});
-
 
368
}
280
369