| 30599 |
amit.gupta |
1 |
$(function () {
|
| 24876 |
tejbeer |
2 |
|
| 30599 |
amit.gupta |
3 |
$(document).on('click', ".wallet-edit", function () {
|
| 24876 |
tejbeer |
4 |
loadManualPayment("main-content");
|
|
|
5 |
});
|
|
|
6 |
|
| 27755 |
amit.gupta |
7 |
$(document).on('click', ".referenceSearch",
|
| 30599 |
amit.gupta |
8 |
function () {
|
|
|
9 |
var reference = $('#reference_id').val();
|
|
|
10 |
var type = $('#reference-type option:selected').html();
|
| 24876 |
tejbeer |
11 |
|
| 30599 |
amit.gupta |
12 |
if (type == "" || type == null || type == undefined) {
|
|
|
13 |
alert("Please Choose Reference Type");
|
|
|
14 |
return false;
|
|
|
15 |
}
|
| 24876 |
tejbeer |
16 |
|
| 30599 |
amit.gupta |
17 |
doGetAjaxRequestHandler(context
|
|
|
18 |
+ "/getWalletHistory?reference=" + reference
|
|
|
19 |
+ "&referenceType=" + type, function (response) {
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
doGetAjaxRequestHandler(context + "/getPartnerName?reference="
|
|
|
23 |
+ reference + "&referenceType=" + type, function (
|
|
|
24 |
response) {
|
|
|
25 |
response = JSON.parse(response);
|
|
|
26 |
console.log(response.businessName + "-" + response.address.city)
|
|
|
27 |
$("#FofoId").val(response.businessName + "-" + response.address.city);
|
|
|
28 |
currentFofoId = response.partnerId;
|
| 24876 |
tejbeer |
29 |
});
|
| 30599 |
amit.gupta |
30 |
$('.wallet-history-container').html(response);
|
|
|
31 |
});
|
| 24876 |
tejbeer |
32 |
|
|
|
33 |
|
| 30599 |
amit.gupta |
34 |
});
|
|
|
35 |
|
|
|
36 |
$(document).on('click', ".fetchTransactions", function () {
|
| 26518 |
amit.gupta |
37 |
var type = $('#reference-type option:selected').html();
|
| 30599 |
amit.gupta |
38 |
if ($('#reference-type option:selected').val() == "") {
|
| 26520 |
amit.gupta |
39 |
type = "";
|
|
|
40 |
}
|
| 30599 |
amit.gupta |
41 |
doGetAjaxRequestHandler(context
|
|
|
42 |
+ "/getWalletHistoryByPartner?referenceType=" + type + "&fofoId=" + currentFofoId, function (response) {
|
| 24896 |
amit.gupta |
43 |
$('.wallet-history-container').html(response);
|
| 24992 |
tejbeer |
44 |
$("#wallet-form")[0].reset();
|
| 24896 |
amit.gupta |
45 |
});
|
|
|
46 |
});
|
| 24876 |
tejbeer |
47 |
|
| 27755 |
amit.gupta |
48 |
$(document).on('click', ".transactionSubmit",
|
| 30599 |
amit.gupta |
49 |
function () {
|
|
|
50 |
var reference = $('#reference_id').val();
|
|
|
51 |
var typeValue = $('#reference-type option:selected').val();
|
|
|
52 |
var transactiontype = $('#transaction-type').val();
|
|
|
53 |
var amount = $('#amount').val();
|
|
|
54 |
var description = $('#description').val();
|
|
|
55 |
var retailerId = currentFofoId
|
|
|
56 |
console.log(currentFofoId)
|
|
|
57 |
console.log(typeValue);
|
|
|
58 |
if (typeValue == "") {
|
|
|
59 |
alert("Please Choose Reference Type");
|
|
|
60 |
return;
|
|
|
61 |
}
|
|
|
62 |
if (typeValue < 16) {
|
|
|
63 |
if (reference == "") {
|
|
|
64 |
alert("Reference Id is required");
|
| 24876 |
tejbeer |
65 |
return;
|
|
|
66 |
}
|
| 30599 |
amit.gupta |
67 |
}
|
| 24876 |
tejbeer |
68 |
|
| 30599 |
amit.gupta |
69 |
if (transactiontype == "") {
|
|
|
70 |
alert("Please Choose Transaction Type");
|
|
|
71 |
return;
|
|
|
72 |
}
|
|
|
73 |
if (amount == "") {
|
|
|
74 |
alert("amount is required");
|
|
|
75 |
return;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
if (description == "") {
|
|
|
79 |
alert("description is required");
|
|
|
80 |
return;
|
|
|
81 |
}
|
|
|
82 |
if (retailerId == "") {
|
|
|
83 |
alert("Partner name is required");
|
|
|
84 |
return;
|
|
|
85 |
}
|
|
|
86 |
let startDate = getDatesFromPicker($("#businessDate")).startDate;
|
|
|
87 |
if (confirm("Business Date is " + startDate.split("T")[0] + "?") == true) {
|
|
|
88 |
if (confirm("Are you sure you want update wallet") == true) {
|
|
|
89 |
|
|
|
90 |
doPostAjaxRequestHandler(context
|
|
|
91 |
+ "/walletUpdate?reference=" + reference
|
|
|
92 |
+ "&referenceTypeValue=" + typeValue + "&transactiontype="
|
|
|
93 |
+ transactiontype + "&amount=" + amount
|
|
|
94 |
+ "&description=" + description + "&retailerId="
|
|
|
95 |
+ currentFofoId + "&businessTimestamp=" + startDate, function (response) {
|
|
|
96 |
if (response != 0) {
|
|
|
97 |
alert("successfully submit");
|
|
|
98 |
console.log(response)
|
|
|
99 |
$("#reference_id").val(response);
|
|
|
100 |
// $("button.referenceSearch").click();
|
|
|
101 |
$("button.fetchTransactions").click();
|
|
|
102 |
} else {
|
|
|
103 |
alert("failed transaction")
|
| 24876 |
tejbeer |
104 |
}
|
| 30599 |
amit.gupta |
105 |
|
|
|
106 |
});
|
| 24876 |
tejbeer |
107 |
}
|
| 30599 |
amit.gupta |
108 |
}
|
| 26487 |
amit.gupta |
109 |
|
| 30599 |
amit.gupta |
110 |
});
|
| 24876 |
tejbeer |
111 |
|
|
|
112 |
});
|
| 30599 |
amit.gupta |
113 |
|
| 34261 |
tejus.loha |
114 |
|
|
|
115 |
// [id^="downloadAddWalletRequest"] - all id that start with downloadAddWalletRequest
|
|
|
116 |
$(document).on('click', '[id^="downloadAddWalletRequest"]', function() {
|
|
|
117 |
const startDate = $('input[name="from"]').val();
|
|
|
118 |
const endDate = $('input[name="to"]').val();
|
|
|
119 |
const buttonId = $(this).attr('id');
|
|
|
120 |
|
|
|
121 |
console.log("startDate - ", startDate);
|
|
|
122 |
console.log("endDate - ", endDate);
|
|
|
123 |
const reportTypes = {
|
|
|
124 |
'downloadAddWalletRequestPendingReport': 'pending',
|
|
|
125 |
'downloadAddWalletRequestApprovedReport': 'approved',
|
|
|
126 |
'downloadAddWalletRequestRejectReport': 'rejected'
|
|
|
127 |
};
|
|
|
128 |
|
|
|
129 |
const reportType = reportTypes[buttonId];
|
|
|
130 |
console.log("reportType - ", reportType);
|
|
|
131 |
if (reportType) {
|
|
|
132 |
window.location.href = `${context}/downloadAddWalletRequestReport?status=${reportType}&startDate=${startDate}&endDate=${endDate}`;
|
|
|
133 |
}
|
|
|
134 |
});
|
|
|
135 |
|
| 24876 |
tejbeer |
136 |
function loadManualPayment(domId) {
|
| 30599 |
amit.gupta |
137 |
doGetAjaxRequestHandler(context + "/manualPayment", function (response) {
|
| 24876 |
tejbeer |
138 |
$('#' + domId).html(response);
|
|
|
139 |
});
|
|
|
140 |
}
|