Subversion Repositories SmartDukaan

Rev

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

Rev 24595 Rev 24608
Line 28... Line 28...
28
 
28
 
29
function createPunchInOut(inOut) {
29
function createPunchInOut(inOut) {
30
	if (confirm("Are you sure you want to do punch " + inOut)) {
30
	if (confirm("Are you sure you want to do punch " + inOut)) {
31
		distance = undefined;
31
		distance = undefined;
32
		if (navigator.geolocation) {
32
		if (navigator.geolocation) {
-
 
33
			doPostAjaxRequestWithParamsHandler(context + "/createPunchInOut", {}, function(response) {
-
 
34
				$('#main-content').html(response);
-
 
35
				loadPunchInOuts("main-content")
-
 
36
				alert("Punch " + inOut + " done successfully");
-
 
37
				$('#punchInOutModal').modal('hide');
-
 
38
			});
33
			navigator.geolocation.getCurrentPosition(function(position) {
39
		/*	navigator.geolocation.getCurrentPosition(function(position) {
34
				console.log(position)
40
				console.log(position)
35
				if (typeof latitude == "undefined") {
41
				if (typeof latitude == "undefined") {
36
					
-
 
37
					console.log(latitude)
-
 
38
					alert("Unable to fetch your device location");
42
					alert("Unable to fetch your device location");
39
				} else {
43
				} else {
40
					distance = getDistance(latitude, longitude, position.coords.latitude, position.coords.longitude);
44
					distance = getDistance(latitude, longitude, position.coords.latitude, position.coords.longitude);
41
					console.log(distance)
45
					console.log(distance)
42
					if (distance < 500) {
46
					if (distance < 500) {
Line 51... Line 55...
51
						
55
						
52
					}
56
					}
53
					
57
					
54
				}
58
				}
55
			}, function(e) {console.log(e);});
59
			}, function(e) {console.log(e);});
-
 
60
			*/
56
		} else {
61
		} else {
57
			alert("Location cant be tracked. Please enable location");
62
			alert("Location cant be tracked. Please enable location");
58
		}
63
		}
59
	}
64
	}
60
	
65