Subversion Repositories SmartDukaan

Rev

Rev 30599 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30599 Rev 34527
Line 1... Line 1...
1
$(function () {
1
$(function () {
2
	$(document).on('click', ".unsettled-payments", function () {
2
    $(document).on('click', ".unsettled-payments", function () {
3
		loadPaymentsRequest("main-content");
3
        loadPaymentsRequest("main-content");
4
	});
4
    });
5
 
5
 
6
	$(document).on('click', '.create-unsettled-payments', function () {
6
    $(document).on('click', '.create-unsettled-payments', function () {
7
		var transactionReference = $('input[name="transactionReference"]').val();
7
        var transactionReference = $('input[name="transactionReference"]').val();
8
		var description = $('input[name="description"]').val();
8
        var description = $('input[name="description"]').val();
9
		var amount = $('input[name="amount"]').val();
9
        var amount = $('input[name="amount"]').val();
10
		var referencedate = $('#referencedate').val();
10
        var referencedate = $('#referencedate').val();
11
 
11
 
12
 
12
 
13
		if (transactionReference === "" && description === "" && amount === "" && referencedate === "") {
13
        if (transactionReference === "" && description === "" && amount === "" && referencedate === "") {
14
			alert("Field can't be empty");
14
            alert("Field can't be empty");
15
			return;
15
            return;
16
		}
16
        }
17
 
17
 
18
		if (transactionReference === "") {
18
        if (transactionReference === "") {
19
			alert("Transaction Reference is required");
19
            alert("Transaction Reference is required");
20
			return;
20
            return;
21
		}
21
        }
22
		if (description === "") {
22
        if (description === "") {
23
			alert("Description is required");
23
            alert("Description is required");
24
			return;
24
            return;
25
		}
25
        }
26
		if (amount === "") {
26
        if (amount === "") {
27
			alert("amount is required");
27
            alert("amount is required");
28
			return;
28
            return;
29
		}
29
        }
30
		if (referencedate === "") {
30
        if (referencedate === "") {
31
			alert("Reference Date is required");
31
            alert("Reference Date is required");
32
			return;
32
            return;
33
		}
33
        }
34
 
34
 
35
		var unsettledData = {};
35
        var unsettledData = {};
36
 
36
 
37
		unsettledData['transactionReference'] = $('input[name="transactionReference"]').val();
37
        unsettledData['transactionReference'] = $('input[name="transactionReference"]').val();
38
		unsettledData['description'] = $('input[name="description"]').val();
38
        unsettledData['description'] = $('input[name="description"]').val();
39
		unsettledData['referenceDate'] = getDatesFromPicker('input[name="dateTime"]').startDate;
39
        unsettledData['referenceDate'] = getDatesFromPicker('input[name="dateTime"]').startDate;
40
		unsettledData['amount'] = $('input[name="amount"]').val();
40
        unsettledData['amount'] = $('input[name="amount"]').val();
41
		if (confirm("Are you sure you want to create Payment") == true) {
41
        if (confirm("Are you sure you want to create Payment") == true) {
42
			doPostAjaxRequestWithJsonHandler(context + "/createUnsettledPaymentsEntries", JSON.stringify(unsettledData), function (response) {
42
            doPostAjaxRequestWithJsonHandler(context + "/createUnsettledPaymentsEntries", JSON.stringify(unsettledData), function (response) {
43
				if (response == 'true') {
43
                if (response == 'true') {
44
					alert("successfully create");
44
                    alert("successfully create");
45
					loadPaymentsRequest("main-content");
45
                    loadPaymentsRequest("main-content");
46
				}
46
                }
47
			});
47
            });
48
 
48
 
49
			return false;
49
            return false;
50
		}
50
        }
51
	});
51
    });
52
 
52
 
53
 
53
 
54
	$(document).on('click', ".remove-unsettledPayment",
54
    $(document).on('click', ".remove-unsettledPayment",
55
		function () {
55
        function () {
56
			if (confirm("Are you sure you want to Remove the Entry")) {
56
            if (confirm("Are you sure you want to Remove the Entry")) {
57
				id = $(this).data('requestid');
57
                id = $(this).data('requestid');
58
				console.log(id);
58
                console.log(id);
59
				unsettledRequestRemoved(id);
59
                unsettledRequestRemoved(id);
60
			}
60
            }
61
		});
61
        });
62
});
62
});
63
 
63
 
64
 
64
 
65
function unsettledRequestRemoved(id) {
65
function unsettledRequestRemoved(id) {
66
	doDeleteAjaxRequestHandler(context + "/removeUnsettledPaymentsEntries?id=" + id, function (response) {
66
    doDeleteAjaxRequestHandler(context + "/removeUnsettledPaymentsEntries?id=" + id, function (response) {
67
		if (response == 'true') {
67
        if (response == 'true') {
68
			alert("successfully Removed");
68
            alert("successfully Removed");
69
			loadPaymentsRequest("main-content");
69
            loadPaymentsRequest("main-content");
70
		}
70
        }
71
 
71
 
72
	});
72
    });
73
 
73
 
74
}
74
}
75
 
75
 
76
function loadPaymentsRequest(domId) {
76
function loadPaymentsRequest(domId) {
77
	doGetAjaxRequestHandler(context + "/getcreateUnsettledPayments", function (response) {
-
 
78
		$('#' + domId).html(response);
-
 
79
	});
-
 
80
}
-
 
81
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
});
-
 
100
82
101