Subversion Repositories SmartDukaan

Rev

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