Subversion Repositories SmartDukaan

Rev

Rev 23834 | Rev 24072 | Go to most recent revision | Details | Compare with Previous | 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
 
24056 amit.gupta 18
function createPunchInOut(inOut) {
19
	if(confirm("Are you sure you want to do punch "+inOut)){
20
		distance = undefined;
21
		if (navigator.geolocation) {
22
		        navigator.geolocation.getCurrentPosition(showPosition);
23
		    } else {
24
		        alert("Location cant be tracked. Please enable location");
25
		    }
23834 ashik.ali 26
		if(distance == undefined){
27
			alert("Unable to fetch your device location");
28
			return;
29
		}
30
		if(distance < 500){
31
			doPostAjaxRequestWithParamsHandler(context+"/createPunchInOut", {}, function(response){
32
				$('#main-content').html(response);
33
				alert("Punch "+inOut+" done successfully");
34
			});
35
		}else{
24056 amit.gupta 36
			alert("Punch "+inOut+" can only be done from store.");
23834 ashik.ali 37
		}
38
	}
39
}
40
 
41
function loadPunchInOuts(domId){
42
	doGetAjaxRequestHandler(context+"/getPunchInOuts", function(response){
43
		$('#' + domId).html(response);
44
	});
45
}
46