Subversion Repositories SmartDukaan

Rev

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

Rev 24833 Rev 25501
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() {
10
	$(".create-partner-target-button")
-
 
11
			.live(
-
 
12
					'click',
-
 
13
					function() {
11
		var targetId = $("#partnerTargetdetailsforAddTarget").val();
14
						var targetId = $("#partnerTargetdetailsforAddTarget")
-
 
15
								.val();
12
		var fofoId = $("#partnerNameForTarget").val();
16
						var fofoId = $("#partnerNameForTarget").val();
13
		var targetValue = $(".targetValue").val();
17
						var targetValue = $(".targetValue").val();
14
		if(fofoId==""||fofoId==undefined||fofoId==null)
18
						if (fofoId == "" || fofoId == undefined
15
			{
19
								|| fofoId == null) {
16
				alert("select partner");
20
							alert("select partner");
17
				return false;
21
							return false;
18
			}
22
						}
19
		if(targetValue==""||targetValue==undefined||targetValue==null)
23
						if (targetValue == "" || targetValue == undefined
20
		{
24
								|| targetValue == null) {
21
			alert("Target value input field can't be empty");
25
							alert("Target value input field can't be empty");
22
			return false;
26
							return false;
23
		}
27
						}
24
		if (confirm("Are you sure you want to create partner target") == true) {
28
						if (confirm("Are you sure you want to create partner target") == true) {
25
			createPartnerTarget(targetId, fofoId, targetValue);
29
							createPartnerTarget(targetId, fofoId, targetValue);
26
		}
30
						}
27
	});
31
					});
28
 
32
 
29
	$("#add-single-partner-target").live('click', function() {
33
	$("#add-single-partner-target").live('click', function() {
30
		var id = $(this).data('id');
34
		var id = $(this).data('id');
31
		addPartnerTarget(id);
35
		addPartnerTarget(id);
32
	});
36
	});
Line 75... Line 79...
75
	$(".partner-target-details").live('click', function() {
79
	$(".partner-target-details").live('click', function() {
76
		var targetId = $(this).attr('data');
80
		var targetId = $(this).attr('data');
77
		console.log("targetId = " + targetId);
81
		console.log("targetId = " + targetId);
78
		loadPartnerTargetDetails(targetId, "partner-target-details-container");
82
		loadPartnerTargetDetails(targetId, "partner-target-details-container");
79
	});
83
	});
-
 
84
 
-
 
85
	$(".target-slide").live('click', function() {
-
 
86
		loadTargetInfoPage("main-content");
-
 
87
	});
-
 
88
 
80
	$(".deleteslab").live('click', function() {
89
	$(".deleteslab").live('click', function() {
81
		console.log("delete slab button clicked");
90
		console.log("delete slab button clicked");
82
		var index = $(this).data('index');
91
		var index = $(this).data('index');
83
		console.log(index);
92
		console.log(index);
84
		targetSlab.splice(-1, 1);
93
		targetSlab.splice(-1, 1);
Line 346... Line 355...
346
	doGetAjaxRequestHandler(context + "/addPartnerTarget?id=" + id, function(
355
	doGetAjaxRequestHandler(context + "/addPartnerTarget?id=" + id, function(
347
			response) {
356
			response) {
348
		$(".add-partner-target-container .modal-content").html(response);
357
		$(".add-partner-target-container .modal-content").html(response);
349
	});
358
	});
350
}
359
}
-
 
360
 
-
 
361
function loadTargetInfoPage(domId) {
-
 
362
	doGetAjaxRequestHandler(context + "/getTargetInfo", function(response) {
-
 
363
		$('#' + domId).html(response);
-
 
364
	});
-
 
365
}
-
 
366
 
351
function createPartnerTarget(targetId, fofoId, targetValue) {
367
function createPartnerTarget(targetId, fofoId, targetValue) {
352
	var params = {
368
	var params = {
353
		"fofoId" : fofoId,
369
		"fofoId" : fofoId,
354
		"partnerTargetDetailsId" : targetId,
370
		"partnerTargetDetailsId" : targetId,
355
		"targetValue" : targetValue,
371
		"targetValue" : targetValue,
Line 357... Line 373...
357
	console.log(targetValue);
373
	console.log(targetValue);
358
	doPostAjaxRequestWithParamsHandler(context + "/addPartnerTarget", params,
374
	doPostAjaxRequestWithParamsHandler(context + "/addPartnerTarget", params,
359
			function(response) {
375
			function(response) {
360
				if (response == "true") {
376
				if (response == "true") {
361
					alert("successfully created!");
377
					alert("successfully created!");
362
				}
-
 
363
				else
378
				} else {
364
					{
-
 
365
					alert("You are not authorized to create partner target");
379
					alert("You are not authorized to create partner target");
366
					}
380
				}
367
			});
381
			});
368
}
382
}
369
383