From 7d2ea6cb17b3410d1e9d53e1dbecc0bfcc2f58f7 Mon Sep 17 00:00:00 2001 From: efernandez Date: Tue, 18 Dec 2018 16:53:17 -0300 Subject: [PATCH] fix guardar, rutas nuevas --- src/js/controller.js | 4 +++- src/js/route.js | 9 +++++++++ src/js/service.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 87bc45e..efb6a0b 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -59,6 +59,7 @@ angular.module('focaAbmVehiculo') focaAbmVehiculoService .getTransportistaPorId($routeParams.idTransportista) .then(function(res) { + $scope.vehiculo.idTransportista = res.data.COD; $scope.vehiculo.transportista = res.data; }) } @@ -83,7 +84,8 @@ angular.module('focaAbmVehiculo') } delete $scope.vehiculo.transportista; focaAbmVehiculoService.guerdarVehiculo($scope.vehiculo).then(function(res) { - $location.path('/vehiculo/' + res.data.id); + console.log(res.data); + $location.path('/vehiculo/' + res.data.id + '/' + res.data.idTransportista); }); }; $scope.solicitarConfirmacionCisterna = function(cisterna) { diff --git a/src/js/route.js b/src/js/route.js index 92c9351..45bec14 100644 --- a/src/js/route.js +++ b/src/js/route.js @@ -20,6 +20,15 @@ angular.module('focaAbmVehiculo') .config([ '$routeProvider', function($routeProvider) { + $routeProvider.when('/vehiculo/:idVehiculo', { + controller: 'focaAbmVehiculoController', + templateUrl: 'src/views/foca-abm-vehiculos-item.html' + }); + } + ]) + .config([ + '$routeProvider', + function($routeProvider) { $routeProvider.when('/vehiculo/:idVehiculo/cisterna/:id', { controller: 'focaAbmVehiculoCisternaController', templateUrl: 'src/views/foca-abm-cisterna-item.html' diff --git a/src/js/service.js b/src/js/service.js index 9bdb44e..cd8f0a9 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -17,7 +17,7 @@ angular.module('focaAbmVehiculo') return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); }, getCisternadoPorVehiculo: function(idVehiculo) { - return $http.get(API_ENDPOINT.URL + '/cisterna/listar/vehiculo/' + idVehiculo); + return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); }, getCisterna: function(id) { return $http.get(API_ENDPOINT.URL + '/cisterna/' + id); -- 1.9.1