Commit 0115cd7c8d03fdb36c0dde9650d86984575aae3c
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !7
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; | ||
| 8 | cordovaGeolocationService.getCurrentPosition(function(posicion) { | 7 | cordovaGeolocationService.getCurrentPosition(function(posicion) { | 
| 9 | var nuevaPosicion = { | 8 | var nuevaPosicion = { | 
| 10 | posicion: { | 9 | posicion: { | 
| 11 | latitud: posicion.coords.latitude, | 10 | latitud: posicion.coords.latitude, | 
| 12 | longitud: posicion.coords.longitude, | 11 | longitud: posicion.coords.longitude, | 
| 13 | idComprobante: idComprobante, | 12 | idComprobante: idComprobante, | 
| 14 | actividad: actividad, | 13 | actividad: actividad, | 
| 15 | observaciones: observaciones, | 14 | observaciones: observaciones, | 
| 16 | visita: visita | 15 | idVisita: visita | 
| 17 | } | 16 | } | 
| 18 | }; | 17 | }; | 
| 19 | 18 | ||
| 20 | console.info(nuevaPosicion); | 19 | console.info(nuevaPosicion); | 
| 21 | return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); | 20 | return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); | 
| 22 | }); | 21 | }); | 
| 23 | }, | 22 | }, | 
| 24 | obtenerPosicion: function(callback) { | 23 | obtenerPosicion: function(callback) { | 
| 25 | cordovaGeolocationService.getCurrentPosition(callback); | 24 | cordovaGeolocationService.getCurrentPosition(callback); | 
| 26 | } | 25 | } | 
| 27 | }; | 26 | }; | 
| 28 | } | 27 | } | 
| 29 | ]); | 28 | ]); | 
| 30 | 29 |