| 31762 |
tejbeer |
1 |
$(function() {
|
|
|
2 |
$(document).on('click', ".create-scheme", function() {
|
| 23343 |
ashik.ali |
3 |
loadScheme("main-content");
|
|
|
4 |
});
|
| 31762 |
tejbeer |
5 |
$(document).on('click', ".scheme-details", function() {
|
| 23343 |
ashik.ali |
6 |
var schemeId = $(this).attr('data');
|
| 23752 |
govind |
7 |
console.log("schemeId = " + schemeId);
|
| 23343 |
ashik.ali |
8 |
loadSchemeDetails(schemeId, "scheme-details-container");
|
|
|
9 |
});
|
| 31762 |
tejbeer |
10 |
$(document).on('click', ".active-scheme", function() {
|
| 23343 |
ashik.ali |
11 |
var schemeId = $(this).attr('data');
|
| 23752 |
govind |
12 |
console.log("active-scheme id : " + schemeId);
|
|
|
13 |
var start = $("#schemes-paginated .start").text();
|
|
|
14 |
// var end = $( "#schemes-paginated .end" ).text();
|
| 23343 |
ashik.ali |
15 |
var offset = start - 1;
|
| 30122 |
amit.gupta |
16 |
if (confirm("Are you sure you want to Active Scheme!")) {
|
| 23343 |
ashik.ali |
17 |
activeScheme(schemeId, offset, "schemes-table");
|
|
|
18 |
}
|
|
|
19 |
});
|
| 23752 |
govind |
20 |
|
| 31762 |
tejbeer |
21 |
|
|
|
22 |
$(document).on('click', ".scheme-imei-history", function() {
|
|
|
23 |
loadImeiWiseScheme("main-content");
|
|
|
24 |
});
|
|
|
25 |
|
|
|
26 |
$(document).on('click', ".expire-scheme", function() {
|
| 23343 |
ashik.ali |
27 |
var schemeId = $(this).attr('data');
|
| 30599 |
amit.gupta |
28 |
var expireDate = getDatesFromPicker('input[name="expireSchemeById"]').endDate;
|
| 30122 |
amit.gupta |
29 |
if (confirm("Are you sure you want to Expire Scheme!")) {
|
| 30599 |
amit.gupta |
30 |
expireScheme(schemeId, expireDate, "schemes-table");
|
| 23343 |
ashik.ali |
31 |
}
|
|
|
32 |
});
|
| 27755 |
amit.gupta |
33 |
$(document).on('click', "#extendDatetime-button",
|
| 31762 |
tejbeer |
34 |
function() {
|
| 28134 |
tejbeer |
35 |
console.log("extendAll button click");
|
| 30599 |
amit.gupta |
36 |
var extendDatetime = getDatesFromPicker('input[name="extendDatetime"]')
|
|
|
37 |
.endDate;
|
| 28134 |
tejbeer |
38 |
console.log("extendDatetime : " + extendDatetime);
|
|
|
39 |
if (extendDatetime) {
|
| 30122 |
amit.gupta |
40 |
if (confirm("Are you sure you want to Extend expireDateTime for All Scheme!")) {
|
| 30599 |
amit.gupta |
41 |
extendAllScheme(extendDatetime);
|
| 28134 |
tejbeer |
42 |
}
|
|
|
43 |
} else {
|
|
|
44 |
alert("feild can't be blank");
|
|
|
45 |
}
|
|
|
46 |
});
|
| 27755 |
amit.gupta |
47 |
$(document).on('click', "#extendScheme-button",
|
| 31762 |
tejbeer |
48 |
function() {
|
| 28134 |
tejbeer |
49 |
console.log("extend button click");
|
| 30599 |
amit.gupta |
50 |
var extendDatetime = getDatesFromPicker('input[name="extendSchemeById"]').endDate;
|
| 28134 |
tejbeer |
51 |
var schemeId = $('#schemeId').val()
|
|
|
52 |
console.log("extendDatetime : " + extendDatetime);
|
|
|
53 |
console.log(schemeId);
|
|
|
54 |
if (extendDatetime) {
|
|
|
55 |
if (confirm("Are you sure you want to Extend expireDateTime for Scheme!") == true) {
|
| 30599 |
amit.gupta |
56 |
extendSchemeById(extendDatetime, schemeId);
|
| 28134 |
tejbeer |
57 |
}
|
|
|
58 |
} else {
|
| 30054 |
manish |
59 |
alert("field can't be blank");
|
| 30122 |
amit.gupta |
60 |
}
|
| 28134 |
tejbeer |
61 |
});
|
| 30122 |
amit.gupta |
62 |
|
|
|
63 |
|
| 29586 |
manish |
64 |
$(document).on('click', ".monthy-investment",
|
| 31762 |
tejbeer |
65 |
function() {
|
| 30122 |
amit.gupta |
66 |
console.log("hello evaluateActualInvestmentPayout");
|
|
|
67 |
window.location.href = context + "/evaluateActualInvestmentPayout";
|
|
|
68 |
|
|
|
69 |
});
|
|
|
70 |
|
| 31762 |
tejbeer |
71 |
$(document).on('click', ".process-investment", function() {
|
| 29759 |
amit.gupta |
72 |
if (confirm("Are you sure you want to Process Investment")) {
|
| 29761 |
amit.gupta |
73 |
processInvestment();
|
| 29759 |
amit.gupta |
74 |
}
|
|
|
75 |
});
|
|
|
76 |
|
| 30122 |
amit.gupta |
77 |
|
| 29586 |
manish |
78 |
$(document).on('click', ".processInvestmentDryRun",
|
| 31762 |
tejbeer |
79 |
function() {
|
| 30122 |
amit.gupta |
80 |
console.log("processInvestmentDryRun");
|
|
|
81 |
window.location.href = context + "/processInvestmentDryRun";
|
|
|
82 |
|
|
|
83 |
});
|
|
|
84 |
|
| 30054 |
manish |
85 |
$(document).on('click', ".brand-wise-income",
|
| 31762 |
tejbeer |
86 |
function() {
|
| 30122 |
amit.gupta |
87 |
var brand = $(this).data('brand');
|
|
|
88 |
|
|
|
89 |
var status = $(this).data('status');
|
|
|
90 |
var month = $(this).data('month');
|
|
|
91 |
|
|
|
92 |
brandWiseIncome(brand, month, status);
|
|
|
93 |
|
|
|
94 |
});
|
|
|
95 |
|
| 30054 |
manish |
96 |
$(document).on('click', ".imei_wise_income",
|
| 31762 |
tejbeer |
97 |
function() {
|
| 23752 |
govind |
98 |
|
| 30122 |
amit.gupta |
99 |
|
|
|
100 |
var catalogItemId = $(this).data('catalogitemid');
|
|
|
101 |
var month = $(this).data('month');
|
|
|
102 |
|
|
|
103 |
console.log(catalogItemId);
|
|
|
104 |
imeiWiseIncome(catalogItemId, month);
|
|
|
105 |
|
|
|
106 |
});
|
|
|
107 |
|
| 31762 |
tejbeer |
108 |
$(document).on('change', "#month-wise-income", function() {
|
| 30122 |
amit.gupta |
109 |
var month = $(this).val();
|
|
|
110 |
|
|
|
111 |
monthWiseIncome(month, "main-content");
|
|
|
112 |
});
|
|
|
113 |
|
|
|
114 |
|
| 31762 |
tejbeer |
115 |
$(document).on('click', ".schemes", function() {
|
| 30122 |
amit.gupta |
116 |
schemes("main-content");
|
| 23347 |
ashik.ali |
117 |
console.log("Active Schemes Button Clicked...")
|
| 28134 |
tejbeer |
118 |
|
| 30122 |
amit.gupta |
119 |
/*bootbox.confirm({
|
| 28134 |
tejbeer |
120 |
message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>"
|
|
|
121 |
,
|
|
|
122 |
buttons: {
|
|
|
123 |
confirm: {
|
|
|
124 |
label: 'I agree',
|
|
|
125 |
className: 'btn-success'
|
|
|
126 |
},
|
|
|
127 |
cancel: {
|
|
|
128 |
label: 'I disagree',
|
|
|
129 |
className: 'btn-danger'
|
|
|
130 |
}
|
|
|
131 |
},
|
| 30122 |
amit.gupta |
132 |
callback: function (result) {
|
| 28134 |
tejbeer |
133 |
if (result == true) {
|
|
|
134 |
}
|
|
|
135 |
}
|
| 30122 |
amit.gupta |
136 |
});*/
|
| 28134 |
tejbeer |
137 |
|
| 23347 |
ashik.ali |
138 |
});
|
| 23752 |
govind |
139 |
|
| 31762 |
tejbeer |
140 |
$(document).on('click', ".margin-calculator", function() {
|
| 27648 |
tejbeer |
141 |
console.log("Active Schemes Button Clicked...")
|
| 28134 |
tejbeer |
142 |
marginCalculator("main-content");
|
| 27648 |
tejbeer |
143 |
});
|
|
|
144 |
|
| 31762 |
tejbeer |
145 |
$(document).on('click', ".schemes-download-page", function() {
|
| 23347 |
ashik.ali |
146 |
console.log("Schemes Download Clicked...")
|
|
|
147 |
loadSchemesDownloadPage("main-content");
|
| 22860 |
ashik.ali |
148 |
});
|
| 23752 |
govind |
149 |
|
| 31762 |
tejbeer |
150 |
$(document).on('click', ".schemes-update", function() {
|
| 23556 |
amit.gupta |
151 |
loadSchemeUpdatePage("main-content");
|
|
|
152 |
});
|
| 23557 |
amit.gupta |
153 |
|
| 31762 |
tejbeer |
154 |
$(document).on('click', ".add-item", function() {
|
| 36421 |
amit |
155 |
var schemeIds = $("#schemeids").val();
|
|
|
156 |
// Read from modal model multi-select if available, else fall back to text input
|
|
|
157 |
var selectedModels = $(".modalCatalogItems").val();
|
|
|
158 |
var catalogIds;
|
|
|
159 |
if (selectedModels && selectedModels.length > 0) {
|
|
|
160 |
catalogIds = selectedModels.join(",");
|
|
|
161 |
} else {
|
|
|
162 |
catalogIds = $("#catalogids").val();
|
|
|
163 |
}
|
|
|
164 |
if (!schemeIds || !catalogIds || catalogIds.trim().length === 0) {
|
|
|
165 |
alert("Scheme ID and at least one Model are required");
|
|
|
166 |
return;
|
|
|
167 |
}
|
|
|
168 |
// Filter out catalogs that already exist in the scheme
|
|
|
169 |
var existingCatalogs = [];
|
|
|
170 |
$('#scheme-details-container tr[data-catalogid]').each(function() {
|
|
|
171 |
existingCatalogs.push(String($(this).data('catalogid')));
|
|
|
172 |
});
|
|
|
173 |
var requestedIds = catalogIds.split(",");
|
|
|
174 |
var duplicates = requestedIds.filter(function(id) { return existingCatalogs.indexOf(id.trim()) >= 0; });
|
|
|
175 |
var newIds = requestedIds.filter(function(id) { return existingCatalogs.indexOf(id.trim()) < 0; });
|
|
|
176 |
if (newIds.length === 0) {
|
|
|
177 |
alert("All selected models already exist in this scheme");
|
|
|
178 |
return;
|
|
|
179 |
}
|
|
|
180 |
if (duplicates.length > 0) {
|
|
|
181 |
alert("Skipping already existing catalog IDs: " + duplicates.join(", "));
|
|
|
182 |
}
|
|
|
183 |
catalogIds = newIds.join(",");
|
|
|
184 |
if (confirm("Add " + newIds.length + " model(s) to Scheme?")) {
|
| 30122 |
amit.gupta |
185 |
updateSingleScheme(schemeIds, catalogIds);
|
| 23928 |
govind |
186 |
}
|
|
|
187 |
});
|
| 31762 |
tejbeer |
188 |
$(document).on('click', ".add-schemes", function() {
|
| 23752 |
govind |
189 |
|
| 30122 |
amit.gupta |
190 |
let schemeIds = $("#schemeids").val();
|
|
|
191 |
let catalogIds = $("#catalogids").val();
|
|
|
192 |
|
| 23914 |
govind |
193 |
if (confirm("Are you sure you want to Add Item to Scheme!") == true) {
|
| 30122 |
amit.gupta |
194 |
if (catalogIds.trim().length === 0 || schemeIds.trim().length === 0) {
|
| 26763 |
tejbeer |
195 |
alert("fields shouldn't be blank");
|
|
|
196 |
return;
|
|
|
197 |
}
|
| 30122 |
amit.gupta |
198 |
updateSchemes(schemeIds, catalogIds);
|
| 23557 |
amit.gupta |
199 |
}
|
|
|
200 |
});
|
| 32299 |
jai.hind |
201 |
|
|
|
202 |
$(document).on('click', ".process-sellIn", function() {
|
|
|
203 |
let purchaseInvoiceNumber=$("#invoiceNumbers1").val();
|
|
|
204 |
if (confirm("Are you sure you want to Process SellIn") == true) {
|
|
|
205 |
if (purchaseInvoiceNumber.trim().length === 0) {
|
|
|
206 |
alert("fields shouldn't be blank");
|
|
|
207 |
return;
|
|
|
208 |
}
|
|
|
209 |
processSellin(purchaseInvoiceNumber);
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
});
|
|
|
213 |
|
|
|
214 |
$(document).on('click', ".process-sellOut", function() {
|
|
|
215 |
let fofoOrderInvoiceNumber=$("#invoiceNumbers2").val();
|
|
|
216 |
if (confirm("Are you sure you want to Process SellOut") == true) {
|
|
|
217 |
if (fofoOrderInvoiceNumber.trim().length === 0) {
|
|
|
218 |
alert("fields shouldn't be blank");
|
|
|
219 |
return;
|
|
|
220 |
}
|
|
|
221 |
processSellout(fofoOrderInvoiceNumber);
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
});
|
|
|
225 |
|
| 31762 |
tejbeer |
226 |
$(document).on('click', ".delete-schemes", function() {
|
| 30122 |
amit.gupta |
227 |
if (confirm("Delete model from Scheme?") == true) {
|
| 23914 |
govind |
228 |
schemeId = $(this).data('schemeid');
|
| 30122 |
amit.gupta |
229 |
catalogId = $(this).data('catalogid');
|
|
|
230 |
deleteScheme(schemeId, catalogId);
|
| 23715 |
govind |
231 |
}
|
| 23752 |
govind |
232 |
});
|
|
|
233 |
|
| 27755 |
amit.gupta |
234 |
$(document).on('click', "#scheme-search-button",
|
| 31762 |
tejbeer |
235 |
function() {
|
| 28134 |
tejbeer |
236 |
var searchText = $("#scheme-search-text").val();
|
|
|
237 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
238 |
searchText = "";
|
|
|
239 |
}
|
| 30122 |
amit.gupta |
240 |
doGetAjaxRequestHandler(context + "/getSchemes?searchScheme="
|
| 31762 |
tejbeer |
241 |
+ searchText, function(response) {
|
|
|
242 |
$('#' + "main-content").html(response);
|
|
|
243 |
});
|
| 28134 |
tejbeer |
244 |
});
|
| 26802 |
tejbeer |
245 |
|
| 31762 |
tejbeer |
246 |
$(document).on("keyup", "#scheme-search-text", function(e) {
|
| 23752 |
govind |
247 |
var keyCode = e.keyCode || e.which;
|
|
|
248 |
if (keyCode == 13) {
|
|
|
249 |
$("#scheme-search-button").click();
|
|
|
250 |
}
|
|
|
251 |
});
|
| 31762 |
tejbeer |
252 |
$(document).on('click', "#scheme-item-search-button", function() {
|
| 23752 |
govind |
253 |
var searchText = $("#scheme-item-search-text").val();
|
| 27875 |
amit.gupta |
254 |
var date = $(".schemes-date").val();
|
| 23752 |
govind |
255 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
256 |
searchText = "";
|
| 26497 |
amit.gupta |
257 |
alert("please select item");
|
|
|
258 |
return;
|
| 23752 |
govind |
259 |
}
|
| 27094 |
tejbeer |
260 |
if (typeof currentItem != "undefined") {
|
|
|
261 |
console.log(currentItem);
|
| 27875 |
amit.gupta |
262 |
loadSchemeItemSearchInfo(currentItem, date);
|
| 27094 |
tejbeer |
263 |
} else {
|
|
|
264 |
console.log("reeffff")
|
|
|
265 |
alert("Data No Found")
|
|
|
266 |
}
|
| 23752 |
govind |
267 |
});
|
|
|
268 |
|
| 31762 |
tejbeer |
269 |
$(document).on('click', "#scheme-imei-search-button", function() {
|
| 28795 |
tejbeer |
270 |
var searchText = $("#scheme-imei-search-text").val();
|
|
|
271 |
var date = $(".schemes-date").val();
|
|
|
272 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
273 |
searchText = "";
|
|
|
274 |
alert("please select imei");
|
|
|
275 |
return;
|
|
|
276 |
}
|
|
|
277 |
if (typeof imei != "undefined") {
|
|
|
278 |
console.log(imei);
|
|
|
279 |
loadSchemeImeiSearchInfo(imei, date);
|
|
|
280 |
} else {
|
|
|
281 |
console.log("reeffff")
|
|
|
282 |
alert("Data No Found")
|
|
|
283 |
}
|
|
|
284 |
});
|
| 31762 |
tejbeer |
285 |
|
|
|
286 |
$(document).on('click', "#scheme-imei-wise-search-button", function() {
|
|
|
287 |
var searchText = $("#scheme-imei-wise-search-text").val();
|
|
|
288 |
var date = $(".schemes-date").val();
|
| 32331 |
amit.gupta |
289 |
if (typeof (searchText) === "undefined" || !searchText) {
|
| 31762 |
tejbeer |
290 |
searchText = "";
|
|
|
291 |
alert("please select imei");
|
|
|
292 |
return;
|
|
|
293 |
}
|
| 32331 |
amit.gupta |
294 |
if (typeof imei !== "undefined") {
|
| 31762 |
tejbeer |
295 |
console.log(imei);
|
|
|
296 |
var searchText = $("#scheme-imei-wise-search-text").val();
|
|
|
297 |
|
|
|
298 |
if ((searchText)) {
|
|
|
299 |
doGetAjaxRequestHandler(`${context}/getSchemesByImei?searchImei=${searchText}`, function(response) {
|
|
|
300 |
$('#' + "main-content").html(response);
|
|
|
301 |
$('#scheme-imei-search-text').val(searchText);
|
|
|
302 |
|
|
|
303 |
});
|
|
|
304 |
}
|
|
|
305 |
} else {
|
| 32331 |
amit.gupta |
306 |
console.log("reeffff");
|
|
|
307 |
alert("Data No Found");
|
| 31762 |
tejbeer |
308 |
}
|
|
|
309 |
});
|
| 27755 |
amit.gupta |
310 |
$(document).on('click', ".categoryWiseSchemeHistory",
|
| 34575 |
vikas.jang |
311 |
function() {
|
|
|
312 |
var category = $('#partner-category').val();
|
|
|
313 |
console.log(category);
|
| 26763 |
tejbeer |
314 |
|
| 34575 |
vikas.jang |
315 |
doGetAjaxRequestHandler(context + "/getSchemes?partnerType="
|
|
|
316 |
+ category, function(response) {
|
|
|
317 |
$('#' + "main-content").html(response);
|
|
|
318 |
$('#partner-category').val(category);
|
|
|
319 |
window.dispatchEvent(new Event('resize'));
|
|
|
320 |
});
|
| 26763 |
tejbeer |
321 |
|
| 34575 |
vikas.jang |
322 |
});
|
| 26763 |
tejbeer |
323 |
|
| 31762 |
tejbeer |
324 |
$(document).on("keyup", "#scheme-item-search-text", function(e) {
|
| 23752 |
govind |
325 |
var keyCode = e.keyCode || e.which;
|
|
|
326 |
if (keyCode == 13) {
|
|
|
327 |
$("#scheme-item-search-button").click();
|
|
|
328 |
}
|
|
|
329 |
});
|
| 22860 |
ashik.ali |
330 |
});
|
|
|
331 |
|
| 23752 |
govind |
332 |
function configureTagListingItemsDescriptionDropDown() {
|
| 30148 |
amit.gupta |
333 |
$('.catalogItemsDescription').multiselect({
|
| 28134 |
tejbeer |
334 |
includeSelectAllOption: true,
|
|
|
335 |
maxHeight: 200,
|
|
|
336 |
buttonWidth: '180px',
|
|
|
337 |
numberDisplayed: 1,
|
| 30148 |
amit.gupta |
338 |
nonSelectedText: 'Models',
|
|
|
339 |
nSelectedText: ' - Models Selected',
|
|
|
340 |
allSelectedText: 'All Models Selected',
|
| 28134 |
tejbeer |
341 |
enableFiltering: true,
|
|
|
342 |
enableCaseInsensitiveFiltering: true
|
| 23752 |
govind |
343 |
});
|
| 23343 |
ashik.ali |
344 |
}
|
|
|
345 |
|
| 23752 |
govind |
346 |
function schemesDownload() {
|
| 30599 |
amit.gupta |
347 |
let pickerData = getDatesFromPicker('input[name="startEndDateTime"]')
|
|
|
348 |
doAjaxGetDownload(context + "/schemes/download?" +
|
|
|
349 |
"startDateTime=" + pickerData.startDate
|
|
|
350 |
+ "&endDateTime=" + pickerData.endDate,
|
| 28134 |
tejbeer |
351 |
"SchemesReport.xlsx");
|
| 23343 |
ashik.ali |
352 |
}
|
| 30122 |
amit.gupta |
353 |
|
| 30501 |
amit.gupta |
354 |
function selectedbrand(categoryId) {
|
| 23914 |
govind |
355 |
var brands = $('#tag-listing-brands').val();
|
|
|
356 |
if (brands) {
|
| 30148 |
amit.gupta |
357 |
loadCatalogDescriptionByBrands(
|
| 30501 |
amit.gupta |
358 |
"tag-listing-items-description-container", categoryId, brands);
|
| 23914 |
govind |
359 |
}
|
|
|
360 |
}
|
| 30122 |
amit.gupta |
361 |
|
| 30492 |
amit.gupta |
362 |
function categoryChanged() {
|
|
|
363 |
let categoryId = $('#category-list').val();
|
|
|
364 |
if (categoryId) {
|
|
|
365 |
loadBrandsByCategory(
|
|
|
366 |
"brand-list", categoryId);
|
|
|
367 |
}
|
|
|
368 |
}
|
|
|
369 |
|
| 23752 |
govind |
370 |
function loadSchemeDetails(schemeId, domId) {
|
|
|
371 |
doGetAjaxRequestHandler(context + "/getSchemeById?schemeId=" + schemeId,
|
| 31762 |
tejbeer |
372 |
function(response) {
|
| 28134 |
tejbeer |
373 |
$('#' + domId).html(response);
|
|
|
374 |
window.dispatchEvent(new Event('resize'));
|
|
|
375 |
});
|
| 23343 |
ashik.ali |
376 |
}
|
|
|
377 |
|
| 23752 |
govind |
378 |
function activeScheme(schemeId, offset, domId) {
|
|
|
379 |
doPutAjaxRequestHandler(context + "/activeSchemeById?schemeId=" + schemeId
|
| 34575 |
vikas.jang |
380 |
+ "&offset=" + offset, function(response) {
|
|
|
381 |
$('#' + domId).html(response);
|
|
|
382 |
$('#scheme-details-container').html('');
|
|
|
383 |
});
|
| 23343 |
ashik.ali |
384 |
}
|
|
|
385 |
|
| 30599 |
amit.gupta |
386 |
function expireScheme(schemeId, expireDate, domId) {
|
| 23752 |
govind |
387 |
doPutAjaxRequestHandler(context + "/expireSchemeById?schemeId=" + schemeId
|
| 31762 |
tejbeer |
388 |
+ "&expireTimestamp=" + expireDate, function(
|
|
|
389 |
response) {
|
| 26763 |
tejbeer |
390 |
alert("Scheme - " + schemeId + " marked for expiry successfully!");
|
| 23343 |
ashik.ali |
391 |
$('#' + domId).html(response);
|
|
|
392 |
$('#scheme-details-container').html('');
|
|
|
393 |
});
|
|
|
394 |
}
|
| 30122 |
amit.gupta |
395 |
|
| 30599 |
amit.gupta |
396 |
function extendAllScheme(extendDate) {
|
| 26763 |
tejbeer |
397 |
doPostAjaxRequestWithJsonHandler(context + "/extendAllSchemes", JSON
|
| 31762 |
tejbeer |
398 |
.stringify(extendDate), function(response) {
|
|
|
399 |
if (response == 'true') {
|
|
|
400 |
alert("Scheme All Extended successfully");
|
|
|
401 |
schemes("main-content");
|
|
|
402 |
} else {
|
|
|
403 |
alert("No scheme Activated Currently");
|
|
|
404 |
schemes("main-content");
|
|
|
405 |
}
|
|
|
406 |
});
|
| 23343 |
ashik.ali |
407 |
|
| 23914 |
govind |
408 |
}
|
| 30122 |
amit.gupta |
409 |
|
| 30599 |
amit.gupta |
410 |
function extendSchemeById(extendDate, schemeId) {
|
| 26763 |
tejbeer |
411 |
doPostAjaxRequestWithJsonHandler(context + "/extendSchemeById?schemeId="
|
| 31762 |
tejbeer |
412 |
+ schemeId, JSON.stringify(extendDate), function(response) {
|
|
|
413 |
if (response == 'true') {
|
|
|
414 |
alert("Scheme extended successfully");
|
|
|
415 |
schemes("main-content");
|
|
|
416 |
} else {
|
|
|
417 |
alert("Scheme already Expired");
|
|
|
418 |
schemes("main-content");
|
|
|
419 |
}
|
|
|
420 |
});
|
| 23914 |
govind |
421 |
}
|
| 30122 |
amit.gupta |
422 |
|
| 29761 |
amit.gupta |
423 |
function processInvestment() {
|
| 31762 |
tejbeer |
424 |
doPostAjaxRequestWithJsonHandler(context + "/payMonthlyInvestment", function(response) {
|
| 29759 |
amit.gupta |
425 |
alert("InvestmentPayout processed successfully");
|
|
|
426 |
});
|
|
|
427 |
}
|
| 23914 |
govind |
428 |
|
| 23752 |
govind |
429 |
function loadScheme(domId) {
|
| 31762 |
tejbeer |
430 |
doGetAjaxRequestHandler(context + "/createScheme", function(response) {
|
| 23343 |
ashik.ali |
431 |
$('#' + domId).html(response);
|
| 30492 |
amit.gupta |
432 |
createSchemeOnReady();
|
|
|
433 |
categoryChanged();
|
| 30599 |
amit.gupta |
434 |
$('input[name="dateRange"]').daterangepicker(getRangedDatePicker());
|
| 23343 |
ashik.ali |
435 |
});
|
| 23752 |
govind |
436 |
|
| 23343 |
ashik.ali |
437 |
}
|
|
|
438 |
|
| 31762 |
tejbeer |
439 |
function loadImeiWiseScheme(domId) {
|
|
|
440 |
doGetAjaxRequestHandler(context + "/getSchemesByImei",
|
|
|
441 |
function(response) {
|
|
|
442 |
$('#' + domId).html(response);
|
|
|
443 |
|
|
|
444 |
});
|
|
|
445 |
}
|
|
|
446 |
|
| 30501 |
amit.gupta |
447 |
function loadCatalogDescriptionByBrands(domId, categoryId, brands) {
|
|
|
448 |
let brandsString = brands.join(",")
|
|
|
449 |
doGetAjaxRequestHandler(`${context}/getCatalogDescriptionByBrands?categoryId=${categoryId}&brands=${brandsString}`,
|
| 31762 |
tejbeer |
450 |
function(response) {
|
| 28134 |
tejbeer |
451 |
$('#' + domId).html(response);
|
|
|
452 |
configureTagListingItemsDescriptionDropDown();
|
|
|
453 |
});
|
| 23752 |
govind |
454 |
|
| 23343 |
ashik.ali |
455 |
}
|
|
|
456 |
|
| 30492 |
amit.gupta |
457 |
function loadBrandsByCategory(domId, categoryId) {
|
|
|
458 |
doGetAjaxRequestHandler(`${context}/getBrandsByCategory?categoryId=${categoryId}`,
|
| 31762 |
tejbeer |
459 |
function(response) {
|
| 30492 |
amit.gupta |
460 |
$('#' + domId).html(response);
|
|
|
461 |
configureBrandsDropDown();
|
|
|
462 |
});
|
|
|
463 |
}
|
|
|
464 |
|
| 23752 |
govind |
465 |
function schemes(domId) {
|
| 31762 |
tejbeer |
466 |
doGetAjaxRequestHandler(context + "/getSchemes", function(response) {
|
| 23343 |
ashik.ali |
467 |
$('#' + domId).html(response);
|
|
|
468 |
});
|
|
|
469 |
}
|
| 30122 |
amit.gupta |
470 |
|
| 27648 |
tejbeer |
471 |
function marginCalculator(domId) {
|
| 31762 |
tejbeer |
472 |
doGetAjaxRequestHandler(context + "/getMarginCalculator", function(response) {
|
| 27648 |
tejbeer |
473 |
$('#' + domId).html(response);
|
|
|
474 |
});
|
|
|
475 |
}
|
| 23343 |
ashik.ali |
476 |
|
| 23752 |
govind |
477 |
function loadSchemesDownloadPage(domId) {
|
| 31762 |
tejbeer |
478 |
doGetAjaxRequestHandler(context + "/schemes/downloadPage", function(
|
| 28134 |
tejbeer |
479 |
response) {
|
| 23343 |
ashik.ali |
480 |
$('#' + domId).html(response);
|
|
|
481 |
});
|
| 23556 |
amit.gupta |
482 |
}
|
|
|
483 |
|
| 23752 |
govind |
484 |
function loadSchemeUpdatePage(domId) {
|
| 32299 |
jai.hind |
485 |
doGetAjaxRequestHandler(context + "/schemes/update-schemes-page", function(
|
| 28134 |
tejbeer |
486 |
response) {
|
| 23556 |
amit.gupta |
487 |
$('#' + domId).html(response);
|
|
|
488 |
});
|
| 23557 |
amit.gupta |
489 |
}
|
|
|
490 |
|
| 30122 |
amit.gupta |
491 |
function brandWiseIncome(brand, month, status) {
|
| 30054 |
manish |
492 |
console.log(brand);
|
|
|
493 |
console.log(month);
|
| 30122 |
amit.gupta |
494 |
|
| 32331 |
amit.gupta |
495 |
doGetAjaxRequestHandler(`${context}/brandWiseIncome?brand=${brand}&month=${month}`, function (
|
| 30054 |
manish |
496 |
response) {
|
|
|
497 |
$('.imei-wise-income-container').html('');
|
| 30122 |
amit.gupta |
498 |
$('.brand-wise-income-container').html(response);
|
| 30054 |
manish |
499 |
});
|
|
|
500 |
}
|
|
|
501 |
|
| 30122 |
amit.gupta |
502 |
function monthWiseIncome(month, domId) {
|
| 30054 |
manish |
503 |
console.log(month);
|
| 31762 |
tejbeer |
504 |
doGetAjaxRequestHandler(context + "/monthWisePartnerIncome/" + month, function(response) {
|
| 30122 |
amit.gupta |
505 |
console.log(response);
|
|
|
506 |
$('#' + domId).html(response);
|
|
|
507 |
})
|
| 30054 |
manish |
508 |
}
|
| 30122 |
amit.gupta |
509 |
|
|
|
510 |
function imeiWiseIncome(catalogItemId, month) {
|
| 30054 |
manish |
511 |
console.log(catalogItemId);
|
|
|
512 |
console.log(month);
|
| 30122 |
amit.gupta |
513 |
|
| 31762 |
tejbeer |
514 |
doGetAjaxRequestHandler(context + "/getLastMonthImeiWiseIncome?catalogItemId=" + catalogItemId + "&month=" + month, function(
|
| 30054 |
manish |
515 |
response) {
|
| 30122 |
amit.gupta |
516 |
$('.imei-wise-income-container').html(response);
|
| 30054 |
manish |
517 |
});
|
|
|
518 |
}
|
|
|
519 |
|
| 36421 |
amit |
520 |
function toIsoDateTime(ddmmyyyy, endOfDay) {
|
|
|
521 |
var parts = ddmmyyyy.split('/');
|
|
|
522 |
if (parts.length !== 3) return ddmmyyyy;
|
|
|
523 |
var isoDate = parts[2] + '-' + parts[1] + '-' + parts[0];
|
|
|
524 |
return isoDate + (endOfDay ? 'T23:59:59' : 'T00:00:00');
|
|
|
525 |
}
|
|
|
526 |
|
|
|
527 |
function updateSingleScheme(schemeIds, catalogIds) {
|
|
|
528 |
var payload = {
|
|
|
529 |
"catalogIds": catalogIds.split(",").map(Number),
|
|
|
530 |
"schemeIds": schemeIds.split(",").map(Number)
|
|
|
531 |
};
|
|
|
532 |
var startDate = $('#addItemStartDate').val();
|
|
|
533 |
var endDate = $('#addItemEndDate').val();
|
|
|
534 |
if (startDate) payload.startDate = toIsoDateTime(startDate, false);
|
|
|
535 |
if (endDate) payload.endDate = toIsoDateTime(endDate, true);
|
| 23928 |
govind |
536 |
doPostAjaxRequestWithJsonHandler(context + '/addItemToScheme', JSON
|
| 36421 |
amit |
537 |
.stringify(payload), function(response) {
|
|
|
538 |
$('#newItemToSchemeModal').modal('hide');
|
|
|
539 |
alert("Item Added to scheme successfully");
|
|
|
540 |
loadSchemeDetails(schemeIds, "scheme-details-container");
|
| 31762 |
tejbeer |
541 |
});
|
| 23715 |
govind |
542 |
}
|
| 30122 |
amit.gupta |
543 |
|
|
|
544 |
function updateSchemes(schemeIds, catalogIds) {
|
| 23928 |
govind |
545 |
doPostAjaxRequestWithJsonHandler(context + '/schemes/update', JSON
|
| 28134 |
tejbeer |
546 |
.stringify({
|
| 30122 |
amit.gupta |
547 |
"catalogIds": catalogIds.split(",").map(Number),
|
| 28134 |
tejbeer |
548 |
"schemeIds": schemeIds.split(",").map(Number)
|
| 31762 |
tejbeer |
549 |
}), function(response) {
|
|
|
550 |
if (response == 'true') {
|
|
|
551 |
alert("Item Added to scheme successfully");
|
|
|
552 |
// $('#newItemToSchemeModal').modal('hide');
|
|
|
553 |
loadSchemeUpdatePage("main-content");
|
|
|
554 |
}
|
|
|
555 |
});
|
| 23928 |
govind |
556 |
}
|
| 30122 |
amit.gupta |
557 |
|
| 32299 |
jai.hind |
558 |
function processSellin(purchaseInvoiceNumber) {
|
|
|
559 |
doPostAjaxRequestWithJsonHandler(context + "/schemes/process-sellin",
|
|
|
560 |
JSON.stringify(purchaseInvoiceNumber.split(",").map(x=>x.trim())), function(response) {
|
|
|
561 |
if (response) {
|
|
|
562 |
alert("Invoices Processed Successfully");
|
|
|
563 |
loadSchemeUpdatePage("main-content");
|
|
|
564 |
}
|
|
|
565 |
});
|
|
|
566 |
}
|
|
|
567 |
|
|
|
568 |
function processSellout(fofoOrderInvoiceNumber) {
|
|
|
569 |
doPostAjaxRequestWithJsonHandler(context + "/schemes/process-sellout",
|
|
|
570 |
JSON.stringify(fofoOrderInvoiceNumber.split(",").map(x=>x.trim())), function(response) {
|
|
|
571 |
if (response) {
|
|
|
572 |
alert("Invoices Processed Successfully");
|
|
|
573 |
loadSchemeUpdatePage("main-content");
|
|
|
574 |
}
|
|
|
575 |
});
|
|
|
576 |
}
|
|
|
577 |
|
|
|
578 |
|
| 30122 |
amit.gupta |
579 |
function deleteScheme(schemeId, catalogId) {
|
|
|
580 |
doDeleteAjaxRequestHandler(context + "/schemes/delete?schemeId=" + schemeId
|
| 31762 |
tejbeer |
581 |
+ "&catalogId=" + catalogId, function(response) {
|
|
|
582 |
if (response == 'true') {
|
|
|
583 |
alert("Model Deleted successfully from Scheme");
|
|
|
584 |
loadSchemeDetails(schemeId, "scheme-details-container");
|
|
|
585 |
}
|
|
|
586 |
});
|
| 23752 |
govind |
587 |
}
|
| 30122 |
amit.gupta |
588 |
|
|
|
589 |
|
|
|
590 |
function loadSearchItemScheme(domId, selectedModel, date) {
|
| 26802 |
tejbeer |
591 |
var searchText = $("#scheme-item-search-text").val();
|
|
|
592 |
var category = $('#partner-category').val();
|
| 26912 |
tejbeer |
593 |
|
| 26802 |
tejbeer |
594 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
595 |
searchText = "";
|
|
|
596 |
}
|
|
|
597 |
if (typeof (category) == "undefined" || !category) {
|
|
|
598 |
category = "";
|
|
|
599 |
}
|
| 30122 |
amit.gupta |
600 |
if (searchText && category) {
|
| 31762 |
tejbeer |
601 |
doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&partnerType=${category}&date=${date}`, function(response) {
|
| 26802 |
tejbeer |
602 |
$('#' + domId).html(response);
|
|
|
603 |
$('#partner-category').val(category);
|
|
|
604 |
});
|
| 30122 |
amit.gupta |
605 |
} else if (searchText) {
|
| 31762 |
tejbeer |
606 |
doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&date=${date}`, function(response) {
|
| 26802 |
tejbeer |
607 |
$('#' + domId).html(response);
|
| 30253 |
amit.gupta |
608 |
$('#partner-category').val(category);
|
| 26802 |
tejbeer |
609 |
});
|
| 26912 |
tejbeer |
610 |
|
|
|
611 |
}
|
|
|
612 |
|
| 23752 |
govind |
613 |
}
|
| 28795 |
tejbeer |
614 |
|
|
|
615 |
function loadSearchImeiScheme(domId, selected_imei, date) {
|
|
|
616 |
var category = $('#partner-category').val();
|
|
|
617 |
var searchText = $("#scheme-imei-search-text").val();
|
|
|
618 |
|
|
|
619 |
var category = $('#partner-category').val();
|
|
|
620 |
|
|
|
621 |
console.log(category)
|
|
|
622 |
|
|
|
623 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
624 |
searchText = "";
|
|
|
625 |
}
|
|
|
626 |
if (typeof (category) == "undefined" || !category) {
|
|
|
627 |
category = "";
|
|
|
628 |
}
|
|
|
629 |
if ((searchText) && (category)) {
|
|
|
630 |
doGetAjaxRequestHandler(context + "/getSchemes?searchImei="
|
| 31762 |
tejbeer |
631 |
+ selected_imei + "&partnerType=" + category, function(
|
|
|
632 |
response) {
|
| 28795 |
tejbeer |
633 |
$('#' + domId).html(response);
|
|
|
634 |
|
|
|
635 |
$('#partner-category').val(category);
|
|
|
636 |
$('#scheme-imei-search-text').val(selected_imei);
|
|
|
637 |
});
|
|
|
638 |
} else if ((searchText)) {
|
| 31762 |
tejbeer |
639 |
doGetAjaxRequestHandler(`${context}/getSchemes?searchImei=${selected_imei}&date=${date}`, function(response) {
|
| 28795 |
tejbeer |
640 |
$('#' + domId).html(response);
|
|
|
641 |
$('#scheme-imei-search-text').val(selected_imei);
|
|
|
642 |
|
|
|
643 |
});
|
|
|
644 |
}
|
|
|
645 |
|
|
|
646 |
}
|
| 30122 |
amit.gupta |
647 |
|
|
|
648 |
function loadSchemeItemSearchInfo(selectedModel, date) {
|
|
|
649 |
loadSearchItemScheme("main-content", selectedModel, date);
|
| 23752 |
govind |
650 |
}
|
| 28795 |
tejbeer |
651 |
|
|
|
652 |
function loadSchemeImeiSearchInfo(selectedImei, date) {
|
|
|
653 |
|
|
|
654 |
loadSearchImeiScheme("main-content", selectedImei, date);
|
|
|
655 |
}
|
|
|
656 |
|
| 34575 |
vikas.jang |
657 |
$(document).on('click', ".mark-active", function() {
|
|
|
658 |
let activeScheme=$("#activeSchemes").val();
|
| 34587 |
vikas.jang |
659 |
if (activeScheme.trim().length === 0) {
|
|
|
660 |
alert("fields shouldn't be blank");
|
|
|
661 |
return;
|
|
|
662 |
}
|
| 34575 |
vikas.jang |
663 |
if (confirm("Are you sure you want to Active schemes?")) {
|
|
|
664 |
console.log("activeScheme",activeScheme);
|
|
|
665 |
doPutAjaxRequestHandler(context + "/activeSchemeByIds?schemeId=" + activeScheme, function(response) {
|
|
|
666 |
if (response){
|
| 34587 |
vikas.jang |
667 |
$("#activeSchemes").val("");
|
| 34575 |
vikas.jang |
668 |
alert("schemes activated")
|
|
|
669 |
}
|
|
|
670 |
});
|
|
|
671 |
}
|
| 35252 |
aman |
672 |
});
|
|
|
673 |
$(document).on('click', ".mark-expire", function () {
|
|
|
674 |
let expireSchemes = $("#expireSchemes").val();
|
|
|
675 |
if (expireSchemes.trim().length === 0) {
|
|
|
676 |
alert("fields shouldn't be blank");
|
|
|
677 |
return;
|
|
|
678 |
}
|
|
|
679 |
if (confirm("Are you sure you want to expire schemes?")) {
|
|
|
680 |
console.log("expireSchemes", expireSchemes);
|
|
|
681 |
doPutAjaxRequestHandler(context + "/expireSchemeByIds?schemeId=" + expireSchemes, function (response) {
|
|
|
682 |
if (response) {
|
|
|
683 |
$("#expireSchemes").val("");
|
|
|
684 |
alert("schemes expired")
|
|
|
685 |
}
|
|
|
686 |
});
|
|
|
687 |
}
|
| 34575 |
vikas.jang |
688 |
});
|