Subversion Repositories SmartDukaan

Rev

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

Rev 24077 Rev 24159
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
 
2
 
3
	$(".punch-in-outs").live('click', function() {
3
	$(".punch-in-outs").live('click', function() {
4
		loadPunchInOuts("main-content");
4
		loadPunchInOuts("main-content");
-
 
5
		
5
	});
6
	});
6
 
7
 
7
	$("#punch-in-outs-paginated .next")
8
	$("#punch-in-outs-paginated .next")
8
			.live(
9
			.live(
9
					'click',
10
					'click',
Line 35... Line 36...
35
				} else {
36
				} else {
36
					distance = getDistance(latitude, longitude, position.coords.latitude, position.coords.longitude);
37
					distance = getDistance(latitude, longitude, position.coords.latitude, position.coords.longitude);
37
					if (distance < 500) {
38
					if (distance < 500) {
38
						doPostAjaxRequestWithParamsHandler(context + "/createPunchInOut", {}, function(response) {
39
						doPostAjaxRequestWithParamsHandler(context + "/createPunchInOut", {}, function(response) {
39
							$('#main-content').html(response);
40
							$('#main-content').html(response);
-
 
41
							loadPunchInOuts("main-content")
40
							alert("Punch " + inOut + " done successfully");
42
							alert("Punch " + inOut + " done successfully");
41
						});
43
						});
42
					} else {
44
					} else {
43
						alert("Punch " + inOut + " can only be done from store.");
45
						alert("Punch " + inOut + " can only be done from store.");
44
					}
46
					}
Line 49... Line 51...
49
			alert("Location cant be tracked. Please enable location");
51
			alert("Location cant be tracked. Please enable location");
50
		}
52
		}
51
	}
53
	}
52
}
54
}
53
 
55
 
-
 
56
function createPunchInOutForPromoter(inOut , userId){
-
 
57
	if (confirm("Are you sure you want to do punch " + inOut)) {
-
 
58
	 
-
 
59
	  console.log(userId)
-
 
60
	  doPostAjaxRequestWithParamsHandler(context + "/createPunchInOutForPromoter?userId="+userId, {}, function(response) {
-
 
61
			//$('#main-content').html(response);
-
 
62
		  alert("Punch " + inOut + " done successfully");
-
 
63
			loadPunchInOuts("main-content")
-
 
64
			
-
 
65
		});
-
 
66
	}
-
 
67
}
-
 
68
 
54
function loadPunchInOuts(domId) {
69
function loadPunchInOuts(domId) {
55
	doGetAjaxRequestHandler(context + "/getPunchInOuts", function(response) {
70
	doGetAjaxRequestHandler(context + "/getPunchInOuts", function(response) {
56
		$('#' + domId).html(response);
71
		$('#' + domId).html(response);	
-
 
72
		
57
	});
73
	});
-
 
74
 
-
 
75
	
-
 
76
}
-
 
77
 
-
 
78
function loadPromoterPunchInOuts(domId){
-
 
79
 
58
}
80
}