Commit d16b59bd1c40bf070a9db8b758e8633cc024eb7f
1 parent
4f637ed66e
Exists in
master
and in
1 other branch
guarda boolean 'visita'
Showing
1 changed file
with
5 additions
and
3 deletions
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) { | 6 | guardarPosicion: function(actividad, idComprobante, observaciones, visita) { |
| 7 | visita = (visita) ? true : false; | ||
| 7 | cordovaGeolocationService.getCurrentPosition(function(posicion) { | 8 | cordovaGeolocationService.getCurrentPosition(function(posicion) { |
| 8 | var nuevaPosicion = { | 9 | var nuevaPosicion = { |
| 9 | posicion: { | 10 | posicion: { |
| 10 | latitud: posicion.coords.latitude, | 11 | latitud: posicion.coords.latitude, |
| 11 | longitud: posicion.coords.longitude, | 12 | longitud: posicion.coords.longitude, |
| 12 | idComprobante: idComprobante, | 13 | idComprobante: idComprobante, |
| 13 | actividad: actividad, | 14 | actividad: actividad, |
| 14 | observaciones: observaciones | 15 | observaciones: observaciones, |
| 16 | visita: visita | ||
| 15 | } | 17 | } |
| 16 | }; | 18 | }; |
| 17 | 19 | ||
| 18 | console.info(nuevaPosicion); | 20 | console.info(nuevaPosicion); |
| 19 | return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); | 21 | return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); |
| 20 | }); | 22 | }); |
| 21 | }, | 23 | }, |
| 22 | obtenerPosicion: function(callback) { | 24 | obtenerPosicion: function(callback) { |
| 23 | cordovaGeolocationService.getCurrentPosition(callback); | 25 | cordovaGeolocationService.getCurrentPosition(callback); |
| 24 | } | 26 | } |
| 25 | }; | 27 | }; |
| 26 | } | 28 | } |
| 27 | ]); | 29 | ]); |
| 28 | 30 |