Subversion Repositories SmartDukaan

Rev

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