Commit 74fd97c1c69d010275c80d19b1dcb414b167c420

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master

See merge request !21
src/js/controller.js
... ... @@ -56,9 +56,10 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
56 56  
57 57 //SETEO BOTONERA LATERAL
58 58 $timeout(function() {
59   - focaBotoneraLateralService.showSalir(true);
  59 + focaBotoneraLateralService.showSalir(false);
60 60 focaBotoneraLateralService.showPausar(true);
61 61 focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido);
  62 + focaBotoneraLateralService.addCustomButton('Salir', salir);
62 63 });
63 64  
64 65 crearNotaPedidoService.getPrecioCondicion().then(
... ... @@ -838,5 +839,27 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
838 839 });
839 840 return result;
840 841 }
  842 +
  843 + function salir() {
  844 + var notaPedido = {
  845 + id: 0,
  846 + vendedor: {},
  847 + cliente: {},
  848 + proveedor: {},
  849 + domicilio: {dom: ''},
  850 + moneda: $scope.notaPedido.moneda,
  851 + cotizacion: $scope.notaPedido.cotizacion
  852 + };
  853 + if(JSON.stringify($scope.notaPedido) !== JSON.stringify(notaPedido)) {
  854 + focaModalService
  855 + .confirm('¿Esta seguro de que desea salir? ' +
  856 + 'Se perderán todos los datos cargados.')
  857 + .then(function(data) {
  858 + if(data) $location.path('/');
  859 + });
  860 + }else {
  861 + $location.path('/');
  862 + }
  863 + }
841 864 }
842 865 ]);