| 37493 |
amit |
1 |
const SCHEME_DETAILS_CONTAINER = "scheme-details-container";
|
|
|
2 |
|
| 31762 |
tejbeer |
3 |
$(function() {
|
|
|
4 |
$(document).on('click', ".create-scheme", function() {
|
| 23343 |
ashik.ali |
5 |
loadScheme("main-content");
|
|
|
6 |
});
|
| 31762 |
tejbeer |
7 |
$(document).on('click', ".scheme-details", function() {
|
| 23343 |
ashik.ali |
8 |
var schemeId = $(this).attr('data');
|
| 23752 |
govind |
9 |
console.log("schemeId = " + schemeId);
|
| 37493 |
amit |
10 |
loadSchemeDetails(schemeId, SCHEME_DETAILS_CONTAINER);
|
| 23343 |
ashik.ali |
11 |
});
|
| 31762 |
tejbeer |
12 |
$(document).on('click', ".active-scheme", function() {
|
| 23343 |
ashik.ali |
13 |
var schemeId = $(this).attr('data');
|
| 23752 |
govind |
14 |
console.log("active-scheme id : " + schemeId);
|
|
|
15 |
var start = $("#schemes-paginated .start").text();
|
|
|
16 |
// var end = $( "#schemes-paginated .end" ).text();
|
| 23343 |
ashik.ali |
17 |
var offset = start - 1;
|
| 30122 |
amit.gupta |
18 |
if (confirm("Are you sure you want to Active Scheme!")) {
|
| 23343 |
ashik.ali |
19 |
activeScheme(schemeId, offset, "schemes-table");
|
|
|
20 |
}
|
|
|
21 |
});
|
| 23752 |
govind |
22 |
|
| 31762 |
tejbeer |
23 |
|
|
|
24 |
$(document).on('click', ".scheme-imei-history", function() {
|
|
|
25 |
loadImeiWiseScheme("main-content");
|
|
|
26 |
});
|
|
|
27 |
|
|
|
28 |
$(document).on('click', ".expire-scheme", function() {
|
| 23343 |
ashik.ali |
29 |
var schemeId = $(this).attr('data');
|
| 30599 |
amit.gupta |
30 |
var expireDate = getDatesFromPicker('input[name="expireSchemeById"]').endDate;
|
| 30122 |
amit.gupta |
31 |
if (confirm("Are you sure you want to Expire Scheme!")) {
|
| 30599 |
amit.gupta |
32 |
expireScheme(schemeId, expireDate, "schemes-table");
|
| 23343 |
ashik.ali |
33 |
}
|
|
|
34 |
});
|
| 27755 |
amit.gupta |
35 |
$(document).on('click', "#extendDatetime-button",
|
| 31762 |
tejbeer |
36 |
function() {
|
| 28134 |
tejbeer |
37 |
console.log("extendAll button click");
|
| 30599 |
amit.gupta |
38 |
var extendDatetime = getDatesFromPicker('input[name="extendDatetime"]')
|
|
|
39 |
.endDate;
|
| 28134 |
tejbeer |
40 |
console.log("extendDatetime : " + extendDatetime);
|
|
|
41 |
if (extendDatetime) {
|
| 30122 |
amit.gupta |
42 |
if (confirm("Are you sure you want to Extend expireDateTime for All Scheme!")) {
|
| 30599 |
amit.gupta |
43 |
extendAllScheme(extendDatetime);
|
| 28134 |
tejbeer |
44 |
}
|
|
|
45 |
} else {
|
|
|
46 |
alert("feild can't be blank");
|
|
|
47 |
}
|
|
|
48 |
});
|
| 27755 |
amit.gupta |
49 |
$(document).on('click', "#extendScheme-button",
|
| 31762 |
tejbeer |
50 |
function() {
|
| 28134 |
tejbeer |
51 |
console.log("extend button click");
|
| 30599 |
amit.gupta |
52 |
var extendDatetime = getDatesFromPicker('input[name="extendSchemeById"]').endDate;
|
| 28134 |
tejbeer |
53 |
var schemeId = $('#schemeId').val()
|
|
|
54 |
console.log("extendDatetime : " + extendDatetime);
|
|
|
55 |
console.log(schemeId);
|
|
|
56 |
if (extendDatetime) {
|
|
|
57 |
if (confirm("Are you sure you want to Extend expireDateTime for Scheme!") == true) {
|
| 30599 |
amit.gupta |
58 |
extendSchemeById(extendDatetime, schemeId);
|
| 28134 |
tejbeer |
59 |
}
|
|
|
60 |
} else {
|
| 30054 |
manish |
61 |
alert("field can't be blank");
|
| 30122 |
amit.gupta |
62 |
}
|
| 28134 |
tejbeer |
63 |
});
|
| 30122 |
amit.gupta |
64 |
|
|
|
65 |
|
| 29586 |
manish |
66 |
$(document).on('click', ".monthy-investment",
|
| 31762 |
tejbeer |
67 |
function() {
|
| 30122 |
amit.gupta |
68 |
console.log("hello evaluateActualInvestmentPayout");
|
|
|
69 |
window.location.href = context + "/evaluateActualInvestmentPayout";
|
|
|
70 |
|
|
|
71 |
});
|
|
|
72 |
|
| 31762 |
tejbeer |
73 |
$(document).on('click', ".process-investment", function() {
|
| 29759 |
amit.gupta |
74 |
if (confirm("Are you sure you want to Process Investment")) {
|
| 29761 |
amit.gupta |
75 |
processInvestment();
|
| 29759 |
amit.gupta |
76 |
}
|
|
|
77 |
});
|
|
|
78 |
|
| 30122 |
amit.gupta |
79 |
|
| 29586 |
manish |
80 |
$(document).on('click', ".processInvestmentDryRun",
|
| 31762 |
tejbeer |
81 |
function() {
|
| 30122 |
amit.gupta |
82 |
console.log("processInvestmentDryRun");
|
|
|
83 |
window.location.href = context + "/processInvestmentDryRun";
|
|
|
84 |
|
|
|
85 |
});
|
|
|
86 |
|
| 30054 |
manish |
87 |
$(document).on('click', ".brand-wise-income",
|
| 31762 |
tejbeer |
88 |
function() {
|
| 30122 |
amit.gupta |
89 |
var brand = $(this).data('brand');
|
|
|
90 |
|
|
|
91 |
var status = $(this).data('status');
|
|
|
92 |
var month = $(this).data('month');
|
|
|
93 |
|
|
|
94 |
brandWiseIncome(brand, month, status);
|
|
|
95 |
|
|
|
96 |
});
|
|
|
97 |
|
| 30054 |
manish |
98 |
$(document).on('click', ".imei_wise_income",
|
| 31762 |
tejbeer |
99 |
function() {
|
| 23752 |
govind |
100 |
|
| 30122 |
amit.gupta |
101 |
|
|
|
102 |
var catalogItemId = $(this).data('catalogitemid');
|
|
|
103 |
var month = $(this).data('month');
|
|
|
104 |
|
|
|
105 |
console.log(catalogItemId);
|
|
|
106 |
imeiWiseIncome(catalogItemId, month);
|
|
|
107 |
|
|
|
108 |
});
|
|
|
109 |
|
| 31762 |
tejbeer |
110 |
$(document).on('change', "#month-wise-income", function() {
|
| 30122 |
amit.gupta |
111 |
var month = $(this).val();
|
|
|
112 |
|
|
|
113 |
monthWiseIncome(month, "main-content");
|
|
|
114 |
});
|
|
|
115 |
|
|
|
116 |
|
| 31762 |
tejbeer |
117 |
$(document).on('click', ".schemes", function() {
|
| 30122 |
amit.gupta |
118 |
schemes("main-content");
|
| 23347 |
ashik.ali |
119 |
console.log("Active Schemes Button Clicked...")
|
| 28134 |
tejbeer |
120 |
|
| 30122 |
amit.gupta |
121 |
/*bootbox.confirm({
|
| 28134 |
tejbeer |
122 |
message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>"
|
|
|
123 |
,
|
|
|
124 |
buttons: {
|
|
|
125 |
confirm: {
|
|
|
126 |
label: 'I agree',
|
|
|
127 |
className: 'btn-success'
|
|
|
128 |
},
|
|
|
129 |
cancel: {
|
|
|
130 |
label: 'I disagree',
|
|
|
131 |
className: 'btn-danger'
|
|
|
132 |
}
|
|
|
133 |
},
|
| 30122 |
amit.gupta |
134 |
callback: function (result) {
|
| 28134 |
tejbeer |
135 |
if (result == true) {
|
|
|
136 |
}
|
|
|
137 |
}
|
| 30122 |
amit.gupta |
138 |
});*/
|
| 28134 |
tejbeer |
139 |
|
| 23347 |
ashik.ali |
140 |
});
|
| 23752 |
govind |
141 |
|
| 31762 |
tejbeer |
142 |
$(document).on('click', ".margin-calculator", function() {
|
| 27648 |
tejbeer |
143 |
console.log("Active Schemes Button Clicked...")
|
| 28134 |
tejbeer |
144 |
marginCalculator("main-content");
|
| 27648 |
tejbeer |
145 |
});
|
|
|
146 |
|
| 31762 |
tejbeer |
147 |
$(document).on('click', ".schemes-download-page", function() {
|
| 23347 |
ashik.ali |
148 |
console.log("Schemes Download Clicked...")
|
|
|
149 |
loadSchemesDownloadPage("main-content");
|
| 22860 |
ashik.ali |
150 |
});
|
| 23752 |
govind |
151 |
|
| 31762 |
tejbeer |
152 |
$(document).on('click', ".schemes-update", function() {
|
| 23556 |
amit.gupta |
153 |
loadSchemeUpdatePage("main-content");
|
|
|
154 |
});
|
| 23557 |
amit.gupta |
155 |
|
| 31762 |
tejbeer |
156 |
$(document).on('click', ".add-item", function() {
|
| 36421 |
amit |
157 |
var schemeIds = $("#schemeids").val();
|
|
|
158 |
// Read from modal model multi-select if available, else fall back to text input
|
|
|
159 |
var selectedModels = $(".modalCatalogItems").val();
|
|
|
160 |
var catalogIds;
|
|
|
161 |
if (selectedModels && selectedModels.length > 0) {
|
|
|
162 |
catalogIds = selectedModels.join(",");
|
|
|
163 |
} else {
|
|
|
164 |
catalogIds = $("#catalogids").val();
|
|
|
165 |
}
|
|
|
166 |
if (!schemeIds || !catalogIds || catalogIds.trim().length === 0) {
|
|
|
167 |
alert("Scheme ID and at least one Model are required");
|
|
|
168 |
return;
|
|
|
169 |
}
|
|
|
170 |
// Filter out catalogs that already exist in the scheme
|
|
|
171 |
var existingCatalogs = [];
|
| 37493 |
amit |
172 |
$('#' + SCHEME_DETAILS_CONTAINER + ' tr[data-catalogid]').each(function() {
|
| 36421 |
amit |
173 |
existingCatalogs.push(String($(this).data('catalogid')));
|
|
|
174 |
});
|
|
|
175 |
var requestedIds = catalogIds.split(",");
|
|
|
176 |
var duplicates = requestedIds.filter(function(id) { return existingCatalogs.indexOf(id.trim()) >= 0; });
|
|
|
177 |
var newIds = requestedIds.filter(function(id) { return existingCatalogs.indexOf(id.trim()) < 0; });
|
|
|
178 |
if (newIds.length === 0) {
|
|
|
179 |
alert("All selected models already exist in this scheme");
|
|
|
180 |
return;
|
|
|
181 |
}
|
|
|
182 |
if (duplicates.length > 0) {
|
|
|
183 |
alert("Skipping already existing catalog IDs: " + duplicates.join(", "));
|
|
|
184 |
}
|
|
|
185 |
catalogIds = newIds.join(",");
|
|
|
186 |
if (confirm("Add " + newIds.length + " model(s) to Scheme?")) {
|
| 30122 |
amit.gupta |
187 |
updateSingleScheme(schemeIds, catalogIds);
|
| 23928 |
govind |
188 |
}
|
|
|
189 |
});
|
| 31762 |
tejbeer |
190 |
$(document).on('click', ".add-schemes", function() {
|
| 23752 |
govind |
191 |
|
| 30122 |
amit.gupta |
192 |
let schemeIds = $("#schemeids").val();
|
|
|
193 |
let catalogIds = $("#catalogids").val();
|
|
|
194 |
|
| 23914 |
govind |
195 |
if (confirm("Are you sure you want to Add Item to Scheme!") == true) {
|
| 30122 |
amit.gupta |
196 |
if (catalogIds.trim().length === 0 || schemeIds.trim().length === 0) {
|
| 26763 |
tejbeer |
197 |
alert("fields shouldn't be blank");
|
|
|
198 |
return;
|
|
|
199 |
}
|
| 30122 |
amit.gupta |
200 |
updateSchemes(schemeIds, catalogIds);
|
| 23557 |
amit.gupta |
201 |
}
|
|
|
202 |
});
|
| 32299 |
jai.hind |
203 |
|
|
|
204 |
$(document).on('click', ".process-sellIn", function() {
|
|
|
205 |
let purchaseInvoiceNumber=$("#invoiceNumbers1").val();
|
|
|
206 |
if (confirm("Are you sure you want to Process SellIn") == true) {
|
|
|
207 |
if (purchaseInvoiceNumber.trim().length === 0) {
|
|
|
208 |
alert("fields shouldn't be blank");
|
|
|
209 |
return;
|
|
|
210 |
}
|
|
|
211 |
processSellin(purchaseInvoiceNumber);
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
});
|
|
|
215 |
|
|
|
216 |
$(document).on('click', ".process-sellOut", function() {
|
|
|
217 |
let fofoOrderInvoiceNumber=$("#invoiceNumbers2").val();
|
|
|
218 |
if (confirm("Are you sure you want to Process SellOut") == true) {
|
|
|
219 |
if (fofoOrderInvoiceNumber.trim().length === 0) {
|
|
|
220 |
alert("fields shouldn't be blank");
|
|
|
221 |
return;
|
|
|
222 |
}
|
|
|
223 |
processSellout(fofoOrderInvoiceNumber);
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
});
|
|
|
227 |
|
| 37493 |
amit |
228 |
// --- scheme details fragment (scheme-details.vm) ----------------------
|
|
|
229 |
// These live here rather than in the template because that fragment is
|
|
|
230 |
// injected with .html(), which re-executes any inline <script> it carries,
|
|
|
231 |
// and a successful save re-injects it. Binding there stacked one more
|
|
|
232 |
// $(document) listener per load until a single click fired N identical PUTs
|
|
|
233 |
// and the idempotency guard rejected all but the first. Scheme-level values
|
|
|
234 |
// are read from data- attributes at click time, so a handler always acts on
|
|
|
235 |
// the scheme currently on screen instead of the one it was rendered with.
|
|
|
236 |
$(document).on('click', ".add-scheme", function() {
|
|
|
237 |
$("#newItemToSchemeModal").modal({ backdrop: true, show: true });
|
|
|
238 |
});
|
|
|
239 |
|
|
|
240 |
$(document).on('hidden.bs.modal', "#newItemToSchemeModal", function() {
|
|
|
241 |
$("#addSchemeForm").trigger("reset");
|
|
|
242 |
});
|
|
|
243 |
|
|
|
244 |
$(document).on('shown.bs.modal', "#newItemToSchemeModal", function() {
|
|
|
245 |
var root = schemeDetailsRoot(this);
|
|
|
246 |
initSingleDatePicker($('input[name="addItemStartDate"]'), root.attr('data-scheme-start'), "down");
|
|
|
247 |
initSingleDatePicker($('input[name="addItemEndDate"]'), root.attr('data-scheme-end'), "down");
|
|
|
248 |
var categoryId = $('#modal-category-list').val();
|
|
|
249 |
if (categoryId) {
|
|
|
250 |
loadSchemeModalBrands(categoryId);
|
|
|
251 |
}
|
|
|
252 |
});
|
|
|
253 |
|
|
|
254 |
$(document).on('change', "#modal-category-list", function() {
|
|
|
255 |
var categoryId = $(this).val();
|
|
|
256 |
if (categoryId) {
|
|
|
257 |
loadSchemeModalBrands(categoryId);
|
|
|
258 |
}
|
|
|
259 |
});
|
|
|
260 |
|
|
|
261 |
$(document).on('click', ".edit-item-dates", function() {
|
|
|
262 |
var row = $(this).closest('tr');
|
|
|
263 |
var root = schemeDetailsRoot(this);
|
|
|
264 |
toggleItemDateEdit(row, true);
|
|
|
265 |
var startInput = row.find('.edit-start-date');
|
|
|
266 |
var endInput = row.find('.edit-end-date');
|
|
|
267 |
// An item with no window of its own opens on the scheme's own window.
|
|
|
268 |
if (!startInput.data('daterangepicker')) {
|
|
|
269 |
initSingleDatePicker(startInput, startInput.val() || root.attr('data-scheme-start'), "down");
|
|
|
270 |
initSingleDatePicker(endInput, endInput.val() || root.attr('data-scheme-end'), "down");
|
|
|
271 |
}
|
|
|
272 |
});
|
|
|
273 |
|
|
|
274 |
$(document).on('click', ".cancel-item-dates", function() {
|
|
|
275 |
toggleItemDateEdit($(this).closest('tr'), false);
|
|
|
276 |
});
|
|
|
277 |
|
|
|
278 |
$(document).on('click', ".save-item-dates", function() {
|
|
|
279 |
var row = $(this).closest('tr');
|
|
|
280 |
var startDate = row.find('.edit-start-date').val();
|
|
|
281 |
var endDate = row.find('.edit-end-date').val();
|
|
|
282 |
if (!startDate || !endDate) {
|
|
|
283 |
alert("Both start date and end date are required");
|
|
|
284 |
return;
|
|
|
285 |
}
|
|
|
286 |
updateSchemeItemWindow(schemeDetailsRoot(this).attr('data-scheme-id'),
|
|
|
287 |
row.data('schemeitemid'), startDate, endDate);
|
|
|
288 |
});
|
|
|
289 |
|
| 31762 |
tejbeer |
290 |
$(document).on('click', ".delete-schemes", function() {
|
| 30122 |
amit.gupta |
291 |
if (confirm("Delete model from Scheme?") == true) {
|
| 23914 |
govind |
292 |
schemeId = $(this).data('schemeid');
|
| 30122 |
amit.gupta |
293 |
catalogId = $(this).data('catalogid');
|
|
|
294 |
deleteScheme(schemeId, catalogId);
|
| 23715 |
govind |
295 |
}
|
| 23752 |
govind |
296 |
});
|
|
|
297 |
|
| 27755 |
amit.gupta |
298 |
$(document).on('click', "#scheme-search-button",
|
| 31762 |
tejbeer |
299 |
function() {
|
| 28134 |
tejbeer |
300 |
var searchText = $("#scheme-search-text").val();
|
|
|
301 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
302 |
searchText = "";
|
|
|
303 |
}
|
| 30122 |
amit.gupta |
304 |
doGetAjaxRequestHandler(context + "/getSchemes?searchScheme="
|
| 31762 |
tejbeer |
305 |
+ searchText, function(response) {
|
|
|
306 |
$('#' + "main-content").html(response);
|
|
|
307 |
});
|
| 28134 |
tejbeer |
308 |
});
|
| 26802 |
tejbeer |
309 |
|
| 31762 |
tejbeer |
310 |
$(document).on("keyup", "#scheme-search-text", function(e) {
|
| 23752 |
govind |
311 |
var keyCode = e.keyCode || e.which;
|
|
|
312 |
if (keyCode == 13) {
|
|
|
313 |
$("#scheme-search-button").click();
|
|
|
314 |
}
|
|
|
315 |
});
|
| 31762 |
tejbeer |
316 |
$(document).on('click', "#scheme-item-search-button", function() {
|
| 23752 |
govind |
317 |
var searchText = $("#scheme-item-search-text").val();
|
| 27875 |
amit.gupta |
318 |
var date = $(".schemes-date").val();
|
| 23752 |
govind |
319 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
320 |
searchText = "";
|
| 26497 |
amit.gupta |
321 |
alert("please select item");
|
|
|
322 |
return;
|
| 23752 |
govind |
323 |
}
|
| 27094 |
tejbeer |
324 |
if (typeof currentItem != "undefined") {
|
|
|
325 |
console.log(currentItem);
|
| 27875 |
amit.gupta |
326 |
loadSchemeItemSearchInfo(currentItem, date);
|
| 27094 |
tejbeer |
327 |
} else {
|
|
|
328 |
console.log("reeffff")
|
|
|
329 |
alert("Data No Found")
|
|
|
330 |
}
|
| 23752 |
govind |
331 |
});
|
|
|
332 |
|
| 31762 |
tejbeer |
333 |
$(document).on('click', "#scheme-imei-search-button", function() {
|
| 28795 |
tejbeer |
334 |
var searchText = $("#scheme-imei-search-text").val();
|
|
|
335 |
var date = $(".schemes-date").val();
|
|
|
336 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
337 |
searchText = "";
|
|
|
338 |
alert("please select imei");
|
|
|
339 |
return;
|
|
|
340 |
}
|
|
|
341 |
if (typeof imei != "undefined") {
|
|
|
342 |
console.log(imei);
|
|
|
343 |
loadSchemeImeiSearchInfo(imei, date);
|
|
|
344 |
} else {
|
|
|
345 |
console.log("reeffff")
|
|
|
346 |
alert("Data No Found")
|
|
|
347 |
}
|
|
|
348 |
});
|
| 31762 |
tejbeer |
349 |
|
|
|
350 |
$(document).on('click', "#scheme-imei-wise-search-button", function() {
|
|
|
351 |
var searchText = $("#scheme-imei-wise-search-text").val();
|
|
|
352 |
var date = $(".schemes-date").val();
|
| 32331 |
amit.gupta |
353 |
if (typeof (searchText) === "undefined" || !searchText) {
|
| 31762 |
tejbeer |
354 |
searchText = "";
|
|
|
355 |
alert("please select imei");
|
|
|
356 |
return;
|
|
|
357 |
}
|
| 32331 |
amit.gupta |
358 |
if (typeof imei !== "undefined") {
|
| 31762 |
tejbeer |
359 |
console.log(imei);
|
|
|
360 |
var searchText = $("#scheme-imei-wise-search-text").val();
|
|
|
361 |
|
|
|
362 |
if ((searchText)) {
|
|
|
363 |
doGetAjaxRequestHandler(`${context}/getSchemesByImei?searchImei=${searchText}`, function(response) {
|
|
|
364 |
$('#' + "main-content").html(response);
|
|
|
365 |
$('#scheme-imei-search-text').val(searchText);
|
|
|
366 |
|
|
|
367 |
});
|
|
|
368 |
}
|
|
|
369 |
} else {
|
| 32331 |
amit.gupta |
370 |
console.log("reeffff");
|
|
|
371 |
alert("Data No Found");
|
| 31762 |
tejbeer |
372 |
}
|
|
|
373 |
});
|
| 27755 |
amit.gupta |
374 |
$(document).on('click', ".categoryWiseSchemeHistory",
|
| 34575 |
vikas.jang |
375 |
function() {
|
|
|
376 |
var category = $('#partner-category').val();
|
|
|
377 |
console.log(category);
|
| 26763 |
tejbeer |
378 |
|
| 34575 |
vikas.jang |
379 |
doGetAjaxRequestHandler(context + "/getSchemes?partnerType="
|
|
|
380 |
+ category, function(response) {
|
|
|
381 |
$('#' + "main-content").html(response);
|
|
|
382 |
$('#partner-category').val(category);
|
|
|
383 |
window.dispatchEvent(new Event('resize'));
|
|
|
384 |
});
|
| 26763 |
tejbeer |
385 |
|
| 34575 |
vikas.jang |
386 |
});
|
| 26763 |
tejbeer |
387 |
|
| 31762 |
tejbeer |
388 |
$(document).on("keyup", "#scheme-item-search-text", function(e) {
|
| 23752 |
govind |
389 |
var keyCode = e.keyCode || e.which;
|
|
|
390 |
if (keyCode == 13) {
|
|
|
391 |
$("#scheme-item-search-button").click();
|
|
|
392 |
}
|
|
|
393 |
});
|
| 22860 |
ashik.ali |
394 |
});
|
|
|
395 |
|
| 37493 |
amit |
396 |
// Every brand/model picker on the scheme screens wants the same multiselect;
|
|
|
397 |
// the label set was the only thing that genuinely varied between the copies.
|
|
|
398 |
// Pass overrides for the rare case that also needs a different width.
|
|
|
399 |
function configureMultiselect(selector, label, overrides) {
|
|
|
400 |
$(selector).multiselect($.extend({
|
| 28134 |
tejbeer |
401 |
includeSelectAllOption: true,
|
| 37493 |
amit |
402 |
multiple: true,
|
| 28134 |
tejbeer |
403 |
maxHeight: 200,
|
|
|
404 |
buttonWidth: '180px',
|
|
|
405 |
numberDisplayed: 1,
|
| 37493 |
amit |
406 |
nonSelectedText: label,
|
|
|
407 |
nSelectedText: ' - ' + label + ' Selected',
|
|
|
408 |
allSelectedText: 'All ' + label + ' Selected',
|
| 28134 |
tejbeer |
409 |
enableFiltering: true,
|
|
|
410 |
enableCaseInsensitiveFiltering: true
|
| 37493 |
amit |
411 |
}, overrides || {}));
|
|
|
412 |
}
|
|
|
413 |
|
|
|
414 |
function configureTagListingItemsDescriptionDropDown() {
|
|
|
415 |
configureMultiselect('.catalogItemsDescription', 'Models');
|
|
|
416 |
}
|
|
|
417 |
|
|
|
418 |
// The fragment root carries the scheme's id and window as data- attributes.
|
|
|
419 |
// Falls back to the container when the caller sits outside the root.
|
|
|
420 |
function schemeDetailsRoot(el) {
|
|
|
421 |
var root = $(el).closest('[data-scheme-id]');
|
|
|
422 |
return root.length ? root : $('#' + SCHEME_DETAILS_CONTAINER + ' [data-scheme-id]').first();
|
|
|
423 |
}
|
|
|
424 |
|
|
|
425 |
function toggleItemDateEdit(row, editing) {
|
|
|
426 |
row.find('.date-display').toggle(!editing);
|
|
|
427 |
row.find('.date-edit').toggle(editing);
|
|
|
428 |
row.find('.edit-item-dates').toggle(!editing);
|
|
|
429 |
row.find('.save-item-dates, .cancel-item-dates').toggle(editing);
|
|
|
430 |
}
|
|
|
431 |
|
|
|
432 |
// Row values are rendered DD/MM/YYYY; scheme-level fallbacks are raw timestamps.
|
|
|
433 |
function initSingleDatePicker(input, value, drops) {
|
|
|
434 |
var startMoment = /^\d{2}\/\d{2}\/\d{4}$/.test(value || '')
|
|
|
435 |
? moment(value, 'DD/MM/YYYY')
|
|
|
436 |
: moment(value);
|
|
|
437 |
input.daterangepicker($.extend(getSingleDatePicker(startMoment), { "drops": drops }));
|
|
|
438 |
}
|
|
|
439 |
|
|
|
440 |
// Re-run on every injection: unlike the delegated handlers these bind directly
|
|
|
441 |
// to elements that the fragment replaces, so they cannot be bound once up front.
|
|
|
442 |
function initSchemeDetails(domId) {
|
|
|
443 |
var root = $('#' + domId).find('[data-scheme-id]');
|
|
|
444 |
if (root.length === 0) {
|
|
|
445 |
return;
|
|
|
446 |
}
|
|
|
447 |
root.find('input[name="extendSchemeById"]').daterangepicker($.extend(getSingleDatePicker(), { "drops": "up" }));
|
|
|
448 |
initSingleDatePicker(root.find('input[name="expireSchemeById"]'), root.attr('data-scheme-end'), "up");
|
|
|
449 |
}
|
|
|
450 |
|
|
|
451 |
// The modal reuses the page-level brand/model endpoints; its selects are re-id'd
|
|
|
452 |
// so they do not clash with the create-scheme page rendered behind it.
|
|
|
453 |
function loadSchemeModalBrands(categoryId) {
|
|
|
454 |
loadBrandsByCategory('modal-brand-list', categoryId, function() {
|
|
|
455 |
$('#modal-brand-list select').attr('id', 'modal-tag-listing-brands');
|
|
|
456 |
configureMultiselect('#modal-tag-listing-brands', 'Brands');
|
|
|
457 |
$('#modal-tag-listing-brands').on('change', function() {
|
|
|
458 |
var brands = $(this).val();
|
|
|
459 |
if (brands) {
|
|
|
460 |
loadSchemeModalModels(categoryId, brands);
|
|
|
461 |
}
|
|
|
462 |
});
|
| 23752 |
govind |
463 |
});
|
| 23343 |
ashik.ali |
464 |
}
|
|
|
465 |
|
| 37493 |
amit |
466 |
function loadSchemeModalModels(categoryId, brands) {
|
|
|
467 |
loadCatalogDescriptionByBrands('modal-models-list', categoryId, brands, function() {
|
|
|
468 |
$('#modal-models-list select').addClass('modalCatalogItems');
|
|
|
469 |
configureMultiselect('.modalCatalogItems', 'Models', { buttonWidth: '220px' });
|
|
|
470 |
});
|
|
|
471 |
}
|
|
|
472 |
|
| 23752 |
govind |
473 |
function schemesDownload() {
|
| 30599 |
amit.gupta |
474 |
let pickerData = getDatesFromPicker('input[name="startEndDateTime"]')
|
|
|
475 |
doAjaxGetDownload(context + "/schemes/download?" +
|
|
|
476 |
"startDateTime=" + pickerData.startDate
|
|
|
477 |
+ "&endDateTime=" + pickerData.endDate,
|
| 28134 |
tejbeer |
478 |
"SchemesReport.xlsx");
|
| 23343 |
ashik.ali |
479 |
}
|
| 30122 |
amit.gupta |
480 |
|
| 30501 |
amit.gupta |
481 |
function selectedbrand(categoryId) {
|
| 23914 |
govind |
482 |
var brands = $('#tag-listing-brands').val();
|
|
|
483 |
if (brands) {
|
| 30148 |
amit.gupta |
484 |
loadCatalogDescriptionByBrands(
|
| 30501 |
amit.gupta |
485 |
"tag-listing-items-description-container", categoryId, brands);
|
| 23914 |
govind |
486 |
}
|
|
|
487 |
}
|
| 30122 |
amit.gupta |
488 |
|
| 30492 |
amit.gupta |
489 |
function categoryChanged() {
|
|
|
490 |
let categoryId = $('#category-list').val();
|
|
|
491 |
if (categoryId) {
|
|
|
492 |
loadBrandsByCategory(
|
|
|
493 |
"brand-list", categoryId);
|
|
|
494 |
}
|
|
|
495 |
}
|
|
|
496 |
|
| 23752 |
govind |
497 |
function loadSchemeDetails(schemeId, domId) {
|
| 37493 |
amit |
498 |
domId = domId || SCHEME_DETAILS_CONTAINER;
|
| 23752 |
govind |
499 |
doGetAjaxRequestHandler(context + "/getSchemeById?schemeId=" + schemeId,
|
| 31762 |
tejbeer |
500 |
function(response) {
|
| 28134 |
tejbeer |
501 |
$('#' + domId).html(response);
|
| 37493 |
amit |
502 |
initSchemeDetails(domId);
|
| 28134 |
tejbeer |
503 |
window.dispatchEvent(new Event('resize'));
|
|
|
504 |
});
|
| 23343 |
ashik.ali |
505 |
}
|
|
|
506 |
|
| 37493 |
amit |
507 |
function updateSchemeItemWindow(schemeId, schemeItemId, startDate, endDate) {
|
|
|
508 |
doPutAjaxRequestHandler(context + "/scheme/item/window?schemeItemId=" + schemeItemId
|
|
|
509 |
+ "&startDate=" + encodeURIComponent(toIsoDateTime(startDate, false))
|
|
|
510 |
+ "&endDate=" + encodeURIComponent(toIsoDateTime(endDate, true)),
|
|
|
511 |
function(response) {
|
|
|
512 |
loadSchemeDetails(schemeId, SCHEME_DETAILS_CONTAINER);
|
|
|
513 |
});
|
|
|
514 |
}
|
|
|
515 |
|
| 23752 |
govind |
516 |
function activeScheme(schemeId, offset, domId) {
|
|
|
517 |
doPutAjaxRequestHandler(context + "/activeSchemeById?schemeId=" + schemeId
|
| 34575 |
vikas.jang |
518 |
+ "&offset=" + offset, function(response) {
|
|
|
519 |
$('#' + domId).html(response);
|
| 37493 |
amit |
520 |
$('#' + SCHEME_DETAILS_CONTAINER).html('');
|
| 34575 |
vikas.jang |
521 |
});
|
| 23343 |
ashik.ali |
522 |
}
|
|
|
523 |
|
| 30599 |
amit.gupta |
524 |
function expireScheme(schemeId, expireDate, domId) {
|
| 23752 |
govind |
525 |
doPutAjaxRequestHandler(context + "/expireSchemeById?schemeId=" + schemeId
|
| 31762 |
tejbeer |
526 |
+ "&expireTimestamp=" + expireDate, function(
|
|
|
527 |
response) {
|
| 26763 |
tejbeer |
528 |
alert("Scheme - " + schemeId + " marked for expiry successfully!");
|
| 23343 |
ashik.ali |
529 |
$('#' + domId).html(response);
|
| 37493 |
amit |
530 |
$('#' + SCHEME_DETAILS_CONTAINER).html('');
|
| 23343 |
ashik.ali |
531 |
});
|
|
|
532 |
}
|
| 30122 |
amit.gupta |
533 |
|
| 30599 |
amit.gupta |
534 |
function extendAllScheme(extendDate) {
|
| 26763 |
tejbeer |
535 |
doPostAjaxRequestWithJsonHandler(context + "/extendAllSchemes", JSON
|
| 31762 |
tejbeer |
536 |
.stringify(extendDate), function(response) {
|
|
|
537 |
if (response == 'true') {
|
|
|
538 |
alert("Scheme All Extended successfully");
|
|
|
539 |
schemes("main-content");
|
|
|
540 |
} else {
|
|
|
541 |
alert("No scheme Activated Currently");
|
|
|
542 |
schemes("main-content");
|
|
|
543 |
}
|
|
|
544 |
});
|
| 23343 |
ashik.ali |
545 |
|
| 23914 |
govind |
546 |
}
|
| 30122 |
amit.gupta |
547 |
|
| 30599 |
amit.gupta |
548 |
function extendSchemeById(extendDate, schemeId) {
|
| 26763 |
tejbeer |
549 |
doPostAjaxRequestWithJsonHandler(context + "/extendSchemeById?schemeId="
|
| 31762 |
tejbeer |
550 |
+ schemeId, JSON.stringify(extendDate), function(response) {
|
|
|
551 |
if (response == 'true') {
|
|
|
552 |
alert("Scheme extended successfully");
|
|
|
553 |
schemes("main-content");
|
|
|
554 |
} else {
|
|
|
555 |
alert("Scheme already Expired");
|
|
|
556 |
schemes("main-content");
|
|
|
557 |
}
|
|
|
558 |
});
|
| 23914 |
govind |
559 |
}
|
| 30122 |
amit.gupta |
560 |
|
| 29761 |
amit.gupta |
561 |
function processInvestment() {
|
| 31762 |
tejbeer |
562 |
doPostAjaxRequestWithJsonHandler(context + "/payMonthlyInvestment", function(response) {
|
| 29759 |
amit.gupta |
563 |
alert("InvestmentPayout processed successfully");
|
|
|
564 |
});
|
|
|
565 |
}
|
| 23914 |
govind |
566 |
|
| 23752 |
govind |
567 |
function loadScheme(domId) {
|
| 31762 |
tejbeer |
568 |
doGetAjaxRequestHandler(context + "/createScheme", function(response) {
|
| 23343 |
ashik.ali |
569 |
$('#' + domId).html(response);
|
| 30492 |
amit.gupta |
570 |
createSchemeOnReady();
|
|
|
571 |
categoryChanged();
|
| 30599 |
amit.gupta |
572 |
$('input[name="dateRange"]').daterangepicker(getRangedDatePicker());
|
| 23343 |
ashik.ali |
573 |
});
|
| 23752 |
govind |
574 |
|
| 23343 |
ashik.ali |
575 |
}
|
|
|
576 |
|
| 31762 |
tejbeer |
577 |
function loadImeiWiseScheme(domId) {
|
|
|
578 |
doGetAjaxRequestHandler(context + "/getSchemesByImei",
|
|
|
579 |
function(response) {
|
|
|
580 |
$('#' + domId).html(response);
|
|
|
581 |
|
|
|
582 |
});
|
|
|
583 |
}
|
|
|
584 |
|
| 37493 |
amit |
585 |
function loadCatalogDescriptionByBrands(domId, categoryId, brands, afterRender) {
|
| 30501 |
amit.gupta |
586 |
let brandsString = brands.join(",")
|
|
|
587 |
doGetAjaxRequestHandler(`${context}/getCatalogDescriptionByBrands?categoryId=${categoryId}&brands=${brandsString}`,
|
| 31762 |
tejbeer |
588 |
function(response) {
|
| 28134 |
tejbeer |
589 |
$('#' + domId).html(response);
|
| 37493 |
amit |
590 |
(afterRender || configureTagListingItemsDescriptionDropDown)();
|
| 28134 |
tejbeer |
591 |
});
|
| 23752 |
govind |
592 |
|
| 23343 |
ashik.ali |
593 |
}
|
|
|
594 |
|
| 37493 |
amit |
595 |
function loadBrandsByCategory(domId, categoryId, afterRender) {
|
| 30492 |
amit.gupta |
596 |
doGetAjaxRequestHandler(`${context}/getBrandsByCategory?categoryId=${categoryId}`,
|
| 31762 |
tejbeer |
597 |
function(response) {
|
| 30492 |
amit.gupta |
598 |
$('#' + domId).html(response);
|
| 37493 |
amit |
599 |
(afterRender || configureBrandsDropDown)();
|
| 30492 |
amit.gupta |
600 |
});
|
|
|
601 |
}
|
|
|
602 |
|
| 23752 |
govind |
603 |
function schemes(domId) {
|
| 31762 |
tejbeer |
604 |
doGetAjaxRequestHandler(context + "/getSchemes", function(response) {
|
| 23343 |
ashik.ali |
605 |
$('#' + domId).html(response);
|
|
|
606 |
});
|
|
|
607 |
}
|
| 30122 |
amit.gupta |
608 |
|
| 27648 |
tejbeer |
609 |
function marginCalculator(domId) {
|
| 31762 |
tejbeer |
610 |
doGetAjaxRequestHandler(context + "/getMarginCalculator", function(response) {
|
| 27648 |
tejbeer |
611 |
$('#' + domId).html(response);
|
|
|
612 |
});
|
|
|
613 |
}
|
| 23343 |
ashik.ali |
614 |
|
| 23752 |
govind |
615 |
function loadSchemesDownloadPage(domId) {
|
| 31762 |
tejbeer |
616 |
doGetAjaxRequestHandler(context + "/schemes/downloadPage", function(
|
| 28134 |
tejbeer |
617 |
response) {
|
| 23343 |
ashik.ali |
618 |
$('#' + domId).html(response);
|
|
|
619 |
});
|
| 23556 |
amit.gupta |
620 |
}
|
|
|
621 |
|
| 23752 |
govind |
622 |
function loadSchemeUpdatePage(domId) {
|
| 32299 |
jai.hind |
623 |
doGetAjaxRequestHandler(context + "/schemes/update-schemes-page", function(
|
| 28134 |
tejbeer |
624 |
response) {
|
| 23556 |
amit.gupta |
625 |
$('#' + domId).html(response);
|
|
|
626 |
});
|
| 23557 |
amit.gupta |
627 |
}
|
|
|
628 |
|
| 30122 |
amit.gupta |
629 |
function brandWiseIncome(brand, month, status) {
|
| 30054 |
manish |
630 |
console.log(brand);
|
|
|
631 |
console.log(month);
|
| 30122 |
amit.gupta |
632 |
|
| 32331 |
amit.gupta |
633 |
doGetAjaxRequestHandler(`${context}/brandWiseIncome?brand=${brand}&month=${month}`, function (
|
| 30054 |
manish |
634 |
response) {
|
|
|
635 |
$('.imei-wise-income-container').html('');
|
| 30122 |
amit.gupta |
636 |
$('.brand-wise-income-container').html(response);
|
| 30054 |
manish |
637 |
});
|
|
|
638 |
}
|
|
|
639 |
|
| 30122 |
amit.gupta |
640 |
function monthWiseIncome(month, domId) {
|
| 30054 |
manish |
641 |
console.log(month);
|
| 31762 |
tejbeer |
642 |
doGetAjaxRequestHandler(context + "/monthWisePartnerIncome/" + month, function(response) {
|
| 30122 |
amit.gupta |
643 |
console.log(response);
|
|
|
644 |
$('#' + domId).html(response);
|
|
|
645 |
})
|
| 30054 |
manish |
646 |
}
|
| 30122 |
amit.gupta |
647 |
|
|
|
648 |
function imeiWiseIncome(catalogItemId, month) {
|
| 30054 |
manish |
649 |
console.log(catalogItemId);
|
|
|
650 |
console.log(month);
|
| 30122 |
amit.gupta |
651 |
|
| 31762 |
tejbeer |
652 |
doGetAjaxRequestHandler(context + "/getLastMonthImeiWiseIncome?catalogItemId=" + catalogItemId + "&month=" + month, function(
|
| 30054 |
manish |
653 |
response) {
|
| 30122 |
amit.gupta |
654 |
$('.imei-wise-income-container').html(response);
|
| 30054 |
manish |
655 |
});
|
|
|
656 |
}
|
|
|
657 |
|
| 36421 |
amit |
658 |
function toIsoDateTime(ddmmyyyy, endOfDay) {
|
|
|
659 |
var parts = ddmmyyyy.split('/');
|
|
|
660 |
if (parts.length !== 3) return ddmmyyyy;
|
|
|
661 |
var isoDate = parts[2] + '-' + parts[1] + '-' + parts[0];
|
|
|
662 |
return isoDate + (endOfDay ? 'T23:59:59' : 'T00:00:00');
|
|
|
663 |
}
|
|
|
664 |
|
|
|
665 |
function updateSingleScheme(schemeIds, catalogIds) {
|
|
|
666 |
var payload = {
|
|
|
667 |
"catalogIds": catalogIds.split(",").map(Number),
|
|
|
668 |
"schemeIds": schemeIds.split(",").map(Number)
|
|
|
669 |
};
|
|
|
670 |
var startDate = $('#addItemStartDate').val();
|
|
|
671 |
var endDate = $('#addItemEndDate').val();
|
|
|
672 |
if (startDate) payload.startDate = toIsoDateTime(startDate, false);
|
|
|
673 |
if (endDate) payload.endDate = toIsoDateTime(endDate, true);
|
| 23928 |
govind |
674 |
doPostAjaxRequestWithJsonHandler(context + '/addItemToScheme', JSON
|
| 36421 |
amit |
675 |
.stringify(payload), function(response) {
|
|
|
676 |
$('#newItemToSchemeModal').modal('hide');
|
|
|
677 |
alert("Item Added to scheme successfully");
|
| 37493 |
amit |
678 |
loadSchemeDetails(schemeIds, SCHEME_DETAILS_CONTAINER);
|
| 31762 |
tejbeer |
679 |
});
|
| 23715 |
govind |
680 |
}
|
| 30122 |
amit.gupta |
681 |
|
|
|
682 |
function updateSchemes(schemeIds, catalogIds) {
|
| 23928 |
govind |
683 |
doPostAjaxRequestWithJsonHandler(context + '/schemes/update', JSON
|
| 28134 |
tejbeer |
684 |
.stringify({
|
| 30122 |
amit.gupta |
685 |
"catalogIds": catalogIds.split(",").map(Number),
|
| 28134 |
tejbeer |
686 |
"schemeIds": schemeIds.split(",").map(Number)
|
| 31762 |
tejbeer |
687 |
}), function(response) {
|
|
|
688 |
if (response == 'true') {
|
|
|
689 |
alert("Item Added to scheme successfully");
|
|
|
690 |
// $('#newItemToSchemeModal').modal('hide');
|
|
|
691 |
loadSchemeUpdatePage("main-content");
|
|
|
692 |
}
|
|
|
693 |
});
|
| 23928 |
govind |
694 |
}
|
| 30122 |
amit.gupta |
695 |
|
| 32299 |
jai.hind |
696 |
function processSellin(purchaseInvoiceNumber) {
|
|
|
697 |
doPostAjaxRequestWithJsonHandler(context + "/schemes/process-sellin",
|
|
|
698 |
JSON.stringify(purchaseInvoiceNumber.split(",").map(x=>x.trim())), function(response) {
|
|
|
699 |
if (response) {
|
|
|
700 |
alert("Invoices Processed Successfully");
|
|
|
701 |
loadSchemeUpdatePage("main-content");
|
|
|
702 |
}
|
|
|
703 |
});
|
|
|
704 |
}
|
|
|
705 |
|
|
|
706 |
function processSellout(fofoOrderInvoiceNumber) {
|
|
|
707 |
doPostAjaxRequestWithJsonHandler(context + "/schemes/process-sellout",
|
|
|
708 |
JSON.stringify(fofoOrderInvoiceNumber.split(",").map(x=>x.trim())), function(response) {
|
|
|
709 |
if (response) {
|
|
|
710 |
alert("Invoices Processed Successfully");
|
|
|
711 |
loadSchemeUpdatePage("main-content");
|
|
|
712 |
}
|
|
|
713 |
});
|
|
|
714 |
}
|
|
|
715 |
|
|
|
716 |
|
| 30122 |
amit.gupta |
717 |
function deleteScheme(schemeId, catalogId) {
|
|
|
718 |
doDeleteAjaxRequestHandler(context + "/schemes/delete?schemeId=" + schemeId
|
| 31762 |
tejbeer |
719 |
+ "&catalogId=" + catalogId, function(response) {
|
|
|
720 |
if (response == 'true') {
|
|
|
721 |
alert("Model Deleted successfully from Scheme");
|
| 37493 |
amit |
722 |
loadSchemeDetails(schemeId, SCHEME_DETAILS_CONTAINER);
|
| 31762 |
tejbeer |
723 |
}
|
|
|
724 |
});
|
| 23752 |
govind |
725 |
}
|
| 30122 |
amit.gupta |
726 |
|
|
|
727 |
|
|
|
728 |
function loadSearchItemScheme(domId, selectedModel, date) {
|
| 26802 |
tejbeer |
729 |
var searchText = $("#scheme-item-search-text").val();
|
|
|
730 |
var category = $('#partner-category').val();
|
| 26912 |
tejbeer |
731 |
|
| 26802 |
tejbeer |
732 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
733 |
searchText = "";
|
|
|
734 |
}
|
|
|
735 |
if (typeof (category) == "undefined" || !category) {
|
|
|
736 |
category = "";
|
|
|
737 |
}
|
| 30122 |
amit.gupta |
738 |
if (searchText && category) {
|
| 31762 |
tejbeer |
739 |
doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&partnerType=${category}&date=${date}`, function(response) {
|
| 26802 |
tejbeer |
740 |
$('#' + domId).html(response);
|
|
|
741 |
$('#partner-category').val(category);
|
|
|
742 |
});
|
| 30122 |
amit.gupta |
743 |
} else if (searchText) {
|
| 31762 |
tejbeer |
744 |
doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&date=${date}`, function(response) {
|
| 26802 |
tejbeer |
745 |
$('#' + domId).html(response);
|
| 30253 |
amit.gupta |
746 |
$('#partner-category').val(category);
|
| 26802 |
tejbeer |
747 |
});
|
| 26912 |
tejbeer |
748 |
|
|
|
749 |
}
|
|
|
750 |
|
| 23752 |
govind |
751 |
}
|
| 28795 |
tejbeer |
752 |
|
|
|
753 |
function loadSearchImeiScheme(domId, selected_imei, date) {
|
|
|
754 |
var category = $('#partner-category').val();
|
|
|
755 |
var searchText = $("#scheme-imei-search-text").val();
|
|
|
756 |
|
|
|
757 |
var category = $('#partner-category').val();
|
|
|
758 |
|
|
|
759 |
console.log(category)
|
|
|
760 |
|
|
|
761 |
if (typeof (searchText) == "undefined" || !searchText) {
|
|
|
762 |
searchText = "";
|
|
|
763 |
}
|
|
|
764 |
if (typeof (category) == "undefined" || !category) {
|
|
|
765 |
category = "";
|
|
|
766 |
}
|
|
|
767 |
if ((searchText) && (category)) {
|
|
|
768 |
doGetAjaxRequestHandler(context + "/getSchemes?searchImei="
|
| 31762 |
tejbeer |
769 |
+ selected_imei + "&partnerType=" + category, function(
|
|
|
770 |
response) {
|
| 28795 |
tejbeer |
771 |
$('#' + domId).html(response);
|
|
|
772 |
|
|
|
773 |
$('#partner-category').val(category);
|
|
|
774 |
$('#scheme-imei-search-text').val(selected_imei);
|
|
|
775 |
});
|
|
|
776 |
} else if ((searchText)) {
|
| 31762 |
tejbeer |
777 |
doGetAjaxRequestHandler(`${context}/getSchemes?searchImei=${selected_imei}&date=${date}`, function(response) {
|
| 28795 |
tejbeer |
778 |
$('#' + domId).html(response);
|
|
|
779 |
$('#scheme-imei-search-text').val(selected_imei);
|
|
|
780 |
|
|
|
781 |
});
|
|
|
782 |
}
|
|
|
783 |
|
|
|
784 |
}
|
| 30122 |
amit.gupta |
785 |
|
|
|
786 |
function loadSchemeItemSearchInfo(selectedModel, date) {
|
|
|
787 |
loadSearchItemScheme("main-content", selectedModel, date);
|
| 23752 |
govind |
788 |
}
|
| 28795 |
tejbeer |
789 |
|
|
|
790 |
function loadSchemeImeiSearchInfo(selectedImei, date) {
|
|
|
791 |
|
|
|
792 |
loadSearchImeiScheme("main-content", selectedImei, date);
|
|
|
793 |
}
|
|
|
794 |
|
| 34575 |
vikas.jang |
795 |
$(document).on('click', ".mark-active", function() {
|
|
|
796 |
let activeScheme=$("#activeSchemes").val();
|
| 34587 |
vikas.jang |
797 |
if (activeScheme.trim().length === 0) {
|
|
|
798 |
alert("fields shouldn't be blank");
|
|
|
799 |
return;
|
|
|
800 |
}
|
| 34575 |
vikas.jang |
801 |
if (confirm("Are you sure you want to Active schemes?")) {
|
|
|
802 |
console.log("activeScheme",activeScheme);
|
|
|
803 |
doPutAjaxRequestHandler(context + "/activeSchemeByIds?schemeId=" + activeScheme, function(response) {
|
|
|
804 |
if (response){
|
| 34587 |
vikas.jang |
805 |
$("#activeSchemes").val("");
|
| 34575 |
vikas.jang |
806 |
alert("schemes activated")
|
|
|
807 |
}
|
|
|
808 |
});
|
|
|
809 |
}
|
| 35252 |
aman |
810 |
});
|
|
|
811 |
$(document).on('click', ".mark-expire", function () {
|
|
|
812 |
let expireSchemes = $("#expireSchemes").val();
|
|
|
813 |
if (expireSchemes.trim().length === 0) {
|
|
|
814 |
alert("fields shouldn't be blank");
|
|
|
815 |
return;
|
|
|
816 |
}
|
|
|
817 |
if (confirm("Are you sure you want to expire schemes?")) {
|
|
|
818 |
console.log("expireSchemes", expireSchemes);
|
|
|
819 |
doPutAjaxRequestHandler(context + "/expireSchemeByIds?schemeId=" + expireSchemes, function (response) {
|
|
|
820 |
if (response) {
|
|
|
821 |
$("#expireSchemes").val("");
|
|
|
822 |
alert("schemes expired")
|
|
|
823 |
}
|
|
|
824 |
});
|
|
|
825 |
}
|
| 34575 |
vikas.jang |
826 |
});
|