Subversion Repositories SmartDukaan

Rev

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