Commit d1f4e3a1e6eb21e0a4f964a39f1048add12d638d
1 parent
60c71d0261
Exists in
master
and in
2 other branches
Agregado mensaje de alerta si la cisterna tiene disponible igual 0.
Showing
1 changed file
with
19 additions
and
3 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -52,10 +52,11 @@ angular.module('focaHojaRuta') |
52 | 52 | |
53 | 53 | watch(); |
54 | 54 | |
55 | - if (!$scope.esatadoRed) { | |
55 | + if (!$scope.estadoRed) { | |
56 | 56 | getLSHojaRuta(); |
57 | 57 | } |
58 | 58 | |
59 | + | |
59 | 60 | }); |
60 | 61 | |
61 | 62 | function watch() { |
... | ... | @@ -148,12 +149,27 @@ angular.module('focaHojaRuta') |
148 | 149 | |
149 | 150 | $scope.modalDescargas = function () { |
150 | 151 | delete $scope.hojaRuta.remitos[0].cliente; |
152 | + var remito = $scope.hojaRuta.remitos[0]; | |
153 | + var msg = ''; | |
154 | + var mostrarMensaje = true; | |
155 | + for (var i = 0; i < remito.cisternas.length; i++) { | |
156 | + if (remito.cisternas[i].cisternaCarga.cantidad <= 0) | |
157 | + msg += 'Cisterna ' + remito.cisternas[i].cisternaCarga.articulo.DetArt + | |
158 | + ' esta vacía.\n'; | |
159 | + else | |
160 | + mostrarMensaje = false; | |
161 | + | |
162 | + } | |
163 | + if (mostrarMensaje === true) { | |
164 | + focaModalService.alert(msg); | |
165 | + return; | |
166 | + } | |
151 | 167 | var modalInstance = $uibModal.open( |
152 | 168 | { |
153 | 169 | templateUrl: 'foca-modal-descarga.html', |
154 | 170 | controller: 'focaModalDescargaCtrl', |
155 | 171 | resolve: { |
156 | - remito: function () { return $scope.hojaRuta.remitos[0]; } | |
172 | + remito: function () { return remito; } | |
157 | 173 | }, |
158 | 174 | } |
159 | 175 | ); |
... | ... | @@ -165,7 +181,7 @@ angular.module('focaHojaRuta') |
165 | 181 | }; |
166 | 182 | |
167 | 183 | $rootScope.$on('estadoRed', function (event, value) { |
168 | - $scope.esatadoRed = value; | |
184 | + $scope.estadoRed = value; | |
169 | 185 | }); |
170 | 186 | |
171 | 187 | function getLSHojaRuta() { |