Subversion Repositories SmartDukaan

Rev

Rev 29898 | Rev 33618 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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