Subversion Repositories SmartDukaan

Rev

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