Commit f36df5ce2c8a60b8170cc298311f483aff97b700
Exists in
master
Merge branch 'master' into 'master'
Master See merge request !15
Showing
1 changed file
Show diff stats
src/js/controller.js
| ... | ... | @@ -50,9 +50,10 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 50 | 50 | |
| 51 | 51 | //SETEO BOTONERA LATERAL |
| 52 | 52 | $timeout(function() { |
| 53 | - focaBotoneraLateralService.showSalir(true); | |
| 53 | + focaBotoneraLateralService.showSalir(false); | |
| 54 | 54 | focaBotoneraLateralService.showPausar(true); |
| 55 | 55 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); |
| 56 | + focaBotoneraLateralService.addCustomButton('Salir', salir); | |
| 56 | 57 | }); |
| 57 | 58 | |
| 58 | 59 | crearRemitoService.getPrecioCondicion().then( |
| ... | ... | @@ -892,5 +893,28 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 892 | 893 | return false(); |
| 893 | 894 | } |
| 894 | 895 | } |
| 896 | + | |
| 897 | + function salir() { | |
| 898 | + var remito = { | |
| 899 | + id: 0, | |
| 900 | + estado: 0, | |
| 901 | + vendedor: {}, | |
| 902 | + cliente: {}, | |
| 903 | + proveedor: {}, | |
| 904 | + domicilio: {dom: ''}, | |
| 905 | + moneda: $scope.remito.moneda, | |
| 906 | + cotizacion: $scope.remito.cotizacion | |
| 907 | + }; | |
| 908 | + if(JSON.stringify($scope.remito) !== JSON.stringify(remito)) { | |
| 909 | + focaModalService | |
| 910 | + .confirm('¿Esta seguro de que desea salir? ' + | |
| 911 | + 'Se perderán todos los datos cargados.') | |
| 912 | + .then(function(data) { | |
| 913 | + if(data) $location.path('/'); | |
| 914 | + }); | |
| 915 | + }else { | |
| 916 | + $location.path('/'); | |
| 917 | + } | |
| 918 | + } | |
| 895 | 919 | } |
| 896 | 920 | ]); |