Commit 398ded9102eea2a125975ad2fd124ce063d647d0
1 parent
018abb2254
Exists in
master
no se puede editar remito facturado
Showing
2 changed files
with
27 additions
and
11 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -7,15 +7,20 @@ angular.module('focaCrearRemito') .controller('remitoController', |
7 | 7 | remitoBusinessService |
8 | 8 | ) { |
9 | 9 | $scope.botonera = [ |
10 | - {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, | |
11 | - {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | |
12 | - {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | |
13 | - {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | |
14 | - {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | |
15 | - { | |
16 | - texto: 'Precios y condiciones', | |
17 | - accion: function() {$scope.abrirModalListaPrecio();}}, | |
18 | - {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | |
10 | + {texto: 'Nota Pedido', accion: function() { | |
11 | + varlidarRemitoFacturado($scope.seleccionarNotaPedido);}}, | |
12 | + {texto: 'Vendedor', accion: function() { | |
13 | + varlidarRemitoFacturado($scope.seleccionarVendedor);}}, | |
14 | + {texto: 'Cliente', accion: function() { | |
15 | + varlidarRemitoFacturado($scope.seleccionarCliente);}}, | |
16 | + {texto: 'Proveedor', accion: function() { | |
17 | + varlidarRemitoFacturado($scope.seleccionarProveedor);}}, | |
18 | + {texto: 'Moneda', accion: function() { | |
19 | + varlidarRemitoFacturado($scope.abrirModalMoneda);}}, | |
20 | + {texto: 'Precios y condiciones', accion: function() { | |
21 | + varlidarRemitoFacturado($scope.abrirModalListaPrecio);}}, | |
22 | + {texto: 'Flete', accion: function() { | |
23 | + varlidarRemitoFacturado($scope.abrirModalFlete);}}, | |
19 | 24 | {texto: '', accion: function() {}} |
20 | 25 | ]; |
21 | 26 | $scope.datepickerAbierto = false; |
... | ... | @@ -29,6 +34,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
29 | 34 | |
30 | 35 | $scope.remito = { |
31 | 36 | id: 0, |
37 | + estado: 0, | |
32 | 38 | vendedor: {}, |
33 | 39 | cliente: {}, |
34 | 40 | proveedor: {}, |
... | ... | @@ -871,6 +877,15 @@ angular.module('focaCrearRemito') .controller('remitoController', |
871 | 877 | |
872 | 878 | return relleno; |
873 | 879 | } |
880 | + | |
881 | + function varlidarRemitoFacturado(funcion) { | |
882 | + if($scope.remito.estado === 5) { | |
883 | + focaModalService.alert('No se puede editar un remito facturado'); | |
884 | + } | |
885 | + else { | |
886 | + funcion(); | |
887 | + } | |
888 | + } | |
874 | 889 | } |
875 | 890 | ] |
876 | 891 | ) |
src/views/remito.html
... | ... | @@ -483,8 +483,9 @@ |
483 | 483 | ng-click="crearRemito()" |
484 | 484 | type="submit" |
485 | 485 | title="Crear nota remito" |
486 | - class="btn btn-default btn-block mb-2"> | |
487 | - Guardar | |
486 | + class="btn btn-default btn-block mb-2" | |
487 | + ng-disabled="remito.estado === 5" | |
488 | + >Guardar | |
488 | 489 | </button> |
489 | 490 | <button |
490 | 491 | ng-click="salir()" |