Subversion Repositories SmartDukaan

Rev

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

Rev 23834 Rev 24056
Line 13... Line 13...
13
		loadPaginatedPreviousItems('/getPaginatedPunchInOuts', null, 'punch-in-outs-paginated', 'punch-in-outs-table', null);
13
		loadPaginatedPreviousItems('/getPaginatedPunchInOuts', null, 'punch-in-outs-paginated', 'punch-in-outs-table', null);
14
		$(this).blur();
14
		$(this).blur();
15
    });
15
    });
16
});
16
});
17
 
17
 
18
function createPunchInOut(inOut){
18
function createPunchInOut(inOut) {
19
	if(confirm("Are you sure you want to do punch "+inOut) == true){
19
	if(confirm("Are you sure you want to do punch "+inOut)){
20
		var distance = $('.fofo-store-distance').val();
20
		distance = undefined;
-
 
21
		if (navigator.geolocation) {
-
 
22
		        navigator.geolocation.getCurrentPosition(showPosition);
-
 
23
		    } else {
-
 
24
		        alert("Location cant be tracked. Please enable location");
-
 
25
		    }
21
		if(distance == undefined){
26
		if(distance == undefined){
22
			alert("Unable to fetch your device location");
27
			alert("Unable to fetch your device location");
23
			return;
28
			return;
24
		}
29
		}
25
		if(distance < 500){
30
		if(distance < 500){
26
			doPostAjaxRequestWithParamsHandler(context+"/createPunchInOut", {}, function(response){
31
			doPostAjaxRequestWithParamsHandler(context+"/createPunchInOut", {}, function(response){
27
				$('#main-content').html(response);
32
				$('#main-content').html(response);
28
				alert("Punch "+inOut+" done successfully");
33
				alert("Punch "+inOut+" done successfully");
29
			});
34
			});
30
		}else{
35
		}else{
31
			alert("Punch "+inOut+" can only be done in 500M range from actual location");
36
			alert("Punch "+inOut+" can only be done from store.");
32
		}
37
		}
33
	}
38
	}
34
}
39
}
35
 
40
 
36
function loadPunchInOuts(domId){
41
function loadPunchInOuts(domId){