Subversion Repositories SmartDukaan

Rev

Rev 29050 | Rev 29058 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24317 govind 1
$(function() {
27754 amit.gupta 2
	$(document).on('click', ".create-service", function() {
24317 govind 3
		loadService("main-content");
4
	});
29050 tejbeer 5
 
27754 amit.gupta 6
	$(document).on('click', ".add-brand", function() {
24317 govind 7
		loadaddBrandToService("main-content");
8
	});
9
 
27755 amit.gupta 10
	$(document).on('click', ".notApplicableService",
24317 govind 11
			function() {
12
				naCommentService = $(this).data('nacommentservice');
13
				console.log(naCommentService);
14
				var dialog = bootbox.dialog({
15
					message : "<h4 style='color:red'>NOTAPPLICABLE</h4><p>"
16
							+ naCommentService + "</p>",
17
					closeButton : true
18
				});
19
				dialog.modal('show');
20
 
21
			});
27755 amit.gupta 22
	$(document).on('click', ".notApplicableBrandService",
24317 govind 23
			function() {
24
				naCommentService = $(this).data('nacommentservice');
25
				console.log(naCommentService);
26
				var dialog = bootbox.dialog({
27
					message : "<h4 style='color:red'>NOTAPPLICABLE</h4><p>"
28
							+ naCommentService + "</p>",
29
					closeButton : true
30
				});
31
				dialog.modal('show');
32
 
33
			});
27754 amit.gupta 34
	$(document).on('click', ".add-brand", function() {
24317 govind 35
		loadaddBrandToService("main-content");
36
	});
29051 manish 37
	$(document).on('click', ".activate-brand-service-modal", function() {
38
		console.log("activate-brand-service-modal clicked");
39
		serviceId = $(this).data('serviceid');
40
		fofoId = $("#partnerName").val();
41
		serviceBrandId = $(this).data('servicebrandid');
42
		console.log(fofoId);
43
		console.log(serviceId);
44
		console.log(serviceBrandId);
45
		var params = {
46
				"serviceId" : serviceId,
47
				"fofoId" : fofoId,
48
				"serviceBrandId" : serviceBrandId
49
 
50
			}
51
			doPostAjaxRequestWithParamsHandler(context
52
			+ "/activatePartnerbrandServiceModal", params, function(response) {
53
 
54
				$('#myServiceActivateBrand').html(response);
55
 
56
			});
57
 
58
 
59
	});
60
   $(document).on('click', ".reason-brand-service-not-activates", function() {
61
 
62
		console.log("reason-brand-service-not-activates clicked");
63
		serviceId = $(this).data('serviceid');
64
		fofoId = $("#partnerName").val();
65
		serviceBrandId = $(this).data('servicebrandid');
66
	  var serviceBrandComment = $('input[name="reasonBrandServiceNotActivate"]').val();
67
		console.log(fofoId);
68
		console.log(serviceId);
69
		console.log(serviceBrandId);
70
		console.log(serviceBrandComment);
71
		reasonPartnerbrandServiceNotActivate(fofoId, serviceId, serviceBrandId,serviceBrandComment);
28830 amit.gupta 72
 
29051 manish 73
	});
74
 
28830 amit.gupta 75
	$(document).on('click', ".markNA", function() {
76
		let fofoId = $('#partnerName').val();
77
		let serviceId = $(this).data("serviceid");
78
		bootbox.dialog({
79
			title : "Mark Not Applicable!",
80
			message : "<div class=form-inline'>"
81
					+ "<label for='code'>Not Applicable Reason:</label>"
82
					+ "<input class='form-control' type='text' id='naText'/>"
83
					+ "</div>",
84
			buttons : {
85
				cancel : {
86
					label : "CANCEL",
87
					className : 'btn-danger',
88
					callback : function() {
89
						return;
90
					}
91
				},
92
				ok : {
93
					label : "OK",
94
					className : 'btn-info',
95
					callback : function() {
96
						naText = $('#naText').val();
97
						if(naText==""||naText==undefined||naText==null){
98
								alert("NA text can't be empty");
99
								return;
100
							}
101
						var params = {
102
								"serviceId" : serviceId,
103
								"fofoId" : fofoId,
104
								"naText":naText
105
							}
106
							doPostAjaxRequestWithJsonHandler(context + "/partnerservice/applicable",
107
									JSON.stringify(params), function(response) {
108
										alert("Successfully Marked NA");
109
										loadAdminPartnerService("main-content", fofoId);
110
									});
111
					}
112
				}
113
			}
114
		});
115
	});
116
	$(document).on('click', ".markApplicable", function() {
117
		let serviceId = $(this).data("serviceid");
118
		if(confirm("Confirm?")) {
119
		let fofoId = $('#partnerName').val();
120
			var params = {
121
				"serviceId" : serviceId,
122
				"fofoId" : fofoId,
123
				"naText":null
124
			}
125
			doPostAjaxRequestWithJsonHandler(context + "/partnerservice/applicable", JSON.stringify(params), function(response) {
126
				alert("successfully Marked Applicable");
127
				loadAdminPartnerService("main-content", fofoId);
128
			});
129
 
130
		}
131
	});
132
 
27755 amit.gupta 133
	$(document).on('click', ".add-service-details-for-partner",
24317 govind 134
			function() {
135
				fofoId = $("#partnerName").val();
136
				serviceId = $("#serviceName").val();
137
				applicableType = $("#applicableService").val();
138
				code = $("#code").val();
139
				partnerStatus = $("#partnerStatusTypeServices").val();
140
				na_comment = $("#na_comment_services").val();
141
				partnerCommentStatus = $("#partner_comment_status").val();
142
				 if (applicableType == "" || applicableType == null
143
							|| applicableType == undefined) {
144
						alert("select appropriate applicableType");
145
				 }
146
				 else if (applicableType == 'NO') {
147
					if (na_comment == "" || na_comment == undefined) {
148
						alert("Na_comment can't be empty");
149
						return;
150
					}
151
					if (fofoId == "" || fofoId == null || fofoId == undefined) {
152
						alert("select appropriate partnerName");
153
						return;
154
					}
155
					 if (serviceId == "" || serviceId == null
156
								|| serviceId == undefined) {
157
							alert("select appropriate serviceName");
158
							return;
159
					 }
160
				}
161
				 else
162
					 {
163
						if (fofoId == "" || fofoId == null || fofoId == undefined) {
164
							alert("select appropriate partnerName");
165
							return;
166
						}
167
						 if (serviceId == "" || serviceId == null
168
									|| serviceId == undefined) {
169
								alert("select appropriate serviceName");
170
								return;
171
						 }
172
				 if (code == "" || code == null
173
						|| code == undefined) {
174
					alert("enter appropriate code")
175
					return;
176
				} 
177
					 }
178
				 console.log(fofoId, serviceId, applicableType, code,
179
							partnerStatus);
180
					addPartnerServiceDetails(fofoId, serviceId, applicableType,
181
							code, partnerStatus, na_comment,
182
							partnerCommentStatus);
183
 
184
			});
27755 amit.gupta 185
	$(document).on('click', ".add-brand-service-details-for-partner",
24317 govind 186
			function() {
187
				fofoId = $("#partnerName").val();
188
				serviceId = $("#serviceName").val();
189
				serviceBrandId = $("#serviceBrandName").val();
190
				applicableType = $("#applicableService").val();
191
				active = $("#activeServiceBrand").val();
192
				partnerStatus = $("#partnerStatusTypeServices").val();
193
				na_comment = $("#na_comment_services").val();
194
				partnerCommentStatus = $("#partner_comment_status").val();
195
				if (applicableType == "NO") {
196
					if (na_comment == "" || na_comment == undefined) {
197
						alert("Na_comment can't be empty");
198
						return;
199
					}
200
				} 
201
				if (fofoId == "" || fofoId == null || fofoId == undefined) {
202
					alert("select appropriate partnerName");
203
					return;
204
				} else if (serviceBrandId == "" || serviceBrandId == null
205
						|| serviceBrandId == undefined) {
206
					alert("select appropriate serviceBrandId");
207
					return;
208
				} else if (applicableType == "" || applicableType == null
209
						|| applicableType == undefined) {
210
					alert("select appropriate applicableType");
211
				} else if (active == "" || active == null
212
						|| active == undefined) {
213
					alert("select appropriate active")
214
				} else if (partnerStatus == "" || partnerStatus == null
215
						|| partnerStatus == undefined) {
216
					alert("select appropriate partnerStatus");
217
				} else {
218
					console.log(fofoId, serviceBrandId, applicableType, active,
219
							partnerStatus);
220
					addPartnerServiceBrandDetails(fofoId, serviceId,
221
							serviceBrandId, applicableType, active,
222
							partnerStatus, na_comment, partnerCommentStatus);
223
				}
224
			});
27754 amit.gupta 225
	$(document).on('click', ".partner-service", function() {
24317 govind 226
		loadpartnerService("main-content");
227
	});
27754 amit.gupta 228
	$(document).on('click', ".admin-partner-service", function() {
24317 govind 229
		loadAdminPartnerService("main-content", 0);
230
	});
28757 amit.gupta 231
 
232
	$(document).on('click', ".partner-finance-services", function(){
233
	  showFinanceServices("main-content");
234
 
235
	});
236
 
27754 amit.gupta 237
	$(document).on('click', ".add-partner-service-details", function() {
24317 govind 238
		loadaddPartnerServiceDetails("main-content");
239
	});
27754 amit.gupta 240
	$(document).on('click', ".add-partner-brand-service-details", function() {
24317 govind 241
		loadaddPartnerBrandServiceDetails("main-content");
242
	});
27754 amit.gupta 243
	$(document).on('click', ".activate-service", function() {
24317 govind 244
		serviceId = $(this).data('serviceid');
245
		fofoId = $("#partnerName").val();
246
		console.log(fofoId);
247
		console.log(serviceId);
248
		activatePartnerService(fofoId, serviceId);
249
	});
27754 amit.gupta 250
	$(document).on('click', ".deactivate-service", function() {
24317 govind 251
		serviceId = $(this).data('serviceid');
252
		fofoId = $("#partnerName").val();
253
		console.log(fofoId);
254
		console.log(serviceId);
255
		deActivatePartnerService(fofoId, serviceId);
256
	});
27754 amit.gupta 257
	$(document).on('click', ".activate-brand-service", function() {
29051 manish 258
		console.log("activate-brand-servicel clicked");
24317 govind 259
		serviceId = $(this).data('serviceid');
260
		fofoId = $("#partnerName").val();
261
		serviceBrandId = $(this).data('servicebrandid');
262
		console.log(fofoId);
263
		console.log(serviceId);
264
		console.log(serviceBrandId);
265
		activatePartnerBrandService(fofoId, serviceId, serviceBrandId);
266
 
267
	});
27754 amit.gupta 268
	$(document).on('click', ".deactivate-brand-service", function() {
24317 govind 269
		console.log("activate-brand-service clicked");
270
		serviceId = $(this).data('serviceid');
271
		fofoId = $("#partnerName").val();
29051 manish 272
		 var serviceBrandComment = $('input[name="reasonBrandServiceNotActivate"]').val();
24317 govind 273
		serviceBrandId = $(this).data('servicebrandid');
274
		console.log(fofoId);
275
		console.log(serviceId);
276
		console.log(serviceBrandId);
29051 manish 277
		console.log(serviceBrandComment);
278
		deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId,serviceBrandComment);
24317 govind 279
 
280
	});
29051 manish 281
	$(document).on('click', ".deactivate-brand-service-modal", function() {
282
		console.log("activate-brand-service clicked");
283
		serviceId = $(this).data('serviceid');
284
		fofoId = $("#partnerName").val();
285
		serviceBrandId = $(this).data('servicebrandid');
286
		console.log(fofoId);
287
		console.log(serviceId);
288
		console.log(serviceBrandId);
289
		var params = {
290
				"serviceId" : serviceId,
291
				"fofoId" : fofoId,
292
				"serviceBrandId" : serviceBrandId
24317 govind 293
 
29051 manish 294
			}
295
			doPostAjaxRequestWithParamsHandler(context
296
			+ "/deactivatePartnerbrandServiceModal", params, function(response) {
297
 
298
				$('#myServiceDeActivateBrand').html(response);
299
 
300
			});
301
	});
302
 
303
 
27755 amit.gupta 304
	$(document).on('click', ".create-service-button",
24317 govind 305
					function() {
306
						console.log("create-service-button clicked");
307
						var serviceName = $('#createserviceName').val();
308
						if (serviceName === "" || serviceName === undefined
309
								|| serviceName == null) {
310
							alert("Input field can't be empty");
311
							return;
312
						}
313
						if (confirm("Are you sure you want to create Service!") == true) {
314
							createService("main-content", serviceName);
315
						}
316
					});
27755 amit.gupta 317
	$(document).on('click', ".partner-service-search-button",
24317 govind 318
			function() {
319
				var fofoId = $('#partnerName').val();
320
				if (fofoId === "" || fofoId === undefined || fofoId == null) {
321
					alert("select appropriate partner");
322
					return;
323
				}
324
				doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="
325
						+ fofoId, function(response) {
326
					$('#' + "partnerServicesByID").html(response);
327
				});
328
			});
27755 amit.gupta 329
	$(document).on('click', "#remove-added-brand-button",
24317 govind 330
					function() {
331
						var serviceId = $(this).data('id');
332
						var brand = $(this).data('brand');
333
						console.log(serviceId);
334
						console.log(brand)
335
						if (confirm("Are you sure you want to remove brand from Service!") == true) {
336
							removeBrandFromService("main-content", serviceId,
337
									brand);
338
						}
339
					});
27754 amit.gupta 340
	$(document).on('click', ".service-brand-button", function() {
24317 govind 341
		var brands = $('#tag-listing-brands').val();
342
		var serviceId = $('#serviceName').val();
343
		console.log(brands);
344
		console.log(serviceId);
345
		if (serviceId === "" || serviceId === undefined) {
346
			alert("service not selected");
347
			return;
348
		}
349
		if (!brands) {
350
			alert("select brand");
351
			return;
352
		}
353
		if (confirm("Are you sure you want to add brand!") == true) {
354
			addBrandToService("main-content", brands, serviceId);
355
		}
356
	});
27754 amit.gupta 357
	$(document).on('change', '#serviceName', function() {
24317 govind 358
		// $('#tag-listing-brand-value').text($(this).text());
359
		loadBrandsByServiceId("service-container", $(this).val());
360
		loadaddedBrandsbyserviceId("added-brand-to-service", $(this).val())
361
	});
362
});
363
 
364
function addPartnerServiceDetails(fofoId, serviceId, applicableType, code,
365
		partnerStatus, na_comment, partnerCommentStatus) {
366
	if (confirm("Are you sure you want to add services details!") == true) {
367
		var params = {
368
			"serviceId" : serviceId,
369
			"fofoId" : fofoId,
370
			"applicableType" : applicableType,
371
			"partnerStatus" : partnerStatus,
372
			"na_comment" : na_comment,
373
			"partnerCommentStatus" : partnerCommentStatus,
374
			"code" : code
375
		}
376
		doPostAjaxRequestWithParamsHandler(context
377
				+ "/addPartnerServicesDetails", params, function(response) {
378
			if (response == "true") {
379
				alert("successfully added partner Service Details");
380
				loadaddPartnerServiceDetails("main-content");
381
			}
382
		});
383
	}
384
}
29051 manish 385
 
386
function reasonPartnerbrandServiceNotActivate(fofoId, serviceId, serviceBrandId,serviceBrandComment) {
387
	if (confirm("Are you sure you want to activate brand service!") == true) {
388
		var params = {
389
			"serviceId" : serviceId,
390
			"fofoId" : fofoId,
391
			"serviceBrandId" : serviceBrandId,
392
			"serviceBrandComment" : serviceBrandComment
393
 
394
		}
395
		doPostAjaxRequestWithParamsHandler(context
396
				+ "/reasonPartnerbrandServiceNotActivate", params, function(response) {
397
			if (response == "true") {
398
				alert("successfully set your Comment for brand service not activated");
399
				$('#myServiceActivateBrand').modal('hide');
400
				$('.modal-backdrop').remove();
401
				loadAdminPartnerService("main-content", fofoId);
402
			}
403
		});
404
	}
405
}
24317 govind 406
function addPartnerServiceBrandDetails(fofoId, serviceId, serviceBrandId,
407
		applicableType, active, partnerStatus, na_comment,
408
		partnerCommentStatus, code) {
409
	if (confirm("Are you sure you want to add service brand details!") == true) {
410
		var params = {
411
			"serviceId" : serviceId,
412
			"serviceBrandId" : serviceBrandId,
413
			"fofoId" : fofoId,
414
			"applicableType" : applicableType,
415
			"active" : active,
416
			"partnerStatus" : partnerStatus,
417
			"na_comment" : na_comment,
418
			"partnerCommentStatus" : partnerCommentStatus,
419
 
420
		}
421
		doPostAjaxRequestWithParamsHandler(context
422
				+ "/addPartnerServiceBrandDetails", params, function(response) {
423
			if (response == "true") {
424
				alert("successfully added partner Service Brand Details");
425
				loadaddPartnerBrandServiceDetails("main-content");
426
			}
427
		});
428
	}
429
}
430
function configureBrandsDropDown() {
431
	$(document).ready(function() {
432
		$('#tag-listing-brands').multiselect({
433
			includeSelectAllOption : true,
434
			multiple : true,
435
			maxHeight : 200,
436
			buttonWidth : '180px',
437
			numberDisplayed : 1,
438
			nonSelectedText : 'Brands',
439
			nSelectedText : ' - Brands Selected',
440
			allSelectedText : 'All Brands Selected',
441
			enableFiltering : true,
442
			enableCaseInsensitiveFiltering : true
443
		});
444
	});
445
}
446
 
447
function loadService(domId) {
448
	doGetAjaxRequestHandler(context + "/getcreateService", function(response) {
449
		$('#' + domId).html(response);
450
	});
451
}
452
function loadaddedBrandsbyserviceId(domId, serviceId) {
453
	doGetAjaxRequestHandler(context + "/getAddedbrands?serviceId=" + serviceId,
454
			function(response) {
455
				$('#' + domId).html(response);
456
			});
457
}
458
function loadBrandsByServiceId(domId, serviceId) {
459
	doGetAjaxRequestHandler(context + "/getbrands?serviceId=" + serviceId,
460
			function(response) {
461
				$('#' + domId).html(response);
462
				configureBrandsDropDown();
463
			});
464
 
465
}
466
function createService(domId, serviceName) {
467
	console.log(serviceName);
468
	doPostAjaxRequestHandler(context + "/createService?serviceName="
469
			+ serviceName, function(response) {
470
		alert("Service Successfully Created");
471
		$('#' + domId).html(response);
472
	});
473
}
474
function loadaddBrandToService(domId) {
475
	doGetAjaxRequestHandler(context + "/addBrandsToService",
476
			function(response) {
477
				$('#' + domId).html(response);
478
			});
479
}
480
function addBrandToService(domId, brands, serviceId) {
481
	doPostAjaxRequestWithJsonHandler(context + "/addBrandsService?serviceId="
482
			+ serviceId, JSON.stringify(brands), function(response) {
483
		alert("Brands added successfully");
484
		loadBrandsByServiceId("service-container", serviceId);
485
		loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)
486
		$('#' + domId).html(response);
487
	});
488
}
489
function removeBrandFromService(domId, serviceId, brand) {
490
 
491
	doDeleteAjaxRequestHandler(context + "/removeBrandfromService?serviceId="
492
			+ serviceId + "&brand=" + brand, function(response) {
493
		alert("Brand removed from service successfully");
494
		loadBrandsByServiceId("service-container", serviceId);
495
		loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)
496
		$('#' + domId).html(response);
497
	});
498
}
28757 amit.gupta 499
function showFinanceServices(domId) {
500
	doGetAjaxRequestHandler(context + "/getFinanceServicesAllPartner", function(response) {
501
 
502
		$('#' + domId).html(response);
503
	});
504
}
505
 
506
 
507
 
508
 
24317 govind 509
function changeServices(partnerServiceId) {
510
	var serviceId = partnerServiceId.value;
511
	var fofoId = $("#partnerName").val();
512
	console.log(fofoId);
513
	console.log(serviceId);
514
	if (fofoId == "" || fofoId == 0 || fofoId == undefined) {
515
		var dialog = bootbox
516
				.dialog({
517
					title : "Are you sure want to change state of service!",
518
					message : "<div class=form-inline'>"
519
							+ "<label for='reason'>Reason:</label>"
520
							+ "<textarea class='form-control' rows='1' id='reason'></textarea>"
521
							+ "</div>",
522
					buttons : {
523
						cancel : {
524
							label : "cancel",
525
							className : 'btn-danger',
526
							callback : function() {
527
								loadpartnerService("main-content");
528
							}
529
						},
530
						ok : {
531
							label : "ok",
532
							className : 'btn-info',
533
							callback : function() {
534
								partnerStatusComment = $('#reason').val();
535
								console.log(partnerStatusComment);
536
								var params = {
537
									"serviceId" : serviceId,
538
									"partnerStatusComment" : partnerStatusComment
539
								}
540
								doPostAjaxRequestWithParamsHandler(
541
										context + "/changeStatePartnerService",
542
										params,
543
										function(response) {
544
											if (response == "true") {
545
												alert("successfully changed");
546
												loadpartnerService("main-content");
547
											}
548
										});
549
 
550
							}
551
						}
552
					}
553
				});
554
 
555
	} else {
556
		if (confirm("Are you sure you want to change!") == true) {
557
			var params = {
558
				"serviceId" : serviceId,
559
				"fofoId" : fofoId
560
 
561
			}
562
			doPostAjaxRequestWithParamsHandler(context
563
					+ "/changeStatePartnerService", params, function(response) {
564
				if (response == "true") {
565
					alert("successfully changed");
566
					loadAdminPartnerService("main-content", fofoId);
567
				}
568
			});
569
		}
570
		else
571
			{
572
			loadAdminPartnerService("main-content", fofoId);			
573
			}
574
	}
575
}
576
function changeServiceNameForServiceBrand() {
577
 
578
	serviceId = $("#serviceName").val();
579
	console.log(serviceId);
580
	doGetAjaxRequestHandler(context + "/selectAddedbrands?serviceId="
581
			+ serviceId, function(response) {
582
		$('#' + "serviceBrandNameContainer").html(response);
583
	});
584
}
585
function configureAllPartnerName() {
586
	$(document).ready(function() {
587
		$('#partnerName').multiselect({
588
			includeSelectAllOption : true,
589
			maxHeight : 200,
590
			buttonWidth : '200px',
591
			numberDisplayed : 1,
592
			nonSelectedText : 'Partners',
593
			nSelectedText : ' - Partners Selected',
594
			allSelectedText : 'All Partners Selected',
595
			enableFiltering : true,
596
			enableCaseInsensitiveFiltering : true
597
 
598
		});
599
	});
600
}
28757 amit.gupta 601
 
602
 
603
 
604
 
605
 
606
 
607
function onChangeStateServiceBrand(partnerServiceBrandId, partnerServiceId,brand) {
608
 
609
 
610
	console.log(brand);
611
 
24317 govind 612
	var brandServiceId = partnerServiceBrandId.value;
613
	var fofoId = $("#partnerName").val();
614
	console.log(brandServiceId, partnerServiceId);
615
	if (fofoId == "" || fofoId == 0 || fofoId == undefined) {
616
		var dialog = bootbox
617
				.dialog({
618
					title : "Are you sure want to change state of service!",
619
					message : "<div class=form-inline'>"
620
							+ "<label for='reason'>Reason:</label>"
621
							+ "<textarea class='form-control' rows='1' id='reason'></textarea>"
622
							+ "</div>",
623
					buttons : {
624
						cancel : {
625
							label : "cancel",
626
							className : 'btn-danger',
627
							callback : function() {
628
								loadpartnerService("main-content");
629
							}
630
						},
631
						ok : {
632
							label : "ok",
633
							className : 'btn-info',
634
							callback : function() {
635
								partnerStatusComment = $('#reason').val();
636
								console.log(partnerStatusComment);
637
								var params = {
28757 amit.gupta 638
									"brand":brand,
24317 govind 639
									"brandServiceId" : brandServiceId,
640
									"serviceId" : partnerServiceId,
641
									"partnerStatusComment" : partnerStatusComment
642
								}
643
								doPostAjaxRequestWithParamsHandler(
644
										context
645
												+ "/changeStatePartnerServiceBrand",
646
										params,
647
										function(response) {
648
											if (response == "true") {
649
												alert("successfully changed");
650
												loadpartnerService("main-content");
651
											}
652
 
653
										});
654
 
655
							}
656
						}
657
					}
658
				});
659
	} else {
660
		if (confirm("Are you sure you want to change!") == true) {
661
 
662
			var params = {
663
				"brandServiceId" : brandServiceId,
28757 amit.gupta 664
				"brand":brand,
24317 govind 665
				"serviceId" : partnerServiceId,
666
				"fofoId" : fofoId
28757 amit.gupta 667
 
668
					}
24317 govind 669
			doPostAjaxRequestWithParamsHandler(context
670
					+ "/changeStatePartnerServiceBrand", params, function(
671
					response) {
672
				if (response == "true") {
673
					alert("successfully changed");
674
					loadAdminPartnerService("main-content", fofoId);
675
				}
676
			});
677
 
678
		} else {
28757 amit.gupta 679
 
24317 govind 680
			loadAdminPartnerService("main-content", fofoId);
681
		}
682
	}
683
}
684
function loadpartnerService(domId) {
685
	doGetAjaxRequestHandler(context + "/getPartnerServices",
686
			function(response) {
687
				$('#' + domId).html(response);
688
			});
689
 
690
}
691
function loadAdminPartnerService(domId, fofoId) {
692
	doGetAjaxRequestHandler(context
693
			+ "/getAdminPanelForPartnerServices?fofoId=" + fofoId, function(
694
			response) {
695
		$('#' + domId).html(response);
696
		if (fofoId != 0 || fofoId) {
697
			doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="
698
					+ fofoId, function(response) {
699
				$('#' + "partnerServicesByID").html(response);
700
			});
701
		}
702
 
703
	});
704
}
705
function activatePartnerService(fofoId, serviceId) {
706
	console.log(fofoId);
28830 amit.gupta 707
	bootbox.dialog({
24317 govind 708
		title : "Are you sure you want to activate services!",
709
		message : "<div class=form-inline'>"
710
				+ "<label for='code'>Code:</label>"
711
				+ "<input class='form-control' type='text' id='code'/>"
712
				+ "</div>",
713
		buttons : {
714
			cancel : {
715
				label : "cancel",
716
				className : 'btn-danger',
717
				callback : function() {
28830 amit.gupta 718
					return;
24317 govind 719
				}
720
			},
721
			ok : {
722
				label : "ok",
723
				className : 'btn-info',
724
				callback : function() {
725
					code = $('#code').val();
726
					//console.log(partnerStatusComment);
727
					if(code==""||code==undefined||code==null)
728
						{
729
							alert("code can't be empty");
730
							activatePartnerService(fofoId, serviceId);
731
							return;
732
						}
733
					var params = {
734
							"serviceId" : serviceId,
735
							"fofoId" : fofoId,
736
							"code":code
737
						}
738
						doPostAjaxRequestWithParamsHandler(context + "/activatePartnerService",
739
								params, function(response) {
740
									if (response == "true") {
741
										alert("successfully activate");
742
										loadAdminPartnerService("main-content", fofoId);
743
									}
744
								});
745
				}
746
			}
747
		}
748
	});
749
}
29051 manish 750
 
24317 govind 751
function deActivatePartnerService(fofoId, serviceId) {
752
	if (confirm("Are you sure you want to deactivate services!") == true) {
753
		var params = {
754
			"serviceId" : serviceId,
755
			"fofoId" : fofoId
756
 
757
		}
758
		doPostAjaxRequestWithParamsHandler(context
759
				+ "/deActivatePartnerService", params, function(response) {
760
			if (response == "true") {
761
				alert("successfully deactivate");
762
				loadAdminPartnerService("main-content", fofoId);
763
			}
764
		});
765
	}
766
}
767
function activatePartnerBrandService(fofoId, serviceId, serviceBrandId) {
768
	if (confirm("Are you sure you want to activate brand service!") == true) {
769
		var params = {
770
			"serviceId" : serviceId,
771
			"fofoId" : fofoId,
772
			"serviceBrandId" : serviceBrandId
773
 
774
		}
775
		doPostAjaxRequestWithParamsHandler(context
776
				+ "/activatePartnerbrandService", params, function(response) {
777
			if (response == "true") {
778
				alert("successfully activate");
29051 manish 779
				$('#myServiceActivateBrand').modal('hide');
780
				$('.modal-backdrop').remove();
24317 govind 781
				loadAdminPartnerService("main-content", fofoId);
782
			}
783
		});
784
	}
785
}
29051 manish 786
 
787
function deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId,serviceBrandComment) {
24317 govind 788
	if (confirm("Are you sure you want to deactivate brand service!") == true) {
789
		var params = {
790
			"serviceId" : serviceId,
791
			"fofoId" : fofoId,
29051 manish 792
			"serviceBrandId" : serviceBrandId,
793
			"serviceBrandComment":serviceBrandComment
24317 govind 794
		}
795
		doPostAjaxRequestWithParamsHandler(context
796
				+ "/deActivatePartnerbrandService", params, function(response) {
797
			if (response == "true") {
798
				alert("successfully deactivate");
29051 manish 799
				$('#myServiceDeActivateBrand').modal('hide');
800
				$('.modal-backdrop').remove();
24317 govind 801
				loadAdminPartnerService("main-content", fofoId);
802
			}
803
		});
804
	}
805
}
806
 
807
function loadaddPartnerServiceDetails(domId) {
808
	doGetAjaxRequestHandler(context + "/getAddPartnerServicesDetails",
809
			function(response) {
810
				$('#' + domId).html(response);
811
			});
812
}
813
function loadaddPartnerBrandServiceDetails(domId) {
814
	doGetAjaxRequestHandler(context + "/getAddPartnerBrandServiceDetails",
815
			function(response) {
816
				$('#' + domId).html(response);
817
			});
818
}