Commit e87f2632753031e2d59fe8f53a879fb417bfb845
Exists in
master
and in
1 other branch
Merge branch 'develop' of git.focasoftware.com:npm/foca-crear-remito
# Conflicts: # src/js/controller.js
Showing
2 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -201,11 +201,13 @@ angular.module('focaCrearRemito').controller('remitoController', |
201 | 201 | |
202 | 202 | function valorPrecioCondicion() { |
203 | 203 | if (parseInt(notaPedido.idListaPrecio) > 0) { |
204 | - crearRemitoService.getListaPrecioById(parseInt(notaPedido.idListaPrecio)) | |
204 | + crearRemitoService | |
205 | + .getListaPrecioById(parseInt(notaPedido.idListaPrecio)) | |
205 | 206 | .then(function (res) { |
206 | 207 | $scope.cabeceras.push({ |
207 | 208 | label: 'Precios y Condiciones:', |
208 | - valor: parseInt(res.data[0].ID) + ' - ' + res.data[0].DES + ' ' + | |
209 | + valor: parseInt(res.data[0].ID) + ' - ' + | |
210 | + res.data[0].DES + ' ' + | |
209 | 211 | remitoBusinessService |
210 | 212 | .plazoToString(notaPedido.notaPedidoPlazo) |
211 | 213 | }); |
... | ... | @@ -427,7 +429,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
427 | 429 | if ($scope.notaPedido.id !== 0) { |
428 | 430 | $scope.idLista = parseInt($scope.notaPedido.idListaPrecio) |
429 | 431 | } |
430 | - if ($scope.remito.idListaPrecio === undefined) { | |
432 | + if ($scope.idLista === undefined) { | |
431 | 433 | focaModalService.alert( |
432 | 434 | 'Primero seleccione una lista de precio y condicion'); |
433 | 435 | return; |
... | ... | @@ -439,7 +441,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
439 | 441 | controller: 'modalBusquedaProductosCtrl', |
440 | 442 | resolve: { |
441 | 443 | parametroProducto: { |
442 | - idLista: $scope.idLista || parseInt($scope.remito.idListaPrecio), | |
444 | + idLista: $scope.idLista, | |
443 | 445 | cotizacion: $scope.remito.cotizacion.VENDEDOR, |
444 | 446 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO |
445 | 447 | } |
... | ... | @@ -720,7 +722,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
720 | 722 | } |
721 | 723 | |
722 | 724 | function abrirModal() { |
723 | - var parametros = { idCliente: $scope.remito.cliente.COD, idListaPrecio : $scope.remito.cliente.MOD}; | |
725 | + var parametros = { idCliente: $scope.remito.cliente.COD, idListaPrecio : $scope.remito.cliente.MOD, | |
726 | + remito: $scope.remito }; | |
724 | 727 | var modalInstance = $uibModal.open( |
725 | 728 | { |
726 | 729 | ariaLabelledBy: 'Busqueda de Precio Condición', |
... | ... | @@ -758,12 +761,21 @@ angular.module('focaCrearRemito').controller('remitoController', |
758 | 761 | } |
759 | 762 | cabecera = plazosConcat.trim(); |
760 | 763 | } |
761 | - $scope.remito.articulosRemito = []; | |
764 | + var cabecerasFilter = !$filter('filter')($scope.cabeceras, | |
765 | + { label: 'Precios y Condiciones' }); | |
766 | + if (!cabecerasFilter) { | |
767 | + $scope.cabeceras.push({ | |
768 | + label: 'Precios y Condiciones:', | |
769 | + valor: parseInt(precioCondicion.listaPrecio.ID) + ' - ' + | |
770 | + precioCondicion.listaPrecio.DES + ' ' + remitoBusinessService.plazoToString(precioCondicion.plazoPago) | |
771 | + }); | |
772 | + $scope.remito.idListaPrecio = parseInt(precioCondicion.listaPrecio.ID); | |
773 | + | |
774 | + } | |
762 | 775 | $filter('filter')($scope.cabeceras, |
763 | 776 | { label: 'Precios y Condiciones' })[0].valor = cabecera; |
764 | 777 | |
765 | 778 | $scope.remito.precioCondicion = precioCondicion; |
766 | - | |
767 | 779 | $filter('filter')($scope.botonera, |
768 | 780 | { label: 'Precios y Condiciones' })[0].checked = true; |
769 | 781 | addArrayCabecera($scope.cabeceras); |
... | ... | @@ -1181,6 +1193,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
1181 | 1193 | },true); |
1182 | 1194 | |
1183 | 1195 | }); |
1196 | + $scope.idLista = parseInt(remito.idListaPrecio); | |
1184 | 1197 | } |
1185 | 1198 | } |
1186 | 1199 |
src/js/service.js
... | ... | @@ -131,7 +131,7 @@ angular.module('focaCrearRemito') |
131 | 131 | ]; |
132 | 132 | }, |
133 | 133 | eliminarRemito: function (remito) { |
134 | - return $http.post(API_ENDPOINT.URL + '/remito/update', {remito: remito}); | |
134 | + return $http.delete(API_ENDPOINT.URL + '/remito/anular/' + remito.id); | |
135 | 135 | } |
136 | 136 | }; |
137 | 137 | }]); |