Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
35289 amit 1
$(function () {
2
    $(document).on('click', ".trial_users", function () {
3
        loadPendingTrialForms("main-content");
4
    });
29598 tejbeer 5
 
35289 amit 6
    $(document).on('click', ".mk_trial_create", function () {
7
        let trialFormId = $(this.closest('tr')).data('id');
8
    });
30439 tejbeer 9
 
35289 amit 10
    $(document).on('click', ".mk_trial_cancel", function () {
11
        let trialFormId = $(this.closest('tr')).data('id');
12
        cancelTrialForm(trialFormId);
13
    });
30439 tejbeer 14
 
35289 amit 15
    function loadPendingTrialForms(domId) {
16
        doGetAjaxRequestHandler(context + "/trial/pending", function (response) {
17
            $('#' + domId).html(response);
18
        });
19
    }
29598 tejbeer 20
 
35289 amit 21
    function trialCreate(trialFormId) {
22
        doAjaxRequestHandler(`${context}/trial/create/${trialFormId}`, "GET", function (response) {
23
            $('#main-content').html(response);
24
        });
25
    }
30439 tejbeer 26
 
35289 amit 27
    function cancelTrialForm(trialFormId) {
28
        if (confirm("Are you sure you want to cancel this trial?")) {
29
            doGetAjaxRequestHandler(`${context}/trial/cancel/${trialFormId}`, function (response) {
30
                if (response == "true") {
31
                    loadPendingTrialForms("main-content");
32
                }
33
            });
34
        }
35
    }
25980 tejbeer 36
});