Commit 3b090edbdadb3c0d57df95582a1741e19c25c856
1 parent
59e0b69f87
Exists in
master
and in
1 other branch
delete articulo
Showing
3 changed files
with
26 additions
and
3 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -354,7 +354,9 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 354 | 354 | }; |
| 355 | 355 | |
| 356 | 356 | $scope.articulosFiltro = function () { |
| 357 | - return $scope.factura.articulosFactura; | |
| 357 | + return $scope.factura.articulosFactura.filter(function (articulo) { | |
| 358 | + return !articulo.desactivado; | |
| 359 | + }); | |
| 358 | 360 | }; |
| 359 | 361 | |
| 360 | 362 | $scope.getTotal = function () { |
| ... | ... | @@ -368,6 +370,24 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 368 | 370 | return parseFloat(total.toFixed(2)); |
| 369 | 371 | }; |
| 370 | 372 | |
| 373 | + $scope.quitarDespacho = function (articulo, index) { | |
| 374 | + | |
| 375 | + crearFacturaService | |
| 376 | + .setearDespachoDesocupado({ | |
| 377 | + surtidor: $scope.factura.despachos[index].SUR, | |
| 378 | + producto: $scope.factura.despachos[index].PRO, | |
| 379 | + carga: $scope.factura.despachos[index].CAR, | |
| 380 | + planilla: $scope.factura.despachos[index].PLA | |
| 381 | + }) | |
| 382 | + .then(function () { | |
| 383 | + articulo.desactivado = true; | |
| 384 | + $scope.factura.despachos.splice(index, 1); | |
| 385 | + }) | |
| 386 | + .catch(function() { | |
| 387 | + focaModalService.alert('Hubo un error al desasociar este despacho'); | |
| 388 | + }); | |
| 389 | + }; | |
| 390 | + | |
| 371 | 391 | function getProductosByPlanilla(numeroPlanilla) { |
| 372 | 392 | |
| 373 | 393 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function(res) { |
| ... | ... | @@ -407,7 +427,7 @@ angular.module('focaCrearFactura').controller('facturaController', [ |
| 407 | 427 | } |
| 408 | 428 | } |
| 409 | 429 | }, |
| 410 | - size: 'lg' | |
| 430 | + size: 'md' | |
| 411 | 431 | } |
| 412 | 432 | ); |
| 413 | 433 |
src/js/service.js
| ... | ... | @@ -18,6 +18,9 @@ angular.module('focaCrearFactura') |
| 18 | 18 | setearDespachoOcupado: function (parametros) { |
| 19 | 19 | return $http.post(route + '/turnos/despacho-en-uso', parametros); |
| 20 | 20 | }, |
| 21 | + setearDespachoDesocupado: function (parametros) { | |
| 22 | + return $http.post(route + '/turnos/depacho-sin-uso', parametros); | |
| 23 | + }, | |
| 21 | 24 | getBotonera: function() { |
| 22 | 25 | return [ |
| 23 | 26 | { |
src/views/factura.html