Commit 7457fa852a376cc2c60742dd74563bb106418167
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing
1 changed file
Show diff stats
src/js/service.js
1 | angular.module('focaSeguimiento') | 1 | angular.module('focaSeguimiento') |
2 | .service('focaSeguimientoService', [ | 2 | .service('focaSeguimientoService', [ |
3 | '$http', 'API_ENDPOINT', 'cordovaGeolocationService', | 3 | '$http', 'API_ENDPOINT', 'cordovaGeolocationService', |
4 | function($http, API_ENDPOINT, cordovaGeolocationService) { | 4 | function($http, API_ENDPOINT, cordovaGeolocationService) { |
5 | return { | 5 | return { |
6 | guardarPosicion: function(actividad, idComprobante, observaciones, visita) { | 6 | guardarPosicion: function(actividad, idComprobante, observaciones, visita) { |
7 | visita = (visita) ? true : false; | 7 | visita = (visita) ? true : false; |
8 | cordovaGeolocationService.getCurrentPosition(function(posicion) { | 8 | cordovaGeolocationService.getCurrentPosition(function(posicion) { |
9 | var nuevaPosicion = { | 9 | var nuevaPosicion = { |
10 | posicion: { | 10 | posicion: { |
11 | latitud: posicion.coords.latitude, | 11 | latitud: posicion.coords.latitude, |
12 | longitud: posicion.coords.longitude, | 12 | longitud: posicion.coords.longitude, |
13 | idComprobante: idComprobante, | 13 | idComprobante: idComprobante, |
14 | actividad: actividad, | 14 | actividad: actividad, |
15 | observaciones: observaciones, | 15 | observaciones: observaciones, |
16 | visita: visita | 16 | visita: visita |
17 | } | 17 | } |
18 | }; | 18 | }; |
19 | 19 | ||
20 | console.info(nuevaPosicion); | 20 | console.info(nuevaPosicion); |
21 | return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); | 21 | return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); |
22 | }); | 22 | }); |
23 | }, | 23 | }, |
24 | obtenerPosicion: function(callback) { | 24 | obtenerPosicion: function(callback) { |
25 | cordovaGeolocationService.getCurrentPosition(callback); | 25 | cordovaGeolocationService.getCurrentPosition(callback); |
26 | } | 26 | } |
27 | }; | 27 | }; |
28 | } | 28 | } |
29 | ]); | 29 | ]); |
30 | 30 |