Commit 8c061c999aff0b7c53f596998b2d33cd17112d60

Authored by Nicolás Guarnieri
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

codigo de vehiculo y cisterna unicos, codigos con ceros

See merge request !9
src/js/controller.js
1 angular.module('focaAbmVehiculo') 1 angular.module('focaAbmVehiculo')
2 .controller('focaAbmVehiculosController', [ 2 .controller('focaAbmVehiculosController', [
3 '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', 3 '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService',
4 '$uibModal', 'focaBotoneraLateralService', '$timeout', 4 '$uibModal', 'focaBotoneraLateralService', '$timeout',
5 function($scope, focaAbmVehiculoService, $location, focaModalService, 5 function($scope, focaAbmVehiculoService, $location, focaModalService,
6 $uibModal, focaBotoneraLateralService, $timeout) { 6 $uibModal, focaBotoneraLateralService, $timeout) {
7 7
8 $scope.now = new Date(); 8 $scope.now = new Date();
9 $scope.botonera = ['Transportista']; 9 $scope.botonera = ['Transportista'];
10 10
11 //SETEO BOTONERA LATERAL 11 //SETEO BOTONERA LATERAL
12 focaBotoneraLateralService.showSalir(true); 12 focaBotoneraLateralService.showSalir(true);
13 focaBotoneraLateralService.showPausar(false); 13 focaBotoneraLateralService.showPausar(false);
14 focaBotoneraLateralService.showCancelar(false); 14 focaBotoneraLateralService.showCancelar(false);
15 focaBotoneraLateralService.showGuardar(false); 15 focaBotoneraLateralService.showGuardar(false);
16 16
17 if(focaAbmVehiculoService.transportistaSeleccionado.COD) { 17 if(focaAbmVehiculoService.transportistaSeleccionado.COD) {
18 elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); 18 elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado);
19 } 19 }
20 20
21 $scope.editar = function(id) { 21 $scope.editar = function(id) {
22 $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); 22 $location.path('/vehiculo/' + id + '/' + $scope.idTransportista);
23 }; 23 };
24 $scope.solicitarConfirmacion = function(vehiculo) { 24 $scope.solicitarConfirmacion = function(vehiculo) {
25 focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + 25 focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' +
26 vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( 26 vehiculo.id + ' ' + vehiculo.tractor + ' ?').then(
27 function(data) { 27 function(data) {
28 if(data) { 28 if(data) {
29 focaAbmVehiculoService.deleteVehiculo(vehiculo.id); 29 focaAbmVehiculoService.deleteVehiculo(vehiculo.id);
30 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 30 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
31 } 31 }
32 } 32 }
33 ); 33 );
34 }; 34 };
35 $scope.seleccionarTransportista = function() { 35 $scope.seleccionarTransportista = function() {
36 var modalInstance = $uibModal.open( 36 var modalInstance = $uibModal.open(
37 { 37 {
38 ariaLabelledBy: 'Busqueda de Transportista', 38 ariaLabelledBy: 'Busqueda de Transportista',
39 templateUrl: 'modal-proveedor.html', 39 templateUrl: 'modal-proveedor.html',
40 controller: 'focaModalProveedorCtrl', 40 controller: 'focaModalProveedorCtrl',
41 size: 'lg', 41 size: 'lg',
42 resolve: { 42 resolve: {
43 transportista: function() { 43 transportista: function() {
44 return true; 44 return true;
45 } 45 }
46 } 46 }
47 } 47 }
48 ); 48 );
49 modalInstance.result.then( 49 modalInstance.result.then(
50 function(transportista) { 50 function(transportista) {
51 elegirTransportista(transportista); 51 elegirTransportista(transportista);
52 focaAbmVehiculoService.transportistaSeleccionado = transportista; 52 focaAbmVehiculoService.transportistaSeleccionado = transportista;
53 }, function() { 53 }, function() {
54 54
55 } 55 }
56 ); 56 );
57 }; 57 };
58 58
59 function elegirTransportista(transportista) { 59 function elegirTransportista(transportista) {
60 var codigo = ('00000' + transportista.COD).slice(-5);
60 $scope.idTransportista = transportista.COD; 61 $scope.idTransportista = transportista.COD;
61 $scope.filtros = transportista.NOM.trim(); 62 $scope.filtros = transportista.NOM.trim();
62 $timeout(function() { 63 $timeout(function() {
63 $scope.$broadcast('addCabecera', { 64 $scope.$broadcast('addCabecera', {
64 label: 'Transportista:', 65 label: 'Transportista:',
65 valor: transportista.COD + ' - ' + transportista.NOM 66 valor: codigo + ' - ' + transportista.NOM
66 }); 67 });
67 }); 68 });
68 buscar(transportista.COD); 69 buscar(transportista.COD);
69 } 70 }
70 71
71 function buscar(idTransportista) { 72 function buscar(idTransportista) {
72 focaAbmVehiculoService 73 focaAbmVehiculoService
73 .getVehiculosPorTransportista(idTransportista) 74 .getVehiculosPorTransportista(idTransportista)
74 .then(function(datos) { 75 .then(function(datos) {
75 $scope.vehiculos = datos.data; 76 $scope.vehiculos = datos.data;
76 }); 77 });
77 } 78 }
78 } 79 }
79 ]) 80 ])
80 .controller('focaAbmVehiculoController', [ 81 .controller('focaAbmVehiculoController', [
81 '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', 82 '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal',
82 'focaModalService', '$timeout', 'focaBotoneraLateralService', 83 'focaModalService', '$timeout', 'focaBotoneraLateralService',
83 function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, 84 function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal,
84 focaModalService, $timeout, focaBotoneraLateralService) { 85 focaModalService, $timeout, focaBotoneraLateralService) {
85 $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; 86 $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false;
86 $scope.now = new Date(); 87 $scope.now = new Date();
87 $scope.focused = 1; 88 $scope.focused = 1;
88 89
89 $timeout(function() { 90 $timeout(function() {
90 focaBotoneraLateralService.showSalir(false); 91 focaBotoneraLateralService.showSalir(false);
91 focaBotoneraLateralService.showPausar(false); 92 focaBotoneraLateralService.showPausar(false);
92 focaBotoneraLateralService.showCancelar(true); 93 focaBotoneraLateralService.showCancelar(true, '/vehiculo');
93 focaBotoneraLateralService.showGuardar(true, $scope.guardar); 94 focaBotoneraLateralService.showGuardar(true, $scope.guardar);
94 }); 95 });
95 96
96 if($scope.nuevo) { 97 if($scope.nuevo) {
97 focaAbmVehiculoService 98 focaAbmVehiculoService
98 .getTransportistaPorId($routeParams.idTransportista) 99 .getTransportistaPorId($routeParams.idTransportista)
99 .then(function(res) { 100 .then(function(res) {
101 var codigo = ('00000' + res.data.COD).slice(-5);
100 $scope.vehiculo.idTransportista = res.data.COD; 102 $scope.vehiculo.idTransportista = res.data.COD;
101 $scope.vehiculo.transportista = res.data; 103 $scope.vehiculo.transportista = res.data;
102 $scope.$broadcast('addCabecera', { 104 $scope.$broadcast('addCabecera', {
103 label: 'Transportista:', 105 label: 'Transportista:',
104 valor: res.data.COD + ' - ' + res.data.NOM 106 valor: codigo + ' - ' + res.data.NOM
105 }); 107 });
106 }); 108 });
107 } 109 }
108 $scope.vehiculo = {}; 110 $scope.vehiculo = {};
109 focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { 111 focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) {
110 if(res.data) { 112 if(res.data) {
113 var codigo = ('00000' + res.data.transportista.COD).slice(-5);
111 $scope.vehiculo = res.data; 114 $scope.vehiculo = res.data;
112 $scope.$broadcast('addCabecera', { 115 $scope.$broadcast('addCabecera', {
113 label: 'Transportista:', 116 label: 'Transportista:',
114 valor: res.data.transportista.COD + ' - ' + res.data.transportista.NOM 117 valor: codigo + ' - ' + res.data.transportista.NOM
115 }); 118 });
116 $scope.$broadcast('addCabecera', { 119 $scope.$broadcast('addCabecera', {
117 label: 'Unidad:', 120 label: 'Unidad:',
118 valor: res.data.codigo 121 valor: res.data.codigo
119 }); 122 });
120 } 123 }
121 }); 124 });
122 focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) 125 focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo)
123 .then(function(res) { 126 .then(function(res) {
124 $scope.cisternas = res.data; 127 $scope.cisternas = res.data;
125 }); 128 });
126 $scope.next = function(key) { 129 $scope.next = function(key) {
127 if (key === 13) $scope.focused++; 130 if (key === 13) $scope.focused++;
128 }; 131 };
129 $scope.cancelar = function() { 132 $scope.cancelar = function() {
130 $location.path('/vehiculo'); 133 $location.path('/vehiculo');
131 }; 134 };
132 $scope.editar = function(id) { 135 $scope.editar = function(id) {
133 $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/' + id); 136 $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/' + id);
134 }; 137 };
135 $scope.guardar = function() { 138 $scope.guardar = function() {
136 if(!$scope.vehiculo.transportista) { 139 //Valida si existe numero de unidad
137 focaModalService.alert('Elija Transportista'); 140 existeCodigoUnidad().then(function() {
138 return; 141 delete $scope.vehiculo.transportista;
139 } 142 focaAbmVehiculoService.guardarVehiculo($scope.vehiculo)
140 delete $scope.vehiculo.transportista; 143 .then(function(res){
141 focaAbmVehiculoService.guerdarVehiculo($scope.vehiculo).then(function(res) { 144 if($scope.nuevo) {
142 if($scope.nuevo) { 145 $location.path('/vehiculo/' + res.data.id +
143 $location.path('/vehiculo/' + res.data.id + '/' + res.data.idTransportista); 146 '/' + res.data.idTransportista);
144 } else { 147 } else {
145 $location.path('/vehiculo'); 148 $location.path('/vehiculo');
146 } 149 }
150 });
151 }, function(){
152 focaModalService.alert('Código de unidad existente');
147 }); 153 });
154
148 }; 155 };
149 $scope.solicitarConfirmacionCisterna = function(cisterna) { 156 $scope.solicitarConfirmacionCisterna = function(cisterna) {
150 focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + 157 focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' +
151 cisterna.id + ' ' + cisterna.codigo + ' ?').then( 158 cisterna.id + ' ' + cisterna.codigo + ' ?').then(
152 function(data) { 159 function(data) {
153 if(data) { 160 if(data) {
154 focaAbmVehiculoService.deleteCisterna(cisterna.id); 161 focaAbmVehiculoService.deleteCisterna(cisterna.id);
155 $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1); 162 $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1);
156 } 163 }
157 } 164 }
158 ); 165 );
159 }; 166 };
160 $scope.seleccionarTransportista = function() { 167 $scope.seleccionarTransportista = function() {
161 var modalInstance = $uibModal.open( 168 var modalInstance = $uibModal.open(
162 { 169 {
163 ariaLabelledBy: 'Busqueda de Transportista', 170 ariaLabelledBy: 'Busqueda de Transportista',
164 templateUrl: 'modal-proveedor.html', 171 templateUrl: 'modal-proveedor.html',
165 controller: 'focaModalProveedorCtrl', 172 controller: 'focaModalProveedorCtrl',
166 size: 'lg', 173 size: 'lg',
167 resolve: { 174 resolve: {
168 transportista: function() { 175 transportista: function() {
169 return true; 176 return true;
170 } 177 }
171 } 178 }
172 } 179 }
173 ); 180 );
174 modalInstance.result.then( 181 modalInstance.result.then(
175 function(transportista) { 182 function(transportista) {
176 $scope.vehiculo.idTransportista = transportista.COD; 183 $scope.vehiculo.idTransportista = transportista.COD;
177 $scope.vehiculo.transportista = transportista; 184 $scope.vehiculo.transportista = transportista;
178 }, function() { 185 }, function() {
179 186
180 } 187 }
181 ); 188 );
182 }; 189 };
190
191 function existeCodigoUnidad(){
192 return new Promise(function(resolve, reject) {
193 focaAbmVehiculoService
194 .getVehiculosPorTransportista($routeParams.idTransportista)
195 .then(function(res){
196 //Valida si existe numero de unidad
197 var existe = res.data.filter(function(vehiculo) {
198 return vehiculo.codigo === $scope.vehiculo.codigo &&
199 vehiculo.id !== $scope.vehiculo.id;
200 });
201
202 if(existe.length){
203 reject(existe);
204 } else {
205 resolve();
206 }
207 });
208 });
209 }
183 } 210 }
184 ]); 211 ]);
185 212
src/js/controllerCisterna.js
1 angular.module('focaAbmVehiculo') 1 angular.module('focaAbmVehiculo')
2 .controller('focaAbmVehiculoCisternaController', [ 2 .controller('focaAbmVehiculoCisternaController', [
3 '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', 3 '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal',
4 'focaModalService', 'focaBotoneraLateralService', '$timeout', 4 'focaModalService', 'focaBotoneraLateralService', '$timeout',
5 function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, 5 function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal,
6 focaModalService, focaBotoneraLateralService, $timeout) { 6 focaModalService, focaBotoneraLateralService, $timeout) {
7 $scope.editar = false; 7 $scope.editar = false;
8 $scope.now = new Date(); 8 $scope.now = new Date();
9 $scope.cisterna = { 9 $scope.cisterna = {
10 cisternaCarga: { 10 cisternaCarga: {
11 articulo: {} 11 articulo: {}
12 } 12 }
13 }; 13 };
14 14
15 $scope.focused = 1; 15 $scope.focused = 1;
16 $scope.next = function(key) { 16 $scope.next = function(key) {
17 if (key === 13) $scope.focused++; 17 if (key === 13) $scope.focused++;
18 }; 18 };
19 19
20 //SETEO BOTONERA LATERAL 20 //SETEO BOTONERA LATERAL
21 $timeout(function() { 21 $timeout(function() {
22 focaBotoneraLateralService.showSalir(false); 22 focaBotoneraLateralService.showSalir(false);
23 focaBotoneraLateralService.showPausar(false); 23 focaBotoneraLateralService.showPausar(false);
24 focaBotoneraLateralService.showCancelar(true); 24 focaBotoneraLateralService.showCancelar(true);
25 focaBotoneraLateralService.showGuardar(true, $scope.guardar); 25 focaBotoneraLateralService.showGuardar(true, $scope.guardar);
26 }); 26 });
27 27
28 focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { 28 focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) {
29 if(res.data) { 29 if(res.data) {
30 $scope.cisterna = res.data; 30 $scope.cisterna = res.data;
31 $scope.editar = true; 31 $scope.editar = true;
32 }else { 32 }else {
33 $scope.editar = false; 33 $scope.editar = false;
34 } 34 }
35 }); 35 });
36 focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { 36 focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) {
37 var codigo = ('00000' + res.data.transportista.COD).slice(-5);
37 $scope.$broadcast('addCabecera', { 38 $scope.$broadcast('addCabecera', {
38 label: 'Transportista:', 39 label: 'Transportista:',
39 valor: res.data.transportista.COD + ' - ' + res.data.transportista.NOM 40 valor: codigo + ' - ' + res.data.transportista.NOM
40 }); 41 });
41 $scope.$broadcast('addCabecera', { 42 $scope.$broadcast('addCabecera', {
42 label: 'Unidad:', 43 label: 'Unidad:',
43 valor: res.data.codigo 44 valor: res.data.codigo
44 }); 45 });
45 }); 46 });
46 $scope.cancelar = function() { 47 $scope.cancelar = function() {
47 $location.path('/vehiculo/' + $routeParams.idVehiculo); 48 $location.path('/vehiculo/' + $routeParams.idVehiculo);
48 }; 49 };
49 $scope.guardar = function() { 50 $scope.guardar = function() {
50 if(!$scope.cisterna.unidadMedida) { 51 if(!$scope.cisterna.unidadMedida) {
51 focaModalService.alert('Ingrese unidad de medida'); 52 focaModalService.alert('Ingrese unidad de medida');
52 return; 53 return;
53 } 54 }
54 if(!$scope.cisterna.cisternaCarga.articulo) { 55 if(!$scope.cisterna.cisternaCarga.articulo) {
55 focaModalService.alert('Ingrese producto'); 56 focaModalService.alert('Ingrese producto');
56 return; 57 return;
57 } 58 }
58 $scope.cisterna.idVehiculo = $routeParams.idVehiculo; 59 existeCodigoCisterna().then(function() {
59 delete $scope.cisterna.unidadMedida; 60 $scope.cisterna.idVehiculo = $routeParams.idVehiculo;
60 delete $scope.cisterna.cisternaCarga.articulo; 61 delete $scope.cisterna.unidadMedida;
61 focaAbmVehiculoService.guardarCisterna($scope.cisterna).then(function() { 62 delete $scope.cisterna.cisternaCarga.articulo;
62 $location.path('/vehiculo/' + $routeParams.idVehiculo); 63 focaAbmVehiculoService.guardarCisterna($scope.cisterna).then(function(){
64 $location.path('/vehiculo/' + $routeParams.idVehiculo);
65 });
66 }, function() {
67 focaModalService.alert('Código de cisterna existente');
63 }); 68 });
69
64 }; 70 };
65 71
66 // $scope.seleccionarArticulo = function() { 72 // $scope.seleccionarArticulo = function() {
67 // var modalInstance = $uibModal.open( 73 // var modalInstance = $uibModal.open(
68 // { 74 // {
69 // ariaLabelledBy: 'Busqueda de Productos', 75 // ariaLabelledBy: 'Busqueda de Productos',
70 // templateUrl: 'modal-busqueda-productos.html', 76 // templateUrl: 'modal-busqueda-productos.html',
71 // controller: 'modalBusquedaProductosCtrl', 77 // controller: 'modalBusquedaProductosCtrl',
72 // resolve: { 78 // resolve: {
73 // parametroProducto: { 79 // parametroProducto: {
74 // idLista: -1, 80 // idLista: -1,
75 // cotizacion: 1, 81 // cotizacion: 1,
76 // simbolo: '$' 82 // simbolo: '$'
77 // } 83 // }
78 // }, 84 // },
79 // size: 'lg' 85 // size: 'lg'
80 // } 86 // }
81 // ); 87 // );
82 // modalInstance.result.then( 88 // modalInstance.result.then(
83 // function(producto) { 89 // function(producto) {
84 // $scope.cisterna.cisternaCarga.idProducto = producto.id, 90 // $scope.cisterna.cisternaCarga.idProducto = producto.id,
85 // $scope.cisterna.cisternaCarga.articulo.DetArt = producto.descripcion; 91 // $scope.cisterna.cisternaCarga.articulo.DetArt = producto.descripcion;
86 // }, function() { 92 // }, function() {
87 // // funcion ejecutada cuando se cancela el modal 93 // // funcion ejecutada cuando se cancela el modal
88 // } 94 // }
89 // ); 95 // );
90 // }; 96 // };
91 97
92 $scope.seleccionarUnidadMedida = function() { 98 $scope.seleccionarUnidadMedida = function() {
93 var modalInstance = $uibModal.open( 99 var modalInstance = $uibModal.open(
94 { 100 {
95 ariaLabelledBy: 'Busqueda de Unidades de medida', 101 ariaLabelledBy: 'Busqueda de Unidades de medida',
96 templateUrl: 'modal-unidad-medida.html', 102 templateUrl: 'modal-unidad-medida.html',
97 controller: 'focaModalUnidadMedidaCtrl', 103 controller: 'focaModalUnidadMedidaCtrl',
98 size: 'lg' 104 size: 'lg'
99 } 105 }
100 ); 106 );
101 modalInstance.result.then(function(unidaMedida) { 107 modalInstance.result.then(function(unidaMedida) {
102 $scope.cisterna.idUnidadMedida = unidaMedida.ID; 108 $scope.cisterna.idUnidadMedida = unidaMedida.ID;
103 $scope.cisterna.unidadMedida = unidaMedida; 109 $scope.cisterna.unidadMedida = unidaMedida;
104 }); 110 });
105 }; 111 };
112
113 function existeCodigoCisterna(){
114 return new Promise(function(resolve, reject) {
115 focaAbmVehiculoService
116 .getCisternadoPorVehiculo($routeParams.idVehiculo)
117 .then(function(res){
118 //Valida si existe numero de unidad
119 var existe = res.data.filter(function(cisterna) {
120 return cisterna.codigo === $scope.cisterna.codigo;
121 });
122
123 if(existe.length){
124 reject(existe);
125 } else {
126 resolve();
127 }
128 });
129 });
130 }
106 } 131 }
107 ]); 132 ]);
108 133
1 angular.module('focaAbmVehiculo') 1 angular.module('focaAbmVehiculo')
2 .factory('focaAbmVehiculoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .factory('focaAbmVehiculoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 return { 3 return {
4 getVehiculos: function() { 4 getVehiculos: function() {
5 return $http.get(API_ENDPOINT.URL + '/vehiculo'); 5 return $http.get(API_ENDPOINT.URL + '/vehiculo');
6 }, 6 },
7 getVehiculo: function(id) { 7 getVehiculo: function(id) {
8 return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); 8 return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id);
9 }, 9 },
10 getTransportistas: function() { 10 getTransportistas: function() {
11 return $http.get(API_ENDPOINT.URL + '/transportista'); 11 return $http.get(API_ENDPOINT.URL + '/transportista');
12 }, 12 },
13 guerdarVehiculo: function(vehiculo) { 13 guardarVehiculo: function(vehiculo) {
14 return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); 14 return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo});
15 }, 15 },
16 deleteVehiculo: function(id) { 16 deleteVehiculo: function(id) {
17 return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); 17 return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id);
18 }, 18 },
19 getCisternadoPorVehiculo: function(idVehiculo) { 19 getCisternadoPorVehiculo: function(idVehiculo) {
20 return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); 20 return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo);
21 }, 21 },
22 getCisterna: function(id) { 22 getCisterna: function(id) {
23 return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); 23 return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id);
24 }, 24 },
25 guardarCisterna: function(cisterna) { 25 guardarCisterna: function(cisterna) {
26 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); 26 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna});
27 }, 27 },
28 deleteCisterna: function(id) { 28 deleteCisterna: function(id) {
29 return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); 29 return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id);
30 }, 30 },
31 getVehiculosPorTransportista: function(id) { 31 getVehiculosPorTransportista: function(id) {
32 return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); 32 return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id);
33 }, 33 },
34 getTransportistaPorId: function(id) { 34 getTransportistaPorId: function(id) {
35 return $http.get(API_ENDPOINT.URL + '/transportista/' + id); 35 return $http.get(API_ENDPOINT.URL + '/transportista/' + id);
36 }, 36 },
37 transportistaSeleccionado: {} 37 transportistaSeleccionado: {}
38 }; 38 };
39 }]); 39 }]);
40 40