Commit fb50d038a137d5cf4d3164afdc12a9bd16f26562
1 parent
2c9f5ae369
Exists in
master
and in
1 other branch
inserto plazos en remito
Showing
2 changed files
with
20 additions
and
5 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -183,10 +183,12 @@ angular.module('focaCrearRemito') .controller('remitoController', |
183 | 183 | } else { |
184 | 184 | $scope.idLista = -1; |
185 | 185 | } |
186 | - | |
186 | + | |
187 | 187 | delete notaPedido.id; |
188 | 188 | $scope.remito = notaPedido; |
189 | + $scope.remito.id = 0; | |
189 | 190 | $scope.remito.moneda = notaPedido.cotizacion.moneda; |
191 | + $scope.plazosPagos = notaPedido.notaPedidoPlazo; | |
190 | 192 | addArrayCabecera(cabeceras); |
191 | 193 | |
192 | 194 | }, function() { |
... | ... | @@ -248,10 +250,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
248 | 250 | }, |
249 | 251 | { |
250 | 252 | label: 'Precio condicion:', |
251 | - valor: valorPrecioCondicion() | |
253 | + valor: valorPrecioCondicion() + ' ' + | |
254 | + remitoBusinessService.plazoToString(remito.remitoPlazo) | |
252 | 255 | } |
253 | 256 | ]; |
254 | - //TO DO CUANDO MOSTRAR PLAZOS | |
255 | 257 | function valorPrecioCondicion() { |
256 | 258 | if(remito.idPrecioCondicion > 0) { |
257 | 259 | return remito.precioCondicion.nombre; |
... | ... | @@ -285,6 +287,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
285 | 287 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
286 | 288 | $scope.remito = remito; |
287 | 289 | $scope.remito.moneda = remito.cotizacion.moneda; |
290 | + $scope.plazosPagos = remito.remitoPlazo; | |
288 | 291 | addArrayCabecera(cabeceras); |
289 | 292 | }, function() { |
290 | 293 | // funcion ejecutada cuando se cancela el modal |
... | ... | @@ -370,6 +373,19 @@ angular.module('focaCrearRemito') .controller('remitoController', |
370 | 373 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
371 | 374 | |
372 | 375 | focaModalService.alert('Remito creado'); |
376 | + //TODO: updatear plazos | |
377 | + if($scope.remito.id === 0) { | |
378 | + var plazos = $scope.plazosPagos; | |
379 | + | |
380 | + for(var j = 0; j < plazos.length; j++) { | |
381 | + var json = { | |
382 | + idRemito: data.data.id, | |
383 | + dias: plazos[j].dias | |
384 | + }; | |
385 | + crearRemitoService.crearPlazosParaRemito(json); | |
386 | + } | |
387 | + } | |
388 | + | |
373 | 389 | $scope.cabecera = []; |
374 | 390 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); |
375 | 391 | addCabecera( |
... | ... | @@ -397,7 +413,6 @@ angular.module('focaCrearRemito') .controller('remitoController', |
397 | 413 | console.info(err); |
398 | 414 | } |
399 | 415 | ); |
400 | - | |
401 | 416 | $scope.notaPedido = { |
402 | 417 | id: 0 |
403 | 418 | }; |
src/js/service.js
... | ... | @@ -45,7 +45,7 @@ angular.module('focaCrearRemito') |
45 | 45 | return $http.post(route + '/flete', {flete : flete}); |
46 | 46 | }, |
47 | 47 | crearPlazosParaRemito: function(plazos) { |
48 | - return $http.post(route + '/plazo-pago/nota-pedido', plazos); | |
48 | + return $http.post(route + '/plazo-pago/remito', plazos); | |
49 | 49 | }, |
50 | 50 | getCotizacionByIdMoneda: function(id) { |
51 | 51 | return $http.get(route + '/moneda/' + id); |