Subversion Repositories SmartDukaan

Rev

Rev 24056 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23834 ashik.ali 1
$(function() {
2
 
3
	$(".punch-in-outs").live('click', function() {
4
		loadPunchInOuts("main-content");
5
	});
6
 
7
	$("#punch-in-outs-paginated .next").live('click', function() {
8
		loadPaginatedNextItems('/getPaginatedPunchInOuts', null, 'punch-in-outs-paginated', 'punch-in-outs-table', null);
9
		$(this).blur();
10
    });
11
 
12
	$("#punch-in-outs-paginated .previous").live('click', function() {
13
		loadPaginatedPreviousItems('/getPaginatedPunchInOuts', null, 'punch-in-outs-paginated', 'punch-in-outs-table', null);
14
		$(this).blur();
15
    });
16
});
17
 
18
function createPunchInOut(inOut){
19
	if(confirm("Are you sure you want to do punch "+inOut) == true){
20
		var distance = $('.fofo-store-distance').val();
21
		if(distance == undefined){
22
			alert("Unable to fetch your device location");
23
			return;
24
		}
25
		if(distance < 500){
26
			doPostAjaxRequestWithParamsHandler(context+"/createPunchInOut", {}, function(response){
27
				$('#main-content').html(response);
28
				alert("Punch "+inOut+" done successfully");
29
			});
30
		}else{
31
			alert("Punch "+inOut+" can only be done in 500M range from actual location");
32
		}
33
	}
34
}
35
 
36
function loadPunchInOuts(domId){
37
	doGetAjaxRequestHandler(context+"/getPunchInOuts", function(response){
38
		$('#' + domId).html(response);
39
	});
40
}
41