Subversion Repositories SmartDukaan

Rev

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