Subversion Repositories SmartDukaan

Rev

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

Rev 9065 Rev 9231
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$('#addOpRadio').live('click', function() {
2
	$('#addOpRadio').live('click', function() {
3
		$('#addRecordSubmit').attr('disabled', 'true');
3
		$('#addUpdateRecordSubmit').attr('disabled', 'true');
4
		$('div#addRecordDataDiv').show();
4
		$('div#addRecordDataDiv').show();
5
		$('div#updateRecordDataDiv').hide();
5
		$('div#updateRecordDataDiv').hide();
-
 
6
		
-
 
7
		$('div#updateCampaignDiv').hide();
-
 
8
		$('div#updateKeywordDiv').hide();
-
 
9
		$('div#updateAdgroupDiv').hide();
-
 
10
		
-
 
11
		$('#campaignRdoUpdate').attr("checked",false);
-
 
12
		$('#adgroupRdoUpdate').attr("checked",false);
-
 
13
		$('#keywordRdoUpdate').attr("checked",false);
-
 
14
    	$('#campaignListUpdate1').val('-1');
-
 
15
    	$('#campaignNameUpdate').val('');
-
 
16
    	$('#campaignStatusUpdate').val('2');
-
 
17
    	
-
 
18
    	$('#campaignListUpdate2').val('-1');
-
 
19
    	$('#adgroupListUpdate1').find("option").remove();
-
 
20
    	$('#adgroupListUpdate1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
21
    	$('#adgroupNameUpdate').val('');
-
 
22
    	$('#adgroupStatusUpdate').val('2');
-
 
23
    	$('#catalogItemIdUpdate').val('');
-
 
24
    	$('#bidAmountUpdate').val('');
-
 
25
    	
-
 
26
    	$('#campaignListUpdate3').val('-1');
-
 
27
    	$('#adgroupListUpdate2').find("option").remove();
-
 
28
    	$('#adgroupListUpdate2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
29
    	$('#keywordListUpdate1').find("option").remove();
-
 
30
    	$('#keywordListUpdate1').append($("<option></option>").val('-1').html('---Select Keyword---'));
-
 
31
    	$('#keywordUpdate').val('');
-
 
32
    	$('#bidUpdate').val('');
-
 
33
    	$('#matchTypeUpdate').val('2'); 	
-
 
34
    	
6
	});
35
	});
7
	
36
	
8
	$('#updateOpRadio').live('click', function() {
37
	$('#updateOpRadio').live('click', function() {
9
		$('div#addRecordDataDiv').hide();
38
		$('div#addRecordDataDiv').hide();
10
		$('div#updateRecordDataDiv').show();
39
		$('div#updateRecordDataDiv').show();
-
 
40
		$('#addUpdateRecordSubmit').attr('disabled', 'true');
-
 
41
		
11
		$("#campaignRdo").attr("checked", false);
42
		$("#campaignRdo").attr("checked", false);
12
        $("#adgroupRdo").attr("checked", false);
43
        $("#adgroupRdo").attr("checked", false);
13
        $("#textAdRdo").attr("checked", false);
44
        $("#textAdRdo").attr("checked", false);
14
        $("#keywordRdo").attr("checked", false);
45
        $("#keywordRdo").attr("checked", false);
15
        $('div#addCampaignDiv').hide();
46
        $('div#addCampaignDiv').hide();
Line 62... Line 93...
62
	$('#campaignRdo').live('click', function() {
93
	$('#campaignRdo').live('click', function() {
63
		$('div#addCampaignDiv').show();
94
		$('div#addCampaignDiv').show();
64
		$('div#addAdgroupDiv').hide();
95
		$('div#addAdgroupDiv').hide();
65
		$('div#addAdgroupAdDiv').hide();
96
		$('div#addAdgroupAdDiv').hide();
66
		$('div#addKeywordDiv').hide();
97
		$('div#addKeywordDiv').hide();
-
 
98
		
67
		$("#adgroupList1").find("option").remove();
99
		$("#adgroupList1").find("option").remove();
68
    	$('#adgroupList1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
100
    	$('#adgroupList1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
69
    	$("#adgroupList2").find("option").remove();
101
    	$("#adgroupList2").find("option").remove();
70
    	$('#adgroupList2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
102
    	$('#adgroupList2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
71
		$('#addRecordSubmit').removeAttr('disabled');
103
		$('#addUpdateRecordSubmit').removeAttr('disabled');
72
		$("#campaignList1").val('-1');
104
		$("#campaignList1").val('-1');
73
        $('#adgroupName').val('');
105
        $('#adgroupName').val('');
74
        $('#adgroupStatus').val('2');
106
        $('#adgroupStatus').val('2');
75
        $('#bidAmount').val('');
107
        $('#bidAmount').val('');
76
        $('#catalogItemId').val('');
108
        $('#catalogItemId').val('');
Line 115... Line 147...
115
		$('div#addKeywordDiv').hide();
147
		$('div#addKeywordDiv').hide();
116
		$("#adgroupList1").find("option").remove();
148
		$("#adgroupList1").find("option").remove();
117
    	$('#adgroupList1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
149
    	$('#adgroupList1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
118
    	$("#adgroupList2").find("option").remove();
150
    	$("#adgroupList2").find("option").remove();
119
    	$('#adgroupList2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
151
    	$('#adgroupList2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
120
		$('#addRecordSubmit').removeAttr('disabled');
152
		$('#addUpdateRecordSubmit').removeAttr('disabled');
121
		$("#campaignList1").val('-1');
153
		$("#campaignList1").val('-1');
122
        $('#adgroupName').val('');
154
        $('#adgroupName').val('');
123
        $('#adgroupStatus').val('2');
155
        $('#adgroupStatus').val('2');
124
        $('#bidAmount').val('');
156
        $('#bidAmount').val('');
125
        $('#catalogItemId').val('');
157
        $('#catalogItemId').val('');
Line 164... Line 196...
164
		$('div#addKeywordDiv').hide();
196
		$('div#addKeywordDiv').hide();
165
		$("#adgroupList1").find("option").remove();
197
		$("#adgroupList1").find("option").remove();
166
    	$('#adgroupList1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
198
    	$('#adgroupList1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
167
    	$("#adgroupList2").find("option").remove();
199
    	$("#adgroupList2").find("option").remove();
168
    	$('#adgroupList2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
200
    	$('#adgroupList2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
169
		$('#addRecordSubmit').removeAttr('disabled');
201
		$('#addUpdateRecordSubmit').removeAttr('disabled');
170
		$("#campaignList1").val('-1');
202
		$("#campaignList1").val('-1');
171
        $('#adgroupName').val('');
203
        $('#adgroupName').val('');
172
        $('#adgroupStatus').val('2');
204
        $('#adgroupStatus').val('2');
173
        $('#bidAmount').val('');
205
        $('#bidAmount').val('');
174
        $('#catalogItemId').val('');
206
        $('#catalogItemId').val('');
Line 242... Line 274...
242
        $("#matchType1").val('3');
274
        $("#matchType1").val('3');
243
        $("#matchType2").val('3');
275
        $("#matchType2").val('3');
244
        $("#matchType3").val('3');
276
        $("#matchType3").val('3');
245
        $("#matchType4").val('3');
277
        $("#matchType4").val('3');
246
        $("#matchType5").val('3');
278
        $("#matchType5").val('3');
247
		$('#addRecordSubmit').removeAttr('disabled');
279
		$('#addUpdateRecordSubmit').removeAttr('disabled');
248
		$('#campaignName').val('');
280
		$('#campaignName').val('');
249
        $("#campaignStatus").val('2');
281
        $("#campaignStatus").val('2');
250
        $('#startDate').val('');
282
        $('#startDate').val('');
251
        $('#endDate').val('');
283
        $('#endDate').val('');
252
        $("#googleSearchNetwork").attr("checked", false);
284
        $("#googleSearchNetwork").attr("checked", false);
253
        $("#displayNetwork").attr("checked", false);
285
        $("#displayNetwork").attr("checked", false);
254
        $("#partnerSearchNetwork").attr("checked", false);
286
        $("#partnerSearchNetwork").attr("checked", false);
255
        $("#campaignAmount").val('');
287
        $("#campaignAmount").val('');
256
	});
288
	});
257
	
289
	
-
 
290
	$('#campaignRdoUpdate').live('click', function() {
-
 
291
		$('div#updateCampaignDiv').show();
-
 
292
		$('div#updateKeywordDiv').hide();
-
 
293
		$('div#updateAdgroupDiv').hide();
-
 
294
		
-
 
295
		$('#addUpdateRecordSubmit').removeAttr('disabled');
-
 
296
		
-
 
297
		$('#campaignListUpdate1').val('-1');
-
 
298
    	$('#campaignNameUpdate').val('');
-
 
299
    	$('#campaignStatusUpdate').val('2');
-
 
300
    	
-
 
301
    	$('#campaignListUpdate2').val('-1');
-
 
302
    	$('#adgroupListUpdate1').find("option").remove();
-
 
303
    	$('#adgroupListUpdate1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
304
    	$('#adgroupNameUpdate').val('');
-
 
305
    	$('#adgroupStatusUpdate').val('2');
-
 
306
    	$('#catalogItemIdUpdate').val('');
-
 
307
    	$('#bidAmountUpdate').val('');
-
 
308
    	
-
 
309
    	$('#campaignListUpdate3').val('-1');
-
 
310
    	$('#adgroupListUpdate2').find("option").remove();
-
 
311
    	$('#adgroupListUpdate2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
312
    	$('#keywordListUpdate1').find("option").remove();
-
 
313
    	$('#keywordListUpdate1').append($("<option></option>").val('-1').html('---Select Keyword---'));
-
 
314
    	$('#keywordUpdate').val('');
-
 
315
    	$('#bidUpdate').val('');
-
 
316
    	$('#matchTypeUpdate').val('2'); 	
-
 
317
	});
-
 
318
	
-
 
319
	$('#keywordRdoUpdate').live('click', function() {
-
 
320
		$('div#updateCampaignDiv').hide();
-
 
321
		$('div#updateKeywordDiv').show();
-
 
322
		$('div#updateAdgroupDiv').hide();
-
 
323
		
-
 
324
		$('#addUpdateRecordSubmit').removeAttr('disabled');
-
 
325
		
-
 
326
		$('#campaignListUpdate1').val('-1');
-
 
327
    	$('#campaignNameUpdate').val('');
-
 
328
    	$('#campaignStatusUpdate').val('2');
-
 
329
    	
-
 
330
    	$('#campaignListUpdate2').val('-1');
-
 
331
    	$('#adgroupListUpdate1').find("option").remove();
-
 
332
    	$('#adgroupListUpdate1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
333
    	$('#adgroupNameUpdate').val('');
-
 
334
    	$('#adgroupStatusUpdate').val('2');
-
 
335
    	$('#catalogItemIdUpdate').val('');
-
 
336
    	$('#bidAmountUpdate').val('');
-
 
337
    	
-
 
338
    	$('#campaignListUpdate3').val('-1');
-
 
339
    	$('#adgroupListUpdate2').find("option").remove();
-
 
340
    	$('#adgroupListUpdate2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
341
    	$('#keywordListUpdate1').find("option").remove();
-
 
342
    	$('#keywordListUpdate1').append($("<option></option>").val('-1').html('---Select Keyword---'));
-
 
343
    	$('#keywordUpdate').val('');
-
 
344
    	$('#bidUpdate').val('');
-
 
345
    	$('#matchTypeUpdate').val('2'); 	
-
 
346
	});
-
 
347
	
-
 
348
	$('#adgroupRdoUpdate').live('click', function() {
-
 
349
		$('div#updateCampaignDiv').hide();
-
 
350
		$('div#updateKeywordDiv').hide();
-
 
351
		$('div#updateAdgroupDiv').show();
-
 
352
		
-
 
353
		$('#addUpdateRecordSubmit').removeAttr('disabled');
-
 
354
		
-
 
355
		$('#campaignListUpdate1').val('-1');
-
 
356
    	$('#campaignNameUpdate').val('');
-
 
357
    	$('#campaignStatusUpdate').val('2');
-
 
358
    	
-
 
359
    	$('#campaignListUpdate2').val('-1');
-
 
360
    	$('#adgroupListUpdate1').find("option").remove();
-
 
361
    	$('#adgroupListUpdate1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
362
    	$('#adgroupNameUpdate').val('');
-
 
363
    	$('#adgroupStatusUpdate').val('2');
-
 
364
    	$('#catalogItemIdUpdate').val('');
-
 
365
    	$('#bidAmountUpdate').val('');
-
 
366
    	
-
 
367
    	$('#campaignListUpdate3').val('-1');
-
 
368
    	$('#adgroupListUpdate2').find("option").remove();
-
 
369
    	$('#adgroupListUpdate2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
370
    	$('#keywordListUpdate1').find("option").remove();
-
 
371
    	$('#keywordListUpdate1').append($("<option></option>").val('-1').html('---Select Keyword---'));
-
 
372
    	$('#keywordUpdate').val('');
-
 
373
    	$('#bidUpdate').val('');
-
 
374
    	$('#matchTypeUpdate').val('2'); 	
-
 
375
	});
-
 
376
	
258
	$('#cancelAddRecords').live('click', function() {
377
	$('#cancelAddUpdateRecords').live('click', function() {
259
		$("#campaignRdo").attr("checked", false);
378
		$("#campaignRdo").attr("checked", false);
260
        $("#adgroupRdo").attr("checked", false);
379
        $("#adgroupRdo").attr("checked", false);
261
        $("#textAdRdo").attr("checked", false);
380
        $("#textAdRdo").attr("checked", false);
262
        $("#keywordRdo").attr("checked", false);
381
        $("#keywordRdo").attr("checked", false);
263
        $('div#addCampaignDiv').hide();
382
        $('div#addCampaignDiv').hide();
Line 303... Line 422...
303
        $("#matchType1").val('3');
422
        $("#matchType1").val('3');
304
        $("#matchType2").val('3');
423
        $("#matchType2").val('3');
305
        $("#matchType3").val('3');
424
        $("#matchType3").val('3');
306
        $("#matchType4").val('3');
425
        $("#matchType4").val('3');
307
        $("#matchType5").val('3');
426
        $("#matchType5").val('3');
308
        $('#addRecordSubmit').attr('disabled', 'true');
427
        $('#addUpdateRecordSubmit').attr('disabled', 'true');
-
 
428
                
-
 
429
        $('div#updateCampaignDiv').hide();
-
 
430
		$('div#updateKeywordDiv').hide();
-
 
431
		$('div#updateAdgroupDiv').hide();
-
 
432
        $('#campaignRdoUpdate').attr("checked",false);
-
 
433
		$('#adgroupRdoUpdate').attr("checked",false);
-
 
434
		$('#keywordRdoUpdate').attr("checked",false);
-
 
435
    	$('#campaignListUpdate1').val('-1');
-
 
436
    	$('#campaignNameUpdate').val('');
-
 
437
    	$('#campaignStatusUpdate').val('2');
-
 
438
    	
-
 
439
    	$('#campaignListUpdate2').val('-1');
-
 
440
    	$('#adgroupListUpdate1').find("option").remove();
-
 
441
    	$('#adgroupListUpdate1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
442
    	$('#adgroupNameUpdate').val('');
-
 
443
    	$('#adgroupStatusUpdate').val('2');
-
 
444
    	$('#catalogItemIdUpdate').val('');
-
 
445
    	$('#bidAmountUpdate').val('');
-
 
446
    	
-
 
447
    	$('#campaignListUpdate3').val('-1');
-
 
448
    	$('#adgroupListUpdate2').find("option").remove();
-
 
449
    	$('#adgroupListUpdate2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
450
    	$('#keywordListUpdate1').find("option").remove();
-
 
451
    	$('#keywordListUpdate1').append($("<option></option>").val('-1').html('---Select Keyword---'));
-
 
452
    	$('#keywordUpdate').val('');
-
 
453
    	$('#bidUpdate').val('');
-
 
454
    	$('#matchTypeUpdate').val('2');
-
 
455
        
309
    });
456
    });
310
	$("#campaignList2").change(function () {
457
	$("#campaignList2").change(function () {
311
	    $("#adgroupList1").find("option:gt(0)").remove();
458
	    $("#adgroupList1").find("option:gt(0)").remove();
312
	    
459
	    
313
	    $.ajax({
460
	    $.ajax({
Line 339... Line 486...
339
    				$('#adgroupList2').append($("<option></option>").val(obj.AdgroupId).html(obj.Name));
486
    				$('#adgroupList2').append($("<option></option>").val(obj.AdgroupId).html(obj.Name));
340
    			});
487
    			});
341
            }
488
            }
342
        });
489
        });
343
	});
490
	});
-
 
491
	
-
 
492
	$("#campaignListUpdate1").change(function () {
-
 
493
		$('#campaignNameUpdate').val('');
-
 
494
    	$('#campaignStatusUpdate').val('2');
-
 
495
    	$('#campaignAmountUpdate').val(''); 
-
 
496
	    $.ajax({
-
 
497
            type      : 'GET',
-
 
498
            url       : '/Support/google-adwords!getCampaignDetails',
-
 
499
            data 	  : 'campaignId=' + $(this).val(),
-
 
500
            dataType  : 'json',
-
 
501
            success   : function(reply) {
-
 
502
	    		$('#campaignNameUpdate').val(reply.Name);
-
 
503
	    		$('#campaignStatusUpdate').val(reply.Status);
-
 
504
	    		$('#campaignAmountUpdate').val(reply.BudgetAmount);
-
 
505
            }
-
 
506
        });
-
 
507
	});
-
 
508
	
-
 
509
	$("#campaignListUpdate2").change(function () {
-
 
510
	    $("#adgroupListUpdate1").find("option:gt(0)").remove();
-
 
511
	    $('#adgroupNameUpdate').val('');
-
 
512
    	$('#adgroupStatusUpdate').val('2');
-
 
513
    	$('#catalogItemIdUpdate').val('');
-
 
514
    	$('#bidAmountUpdate').val('');
-
 
515
	    
-
 
516
	    $.ajax({
-
 
517
            type      : 'GET',
-
 
518
            url       : '/Support/google-adwords!getAdgroupList',
-
 
519
            data 	  : 'campaignId=' + $(this).val(),
-
 
520
            dataType  : 'json',
-
 
521
            success   : function(reply) {
-
 
522
            	$("#adgroupListUpdate1").find("option").remove();
-
 
523
            	$('#adgroupListUpdate1').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
524
    			$.each(reply.AdGroupData, function(i,obj) {
-
 
525
    				$('#adgroupListUpdate1').append($("<option></option>").val(obj.AdgroupId).html(obj.Name));
-
 
526
    			});
-
 
527
            }
-
 
528
        });
-
 
529
	});
-
 
530
	
-
 
531
	$("#adgroupListUpdate1").change(function () {
-
 
532
		$('#adgroupNameUpdate').val('');
-
 
533
    	$('#adgroupStatusUpdate').val('2');
-
 
534
    	$('#catalogItemIdUpdate').val('');
-
 
535
    	$('#bidAmountUpdate').val('');
-
 
536
	    $.ajax({
-
 
537
            type      : 'GET',
-
 
538
            url       : '/Support/google-adwords!getAdGroupDetails',
-
 
539
            data 	  : 'adgroupId=' + $(this).val(),
-
 
540
            dataType  : 'json',
-
 
541
            success   : function(reply) {
-
 
542
           	    $('#adgroupNameUpdate').val(reply.Name);
-
 
543
            	$('#adgroupStatusUpdate').val(reply.Status);
-
 
544
            	$('#catalogItemIdUpdate').val(reply.CatalogItemId);
-
 
545
            	$('#bidAmountUpdate').val(reply.BidAmount);
-
 
546
        	
-
 
547
            }
-
 
548
        });
-
 
549
	});
-
 
550
	
-
 
551
	$("#campaignListUpdate3").change(function () {
-
 
552
	    $("#adgroupListUpdate2").find("option:gt(0)").remove();
-
 
553
	    $("#keywordListUpdate1").find("option:gt(0)").remove();
-
 
554
	    $('#keywordUpdate').val('');
-
 
555
    	$('#matchTypeUpdate').val('2');
-
 
556
    	$('#bidUpdate').val('');
-
 
557
	    $.ajax({
-
 
558
            type      : 'GET',
-
 
559
            url       : '/Support/google-adwords!getAdgroupList',
-
 
560
            data 	  : 'campaignId=' + $(this).val(),
-
 
561
            dataType  : 'json',
-
 
562
            success   : function(reply) {
-
 
563
            	$("#adgroupListUpdate2").find("option").remove();
-
 
564
            	$('#adgroupListUpdate2').append($("<option></option>").val('-1').html('---Select AdGroup---'));
-
 
565
    			$.each(reply.AdGroupData, function(i,obj) {
-
 
566
    				$('#adgroupListUpdate2').append($("<option></option>").val(obj.AdgroupId).html(obj.Name));
-
 
567
    			});
-
 
568
            }
-
 
569
        });
-
 
570
	});
-
 
571
	
-
 
572
	$("#adgroupListUpdate2").change(function () {
-
 
573
	    $("#keywordListUpdate1").find("option:gt(0)").remove();
-
 
574
	    $('#keywordUpdate').val('');
-
 
575
    	$('#matchTypeUpdate').val('2');
-
 
576
    	$('#bidUpdate').val('');
-
 
577
	    $.ajax({
-
 
578
            type      : 'GET',
-
 
579
            url       : '/Support/google-adwords!getKeywordList',
-
 
580
            data 	  : 'adgroupId=' + $(this).val(),
-
 
581
            dataType  : 'json',
-
 
582
            success   : function(reply) {
-
 
583
            	$("#keywordListUpdate1").find("option").remove();
-
 
584
            	$('#keywordListUpdate1').append($("<option></option>").val('-1').html('---Select Keyword---'));
-
 
585
    			$.each(reply.AdKeywordData, function(i,obj) {
-
 
586
    				$('#keywordListUpdate1').append($("<option></option>").val(obj.KeywordId).html(obj.Text));
-
 
587
    			});
-
 
588
            }
-
 
589
        });
-
 
590
	});
-
 
591
	
-
 
592
	$("#keywordListUpdate1").change(function () {
-
 
593
		$('#keywordUpdate').val('');
-
 
594
    	$('#matchTypeUpdate').val('2');
-
 
595
    	$('#bidUpdate').val('');
-
 
596
	    $.ajax({
-
 
597
            type      : 'GET',
-
 
598
            url       : '/Support/google-adwords!getKeywordDetails',
-
 
599
            data 	  : 'keywordId=' + $(this).val() + '&adgroupId=' + $("#adgroupListUpdate2").val(),
-
 
600
            dataType  : 'json',
-
 
601
            success   : function(reply) {
-
 
602
            	$('#keywordUpdate').val(reply.Text);
-
 
603
                $('#matchTypeUpdate').val(reply.MatchType);
-
 
604
                $('#bidUpdate').val(reply.Bid);
-
 
605
            	
-
 
606
            }
-
 
607
        });
-
 
608
	});
-
 
609
	
344
});
610
});
345
611