Commit 88750e8ea3a2cf499a7241741946ae53c8e2726e
1 parent
e80bc1985b
Exists in
master
and in
2 other branches
creación de choferes correcto
Showing
1 changed file
with
12 additions
and
4 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -2,9 +2,9 @@ angular.module('focaAbmChofer') |
2 | 2 | .controller('focaAbmChoferesController', [ |
3 | 3 | '$scope', 'focaAbmChoferService', '$location', '$uibModal', |
4 | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', |
5 | - '$routeParams', '$filter', | |
5 | + '$routeParams', | |
6 | 6 | function($scope, focaAbmChoferService, $location, $uibModal, focaModalService, |
7 | - focaBotoneraLateralService, $timeout, $localStorage, $routeParams, $filter) { | |
7 | + focaBotoneraLateralService, $timeout, $localStorage, $routeParams) { | |
8 | 8 | |
9 | 9 | $scope.focused = 1; |
10 | 10 | $scope.now = new Date(); |
... | ... | @@ -45,6 +45,7 @@ angular.module('focaAbmChofer') |
45 | 45 | nombre: '', |
46 | 46 | telefono: '', |
47 | 47 | editando: true, |
48 | + desactivado: false | |
48 | 49 | }; |
49 | 50 | $scope.choferes.unshift(chofer); |
50 | 51 | $scope.crear = false; |
... | ... | @@ -110,7 +111,13 @@ angular.module('focaAbmChofer') |
110 | 111 | delete chofer.transportista; |
111 | 112 | delete chofer.editando; |
112 | 113 | }); |
113 | - focaAbmChoferService.guardarChoferes($scope.choferes); | |
114 | + focaAbmChoferService | |
115 | + .guardarChoferes($scope.choferes) | |
116 | + .then(salir) | |
117 | + .catch(e => { | |
118 | + console.error(e); | |
119 | + focaModalService.alert('Hubo un error al guardar'); | |
120 | + }); | |
114 | 121 | }; |
115 | 122 | |
116 | 123 | $scope.solicitarConfirmacion = function(chofer) { |
... | ... | @@ -194,7 +201,8 @@ angular.module('focaAbmChofer') |
194 | 201 | } |
195 | 202 | }) |
196 | 203 | .then(function() { |
197 | - chofer.idTransportista = focaAbmChoferService.transportistaSeleccionado.COD; | |
204 | + chofer.idTransportista = focaAbmChoferService | |
205 | + .transportistaSeleccionado.COD; | |
198 | 206 | delete chofer.transportista; |
199 | 207 | }, function() { |
200 | 208 | focaModalService.alert('Dni existente'); |