Commit 64ca5b414792b3e939ec357a00153f3e3fe1df89
1 parent
bdbd4d53ad
Exists in
master
Creo servicio para llamar a domicilios que tengan solo tipo de entrega
Showing
1 changed file
with
3 additions
and
19 deletions
 
Show diff stats
src/js/service.js
| 1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') | 
| 2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 
| 3 | var route = API_ENDPOINT.URL; | 3 | var route = API_ENDPOINT.URL; | 
| 4 | return { | 4 | return { | 
| 5 | crearNotaPedido: function(notaPedido) { | 5 | crearNotaPedido: function(notaPedido) { | 
| 6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | 6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | 
| 7 | }, | 7 | }, | 
| 8 | obtenerNotaPedido: function() { | 8 | obtenerNotaPedido: function() { | 
| 9 | return $http.get(route +'/nota-pedido'); | 9 | return $http.get(route +'/nota-pedido'); | 
| 10 | }, | 10 | }, | 
| 11 | setNotaPedido: function(notaPedido) { | 11 | setNotaPedido: function(notaPedido) { | 
| 12 | this.notaPedido = notaPedido; | 12 | this.notaPedido = notaPedido; | 
| 13 | }, | 13 | }, | 
| 14 | clearNotaPedido: function() { | 14 | clearNotaPedido: function() { | 
| 15 | this.notaPedido = undefined; | 15 | this.notaPedido = undefined; | 
| 16 | }, | 16 | }, | 
| 17 | getNotaPedido: function() { | 17 | getNotaPedido: function() { | 
| 18 | return this.notaPedido; | 18 | return this.notaPedido; | 
| 19 | }, | 19 | }, | 
| 20 | getArticulosByIdNotaPedido: function(id) { | 20 | getArticulosByIdNotaPedido: function(id) { | 
| 21 | return $http.get(route+'/articulos/nota-pedido/'+id); | 21 | return $http.get(route+'/articulos/nota-pedido/'+id); | 
| 22 | }, | 22 | }, | 
| 23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { | 23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { | 
| 24 | return $http.post(route + '/articulos/nota-pedido', | 24 | return $http.post(route + '/articulos/nota-pedido', | 
| 25 | {articuloNotaPedido: articuloNotaPedido}); | 25 | {articuloNotaPedido: articuloNotaPedido}); | 
| 26 | }, | 26 | }, | 
| 27 | getDomiciliosByIdNotaPedido: function(id) { | 27 | getDomiciliosByIdNotaPedido: function(id) { | 
| 28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 
| 29 | }, | 29 | }, | 
| 30 | //EN DESARROLLO | 30 | getDomiciliosByIdCliente: function(id) { | 
| 31 | getDomicilios: function(id) { | 31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 
| 32 | // return $http.get(route + '/'+id) | 32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 
| 33 | id='le asigno un valor para pasar pre commit'; | ||
| 34 | var domicilio = [ | ||
| 35 | { | ||
| 36 | id: 1, | ||
| 37 | dom: 'RISSO PATRON 781' | ||
| 38 | }, | ||
| 39 | { | ||
| 40 | id: 2, | ||
| 41 | dom: 'MARIANO MORENO 533' | ||
| 42 | }, | ||
| 43 | { | ||
| 44 | id: 3, | ||
| 45 | dom: 'SALTA 796' | ||
| 46 | } | ||
| 47 | ]; | ||
| 48 | return domicilio; | ||
| 49 | }, | 33 | }, | 
| 50 | getPrecioCondicion: function() { | 34 | getPrecioCondicion: function() { | 
| 51 | return $http.get(route + '/precio-condicion'); | 35 | return $http.get(route + '/precio-condicion'); | 
| 52 | }, | 36 | }, | 
| 53 | getPrecioCondicionById: function(id) { | 37 | getPrecioCondicionById: function(id) { | 
| 54 | return $http.get(route + '/precio-condicion/' + id); | 38 | return $http.get(route + '/precio-condicion/' + id); | 
| 55 | }, | 39 | }, | 
| 56 | getPlazoPagoByPrecioCondicion: function(id) { | 40 | getPlazoPagoByPrecioCondicion: function(id) { | 
| 57 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 41 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 
| 58 | }, | 42 | }, | 
| 59 | crearFlete: function(flete) { | 43 | crearFlete: function(flete) { | 
| 60 | return $http.post(route + '/flete', {flete : flete}); | 44 | return $http.post(route + '/flete', {flete : flete}); | 
| 61 | } | 45 | } | 
| 62 | }; | 46 | }; | 
| 63 | }]); | 47 | }]); | 
| 64 | 48 |