Subversion Repositories SmartDukaan

Rev

Rev 22073 | Rev 22091 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22073 Rev 22090
Line 26... Line 26...
26
  }
26
  }
27
 
27
 
28
function submitUser(googleUser){
28
function submitUser(googleUser){
29
	jQuery.ajax({
29
	jQuery.ajax({
30
        type : "POST",
30
        type : "POST",
31
        url : context+"login",
31
        url : context+"/login",
32
        data: {"token":googleUser.getAuthResponse().id_token},
32
        data: {"token":googleUser.getAuthResponse().id_token},
33
        success: function(data, textStatus, request){
33
        success: function(data, textStatus, request){
34
        	console.log(data);
34
        	console.log(data);
35
        	addProfileInLocalDb();
35
        	addProfileInLocalDb();
36
        	window.location.href= context + "dashboard";
36
        	window.location.href= context + "dashboard";
Line 75... Line 75...
75
}
75
}
76
 
76
 
77
function loadBadInventory(domId, search_text){
77
function loadBadInventory(domId, search_text){
78
	jQuery.ajax({
78
	jQuery.ajax({
79
        type : "GET",
79
        type : "GET",
80
        url : context+"getBadInventorySnapshot/?searchTerm="+search_text,
80
        url : context+"/getBadInventorySnapshot/?searchTerm="+search_text,
81
        success : function(response) {
81
        success : function(response) {
82
            $('#' + domId).html(response);
82
            $('#' + domId).html(response);
83
        }
83
        }
84
    });  
84
    });  
85
}
85
}
86
 
86
 
87
function loadGrnHistory(domId,purchase_reference,searchType, startTime, endTime){
87
function loadGrnHistory(domId,purchase_reference,searchType, startTime, endTime){
88
	jQuery.ajax({
88
	jQuery.ajax({
89
        type : "GET",
89
        type : "GET",
90
        url : context+"grnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
90
        url : context+"/grnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
91
        +"&startTime="+startTime
91
        +"&startTime="+startTime
92
        +"&endTime="+endTime,
92
        +"&endTime="+endTime,
93
        success : function(response) {
93
        success : function(response) {
94
            $('#' + domId).html(response);
94
            $('#' + domId).html(response);
95
        }
95
        }
Line 101... Line 101...
101
	console.log(end);
101
	console.log(end);
102
	console.log(+end + +10);
102
	console.log(+end + +10);
103
	console.log(+start + +10);
103
	console.log(+start + +10);
104
	jQuery.ajax({
104
	jQuery.ajax({
105
	        type : "GET",
105
	        type : "GET",
106
	        url : context+"getPaginatedCurrentInventorySnapshot/?offset="+end+"&searchTerm="+searchText,
106
	        url : context+"/getPaginatedCurrentInventorySnapshot/?offset="+end+"&searchTerm="+searchText,
107
			beforeSend: function(){
107
			beforeSend: function(){
108
	        //$('#ajax-spinner').show();
108
	        //$('#ajax-spinner').show();
109
	        },
109
	        },
110
	        complete: function(){
110
	        complete: function(){
111
	        //$('#ajax-spinner').hide();
111
	        //$('#ajax-spinner').hide();
Line 128... Line 128...
128
	    });  
128
	    });  
129
	}
129
	}
130
function getPreviousItems(start,end,pre,searchText){
130
function getPreviousItems(start,end,pre,searchText){
131
	jQuery.ajax({
131
	jQuery.ajax({
132
	        type : "GET",
132
	        type : "GET",
133
	        url : context+"getPaginatedCurrentInventorySnapshot/?offset="+pre+"&searchTerm="+searchText,
133
	        url : context+"/getPaginatedCurrentInventorySnapshot/?offset="+pre+"&searchTerm="+searchText,
134
			beforeSend: function(){
134
			beforeSend: function(){
135
	        //$('#ajax-spinner').show();
135
	        //$('#ajax-spinner').show();
136
	        },
136
	        },
137
	        complete: function(){
137
	        complete: function(){
138
	        //$('#ajax-spinner').hide();
138
	        //$('#ajax-spinner').hide();
Line 159... Line 159...
159
	console.log(end);
159
	console.log(end);
160
	console.log(+end + +10);
160
	console.log(+end + +10);
161
	console.log(+start + +10);
161
	console.log(+start + +10);
162
	jQuery.ajax({
162
	jQuery.ajax({
163
	        type : "GET",
163
	        type : "GET",
164
	        url : context+"getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
164
	        url : context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
165
	        +"&startTime="+startTime
165
	        +"&startTime="+startTime
166
	        +"&endTime="+endTime+"&offset="+end,
166
	        +"&endTime="+endTime+"&offset="+end,
167
			beforeSend: function(){
167
			beforeSend: function(){
168
	        //$('#ajax-spinner').show();
168
	        //$('#ajax-spinner').show();
169
	        },
169
	        },
Line 188... Line 188...
188
	    });  
188
	    });  
189
	}
189
	}
190
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
190
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
191
	jQuery.ajax({
191
	jQuery.ajax({
192
	        type : "GET",
192
	        type : "GET",
193
	        url : context+"getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
193
	        url : context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
194
	        +"&startTime="+startTime
194
	        +"&startTime="+startTime
195
	        +"&endTime="+endTime+"&offset="+pre,
195
	        +"&endTime="+endTime+"&offset="+pre,
196
			beforeSend: function(){
196
			beforeSend: function(){
197
	        //$('#ajax-spinner').show();
197
	        //$('#ajax-spinner').show();
198
	        },
198
	        },
Line 230... Line 230...
230
}
230
}
231
 
231
 
232
function loadGrnDetails(purchaseId,domId){
232
function loadGrnDetails(purchaseId,domId){
233
	jQuery.ajax({
233
	jQuery.ajax({
234
        type : "GET",
234
        type : "GET",
235
        url : context+"grnHistoryDetailByPurchaseId/?purchaseId="+purchaseId,
235
        url : context+"/grnHistoryDetailByPurchaseId/?purchaseId="+purchaseId,
236
        success : function(response) {
236
        success : function(response) {
237
            $('#' + domId).html(response);
237
            $('#' + domId).html(response);
238
            window.dispatchEvent(new Event('resize'));
238
            window.dispatchEvent(new Event('resize'));
239
        }
239
        }
240
    });
240
    });
241
}
241
}
242
 
242
 
243
function loadPendingGrnDetails(purchaseId,domId){
243
function loadPendingGrnDetails(purchaseId,domId){
244
	jQuery.ajax({
244
	jQuery.ajax({
245
		url: context+"purchase/?airwayBillOrInvoiceNumber="+purchaseId,
245
		url: context+"/purchase/?airwayBillOrInvoiceNumber="+purchaseId,
246
		type: 'POST',
246
		type: 'POST',
247
		async: false,
247
		async: false,
248
		success: function (data) {
248
		success: function (data) {
249
			$('#'+domId).html(data);
249
			$('#'+domId).html(data);
250
		},
250
		},
Line 262... Line 262...
262
	console.log(end);
262
	console.log(end);
263
	console.log(+end + +10);
263
	console.log(+end + +10);
264
	console.log(+start + +10);
264
	console.log(+start + +10);
265
	jQuery.ajax({
265
	jQuery.ajax({
266
	        type : "GET",
266
	        type : "GET",
267
	        url : context+"getPaginatedCatalog/?offset="+end+"&searchTerm="+searchText,
267
	        url : context+"/getPaginatedCatalog/?offset="+end+"&searchTerm="+searchText,
268
			beforeSend: function(){
268
			beforeSend: function(){
269
	        //$('#ajax-spinner').show();
269
	        //$('#ajax-spinner').show();
270
	        },
270
	        },
271
	        complete: function(){
271
	        complete: function(){
272
	        //$('#ajax-spinner').hide();
272
	        //$('#ajax-spinner').hide();
Line 288... Line 288...
288
	    });  
288
	    });  
289
	}
289
	}
290
function getPreviousCatalogItems(start,end,pre,searchText){
290
function getPreviousCatalogItems(start,end,pre,searchText){
291
	jQuery.ajax({
291
	jQuery.ajax({
292
	        type : "GET",
292
	        type : "GET",
293
	        url : context+"getPaginatedCatalog/?offset="+pre+"&searchTerm="+searchText,
293
	        url : context+"/getPaginatedCatalog/?offset="+pre+"&searchTerm="+searchText,
294
			beforeSend: function(){
294
			beforeSend: function(){
295
	        //$('#ajax-spinner').show();
295
	        //$('#ajax-spinner').show();
296
	        },
296
	        },
297
	        complete: function(){
297
	        complete: function(){
298
	        //$('#ajax-spinner').hide();
298
	        //$('#ajax-spinner').hide();
Line 358... Line 358...
358
 
358
 
359
function loadCart(domId){
359
function loadCart(domId){
360
	jQuery.ajax({
360
	jQuery.ajax({
361
        type : "POST",
361
        type : "POST",
362
        data: {"cartData":localStorage.getItem("bag")},
362
        data: {"cartData":localStorage.getItem("bag")},
363
        url : context+"cart",
363
        url : context+"/cart",
364
        success : function(response) {
364
        success : function(response) {
365
            $('#' + domId).html(response);
365
            $('#' + domId).html(response);
366
        }
366
        }
367
    });  
367
    });  
368
}
368
}
369
 
369
 
370
function checkout(domId){
370
function checkout(domId){
371
	jQuery.ajax({
371
	jQuery.ajax({
372
        type : "POST",
372
        type : "POST",
373
        data: {"cartData":localStorage.getItem("bag")},
373
        data: {"cartData":localStorage.getItem("bag")},
374
        url : context+"validate-cart",
374
        url : context+"/validate-cart",
375
        success : function(response) {
375
        success : function(response) {
376
        	var obj = JSON.parse(response);
376
        	var obj = JSON.parse(response);
377
        	redirectCart(obj.redirectUrl, obj.params, obj.method, "main-content");
377
        	redirectCart(obj.redirectUrl, obj.params, obj.method, "main-content");
378
        }
378
        }
379
    });  
379
    });