service.js
2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
angular.module('focaCrearNotaPedido')
.service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
var route = API_ENDPOINT.URL;
return {
crearNotaPedido: function(notaPedido) {
return $http.post(route + '/nota-pedido', {notaPedido: notaPedido});
},
obtenerNotaPedido: function() {
return $http.get(route +'/nota-pedido');
},
setNotaPedido: function(notaPedido) {
this.notaPedido = notaPedido;
},
clearNotaPedido: function() {
this.notaPedido = undefined;
},
getNotaPedido: function() {
return this.notaPedido;
},
getArticulosByIdNotaPedido: function(id) {
return $http.get(route+'/articulos/nota-pedido/'+id);
},
crearArticulosParaNotaPedido: function(articuloNotaPedido) {
return $http.post(route + '/articulos/nota-pedido',
{articuloNotaPedido: articuloNotaPedido});
},
getDomiciliosByIdNotaPedido: function(id) {
return $http.get(route +'/nota-pedido/'+id+'/domicilios');
},
//EN DESARROLLO
getDomicilios: function(id) {
// return $http.get(route + '/'+id)
id='le asigno un valor para pasar pre commit';
var domicilio = [
{
id: 1,
dom: 'RISSO PATRON 781'
},
{
id: 2,
dom: 'MARIANO MORENO 533'
},
{
id: 3,
dom: 'SALTA 796'
}
];
return domicilio;
},
getPrecioCondicion: function() {
return $http.get(route + '/precio-condicion');
},
getPrecioCondicionById: function(id) {
return $http.get(route + '/precio-condicion/' + id);
},
getPlazoPagoByPrecioCondicion: function(id) {
return $http.get(route + '/plazo-pago/precio-condicion/'+ id);
},
crearFlete: function(flete) {
return $http.post(route + '/flete', {flete : flete});
}
};
}]);