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