Subversion Repositories SmartDukaan

Rev

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

Rev 23870 Rev 23872
Line 17... Line 17...
17
		'rejectedValue : '+errorObject.rejectedValue+'\n'+
17
		'rejectedValue : '+errorObject.rejectedValue+'\n'+
18
		'message : '+errorObject.message);
18
		'message : '+errorObject.message);
19
}
19
}
20
 
20
 
21
$( document ).ajaxError(function(event, jqxhr, settings, thrownError) {
21
$( document ).ajaxError(function(event, jqxhr, settings, thrownError) {
22
	//$( ".log" ).text( "Triggered ajaxError handler." );
22
	// $( ".log" ).text( "Triggered ajaxError handler." );
23
	if(jqxhr.status == 400){
23
	if(jqxhr.status == 400){
24
		//$('#error-prompt-model').modal();
24
		// $('#error-prompt-model').modal();
25
		badRequestAlert(jqxhr);	
25
		badRequestAlert(jqxhr);	
26
	}else{
26
	}else{
27
		internalServerErrorAlert(jqxhr);
27
		internalServerErrorAlert(jqxhr);
28
	}
28
	}
29
});
29
});
Line 33... Line 33...
33
	$.ajax({
33
	$.ajax({
34
	   url: urlString,
34
	   url: urlString,
35
	   async: true,
35
	   async: true,
36
	   cache: false,
36
	   cache: false,
37
	   data: params,
37
	   data: params,
38
       //dataType:'json',
38
       // dataType:'json',
39
	   type: httpType,
39
	   type: httpType,
40
	   success: function(response) {
40
	   success: function(response) {
41
	      callback_function(response);
41
	      callback_function(response);
42
	      $('.currency').each(function(index,ele){
42
	      $('.currency').each(function(index,ele){
43
	    	  if(!isNaN(parseInt($(ele).html()))) {
43
	    	  if(!isNaN(parseInt($(ele).html()))) {
Line 64... Line 64...
64
	   processData: false,
64
	   processData: false,
65
	   data: json,
65
	   data: json,
66
       contentType:'application/json',
66
       contentType:'application/json',
67
	   type: httpType,
67
	   type: httpType,
68
	   success: function(response) {
68
	   success: function(response) {
69
	      //console.log("response"+JSON.stringify(data));
69
	      // console.log("response"+JSON.stringify(data));
70
	      callback_function(response);
70
	      callback_function(response);
71
	      $('.currency').each(function(index,ele){
71
	      $('.currency').each(function(index,ele){
72
	    	  if(!isNaN(parseInt($(ele).html()))) {
72
	    	  if(!isNaN(parseInt($(ele).html()))) {
73
	    		  $(ele).html(numberToComma($(ele).html()));  
73
	    		  $(ele).html(numberToComma($(ele).html()));  
74
	    	  }
74
	    	  }
Line 138... Line 138...
138
       cache: false,
138
       cache: false,
139
       contentType: false,
139
       contentType: false,
140
       enctype: 'multipart/form-data',
140
       enctype: 'multipart/form-data',
141
       processData: false,
141
       processData: false,
142
	   success: function(response) {
142
	   success: function(response) {
143
	      //console.log("response"+JSON.stringify(data));
143
	      // console.log("response"+JSON.stringify(data));
144
	      callback_function(response);
144
	      callback_function(response);
145
	   }
145
	   }
146
	});
146
	});
147
}
147
}
148
 
148
 
Line 193... Line 193...
193
	xhttp.open(httpType, urlString);
193
	xhttp.open(httpType, urlString);
194
	if(httpType == "POST"){
194
	if(httpType == "POST"){
195
		xhttp.setRequestHeader("Content-Type", "application/json");
195
		xhttp.setRequestHeader("Content-Type", "application/json");
196
	}
196
	}
197
	// You should set responseType as blob for binary responses
197
	// You should set responseType as blob for binary responses
198
	//xhttp.responseType = 'blob';
198
	// xhttp.responseType = 'blob';
199
	xhttp.send(data);
199
	xhttp.send(data);
200
}
200
}
201
 
201
 
202
function loadPaginatedNextItems(url, params, paginatedIdentifier, tableIdentifier, detailsContainerIdentifier){
202
function loadPaginatedNextItems(url, params, paginatedIdentifier, tableIdentifier, detailsContainerIdentifier){
203
	var start = $("#"+paginatedIdentifier+" .start").text();
203
	var start = $("#"+paginatedIdentifier+" .start").text();
Line 205... Line 205...
205
	url = context + url + "?offset=" + end;
205
	url = context + url + "?offset=" + end;
206
	
206
	
207
	if(params != null){
207
	if(params != null){
208
		for (var key in params) {
208
		for (var key in params) {
209
			if (params.hasOwnProperty(key)) {
209
			if (params.hasOwnProperty(key)) {
210
				//console.log(key + " -> " + p[key]);
210
				// console.log(key + " -> " + p[key]);
211
				url = url +"&" + key + "=" + params[key];
211
				url = url +"&" + key + "=" + params[key];
212
			}
212
			}
213
		}
213
		}
214
	}
214
	}
215
	
215
	
Line 225... Line 225...
225
		$("#"+paginatedIdentifier+" .start").text(+start + +10);
225
		$("#"+paginatedIdentifier+" .start").text(+start + +10);
226
		var last = $("#"+paginatedIdentifier+" .end").text();
226
		var last = $("#"+paginatedIdentifier+" .end").text();
227
		var temp = $("#"+paginatedIdentifier+" .size").text();
227
		var temp = $("#"+paginatedIdentifier+" .size").text();
228
		if (parseInt(last) >= parseInt(temp)){
228
		if (parseInt(last) >= parseInt(temp)){
229
			$("#"+paginatedIdentifier+" .next").prop('disabled', true);
229
			$("#"+paginatedIdentifier+" .next").prop('disabled', true);
230
			//$( "#good-inventory-paginated .end" ).text(temp);
230
			// $( "#good-inventory-paginated .end" ).text(temp);
231
		}
231
		}
232
	    $('#'+tableIdentifier).html(response);
232
	    $('#'+tableIdentifier).html(response);
233
	    if(detailsContainerIdentifier != null){
233
	    if(detailsContainerIdentifier != null){
234
			$('#'+detailsContainerIdentifier).html('');
234
			$('#'+detailsContainerIdentifier).html('');
235
		}
235
		}
Line 286... Line 286...
286
}
286
}
287
 
287
 
288
function dateRangeCallback(start, end) {
288
function dateRangeCallback(start, end) {
289
	startDate = start.format('YYYY-MM-DD');
289
	startDate = start.format('YYYY-MM-DD');
290
	endDate = end.format('YY-MM-DD');
290
	endDate = end.format('YY-MM-DD');
-
 
291
}
-
 
292
 
-
 
293
function getSingleDatePicker(){
-
 
294
	var singleDatePicker =  
-
 
295
	{ 
-
 
296
		"todayHighlight": true, 
-
 
297
		"startDate": moment(),
-
 
298
		"maxDate":  moment(),
-
 
299
		"autoclose": true,
-
 
300
		"autoUpdateInput": true,
-
 
301
		"singleDatePicker": true,
-
 
302
    "locale": {
-
 
303
		'format': 'DD/MM/YYYY'
-
 
304
	}
-
 
305
  };
-
 
306
	return singleDatePicker;
291
}
307
}
292
308