| 21987 |
kshitij.so |
1 |
var grnhistory= grnhistory || {};
|
|
|
2 |
grnhistory.searchText = "";
|
|
|
3 |
grnhistory.searchType = "";
|
|
|
4 |
grnhistory.startTime = "0";
|
|
|
5 |
grnhistory.endTime = "0";
|
|
|
6 |
|
| 22283 |
ashik.ali |
7 |
var saleHistory=saleHistory || {};
|
|
|
8 |
saleHistory.searchText="";
|
|
|
9 |
saleHistory.searchType="";
|
|
|
10 |
saleHistory.startTime="";
|
|
|
11 |
saleHistory.endTime="";
|
|
|
12 |
|
| 22551 |
ashik.ali |
13 |
var walletHistory = walletHistory || {};
|
|
|
14 |
walletHistory.startTime="";
|
|
|
15 |
walletHistory.endTime="";
|
|
|
16 |
|
| 21627 |
kshitij.so |
17 |
$(function() {
|
|
|
18 |
$(".new_grn").live('click', function() {
|
|
|
19 |
loadNewGrn("main-content");
|
|
|
20 |
});
|
| 21987 |
kshitij.so |
21 |
|
| 22982 |
ashik.ali |
22 |
$("#retailerDocumentForm").submit(function(event) {
|
|
|
23 |
event.preventDefault();
|
|
|
24 |
var emailIdOrMobileNumber = $('#retailer-details-search-text').val();
|
|
|
25 |
var file = $("#retailerDocument").val();
|
|
|
26 |
uploadRetailerDocument("retailer-details-container", file, emailIdOrMobileNumber);
|
|
|
27 |
});
|
|
|
28 |
|
|
|
29 |
|
| 21987 |
kshitij.so |
30 |
$(".good_inventory").live('click', function() {
|
|
|
31 |
loadGoodInventory("main-content","");
|
|
|
32 |
});
|
|
|
33 |
|
|
|
34 |
$(".catalog").live('click', function() {
|
|
|
35 |
loadCatalog("main-content","");
|
|
|
36 |
});
|
|
|
37 |
|
| 22523 |
ashik.ali |
38 |
$(".item_aging").live('click', function() {
|
|
|
39 |
getInventoryItemAgingByInterval("main-content", "");
|
|
|
40 |
});
|
|
|
41 |
|
|
|
42 |
$("#item-aging-paginated .next").live('click', function() {
|
|
|
43 |
var end = $( "#item-aging-paginated .end" ).text();
|
|
|
44 |
getItemAgingNextPreviousItems(end, "");
|
|
|
45 |
$("#item-aging-paginated .next").blur();
|
|
|
46 |
});
|
|
|
47 |
|
|
|
48 |
$("#item-aging-search-button").live('click', function() {
|
|
|
49 |
searchContent = $("#item-aging-search-text").val();
|
|
|
50 |
if (typeof (searchContent) == "undefined" || !searchContent){
|
|
|
51 |
searchContent = "";
|
|
|
52 |
}
|
|
|
53 |
getInventoryItemAgingByInterval("main-content", searchContent);
|
|
|
54 |
});
|
|
|
55 |
|
| 22982 |
ashik.ali |
56 |
$("#retailer-details-search-button").live('click', function() {
|
|
|
57 |
searchContent = $("#retailer-details-search-text").val();
|
|
|
58 |
if (typeof (searchContent) == "undefined" || !searchContent){
|
|
|
59 |
searchContent = "";
|
|
|
60 |
}
|
|
|
61 |
getRetailerDetailsByEmailIdOrMobileNumber("retailer-details-container", searchContent);
|
|
|
62 |
});
|
|
|
63 |
|
| 22523 |
ashik.ali |
64 |
$("#item-aging-search-text").live("keyup", function(e) {
|
|
|
65 |
var keyCode = e.keyCode || e.which;
|
|
|
66 |
if(keyCode == 13){
|
|
|
67 |
$("#item-aging-search-button").click();
|
|
|
68 |
}
|
|
|
69 |
});
|
|
|
70 |
|
|
|
71 |
$("#item-aging-paginated .previous").live('click', function() {
|
|
|
72 |
var start = $( "#item-aging-paginated .start" ).text();
|
|
|
73 |
getItemAgingNextPreviousItems(start - 11, "");
|
|
|
74 |
$("#item-aging-paginated .previous").blur();
|
|
|
75 |
});
|
|
|
76 |
|
| 22488 |
ashik.ali |
77 |
$(".download_aging_report").live('click', function() {
|
|
|
78 |
downloadAgingReport();
|
|
|
79 |
});
|
|
|
80 |
|
| 23026 |
ashik.ali |
81 |
$(".item-ledger-report-download-page").live('click', function() {
|
|
|
82 |
loadItemLedgerReportDownloadPage("main-content");
|
| 22523 |
ashik.ali |
83 |
});
|
|
|
84 |
|
| 23026 |
ashik.ali |
85 |
/*$(".item-ledger-report-download").live('click', function() {
|
|
|
86 |
var startEndDateTime = $('input[name="startEndDateTime"]').val().split("-");
|
|
|
87 |
var startDateTime = $.trim(startEndDateTime[0]);
|
|
|
88 |
var endDateTime = $.trim(startEndDateTime[1]);
|
|
|
89 |
downloadItemLedgerReport(startDateTime, endDateTime);
|
|
|
90 |
});*/
|
|
|
91 |
|
| 21987 |
kshitij.so |
92 |
$(".bad_inventory").live('click', function() {
|
|
|
93 |
loadBadInventory("main-content","");
|
|
|
94 |
});
|
| 21627 |
kshitij.so |
95 |
|
| 21987 |
kshitij.so |
96 |
$(".grn_history").live('click', function() {
|
|
|
97 |
loadGrnHistory("main-content","","","0","0");
|
|
|
98 |
});
|
|
|
99 |
|
| 23076 |
ashik.ali |
100 |
$(".pending_grn").live('click', function() {
|
|
|
101 |
loadPendingGrn("main-content", "", "", "0", "0");
|
|
|
102 |
});
|
|
|
103 |
|
| 21987 |
kshitij.so |
104 |
$(".cart_icon_header").live('click', function() {
|
|
|
105 |
loadCart("main-content");
|
|
|
106 |
});
|
|
|
107 |
|
| 22551 |
ashik.ali |
108 |
$(".wallet_icon_header").live('click', function() {
|
|
|
109 |
loadWallet("main-content", "", "");
|
|
|
110 |
});
|
|
|
111 |
|
| 21987 |
kshitij.so |
112 |
$(".cart-checkout").live('click', function() {
|
|
|
113 |
checkout("main-content");
|
|
|
114 |
});
|
|
|
115 |
|
| 22245 |
ashik.ali |
116 |
$(".create-order").live('click', function() {
|
|
|
117 |
checkout("main-content");
|
|
|
118 |
});
|
|
|
119 |
|
|
|
120 |
$(".sale-history").live('click', function() {
|
| 22292 |
ashik.ali |
121 |
console.log("Sale History Button Clicked...")
|
| 22245 |
ashik.ali |
122 |
saleHistory("main-content","","","0","0");
|
|
|
123 |
});
|
|
|
124 |
|
| 22860 |
ashik.ali |
125 |
$(".schemes").live('click', function() {
|
|
|
126 |
console.log("Active Schemes Button Clicked...")
|
|
|
127 |
schemes("main-content");
|
|
|
128 |
});
|
| 22354 |
ashik.ali |
129 |
|
| 23026 |
ashik.ali |
130 |
$(".schemes-download-page").live('click', function() {
|
|
|
131 |
console.log("Schemes Download Clicked...")
|
|
|
132 |
loadSchemesDownloadPage("main-content");
|
|
|
133 |
});
|
| 22860 |
ashik.ali |
134 |
|
| 23026 |
ashik.ali |
135 |
|
| 22354 |
ashik.ali |
136 |
$(".contact-us").live('click', function() {
|
|
|
137 |
console.log("Contact Us Button Clicked...")
|
|
|
138 |
contactUs("main-content");
|
|
|
139 |
});
|
|
|
140 |
|
| 22860 |
ashik.ali |
141 |
$(".create-scheme").live('click', function() {
|
|
|
142 |
loadScheme("main-content");
|
|
|
143 |
});
|
|
|
144 |
|
| 22982 |
ashik.ali |
145 |
$(".retailer-info").live('click', function() {
|
|
|
146 |
retailerInfo("main-content");
|
|
|
147 |
});
|
|
|
148 |
|
| 23026 |
ashik.ali |
149 |
$('#brands li a').live('click', function(){
|
|
|
150 |
$('#brand-value').text($(this).text());
|
|
|
151 |
loadItemsDescriptionByBrand("items-description-container", $(this).text());
|
|
|
152 |
console.log($(this).text());
|
|
|
153 |
});
|
|
|
154 |
|
| 21627 |
kshitij.so |
155 |
|
| 21640 |
kshitij.so |
156 |
$("td.startGrnSerialized").live('click', function() {
|
| 21627 |
kshitij.so |
157 |
var invoiceNumber = $(this).attr('invoiceNumber');
|
|
|
158 |
var quantity = $(this).attr('quantity');
|
|
|
159 |
var displayName = $(this).attr('displayName');
|
|
|
160 |
var itemId = $(this).attr('itemId');
|
|
|
161 |
console.log(quantity);
|
|
|
162 |
$(".modal-body .grnInvoiceNumber>span").text(invoiceNumber);
|
|
|
163 |
$(".modal-body .grnProductInfo>span").text(displayName);
|
| 21640 |
kshitij.so |
164 |
$("#scanModel .invoiceNumber").val(invoiceNumber);
|
|
|
165 |
$("#scanModel .itemId").val(itemId);
|
| 21627 |
kshitij.so |
166 |
$( "#grnImeiInformation" ).empty();
|
|
|
167 |
var qty = parseInt(quantity);
|
|
|
168 |
var divCode = '<div class="row">CONTENT</div><p></p>';
|
|
|
169 |
var innerDiv = '<div class="col-sm-3">'+
|
|
|
170 |
'<div class="input-group">'+
|
|
|
171 |
'<input type="text" class="form-control">'+
|
|
|
172 |
'</div>'+
|
|
|
173 |
'</div>';
|
|
|
174 |
while(qty!=0){
|
|
|
175 |
var divText = "";
|
|
|
176 |
if (qty < 4){
|
|
|
177 |
var cp = qty;
|
|
|
178 |
for (var i=0;i<cp;i++ ){
|
|
|
179 |
divText = divText + innerDiv;
|
|
|
180 |
qty = qty - 1;
|
|
|
181 |
}
|
|
|
182 |
}
|
|
|
183 |
else{
|
|
|
184 |
for(var i=0;i<4;i++){
|
|
|
185 |
divText = divText + innerDiv;
|
|
|
186 |
qty = qty - 1;
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
divText = divCode.replace("CONTENT",divText);
|
|
|
190 |
$("#grnImeiInformation")
|
|
|
191 |
.append(divText)
|
|
|
192 |
}
|
|
|
193 |
});
|
|
|
194 |
|
| 21640 |
kshitij.so |
195 |
$("td.startGrnNonSerialized").live('click', function() {
|
|
|
196 |
var invoiceNumber = $(this).attr('invoiceNumber');
|
|
|
197 |
var quantity = $(this).attr('quantity');
|
|
|
198 |
var displayName = $(this).attr('displayName');
|
|
|
199 |
var itemId = $(this).attr('itemId');
|
|
|
200 |
console.log(quantity);
|
|
|
201 |
$("#scanNonSerializedModel .modal-body .grnInvoiceNumber>span").text(invoiceNumber);
|
|
|
202 |
$("#scanNonSerializedModel .modal-body .grnProductInfo>span").text(displayName);
|
|
|
203 |
$("#scanNonSerializedModel .invoiceNumber").val(invoiceNumber);
|
|
|
204 |
$("#scanNonSerializedModel .itemId").val(itemId);
|
|
|
205 |
$( "#grnImeiInformation" ).empty();
|
|
|
206 |
var qty = parseInt(quantity);
|
|
|
207 |
var divCode = '<div class="row">CONTENT</div><p></p>';
|
|
|
208 |
var innerDiv = '<div class="col-sm-3">'+
|
|
|
209 |
'<div class="input-group">'+
|
|
|
210 |
'<input type="text" class="form-control">'+
|
|
|
211 |
'</div>'+
|
|
|
212 |
'</div>';
|
|
|
213 |
while(qty!=0){
|
|
|
214 |
var divText = "";
|
|
|
215 |
if (qty < 4){
|
|
|
216 |
var cp = qty;
|
|
|
217 |
for (var i=0;i<cp;i++ ){
|
|
|
218 |
divText = divText + innerDiv;
|
|
|
219 |
qty = qty - 1;
|
|
|
220 |
}
|
|
|
221 |
}
|
|
|
222 |
else{
|
|
|
223 |
for(var i=0;i<4;i++){
|
|
|
224 |
divText = divText + innerDiv;
|
|
|
225 |
qty = qty - 1;
|
|
|
226 |
}
|
|
|
227 |
}
|
|
|
228 |
divText = divCode.replace("CONTENT",divText);
|
|
|
229 |
$("#grnImeiInformation")
|
|
|
230 |
.append(divText)
|
|
|
231 |
}
|
|
|
232 |
});
|
|
|
233 |
|
|
|
234 |
$("#grnSubmitSerialized").live('click', function(){
|
| 21627 |
kshitij.so |
235 |
var imeis = [];
|
|
|
236 |
var error = false;
|
|
|
237 |
var errorText = "";
|
|
|
238 |
$("#grnImeiInformation :input").each(function(){
|
|
|
239 |
var input = $(this).val().trim();
|
|
|
240 |
if (imeis.indexOf(input) !=-1 || !input){
|
|
|
241 |
error = true;
|
|
|
242 |
if (!input){
|
|
|
243 |
$(this).addClass("border-highlight");
|
|
|
244 |
}
|
|
|
245 |
}
|
|
|
246 |
imeis.push(input);
|
| 22415 |
ashik.ali |
247 |
|
| 21627 |
kshitij.so |
248 |
});
|
|
|
249 |
if (error){
|
|
|
250 |
return false;
|
|
|
251 |
}
|
| 21640 |
kshitij.so |
252 |
var invoiceNumber = $("#scanModel .invoiceNumber").val();
|
|
|
253 |
var itemId = $("#scanModel .itemId").val();
|
| 21627 |
kshitij.so |
254 |
var postData = JSON.stringify({"itemId":parseInt(itemId),"invoiceNumber":invoiceNumber,"serialNumbers":imeis});
|
|
|
255 |
jQuery.ajax({
|
| 22092 |
amit.gupta |
256 |
url: context+"/scanSerialized",
|
| 21627 |
kshitij.so |
257 |
type: 'POST',
|
|
|
258 |
data: postData,
|
|
|
259 |
contentType:'application/json',
|
|
|
260 |
async: false,
|
|
|
261 |
success: function (data) {
|
| 21640 |
kshitij.so |
262 |
alert("Purchase booked successfully");
|
|
|
263 |
$('#scanModel').modal('hide');
|
|
|
264 |
$("#scanModel").on("hidden.bs.modal", function () {
|
|
|
265 |
$("#purchase-reference-submit").submit();
|
|
|
266 |
});
|
| 21627 |
kshitij.so |
267 |
},
|
|
|
268 |
cache: false,
|
|
|
269 |
processData: false
|
|
|
270 |
});
|
|
|
271 |
return false;
|
|
|
272 |
});
|
| 21640 |
kshitij.so |
273 |
|
|
|
274 |
$("#grnNonSerializedSubmit").live('click', function(){
|
|
|
275 |
var error = false;
|
|
|
276 |
var errorText = "";
|
|
|
277 |
if (error){
|
|
|
278 |
return false;
|
|
|
279 |
}
|
|
|
280 |
var invoiceNumber = $("#scanNonSerializedModel .invoiceNumber").val();
|
|
|
281 |
var itemId = $("#scanNonSerializedModel .itemId").val();
|
|
|
282 |
var quantity = $("#scanNonSerializedModel .quantity").val();
|
|
|
283 |
var postData = JSON.stringify({"itemId":parseInt(itemId),"invoiceNumber":invoiceNumber,"quantity":parseInt(quantity)});
|
|
|
284 |
jQuery.ajax({
|
| 22092 |
amit.gupta |
285 |
url: context+"/scanNonSerialized",
|
| 21640 |
kshitij.so |
286 |
type: 'POST',
|
|
|
287 |
data: postData,
|
|
|
288 |
contentType:'application/json',
|
|
|
289 |
async: false,
|
|
|
290 |
success: function (data) {
|
|
|
291 |
alert("Purchase booked successfully");
|
|
|
292 |
$('#scanNonSerializedModel').modal('hide');
|
|
|
293 |
$("#scanNonSerializedModel").on("hidden.bs.modal", function () {
|
|
|
294 |
$("#purchase-reference-submit").submit();
|
|
|
295 |
});
|
|
|
296 |
},
|
|
|
297 |
cache: false,
|
|
|
298 |
processData: false
|
|
|
299 |
});
|
|
|
300 |
return false;
|
|
|
301 |
});
|
| 21627 |
kshitij.so |
302 |
|
|
|
303 |
$("#grnImeiInformation :input").live('change paste keyup mouseup', function() {
|
|
|
304 |
if ($(this).val().trim() != "") {
|
|
|
305 |
console.log('The text box really changed this time');
|
|
|
306 |
$('#grnImeiInformation :input').removeClass("border-highlight");
|
|
|
307 |
if(findDuplicateSerialNumbers( $(this).val().trim()) > 0){
|
|
|
308 |
var inputs = $("#grnImeiInformation :input[value="+$(this).val().trim()+"]");
|
|
|
309 |
if(inputs.length > 1){
|
|
|
310 |
inputs.each(function(){$(this).addClass("border-highlight")});
|
|
|
311 |
}
|
|
|
312 |
}
|
|
|
313 |
}
|
|
|
314 |
});
|
| 21987 |
kshitij.so |
315 |
|
| 22415 |
ashik.ali |
316 |
|
|
|
317 |
$("#grnImeiInformation :input").live('paste', function() {
|
|
|
318 |
if ($(this).val().trim() != "") {
|
|
|
319 |
console.log('paste event');
|
|
|
320 |
$(this).next("input .form-control").focus();
|
|
|
321 |
}
|
|
|
322 |
});
|
|
|
323 |
|
| 21987 |
kshitij.so |
324 |
$("#good-inventory-paginated .next").live('click', function() {
|
|
|
325 |
var start = $( "#good-inventory-paginated .start" ).text();
|
|
|
326 |
var end = $( "#good-inventory-paginated .end" ).text();
|
|
|
327 |
var searchText = $("#good-inventory-search-text").val();
|
|
|
328 |
if (typeof (searchText) == "undefined" || !searchText){
|
|
|
329 |
searchText = "";
|
|
|
330 |
}
|
| 22523 |
ashik.ali |
331 |
getNextItems(start,end, searchText);
|
| 21987 |
kshitij.so |
332 |
$("#good-inventory-paginated .next").blur();
|
|
|
333 |
|
|
|
334 |
});
|
|
|
335 |
|
|
|
336 |
$("#good-inventory-paginated .previous").live('click', function() {
|
|
|
337 |
var start = $( "#good-inventory-paginated .start" ).text();
|
|
|
338 |
var end = $( "#good-inventory-paginated .end" ).text();
|
|
|
339 |
var searchText = $("#good-inventory-search-text").val();
|
|
|
340 |
if (typeof (searchText) == "undefined" || !searchText){
|
|
|
341 |
searchText = "";
|
|
|
342 |
}
|
|
|
343 |
var pre = end - 20;
|
| 22523 |
ashik.ali |
344 |
getPreviousItems(start, end, pre, searchText);
|
| 21987 |
kshitij.so |
345 |
$("#good-inventory-paginated .previous").blur();
|
|
|
346 |
});
|
|
|
347 |
|
|
|
348 |
$("#good-inventory-search-button").live('click', function() {
|
|
|
349 |
var searchText = $("#good-inventory-search-text").val();
|
|
|
350 |
if (typeof (searchText) == "undefined" || !searchText){
|
|
|
351 |
searchText = "";
|
|
|
352 |
}
|
|
|
353 |
loadGoodInventorySearchInfo(searchText);
|
|
|
354 |
});
|
|
|
355 |
|
|
|
356 |
$("#good-inventory-search-text").live("keyup", function(e) {
|
|
|
357 |
var keyCode = e.keyCode || e.which;
|
|
|
358 |
if(keyCode == 13){
|
|
|
359 |
$("#good-inventory-search-button").click();
|
|
|
360 |
}
|
|
|
361 |
});
|
|
|
362 |
|
| 23076 |
ashik.ali |
363 |
$("#airwayBillOrInvoiceNumberText").live("keyup", function(e) {
|
|
|
364 |
var keyCode = e.keyCode || e.which;
|
|
|
365 |
if(keyCode == 13){
|
|
|
366 |
$("#purchase-reference-submit-button").click();
|
|
|
367 |
}
|
|
|
368 |
});
|
|
|
369 |
|
| 21987 |
kshitij.so |
370 |
$("#catalog-paginated .next").live('click', function() {
|
|
|
371 |
var start = $( "#catalog-paginated .start" ).text();
|
|
|
372 |
var end = $( "#catalog-paginated .end" ).text();
|
|
|
373 |
var searchText = $("#catalog-search-text").val();
|
|
|
374 |
if (typeof (searchText) == "undefined" || !searchText){
|
|
|
375 |
searchText = "";
|
|
|
376 |
}
|
|
|
377 |
getNextCatalogItems(start,end,searchText);
|
|
|
378 |
$("#catalog-paginated .next").blur();
|
|
|
379 |
});
|
|
|
380 |
|
|
|
381 |
$("#catalog-paginated .previous").live('click', function() {
|
|
|
382 |
var start = $( "#catalog-paginated .start" ).text();
|
|
|
383 |
var end = $( "#catalog-paginated .end" ).text();
|
|
|
384 |
var searchText = $("#catalog-search-text").val();
|
|
|
385 |
if (typeof (searchText) == "undefined" || !searchText){
|
|
|
386 |
searchText = "";
|
|
|
387 |
}
|
|
|
388 |
var pre = end - 20;
|
|
|
389 |
getPreviousCatalogItems(start,end,pre,searchText);
|
|
|
390 |
$("#catalog-paginated .previous").blur();
|
|
|
391 |
});
|
|
|
392 |
|
|
|
393 |
$("#catalog-search-button").live('click', function() {
|
|
|
394 |
var searchText = $("#catalog-search-text").val();
|
|
|
395 |
if (typeof (searchText) == "undefined" || !searchText){
|
|
|
396 |
searchText = "";
|
|
|
397 |
}
|
|
|
398 |
loadCatalogSearchInfo(searchText);
|
|
|
399 |
});
|
|
|
400 |
|
|
|
401 |
$("#catalog-search-text").live("keyup", function(e) {
|
|
|
402 |
var keyCode = e.keyCode || e.which;
|
|
|
403 |
if(keyCode == 13){
|
|
|
404 |
$("#catalog-search-button").click();
|
|
|
405 |
}
|
|
|
406 |
});
|
|
|
407 |
|
|
|
408 |
$("#grn-history-search-button").live('click', function() {
|
|
|
409 |
grnhistory.searchText = $("#grn-history-search-text").val();
|
|
|
410 |
grnhistory.searchType = "purchaseReference";
|
|
|
411 |
grnhistory.startTime = "0";
|
|
|
412 |
grnhistory.endTime = "0";
|
|
|
413 |
if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText){
|
|
|
414 |
grnhistory.searchText = "";
|
|
|
415 |
}
|
|
|
416 |
loadGrnHistorySearchInfo(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
|
|
|
417 |
});
|
|
|
418 |
|
|
|
419 |
$("#grn-history-search-text").live("keyup", function(e) {
|
|
|
420 |
var keyCode = e.keyCode || e.which;
|
|
|
421 |
if(keyCode == 13){
|
|
|
422 |
$("#grn-history-search-button").click();
|
|
|
423 |
}
|
|
|
424 |
});
|
|
|
425 |
|
| 22982 |
ashik.ali |
426 |
$("#retailer-details-search-text").live("keyup", function(e) {
|
|
|
427 |
var keyCode = e.keyCode || e.which;
|
|
|
428 |
if(keyCode == 13){
|
|
|
429 |
$("#retailer-details-search-button").click();
|
|
|
430 |
}
|
|
|
431 |
});
|
| 22283 |
ashik.ali |
432 |
|
| 22982 |
ashik.ali |
433 |
|
| 22283 |
ashik.ali |
434 |
$("#sale-history-search-button").live('click', function() {
|
|
|
435 |
saleHistory.searchText = $("#sale-history-search-text").val();
|
|
|
436 |
saleHistory.searchType = "invoiceNumber";
|
|
|
437 |
saleHistory.startTime = "0";
|
|
|
438 |
saleHistory.endTime = "0";
|
|
|
439 |
if (typeof (saleHistory.searchText) == "undefined" || !saleHistory.searchText){
|
|
|
440 |
saleHistory.searchText = "";
|
|
|
441 |
}
|
|
|
442 |
saleHistorySearchInfo(saleHistory.searchText, saleHistory.searchType, saleHistory.startTime, saleHistory.endTime);
|
|
|
443 |
});
|
|
|
444 |
|
|
|
445 |
$("#sale-history-search-text").live("keyup", function(e) {
|
|
|
446 |
var keyCode = e.keyCode || e.which;
|
|
|
447 |
if(keyCode == 13){
|
|
|
448 |
$("#sale-history-search-button").click();
|
|
|
449 |
}
|
|
|
450 |
});
|
|
|
451 |
|
| 21987 |
kshitij.so |
452 |
$("#grn-history-paginated .next").live('click', function() {
|
|
|
453 |
var start = $( "#grn-history-paginated .start" ).text();
|
|
|
454 |
var end = $( "#grn-history-paginated .end" ).text();
|
|
|
455 |
getGrnHistoryNextItems(start,end,grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
|
|
|
456 |
$("#grn-history-paginated .next").blur();
|
|
|
457 |
|
|
|
458 |
});
|
|
|
459 |
|
|
|
460 |
$("#grn-history-paginated .previous").live('click', function() {
|
|
|
461 |
var start = $( "#grn-history-paginated .start" ).text();
|
|
|
462 |
var end = $( "#grn-history-paginated .end" ).text();
|
|
|
463 |
var pre = end - 20;
|
|
|
464 |
getGrnHistoryPreviousItems(start,end,pre,grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
|
|
|
465 |
$("#grn-history-paginated .previous").blur();
|
|
|
466 |
});
|
|
|
467 |
|
|
|
468 |
$("#grn-history-date-button").live('click', function() {
|
|
|
469 |
var dateRange = $('#reportrange span').text();
|
|
|
470 |
grnhistory.startTime = new Date(dateRange.split("-")[0]).getTime();
|
|
|
471 |
grnhistory.endTime = new Date(dateRange.split("-")[1]).getTime();
|
|
|
472 |
grnhistory.searchType = "dateFilter";
|
|
|
473 |
grnhistory.searchText = "";
|
|
|
474 |
loadGrnHistorySearchInfo(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
|
|
|
475 |
});
|
|
|
476 |
|
| 22292 |
ashik.ali |
477 |
|
|
|
478 |
$("#sale-history-paginated .next").live('click', function() {
|
|
|
479 |
var start = $( "#sale-history-paginated .start" ).text();
|
|
|
480 |
var end = $( "#sale-history-paginated .end" ).text();
|
|
|
481 |
getSaleHistoryNextItems(start, end, saleHistory.searchText, saleHistory.searchType, saleHistory.startTime, saleHistory.endTime);
|
|
|
482 |
$("#sale-history-paginated .next").blur();
|
|
|
483 |
});
|
|
|
484 |
|
|
|
485 |
$("#sale-history-paginated .previous").live('click', function() {
|
|
|
486 |
var start = $( "#sale-history-paginated .start" ).text();
|
|
|
487 |
var end = $( "#sale-history-paginated .end" ).text();
|
|
|
488 |
var pre = end - 20;
|
|
|
489 |
getSaleHistoryPreviousItems(start, end, pre, saleHistory.searchText, saleHistory.searchType, saleHistory.startTime, saleHistory.endTime);
|
|
|
490 |
$("#sale-history-paginated .previous").blur();
|
|
|
491 |
});
|
|
|
492 |
|
| 22860 |
ashik.ali |
493 |
$("#schemes-paginated .next").live('click', function() {
|
|
|
494 |
var start = $( "#schemes-paginated .start" ).text();
|
|
|
495 |
var end = $( "#schemes-paginated .end" ).text();
|
|
|
496 |
getSchemesNextItems(start, end);
|
|
|
497 |
$("#schemes-paginated .next").blur();
|
|
|
498 |
});
|
|
|
499 |
|
|
|
500 |
$("#schemes-paginated .previous").live('click', function() {
|
|
|
501 |
var start = $( "#schemes-paginated .start" ).text();
|
|
|
502 |
var end = $( "#schemes-paginated .end" ).text();
|
|
|
503 |
var pre = end - 20;
|
|
|
504 |
getSchemesPreviousItems(start, end, pre);
|
|
|
505 |
$("#schemes-paginated .previous").blur();
|
|
|
506 |
});
|
|
|
507 |
|
| 22551 |
ashik.ali |
508 |
$("#wallet-history-paginated .next").live('click', function() {
|
|
|
509 |
var start = $( "#wallet-history-paginated .start" ).text();
|
|
|
510 |
var end = $( "#wallet-history-paginated .end" ).text();
|
|
|
511 |
getWalletHistoryNextItems(start, end, walletHistory.startTime, walletHistory.endTime);
|
|
|
512 |
$("#wallet-history-paginated .next").blur();
|
|
|
513 |
});
|
|
|
514 |
|
|
|
515 |
$("#wallet-history-paginated .previous").live('click', function() {
|
|
|
516 |
var start = $( "#wallet-history-paginated .start" ).text();
|
|
|
517 |
var end = $( "#wallet-history-paginated .end" ).text();
|
|
|
518 |
var pre = end - 20;
|
|
|
519 |
getWalletHistoryPreviousItems(start, end, pre, walletHistory.startTime, walletHistory.endTime);
|
|
|
520 |
$("#wallet-history-paginated .previous").blur();
|
|
|
521 |
});
|
|
|
522 |
|
| 22292 |
ashik.ali |
523 |
$("#sale-history-date-button").live('click', function() {
|
|
|
524 |
var dateRange = $('#reportrange span').text();
|
|
|
525 |
saleHistory.startTime = new Date(dateRange.split("-")[0]).getTime();
|
|
|
526 |
saleHistory.endTime = new Date(dateRange.split("-")[1]).getTime();
|
|
|
527 |
saleHistory.searchType = "dateFilter";
|
|
|
528 |
saleHistory.searchText = "";
|
|
|
529 |
saleHistorySearchInfo(saleHistory.searchText, saleHistory.searchType, saleHistory.startTime, saleHistory.endTime);
|
|
|
530 |
});
|
|
|
531 |
|
| 22551 |
ashik.ali |
532 |
$("#wallet-history-date-button").live('click', function() {
|
|
|
533 |
var dateRange = $('#reportrange span').text();
|
|
|
534 |
walletHistory.startTime = new Date(dateRange.split("-")[0]).getTime();
|
|
|
535 |
walletHistory.endTime = new Date(dateRange.split("-")[1]).getTime();
|
|
|
536 |
saleHistorySearchInfo(saleHistory.searchText, saleHistory.searchType, saleHistory.startTime, saleHistory.endTime);
|
|
|
537 |
});
|
|
|
538 |
|
| 21987 |
kshitij.so |
539 |
//grn-details
|
|
|
540 |
|
|
|
541 |
$(".grn-details").live('click',function(){
|
|
|
542 |
var purchaseId = $(this).attr('data');
|
|
|
543 |
console.log(purchaseId);
|
|
|
544 |
loadGrnDetails(purchaseId,"grn-details-container");
|
|
|
545 |
});
|
|
|
546 |
|
| 23076 |
ashik.ali |
547 |
$(".pending-grn-details").live('click',function(){
|
|
|
548 |
console.log("pending-grn-details clicked");
|
|
|
549 |
var orderId = $(this).attr('data');
|
|
|
550 |
console.log("orderId : "+orderId);
|
|
|
551 |
loadPendingGrnDetails(orderId, "pending-grn-details-container");
|
|
|
552 |
});
|
|
|
553 |
|
| 22245 |
ashik.ali |
554 |
$(".sale-details").live('click',function(){
|
|
|
555 |
var orderId = $(this).attr('data');
|
| 22860 |
ashik.ali |
556 |
console.log("orderId = "+orderId);
|
| 22245 |
ashik.ali |
557 |
loadSaleDetails(orderId,"sale-details-container");
|
|
|
558 |
});
|
|
|
559 |
|
| 22860 |
ashik.ali |
560 |
$(".scheme-details").live('click',function(){
|
|
|
561 |
var schemeId = $(this).attr('data');
|
|
|
562 |
console.log("schemeId = "+schemeId);
|
|
|
563 |
loadSchemeDetails(schemeId, "scheme-details-container");
|
|
|
564 |
});
|
|
|
565 |
|
| 21987 |
kshitij.so |
566 |
$(".pending-grn").live('click',function(){
|
|
|
567 |
var purchaseReference = $(this).attr('data');
|
|
|
568 |
console.log(purchaseReference);
|
|
|
569 |
loadPendingGrnDetails(purchaseReference,"main-content");
|
|
|
570 |
});
|
|
|
571 |
|
| 22860 |
ashik.ali |
572 |
$(".active-scheme").live('click',function(){
|
|
|
573 |
var schemeId = $(this).attr('data');
|
|
|
574 |
console.log("active-scheme id : "+schemeId);
|
|
|
575 |
var start = $( "#schemes-paginated .start" ).text();
|
|
|
576 |
//var end = $( "#schemes-paginated .end" ).text();
|
|
|
577 |
var offset = start - 1;
|
|
|
578 |
if(confirm("Are you sure you want to Active Scheme!") == true){
|
|
|
579 |
activeScheme(schemeId, offset, "schemes-table");
|
|
|
580 |
}
|
|
|
581 |
});
|
|
|
582 |
|
|
|
583 |
$(".expire-scheme").live('click',function(){
|
|
|
584 |
var schemeId = $(this).attr('data');
|
|
|
585 |
console.log("expire-scheme id : "+schemeId);
|
|
|
586 |
var start = $( "#schemes-paginated .start" ).text();
|
|
|
587 |
//var end = $( "#schemes-paginated .end" ).text();
|
|
|
588 |
var offset = start - 1;
|
|
|
589 |
if(confirm("Are you sure you want to Expire Scheme!") == true){
|
|
|
590 |
expireScheme(schemeId, offset, "schemes-table");
|
|
|
591 |
}
|
|
|
592 |
});
|
|
|
593 |
|
| 21987 |
kshitij.so |
594 |
//add-to-bag
|
|
|
595 |
|
|
|
596 |
$(".add-to-bag").live('click', function() {
|
|
|
597 |
var itemId = $(this).attr('data');
|
|
|
598 |
$("#bagModel .itemId").val(itemId);
|
|
|
599 |
$("#bagModel .quantity").val(0);
|
|
|
600 |
jQuery.ajax({
|
| 22092 |
amit.gupta |
601 |
url: context+"/checkItemAvailability/?itemId="+itemId,
|
| 21987 |
kshitij.so |
602 |
type: 'GET',
|
|
|
603 |
contentType:'application/json',
|
|
|
604 |
async: false,
|
|
|
605 |
success: function (data) {
|
|
|
606 |
var obj = JSON.parse(data);
|
|
|
607 |
console.log(obj);
|
|
|
608 |
console.log(obj.displayName);
|
|
|
609 |
$(".modal-body h4.bagModalProductInfo.modelHeaderCustom > span").text(obj.displayName);
|
|
|
610 |
$(".modal-body h4.bagModalAvailability.modelHeaderCustom > span").text(obj.availability);
|
|
|
611 |
$("#bagModel .availability").val(obj.availability);
|
|
|
612 |
},
|
|
|
613 |
cache: false,
|
|
|
614 |
processData: false
|
|
|
615 |
});
|
|
|
616 |
});
|
|
|
617 |
|
|
|
618 |
//addToBagButton
|
|
|
619 |
|
|
|
620 |
$("#addToBagButton").live('click', function() {
|
|
|
621 |
var itemId = $(this).attr('data');
|
|
|
622 |
var itemId = $("#bagModel .itemId").val();
|
|
|
623 |
var tempAvailability = $("#bagModel .availability").val();
|
|
|
624 |
var quantity = $("#bagModel .quantity").val();
|
|
|
625 |
|
|
|
626 |
if (!quantity || parseInt(quantity) <= 0 || isNaN(parseInt(quantity)) || quantity.indexOf('.') != -1){
|
|
|
627 |
alert("Please enter valid quantity");
|
|
|
628 |
return;
|
|
|
629 |
}
|
|
|
630 |
|
|
|
631 |
jQuery.ajax({
|
| 22092 |
amit.gupta |
632 |
url: context+"/checkItemAvailability/?itemId="+itemId,
|
| 21987 |
kshitij.so |
633 |
type: 'GET',
|
|
|
634 |
contentType:'application/json',
|
|
|
635 |
async: false,
|
|
|
636 |
success: function (data) {
|
|
|
637 |
var obj = JSON.parse(data);
|
|
|
638 |
console.log(obj);
|
|
|
639 |
if (obj.availability < parseInt(quantity) || obj.availability == 0){
|
|
|
640 |
alert("You don't have enough inventory of this item");
|
|
|
641 |
return;
|
|
|
642 |
}
|
|
|
643 |
var obj = {'itemId':obj.itemId,'displayName':obj.displayName,'quantity':parseInt(quantity),'iconUrl':obj.iconUrl};
|
|
|
644 |
console.log(obj);
|
|
|
645 |
addItemInLocalStorage(obj);
|
|
|
646 |
alert("Item added to bag successfully");
|
|
|
647 |
$('#bagModel').modal('hide');
|
|
|
648 |
},
|
|
|
649 |
cache: false,
|
|
|
650 |
processData: false
|
|
|
651 |
});
|
|
|
652 |
});
|
|
|
653 |
|
|
|
654 |
$(".cart-trash").live('click',function(){
|
|
|
655 |
var itemId = $(this).attr('data');
|
|
|
656 |
removeItemFromLocalStorage(itemId);
|
|
|
657 |
$('div[itemId="' + itemId + '"]').remove();
|
|
|
658 |
if ($('#cart-details').html().trim() == ""){
|
|
|
659 |
$('#cart-details-empty').show();
|
|
|
660 |
$('#cart-checkout').hide();
|
|
|
661 |
}
|
|
|
662 |
});
|
|
|
663 |
|
|
|
664 |
$(".cart-qty").live('change paste keyup mouseup', function() {
|
|
|
665 |
var itemId = $(this).attr('data');
|
|
|
666 |
var maxQty = $(this).attr('max');
|
|
|
667 |
var qty = $(this).val();
|
|
|
668 |
if (!qty){
|
|
|
669 |
qty = 0;
|
|
|
670 |
}
|
|
|
671 |
if(parseInt(qty) < 0){
|
|
|
672 |
alert("Invalid quantity");
|
|
|
673 |
$(this).val(0);
|
|
|
674 |
qty = 0;
|
|
|
675 |
}
|
|
|
676 |
if (parseInt(qty) > parseInt(maxQty)){
|
|
|
677 |
alert("You don't have availability of "+qty);
|
|
|
678 |
$(this).val(maxQty);
|
|
|
679 |
qty = maxQty;
|
|
|
680 |
}
|
|
|
681 |
changeQuantityInLocalStorage(itemId, qty);
|
|
|
682 |
});
|
|
|
683 |
|
| 22661 |
amit.gupta |
684 |
$("form#cd input.discountAmount").live('change paste keyup mouseup', function() {
|
|
|
685 |
var discountAmount = parseFloat($(this).val());
|
|
|
686 |
if (isNaN(discountAmount)){
|
|
|
687 |
discountAmount = 0;
|
|
|
688 |
}
|
|
|
689 |
if(discountAmount < 0){
|
|
|
690 |
alert("Invalid insurance Value");
|
|
|
691 |
$(this).val(0);
|
|
|
692 |
}
|
| 22662 |
amit.gupta |
693 |
calculateTotalAmount();
|
| 22661 |
amit.gupta |
694 |
});
|
|
|
695 |
|
| 21987 |
kshitij.so |
696 |
$("form#cd input.unitPrice").live('change paste keyup mouseup', function() {
|
| 22245 |
ashik.ali |
697 |
|
| 22661 |
amit.gupta |
698 |
var unitPrice = parseFloat($(this).val());
|
|
|
699 |
if (isNaN(unitPrice)){
|
| 21987 |
kshitij.so |
700 |
unitPrice = 0;
|
|
|
701 |
}
|
| 22661 |
amit.gupta |
702 |
if(unitPrice < 0){
|
| 21987 |
kshitij.so |
703 |
alert("Invalid unit price");
|
|
|
704 |
$(this).val(0);
|
|
|
705 |
}
|
| 22661 |
amit.gupta |
706 |
calculateTotalAmount();
|
| 21987 |
kshitij.so |
707 |
});
|
| 22245 |
ashik.ali |
708 |
|
|
|
709 |
|
|
|
710 |
$("form#cd input.insuranceAmount").live('change paste keyup mouseup', function() {
|
| 22661 |
amit.gupta |
711 |
calculateTotalAmount();
|
|
|
712 |
});
|
|
|
713 |
|
|
|
714 |
});
|
|
|
715 |
|
|
|
716 |
function calculateTotalAmount() {
|
|
|
717 |
var netPayableAmount = 0;
|
|
|
718 |
$("#cd").find('tr:gt(0)').each(function(index, el){
|
|
|
719 |
var rowTotal = 0;
|
|
|
720 |
$tr = $(el);
|
|
|
721 |
|
|
|
722 |
var insuranceAmount = $tr.find('.insuranceAmount').val();
|
| 22245 |
ashik.ali |
723 |
if (!insuranceAmount){
|
|
|
724 |
insuranceAmount = 0;
|
|
|
725 |
}else{
|
|
|
726 |
insuranceAmount = parseFloat(insuranceAmount);
|
|
|
727 |
}
|
|
|
728 |
|
| 22661 |
amit.gupta |
729 |
var qty = parseFloat($(el).find('.unitPrice').attr('quantity'));
|
|
|
730 |
var unitPrice = parseFloat($(el).find('.unitPrice').val());
|
| 22245 |
ashik.ali |
731 |
|
| 22661 |
amit.gupta |
732 |
var discountAmount = parseFloat($(el).find('.discountAmount').val());
|
|
|
733 |
if(isNaN(discountAmount)){
|
|
|
734 |
discountAmount = 0;
|
|
|
735 |
}
|
|
|
736 |
|
|
|
737 |
rowTotal = unitPrice*qty + insuranceAmount - discountAmount;
|
|
|
738 |
$tr.find('.totalPrice').val(rowTotal);
|
|
|
739 |
netPayableAmount += rowTotal;
|
| 22245 |
ashik.ali |
740 |
});
|
| 22661 |
amit.gupta |
741 |
$('#cd').find('input.netPayableAmount').val(netPayableAmount);
|
| 22982 |
ashik.ali |
742 |
}
|
|
|
743 |
|
|
|
744 |
function updateRetailerDocument(){
|
|
|
745 |
//$("#updateRetailerShopDocument0").click( function() {
|
|
|
746 |
console.log("Update Retailer Document Clicked");
|
|
|
747 |
//console.log(ownerId);
|
|
|
748 |
var emailIdOrMobileNumber = $('#retailer-details-search-text').val();
|
|
|
749 |
console.log("emailIdOrMobileNumber: "+ emailIdOrMobileNumber);
|
|
|
750 |
var file = $('#retailerDocument')[0].files[0];
|
|
|
751 |
console.log("file : "+file.name);
|
|
|
752 |
uploadRetailerDocument("retailer-details-container", file, emailIdOrMobileNumber);
|
|
|
753 |
}
|
|
|
754 |
|
|
|
755 |
function updateRetailerShopDocument(ownerId){
|
|
|
756 |
//$("#updateRetailerShopDocument0").click( function() {
|
|
|
757 |
console.log("Update Retailer Shop Document Clicked");
|
|
|
758 |
console.log(ownerId);
|
|
|
759 |
var shopSize = parseInt($("#shopDetailsSize").attr('size'));
|
|
|
760 |
console.log("size : "+shopSize);
|
|
|
761 |
for(var index = 0; index < shopSize; index++){
|
|
|
762 |
if("updateRetailerShopDocument"+index == ownerId){
|
|
|
763 |
var emailIdOrMobileNumber = $('#retailer-details-search-text').val();
|
|
|
764 |
console.log("emailIdOrMobileNumber: "+ emailIdOrMobileNumber);
|
|
|
765 |
var shopId = $('#retailerShopDocument'+index).attr("shopId");
|
|
|
766 |
console.log("shopId : "+shopId);
|
|
|
767 |
var file = $('#retailerShopDocument'+index)[0].files[0];
|
|
|
768 |
console.log("file : "+file.name);
|
|
|
769 |
uploadRetailerShopDocument("retailer-details-container", file, emailIdOrMobileNumber, shopId);
|
|
|
770 |
}
|
|
|
771 |
}
|
| 23026 |
ashik.ali |
772 |
}
|
|
|
773 |
|
|
|
774 |
function updateDetails(){
|
|
|
775 |
|
| 22661 |
amit.gupta |
776 |
}
|