Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33443 ranu 1
$(function () {
2
    $(document).on('click', ".print-resource", function () {
3
        loadPrintResource("main-content");
4
    });
5
 
6
    $(document).on('click', ".print-resource-button-mk", function (event) {
7
        event.preventDefault();
8
 
9
        if (confirm("Are you sure?")) {
10
 
11
            let title = $("#title").val();
12
            let startDate = $("#startDate").val();
13
            let endDate = $("#endDate").val();
14
            let imgurl = $("#imgurl").val();
15
            let region = $("#region").val();
16
 
17
            let param = {
18
                title: title,
19
                startDate: startDate,
20
                endDate: endDate,
21
                imgUrl: imgurl,
22
                region: region
23
            }
24
 
25
            console.log('param', param);
26
 
27
            doPostAjaxRequestWithJsonHandler(context + "/postPrintResource", JSON.stringify(param), function (response) {
28
                if (response == 'true') {
29
                    bootbox.alert("Print Resource Submit Successfully");
30
                    loadPrintResource("main-content");
31
                }
32
 
33
            });
34
        }
35
    });
36
 
37
    let dateChangePrintId = 0;
38
    $(document).on('click', ".change-end-date-btn", function () {
39
        dateChangePrintId = $(this).data('printid');
40
    });
41
 
42
    $(document).on('click', ".change-end-date-submit-mk", function () {
43
        let date = $('.change-date-input-mk').val();
44
        doPostAjaxRequestHandler(context + "/changeEndDate?date=" + date + "&resourceId=" + dateChangePrintId, function (response) {
45
            if (response == 'true') {
46
                alert("Date Change Successfully");
47
                loadAllPrintResource("main-content");
48
            }
49
        });
50
    });
51
 
52
    $(document).on('click', ".partner_print_resources", function () {
53
 
54
        loadPartnerPrintResource("main-content");
55
    });
56
 
57
    $(document).on('click', ".all-print-resource", function () {
58
 
59
        loadAllPrintResource("main-content");
60
    });
61
 
62
});
63
 
64
function loadPrintResource(domId) {
65
    doGetAjaxRequestHandler(context + "/printResources", function (response) {
66
        $('#' + domId).html(response);
67
    });
68
}
69
 
70
function loadAllPrintResource(domId) {
71
    doGetAjaxRequestHandler(context + "/allPrintResources", function (response) {
72
        $('#' + domId).html(response);
73
    });
74
}
75
 
76
 
77
function loadPartnerPrintResource(domId) {
78
    doGetAjaxRequestHandler(context + "/partnerPrintResources", function (response) {
79
        $('#' + domId).html(response);
80
 
81
    });
82
}