Subversion Repositories SmartDukaan

Rev

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