Subversion Repositories SmartDukaan

Rev

Rev 33618 | Details | Compare with Previous | Last modification | View Log | RSS feed

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