Commit 573c92b5fcacceb5b6cc53393a6a6c20d5450cef
1 parent
84ddb5e1a8
Exists in
master
reemplazo modal-tarifa-flete por modal-prompt
Showing
1 changed file
with
14 additions
and
20 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -214,31 +214,25 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
214 | 214 | }; |
215 | 215 | |
216 | 216 | $scope.seleccionarTarifario = function() { |
217 | - var modalInstance = $uibModal.open( | |
218 | - { | |
219 | - ariaLabelledBy: 'Busqueda de Tarifario', | |
220 | - templateUrl: 'modal-tarifa-flete.html', | |
221 | - controller: 'focaModalTarifaFleteController', | |
222 | - size: 'lg', | |
223 | - resolve: { | |
224 | - parametrosTarifaFlete: function() { | |
225 | - return $scope.hojaRuta.tarifario.costo; | |
226 | - } | |
217 | + focaModalService | |
218 | + .prompt('Tarifa flete', $scope.hojaRuta.tarifario.costo) | |
219 | + .then(function(costo) { | |
220 | + if (isNaN(costo)) { | |
221 | + focaModalService | |
222 | + .alert('Ingrese un valor válido') | |
223 | + .then(function() { | |
224 | + $scope.seleccionarTarifario(); | |
225 | + }); | |
226 | + | |
227 | + return; | |
227 | 228 | } |
228 | - } | |
229 | - ); | |
230 | 229 | |
231 | - modalInstance.result.then( | |
232 | - function(tarifario) { | |
233 | - $scope.hojaRuta.tarifario = tarifario; | |
230 | + $scope.hojaRuta.tarifario.costo = costo; | |
234 | 231 | $scope.$broadcast('addCabecera', { |
235 | 232 | label: 'Tarifario:', |
236 | - valor: tarifario.costo | |
233 | + valor: costo | |
237 | 234 | }); |
238 | - }, function() { | |
239 | - // funcion ejecutada cuando se cancela el modal | |
240 | - } | |
241 | - ); | |
235 | + }); | |
242 | 236 | }; |
243 | 237 | |
244 | 238 | $scope.seleccionarRemitos = function() { |