Subversion Repositories SmartDukaan

Rev

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

Rev 23500 Rev 23629
Line 95... Line 95...
95
 
95
 
96
function doPutAjaxRequestHandler(urlString, callback_function){
96
function doPutAjaxRequestHandler(urlString, callback_function){
97
	doAjaxRequestHandler(urlString, "PUT", callback_function);
97
	doAjaxRequestHandler(urlString, "PUT", callback_function);
98
}
98
}
99
 
99
 
-
 
100
function doPostAjaxRequestHandler(urlString, callback_function){
-
 
101
	doAjaxRequestHandler(urlString, "POST", callback_function);
-
 
102
}
-
 
103
 
100
function doAjaxUploadRequest(urlString, httpType, file){
104
function doAjaxUploadRequest(urlString, httpType, file){
101
	var response;
105
	var response;
102
	doAjaxUploadRequestHandler(urlString, httpType, file, function(ajaxResponse){
106
	doAjaxUploadRequestHandler(urlString, httpType, file, function(ajaxResponse){
103
		response = ajaxResponse;
107
		response = ajaxResponse;
104
	});
108
	});
Line 176... Line 180...
176
	// You should set responseType as blob for binary responses
180
	// You should set responseType as blob for binary responses
177
	//xhttp.responseType = 'blob';
181
	//xhttp.responseType = 'blob';
178
	xhttp.send(data);
182
	xhttp.send(data);
179
}
183
}
180
 
184
 
-
 
185
function loadPaginatedNextItems(url, params, paginatedIdentifier, tableIdentifier, detailsContainerIdentifier){
-
 
186
	var start = $("#"+paginatedIdentifier+" .start").text();
-
 
187
	var end = $("#"+paginatedIdentifier+" .end").text();
-
 
188
	url = context + url + "?offset=" + end;
-
 
189
	
-
 
190
	if(params != null){
-
 
191
		for (var key in params) {
-
 
192
			if (params.hasOwnProperty(key)) {
-
 
193
				//console.log(key + " -> " + p[key]);
-
 
194
				url = url +"&" + key + "=" + params[key];
-
 
195
			}
-
 
196
		}
-
 
197
	}
-
 
198
	
-
 
199
	doGetAjaxRequestHandler(url, function(response){
-
 
200
		var size = $("#"+paginatedIdentifier+" .size").text();
-
 
201
		if((parseInt(end) + 10) > parseInt(size)){
-
 
202
			console.log("(end + 10) > size == true");
-
 
203
			$("#"+paginatedIdentifier+" .end").text(size);
-
 
204
		}else{
-
 
205
			console.log("(end + 10) > size == false");
-
 
206
			$("#"+paginatedIdentifier+" .end").text(+end + +10);
-
 
207
		}
-
 
208
		$("#"+paginatedIdentifier+" .start").text(+start + +10);
-
 
209
		var last = $("#"+paginatedIdentifier+" .end").text();
-
 
210
		var temp = $("#"+paginatedIdentifier+" .size").text();
-
 
211
		if (parseInt(last) >= parseInt(temp)){
-
 
212
			$("#"+paginatedIdentifier+" .next").prop('disabled', true);
-
 
213
			//$( "#good-inventory-paginated .end" ).text(temp);
-
 
214
		}
-
 
215
	    $('#'+tableIdentifier).html(response);
-
 
216
	    if(detailsContainerIdentifier != null){
-
 
217
			$('#'+detailsContainerIdentifier).html('');
-
 
218
		}
-
 
219
	    $("#"+paginatedIdentifier+" .previous").prop('disabled', false);
-
 
220
	});
-
 
221
    
-
 
222
}
-
 
223
 
-
 
224
 
-
 
225
function loadPaginatedPreviousItems(url, params, paginatedIdentifier, tableIdentifier, detailsContainerIdentifier){
-
 
226
	var start = $("#"+paginatedIdentifier+" .start").text();
-
 
227
	var end =  $("#"+paginatedIdentifier+" .end").text();
-
 
228
	var size = $("#"+paginatedIdentifier+" .size").text();
-
 
229
	if(parseInt(end) == parseInt(size)){
-
 
230
		var mod = parseInt(end) % 10;
-
 
231
		end = parseInt(end) + (10 - mod); 
-
 
232
	}
-
 
233
	var pre = end - 20;
-
 
234
	
-
 
235
	url = context + url + "?offset=" + pre;
-
 
236
	
-
 
237
	if(params != null){
-
 
238
		for (var key in params) {
-
 
239
			if (params.hasOwnProperty(key)) {
-
 
240
				url = url +"&" + key + "=" + params[key];
-
 
241
			}
-
 
242
		}
-
 
243
	}
-
 
244
	
-
 
245
	doGetAjaxRequestHandler(url, function(response){
-
 
246
		$("#"+paginatedIdentifier+" .end").text(+end - +10);
-
 
247
		$("#"+paginatedIdentifier+" .start").text(+start - +10);
-
 
248
		$('#'+tableIdentifier).html(response);
-
 
249
		if(detailsContainerIdentifier != null){
-
 
250
			$('#'+detailsContainerIdentifier).html('');
-
 
251
		}
-
 
252
		$("#"+paginatedIdentifier+" .next").prop('disabled', false);
-
 
253
		if (parseInt(pre)==0){
-
 
254
			$("#"+paginatedIdentifier+" .previous").prop('disabled', true);
-
 
255
		}
-
 
256
	});	
-
 
257
	
-
 
258
}
-
 
259
 
181
 
260
 
182
function numberToComma(x) {
261
function numberToComma(x) {
183
	x=x.toString();
262
	x=x.toString();
184
	var lastThree = x.substring(x.length-3);
263
	var lastThree = x.substring(x.length-3);
185
	var otherNumbers = x.substring(0,x.length-3);
264
	var otherNumbers = x.substring(0,x.length-3);