Commit 1c5870b5b6d6964dd11ce869f804fdc2be45a10e
Exists in
master
Merge branch 'master' into 'develop'
Master(efernandez) See merge request !66
Showing
1 changed file
Show diff stats
src/js/service.js
1 | angular.module('focaCrearHojaRuta') | 1 | angular.module('focaCrearHojaRuta') |
2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', '$cookies', | 2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', '$cookies', |
3 | function($http, API_ENDPOINT, $cookies) { | 3 | function($http, API_ENDPOINT, $cookies) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | idUsuario: $cookies.get('vendedorCobrador'), | 6 | idUsuario: $cookies.get('vendedorCobrador'), |
7 | crearHojaRuta: function(hojaRuta) { | 7 | crearHojaRuta: function(hojaRuta) { |
8 | return $http.post(route + '/hoja-ruta', hojaRuta); | 8 | return $http.post(route + '/hoja-ruta', hojaRuta); |
9 | }, | 9 | }, |
10 | crearRemito: function(remito) { | 10 | crearRemito: function(remito) { |
11 | // TODO: Cambiar para usar el servicio /remito | 11 | // TODO: Cambiar para usar el servicio /remito |
12 | return $http.post(route + '/remito/guardar', remito); | 12 | return $http.post(route + '/remito/guardar', remito); |
13 | }, | 13 | }, |
14 | obtenerHojaRuta: function() { | 14 | obtenerHojaRuta: function() { |
15 | return $http.get(route +'/hoja-ruta'); | 15 | return $http.get(route +'/hoja-ruta'); |
16 | }, | 16 | }, |
17 | setHojaRuta: function(hojaRuta) { | 17 | setHojaRuta: function(hojaRuta) { |
18 | this.hojaRuta = hojaRuta; | 18 | this.hojaRuta = hojaRuta; |
19 | }, | 19 | }, |
20 | clearHojaRuta: function() { | 20 | clearHojaRuta: function() { |
21 | this.hojaRuta = undefined; | 21 | this.hojaRuta = undefined; |
22 | }, | 22 | }, |
23 | getHojaRuta: function() { | 23 | getHojaRuta: function() { |
24 | return this.hojaRuta; | 24 | return this.hojaRuta; |
25 | }, | 25 | }, |
26 | getArticulosByIdHojaRuta: function(id) { | 26 | getArticulosByIdHojaRuta: function(id) { |
27 | return $http.get(route+'/articulos/hoja-ruta/'+id); | 27 | return $http.get(route+'/articulos/hoja-ruta/'+id); |
28 | }, | 28 | }, |
29 | crearArticulosParaHojaRuta: function(articuloHojaRuta) { | 29 | crearArticulosParaHojaRuta: function(articuloHojaRuta) { |
30 | return $http.post(route + '/articulos/remito', | 30 | return $http.post(route + '/articulos/remito', |
31 | {articuloRemito: articuloHojaRuta}); | 31 | {articuloRemito: articuloHojaRuta}); |
32 | }, | 32 | }, |
33 | getDomiciliosByIdHojaRuta: function(id) { | 33 | getDomiciliosByIdHojaRuta: function(id) { |
34 | return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); | 34 | return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); |
35 | }, | 35 | }, |
36 | getDomiciliosByIdCliente: function(id) { | 36 | getDomiciliosByIdCliente: function(id) { |
37 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 37 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
38 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 38 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
39 | }, | 39 | }, |
40 | getPrecioCondicion: function() { | 40 | getPrecioCondicion: function() { |
41 | return $http.get(route + '/precio-condicion'); | 41 | return $http.get(route + '/precio-condicion'); |
42 | }, | 42 | }, |
43 | getPrecioCondicionById: function(id) { | 43 | getPrecioCondicionById: function(id) { |
44 | return $http.get(route + '/precio-condicion/' + id); | 44 | return $http.get(route + '/precio-condicion/' + id); |
45 | }, | 45 | }, |
46 | getPlazoPagoByPrecioCondicion: function(id) { | 46 | getPlazoPagoByPrecioCondicion: function(id) { |
47 | return $http.get(route + '/plazo-pago/precio-condicion/' + id); | 47 | return $http.get(route + '/plazo-pago/precio-condicion/' + id); |
48 | }, | 48 | }, |
49 | crearFlete: function(flete) { | 49 | crearFlete: function(flete) { |
50 | return $http.post(route + '/flete', {flete : flete}); | 50 | return $http.post(route + '/flete', {flete : flete}); |
51 | }, | 51 | }, |
52 | crearPlazosParaHojaRuta: function(plazos) { | 52 | crearPlazosParaHojaRuta: function(plazos) { |
53 | return $http.post(route + '/plazo-pago/hoja-ruta', plazos); | 53 | return $http.post(route + '/plazo-pago/hoja-ruta', plazos); |
54 | }, | 54 | }, |
55 | getCotizacionByIdMoneda: function(id) { | 55 | getCotizacionByIdMoneda: function(id) { |
56 | return $http.get(route + '/moneda/' + id); | 56 | return $http.get(route + '/moneda/' + id); |
57 | }, | 57 | }, |
58 | crearEstadoParaHojaRuta: function(estado) { | 58 | crearEstadoParaHojaRuta: function(estado) { |
59 | return $http.post(route + '/estado', {estado: estado}); | 59 | return $http.post(route + '/estado', {estado: estado}); |
60 | }, | 60 | }, |
61 | getNumeroHojaRuta: function() { | 61 | getNumeroHojaRuta: function() { |
62 | return $http.get(route + '/hoja-ruta/numero-siguiente'); | 62 | return $http.get(route + '/hoja-ruta/numero-siguiente'); |
63 | }, | 63 | }, |
64 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { | 64 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { |
65 | var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; | 65 | var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; |
66 | return $http.get(route + '/vehiculo/obtener/remitos/' + | 66 | return $http.get(route + '/vehiculo/obtener/remitos/' + |
67 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); | 67 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); |
68 | }, | 68 | }, |
69 | desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { | 69 | desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { |
70 | return $http.post(route + '/vehiculo/desasociar-remitos', | 70 | return $http.post(route + '/vehiculo/desasociar-remitos', |
71 | { | 71 | { |
72 | idsRemitos: idsRemitos, | 72 | idsRemitos: idsRemitos, |
73 | idVehiculo: idVehiculo, | 73 | idVehiculo: idVehiculo, |
74 | vehiculoSinRemitos: sinRemitos | 74 | vehiculoSinRemitos: sinRemitos |
75 | }); | 75 | }); |
76 | }, | 76 | }, |
77 | getParametros: function() { | 77 | getParametros: function() { |
78 | return $http.get(API_ENDPOINT.URL + '/parametros/hojaRuta'); | 78 | return $http.get(API_ENDPOINT.URL + '/parametros/hojaRuta'); |
79 | }, | 79 | }, |
80 | getBotonera: function() { | 80 | getBotonera: function() { |
81 | return [ | 81 | return [ |
82 | { | 82 | { |
83 | label: 'Fecha Entrega', | 83 | label: 'Fecha Entrega', |
84 | image: 'FechaEntrega.png' | 84 | image: 'FechaEntrega.png' |
85 | }, | 85 | }, |
86 | { | 86 | { |
87 | label: 'Transportista', | 87 | label: 'Transportista', |
88 | image: 'transportista.png' | 88 | image: 'transportista.png' |
89 | }, | 89 | }, |
90 | { | 90 | { |
91 | label: 'Chofer', | 91 | label: 'Chofer', |
92 | image: 'chofer.png' | 92 | image: 'chofer.png' |
93 | }, | 93 | }, |
94 | { | 94 | { |
95 | label: 'Vehiculo', | 95 | label: 'Vehiculo', |
96 | image: 'vehiculos.png' | 96 | image: 'vehiculos.png' |
97 | }, | 97 | }, |
98 | { | 98 | { |
99 | label: 'Tarifario', | 99 | label: 'Tarifario', |
100 | image: 'tarifario.png' | 100 | image: 'tarifario.png' |
101 | }, | 101 | }, |
102 | { | 102 | { |
103 | label: 'Remitos', | 103 | label: 'Remitos', |
104 | image: 'remito.png' | 104 | image: 'remito.png' |
105 | }, | 105 | }, |
106 | { | 106 | { |
107 | label: 'Vehiculos precargados', | 107 | label: 'Vehiculos precargados', |
108 | image: 'vehiculos.png' | 108 | image: 'vehiculos.png' |
109 | }, | 109 | }, |
110 | { | 110 | { |
111 | label: 'Datos extra', | 111 | label: 'Datos extra', |
112 | image: 'tarifario.png' | 112 | image: 'tarifario.png' |
113 | } | 113 | } |
114 | ]; | 114 | ]; |
115 | }, | 115 | }, |
116 | getBotones: function () { | 116 | getBotones: function () { |
117 | return [ | 117 | return [ |
118 | { | 118 | { |
119 | label: 'Precargados', | 119 | label: 'Precargados', |
120 | image: 'vehiculos.png' | 120 | image: 'vehiculos.png' |
121 | }, | 121 | }, |
122 | { | 122 | { |
123 | label: 'Cargar Remitos', | 123 | label: 'Cargar Remitos', |
124 | image: 'remito.png' | 124 | image: 'remito.png' |
125 | }, | 125 | }, |
126 | { | 126 | { |
127 | label: 'Remito Abierto', | 127 | label: 'Remito Abierto', |
128 | image: 'remitoabierto.png' | 128 | image: 'remitoabierto.png' |
129 | } | 129 | } |
130 | ]; | 130 | ]; |
131 | }, | 131 | }, |
132 | getRemitoAbierto: function () { | 132 | getRemitoAbierto: function () { |
133 | return [ | 133 | return [ |
134 | { | 134 | { |
135 | label: 'Fecha Entrega', | 135 | label: 'Fecha Entrega', |
136 | image: 'FechaEntrega.png' | 136 | image: 'FechaEntrega.png' |
137 | }, | 137 | }, |
138 | { | 138 | { |
139 | label: 'Transportista', | 139 | label: 'Transportista', |
140 | image: 'transportista.png' | 140 | image: 'transportista.png' |
141 | }, | 141 | }, |
142 | { | 142 | { |
143 | label: 'Vehiculo', | 143 | label: 'Vehiculo', |
144 | image: 'vehiculos.png' | 144 | image: 'vehiculos.png' |
145 | }, | 145 | }, |
146 | { | 146 | { |
147 | label: 'Chofer', | 147 | label: 'Chofer', |
148 | image: 'chofer.png' | 148 | image: 'chofer.png' |
149 | }, | 149 | }, |
150 | { | 150 | { |
151 | label: 'Proveedor', | 151 | label: 'Proveedor', |
152 | image: 'proveedor.png' | 152 | image: 'proveedor.png' |
153 | }, | 153 | }, |
154 | { | 154 | { |
155 | label: 'Tarifario', | 155 | label: 'Tarifario', |
156 | image: 'tarifario.png' | 156 | image: 'tarifario.png' |
157 | }, | 157 | }, |
158 | { | 158 | { |
159 | label: 'Cliente', | 159 | label: 'Cliente', |
160 | image: 'cliente.png' | 160 | image: 'cliente.png' |
161 | }, | 161 | }, |
162 | { | 162 | { |
163 | label: 'Detalle de Carga', | 163 | label: 'Detalle de Carga', |
164 | image: 'detalleDeCarga.png' | 164 | image: 'detalleDeCarga.png' |
165 | } | 165 | } |
166 | ]; | 166 | ]; |
167 | }, | 167 | }, |
168 | getArticulos : function () { | 168 | getArticulos : function () { |
169 | return $http.get(API_ENDPOINT.URL + '/articulos'); | 169 | return $http.get(API_ENDPOINT.URL + '/articulos'); |
170 | }, | 170 | }, |
171 | getVendedorById : function (idVendedor) { | 171 | getVendedorById : function (idVendedor) { |
172 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + idVendedor); | 172 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + idVendedor); |
173 | }, | 173 | }, |
174 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 174 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { |
175 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 175 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + |
176 | idDomicilio + '/' + idCliente); | 176 | idDomicilio + '/' + idCliente); |
177 | }, | 177 | }, |
178 | getBotoneraPrecargado: function () { | 178 | getBotoneraPrecargado: function () { |
179 | return [ | 179 | return [ |
180 | { | 180 | { |
181 | label: 'Fecha Entrega', | 181 | label: 'Fecha Entrega', |
182 | image: 'FechaEntrega.png' | 182 | image: 'FechaEntrega.png' |
183 | }, | 183 | }, |
184 | { | 184 | { |
185 | label: 'Transportista', | 185 | label: 'Transportista', |
186 | image: 'transportista.png' | 186 | image: 'transportista.png' |
187 | }, | 187 | }, |
188 | { | 188 | { |
189 | label: 'Chofer', | 189 | label: 'Chofer', |
190 | image: 'chofer.png' | 190 | image: 'chofer.png' |
191 | }, | 191 | }, |
192 | { | 192 | { |
193 | label: 'VehiculosPrecargados', | 193 | label: 'VehiculosPrecargados', |
194 | image: 'vehiculos.png' | 194 | image: 'vehiculos.png' |
195 | }, | 195 | }, |
196 | { | 196 | { |
197 | label: 'Tarifario', | 197 | label: 'Tarifario', |
198 | image: 'tarifario.png' | 198 | image: 'tarifario.png' |
199 | }, | 199 | }, |
200 | { | 200 | { |
201 | label: 'Datos extra', | 201 | label: 'Datos extra', |
202 | image: 'tarifario.png' | 202 | image: 'tarifario.png' |
203 | } | 203 | } |
204 | ]; | 204 | ]; |
205 | }, | 205 | }, |
206 | getBotoneraCargarRemito: function () { | 206 | getBotoneraCargarRemito: function () { |
207 | return [ | 207 | return [ |
208 | { | 208 | { |
209 | label: 'Fecha Entrega', | 209 | label: 'Fecha Entrega', |
210 | image: 'FechaEntrega.png' | 210 | image: 'FechaEntrega.png' |
211 | }, | 211 | }, |
212 | { | 212 | { |
213 | label: 'Transportista', | 213 | label: 'Transportista', |
214 | image: 'transportista.png' | 214 | image: 'transportista.png' |
215 | }, | 215 | }, |
216 | { | 216 | { |
217 | label: 'Chofer', | 217 | label: 'Chofer', |
218 | image: 'chofer.png' | 218 | image: 'chofer.png' |
219 | }, | 219 | }, |
220 | { | 220 | { |
221 | label: 'Vehiculo', | 221 | label: 'Vehiculo', |
222 | image: 'flete.png' | 222 | image: 'flete.png' |
223 | }, | 223 | }, |
224 | { | 224 | { |
225 | label: 'Remitos', | 225 | label: 'Remitos', |
226 | image: 'remito.png' | 226 | image: 'remito.png' |
227 | }, | 227 | }, |
228 | { | 228 | { |
229 | label: 'Tarifario', | 229 | label: 'Tarifario', |
230 | image: 'tarifario.png' | 230 | image: 'tarifario.png' |
231 | }, | 231 | }, |
232 | { | 232 | { |
233 | label: 'Datos extra', | 233 | label: 'Datos extra', |
234 | image: 'tarifario.png' | 234 | image: 'tarifario.png' |
235 | } | 235 | } |
236 | ]; | 236 | ]; |
237 | }, | 237 | }, |
238 | guardarCisternas: function(cisterna, idRemito) { | 238 | guardarCisternas: function(cisterna, idRemito) { |
239 | 239 | ||
240 | cisterna.cisternaMovimientos.forEach(function(cisternaMovimiento) { | 240 | cisterna.cisternaMovimientos.forEach(function(cisternaMovimiento) { |
241 | cisternaMovimiento.idRemito = idRemito; | 241 | cisternaMovimiento.idRemito = idRemito; |
242 | }); | 242 | }); |
243 | 243 | ||
244 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + | 244 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + |
245 | this.idUsuario + '/' + idRemito, cisterna); | 245 | this.idUsuario + '/' + idRemito, cisterna); |
246 | }, | 246 | }, |
247 | crearArticulosParaRemito: function(articuloRemito) { | 247 | crearArticulosParaRemito: function(articuloRemito) { |
248 | return $http.post(route + '/articulos/remito', | 248 | return $http.post(route + '/articulos/remito', |
249 | {articuloRemito: articuloRemito}); | 249 | {articuloRemito: articuloRemito}); |
250 | }, | 250 | }, |
251 | obtenerCisternasPorFecha: function(idVehiculo, fecha) { | ||
252 | return $http.post(route + '/cisterna/listar/fecha', | ||
253 | {idVehiculo: idVehiculo, fechaReparto: fecha}); | ||
254 | }, | ||
255 | getNumeroOrden: function(idVehiculo, fecha) { | 251 | getNumeroOrden: function(idVehiculo, fecha) { |
256 | return $http.get(route + '/hoja-ruta/obtener/numero-orden/' + | 252 | return $http.get(route + '/hoja-ruta/obtener/numero-orden/' + |
257 | idVehiculo + '/' + fecha.toISOString().slice(0, 10)); | 253 | idVehiculo + '/' + fecha.toISOString().slice(0, 10)); |
258 | } | 254 | } |
259 | }; | 255 | }; |
260 | }]); | 256 | }]); |
261 | 257 |