Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
30599 amit.gupta 1
$(function () {
34527 tejus.loha 2
    $(document).on('click', ".unsettled-payments", function () {
3
        loadPaymentsRequest("main-content");
4
    });
30599 amit.gupta 5
 
34527 tejus.loha 6
    $(document).on('click', '.create-unsettled-payments', function () {
7
        var transactionReference = $('input[name="transactionReference"]').val();
8
        var description = $('input[name="description"]').val();
9
        var amount = $('input[name="amount"]').val();
10
        var referencedate = $('#referencedate').val();
24089 tejbeer 11
 
30599 amit.gupta 12
 
34527 tejus.loha 13
        if (transactionReference === "" && description === "" && amount === "" && referencedate === "") {
14
            alert("Field can't be empty");
15
            return;
16
        }
30599 amit.gupta 17
 
34527 tejus.loha 18
        if (transactionReference === "") {
19
            alert("Transaction Reference is required");
20
            return;
21
        }
22
        if (description === "") {
23
            alert("Description is required");
24
            return;
25
        }
26
        if (amount === "") {
27
            alert("amount is required");
28
            return;
29
        }
30
        if (referencedate === "") {
31
            alert("Reference Date is required");
32
            return;
33
        }
30599 amit.gupta 34
 
34527 tejus.loha 35
        var unsettledData = {};
30599 amit.gupta 36
 
34527 tejus.loha 37
        unsettledData['transactionReference'] = $('input[name="transactionReference"]').val();
38
        unsettledData['description'] = $('input[name="description"]').val();
39
        unsettledData['referenceDate'] = getDatesFromPicker('input[name="dateTime"]').startDate;
40
        unsettledData['amount'] = $('input[name="amount"]').val();
41
        if (confirm("Are you sure you want to create Payment") == true) {
42
            doPostAjaxRequestWithJsonHandler(context + "/createUnsettledPaymentsEntries", JSON.stringify(unsettledData), function (response) {
43
                if (response == 'true') {
44
                    alert("successfully create");
45
                    loadPaymentsRequest("main-content");
46
                }
47
            });
30599 amit.gupta 48
 
34527 tejus.loha 49
            return false;
50
        }
51
    });
30599 amit.gupta 52
 
53
 
34527 tejus.loha 54
    $(document).on('click', ".remove-unsettledPayment",
55
        function () {
56
            if (confirm("Are you sure you want to Remove the Entry")) {
57
                id = $(this).data('requestid');
58
                console.log(id);
59
                unsettledRequestRemoved(id);
60
            }
61
        });
24089 tejbeer 62
});
63
 
64
 
30599 amit.gupta 65
function unsettledRequestRemoved(id) {
34527 tejus.loha 66
    doDeleteAjaxRequestHandler(context + "/removeUnsettledPaymentsEntries?id=" + id, function (response) {
67
        if (response == 'true') {
68
            alert("successfully Removed");
69
            loadPaymentsRequest("main-content");
70
        }
24089 tejbeer 71
 
34527 tejus.loha 72
    });
24089 tejbeer 73
 
74
}
75
 
30599 amit.gupta 76
function loadPaymentsRequest(domId) {
34527 tejus.loha 77
    doGetAjaxRequestHandler(context + "/getcreateUnsettledPayments", function (response) {
78
        $('#' + domId).html(response);
79
    });
80
}
81
 
82
function getUpiPaymentsReportPanel(domId) {
83
    doGetAjaxRequestHandler(context + "/getHdfcPaymentsReport", function (response) {
84
        $('#' + domId).html(response);
85
    });
86
}
87
 
88
$(document).on('click', ".hdfc-payment-report-panel", function () {
89
    getUpiPaymentsReportPanel('main-content');
90
});
91
$(document).on('click', "#viewHdfcPaymentsReport", function () {
92
    console.log("clicked viewHdfcPaymentsReport");
93
    let mode = $('select[name="transferModeSelector"]').val();
94
    let startDate = $('#chartForm').val();
95
    let endDate = $('#chartTo').val();
96
    doGetAjaxRequestHandler(`${context}/getHdfcPaymentsReport?transferMode=${mode}&startDate=${startDate}&endDate=${endDate}`, function (response) {
97
        $('#main-content').html(response);
98
    });
99
});