Commit 63836a4b976136b7e977c511394b711115e728fa
1 parent
b25becceee
Exists in
master
Agrego formulario datos externos
Showing
1 changed file
with
26 additions
and
2 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -28,7 +28,8 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
| 28 | 28 | transportista: {}, |
| 29 | 29 | tarifario: { |
| 30 | 30 | costo: null |
| 31 | - } | |
| 31 | + }, | |
| 32 | + datosExtra: {} | |
| 32 | 33 | }; |
| 33 | 34 | } |
| 34 | 35 | nuevaHojaRuta(); |
| ... | ... | @@ -93,7 +94,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
| 93 | 94 | }, |
| 94 | 95 | remitos: $scope.remitosTabla |
| 95 | 96 | }; |
| 96 | - | |
| 97 | + save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); | |
| 97 | 98 | focaCrearHojaRutaService.crearHojaRuta(save).then( |
| 98 | 99 | function(data) { |
| 99 | 100 | focaModalService.alert( |
| ... | ... | @@ -294,6 +295,29 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
| 294 | 295 | }); |
| 295 | 296 | }; |
| 296 | 297 | |
| 298 | + $scope.seleccionarDatosExtra = function() { | |
| 299 | + var datosHojaRuta = $scope.hojaRuta.datosExtra; | |
| 300 | + var modalInstance = $uibModal.open( | |
| 301 | + { | |
| 302 | + templateUrl: 'foca-modal-datos-hoja-ruta.html', | |
| 303 | + controller: 'focaModalDatosHojaRutaCtrl', | |
| 304 | + size: 'lg', | |
| 305 | + resolve: { | |
| 306 | + parametrosDatos: function() { | |
| 307 | + return { | |
| 308 | + datosHojaRuta: datosHojaRuta | |
| 309 | + }; | |
| 310 | + } | |
| 311 | + } | |
| 312 | + } | |
| 313 | + ); | |
| 314 | + return modalInstance.result.then(function(datosExtra) { | |
| 315 | + $scope.hojaRuta.datosExtra = datosExtra; | |
| 316 | + }, function() { | |
| 317 | + //se ejecuta cuando se cancela el modal | |
| 318 | + }); | |
| 319 | + }; | |
| 320 | + | |
| 297 | 321 | function elegirFecha() { |
| 298 | 322 | focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { |
| 299 | 323 | $scope.$broadcast('addCabecera', { |