Commit 3e04616ff2a67dcf96a716e217325fc5262c18ba
1 parent
86bf67f6c5
Exists in
master
implementación para guardar plazos
Showing
2 changed files
with
13 additions
and
2 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -107,7 +107,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 107 | 107 | }; |
| 108 | 108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 109 | 109 | function(data) { |
| 110 | - focaModalService.alert('Nota pedido creada'); | |
| 111 | 110 | if($scope.notaPedido.flete === 1) { |
| 112 | 111 | var flete = { |
| 113 | 112 | idNotaPedido: data.data.id, |
| ... | ... | @@ -126,6 +125,15 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 126 | 125 | crearNotaPedidoService |
| 127 | 126 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
| 128 | 127 | } |
| 128 | + var plazos = $scope.plazosPagos; | |
| 129 | + for(var j = 0; j < plazos.length; j++) { | |
| 130 | + var json = { | |
| 131 | + idPedido: data.data.id, | |
| 132 | + dias: plazos[j].dias | |
| 133 | + }; | |
| 134 | + crearNotaPedidoService.crearPlazosParaNotaPedido(json); | |
| 135 | + } | |
| 136 | + focaModalService.alert('Nota pedido creada'); | |
| 129 | 137 | $scope.limpiarPantalla(); |
| 130 | 138 | } |
| 131 | 139 | ); |
| ... | ... | @@ -311,7 +319,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 311 | 319 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 312 | 320 | } else { //Cuando se ingresan los plazos manualmente |
| 313 | 321 | idLista = -1; //-1, el modal productos busca todos los productos |
| 314 | - $scope.notaPedido.plazoPago = precioCondicion; | |
| 322 | + $scope.plazosPagos = precioCondicion; | |
| 315 | 323 | for(var j = 0; j < precioCondicion.length; j++) { |
| 316 | 324 | plazosConcat += precioCondicion[j].dias + ' '; |
| 317 | 325 | } |
src/js/service.js
| ... | ... | @@ -42,6 +42,9 @@ angular.module('focaCrearNotaPedido') |
| 42 | 42 | }, |
| 43 | 43 | crearFlete: function(flete) { |
| 44 | 44 | return $http.post(route + '/flete', {flete : flete}); |
| 45 | + }, | |
| 46 | + crearPlazosParaNotaPedido: function(plazos) { | |
| 47 | + return $http.post(route + '/plazo-pago/nota-pedido', plazos); | |
| 45 | 48 | } |
| 46 | 49 | }; |
| 47 | 50 | }]); |