Commit bbd0bd31dbae3981462110628c03f4d791af8115
Exists in
master
Merge branch 'master' into 'master'
Custom button salir See merge request !15
Showing
2 changed files
Show diff stats
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 = [{ | 9 | $scope.botonera = [{ |
| 10 | label: 'Transportista', | 10 | label: 'Transportista', |
| 11 | image: 'cliente.png' | 11 | image: 'cliente.png' |
| 12 | }]; | 12 | }]; |
| 13 | 13 | ||
| 14 | //SETEO BOTONERA LATERAL | 14 | //SETEO BOTONERA LATERAL |
| 15 | focaBotoneraLateralService.showSalir(true); | 15 | focaBotoneraLateralService.showSalir(true); |
| 16 | focaBotoneraLateralService.showPausar(false); | 16 | focaBotoneraLateralService.showPausar(false); |
| 17 | focaBotoneraLateralService.showCancelar(false); | 17 | focaBotoneraLateralService.showCancelar(false); |
| 18 | focaBotoneraLateralService.showGuardar(false); | 18 | focaBotoneraLateralService.showGuardar(false); |
| 19 | 19 | ||
| 20 | if(focaAbmVehiculoService.transportistaSeleccionado.COD) { | 20 | if(focaAbmVehiculoService.transportistaSeleccionado.COD) { |
| 21 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); | 21 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); |
| 22 | } | 22 | } |
| 23 | focaAbmVehiculoService.cleanCisternasLocal(); | 23 | focaAbmVehiculoService.cleanCisternasLocal(); |
| 24 | $scope.editar = function(id) { | 24 | $scope.editar = function(id) { |
| 25 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | 25 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); |
| 26 | }; | 26 | }; |
| 27 | $scope.solicitarConfirmacion = function(vehiculo) { | 27 | $scope.solicitarConfirmacion = function(vehiculo) { |
| 28 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | 28 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + |
| 29 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | 29 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( |
| 30 | function(data) { | 30 | function(data) { |
| 31 | if(data) { | 31 | if(data) { |
| 32 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); | 32 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); |
| 33 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 33 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | ); | 36 | ); |
| 37 | }; | 37 | }; |
| 38 | $scope.seleccionarTransportista = function() { | 38 | $scope.seleccionarTransportista = function() { |
| 39 | var modalInstance = $uibModal.open( | 39 | var modalInstance = $uibModal.open( |
| 40 | { | 40 | { |
| 41 | ariaLabelledBy: 'Busqueda de Transportista', | 41 | ariaLabelledBy: 'Busqueda de Transportista', |
| 42 | templateUrl: 'modal-proveedor.html', | 42 | templateUrl: 'modal-proveedor.html', |
| 43 | controller: 'focaModalProveedorCtrl', | 43 | controller: 'focaModalProveedorCtrl', |
| 44 | size: 'lg', | 44 | size: 'lg', |
| 45 | resolve: { | 45 | resolve: { |
| 46 | transportista: function() { | 46 | transportista: function() { |
| 47 | return true; | 47 | return true; |
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | ); | 51 | ); |
| 52 | modalInstance.result.then( | 52 | modalInstance.result.then( |
| 53 | function(transportista) { | 53 | function(transportista) { |
| 54 | elegirTransportista(transportista); | 54 | elegirTransportista(transportista); |
| 55 | focaAbmVehiculoService.transportistaSeleccionado = transportista; | 55 | focaAbmVehiculoService.transportistaSeleccionado = transportista; |
| 56 | }, function() { | 56 | }, function() { |
| 57 | 57 | ||
| 58 | } | 58 | } |
| 59 | ); | 59 | ); |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | function elegirTransportista(transportista) { | 62 | function elegirTransportista(transportista) { |
| 63 | var codigo = ('00000' + transportista.COD).slice(-5); | 63 | var codigo = ('00000' + transportista.COD).slice(-5); |
| 64 | $scope.idTransportista = transportista.COD; | 64 | $scope.idTransportista = transportista.COD; |
| 65 | $scope.filtros = transportista.NOM.trim(); | 65 | $scope.filtros = transportista.NOM.trim(); |
| 66 | $timeout(function() { | 66 | $timeout(function() { |
| 67 | $scope.$broadcast('addCabecera', { | 67 | $scope.$broadcast('addCabecera', { |
| 68 | label: 'Transportista:', | 68 | label: 'Transportista:', |
| 69 | valor: codigo + ' - ' + transportista.NOM | 69 | valor: codigo + ' - ' + transportista.NOM |
| 70 | }); | 70 | }); |
| 71 | }); | 71 | }); |
| 72 | buscar(transportista.COD); | 72 | buscar(transportista.COD); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | function buscar(idTransportista) { | 75 | function buscar(idTransportista) { |
| 76 | focaAbmVehiculoService | 76 | focaAbmVehiculoService |
| 77 | .getVehiculosPorTransportista(idTransportista) | 77 | .getVehiculosPorTransportista(idTransportista) |
| 78 | .then(function(datos) { | 78 | .then(function(datos) { |
| 79 | $scope.vehiculos = datos.data; | 79 | $scope.vehiculos = datos.data; |
| 80 | }); | 80 | }); |
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | ]) | 83 | ]) |
| 84 | .controller('focaAbmVehiculoController', [ | 84 | .controller('focaAbmVehiculoController', [ |
| 85 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 85 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
| 86 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$window', | 86 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$window', |
| 87 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 87 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
| 88 | focaModalService, $timeout, focaBotoneraLateralService, $window) { | 88 | focaModalService, $timeout, focaBotoneraLateralService, $window) { |
| 89 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; | 89 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; |
| 90 | $scope.now = new Date(); | 90 | $scope.now = new Date(); |
| 91 | $scope.focused = 1; | 91 | $scope.focused = 1; |
| 92 | $scope.transportistaStamp = ''; | 92 | $scope.transportistaStamp = ''; |
| 93 | $scope.cisternas = []; | 93 | $scope.cisternas = []; |
| 94 | 94 | ||
| 95 | $timeout(function() { | 95 | $timeout(function() { |
| 96 | focaBotoneraLateralService.showSalir(true); | 96 | focaBotoneraLateralService.showSalir(false); |
| 97 | focaBotoneraLateralService.showPausar(false); | 97 | focaBotoneraLateralService.showPausar(false); |
| 98 | focaBotoneraLateralService.showCancelar(); | 98 | focaBotoneraLateralService.showCancelar(false); |
| 99 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 99 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 100 | focaBotoneraLateralService.addCustomButton('Salir', $scope.cancelar); | ||
| 100 | }); | 101 | }); |
| 101 | 102 | ||
| 102 | if($scope.nuevo) { | 103 | if($scope.nuevo) { |
| 103 | focaAbmVehiculoService | 104 | focaAbmVehiculoService |
| 104 | .getTransportistaPorId($routeParams.idTransportista) | 105 | .getTransportistaPorId($routeParams.idTransportista) |
| 105 | .then(function(res) { | 106 | .then(function(res) { |
| 106 | var codigo = ('00000' + res.data.COD).slice(-5); | 107 | var codigo = ('00000' + res.data.COD).slice(-5); |
| 107 | $scope.vehiculo.idTransportista = res.data.COD; | 108 | $scope.vehiculo.idTransportista = res.data.COD; |
| 108 | $scope.vehiculo.transportista = res.data; | 109 | $scope.vehiculo.transportista = res.data; |
| 109 | $scope.$broadcast('addCabecera', { | 110 | $scope.$broadcast('addCabecera', { |
| 110 | label: 'Transportista:', | 111 | label: 'Transportista:', |
| 111 | valor: codigo + ' - ' + res.data.NOM | 112 | valor: codigo + ' - ' + res.data.NOM |
| 112 | }); | 113 | }); |
| 113 | }); | 114 | }); |
| 114 | } | 115 | } |
| 115 | $scope.vehiculo = {}; | 116 | $scope.vehiculo = {}; |
| 116 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { | 117 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { |
| 117 | if(res.data) { | 118 | if(res.data) { |
| 118 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); | 119 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); |
| 119 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM | 120 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM |
| 120 | 121 | ||
| 121 | $scope.vehiculo = res.data; | 122 | $scope.vehiculo = res.data; |
| 122 | $scope.$broadcast('addCabecera', { | 123 | $scope.$broadcast('addCabecera', { |
| 123 | label: 'Transportista:', | 124 | label: 'Transportista:', |
| 124 | valor: $scope.transportistaStamp | 125 | valor: $scope.transportistaStamp |
| 125 | }); | 126 | }); |
| 126 | $scope.$broadcast('addCabecera', { | 127 | $scope.$broadcast('addCabecera', { |
| 127 | label: 'Unidad:', | 128 | label: 'Unidad:', |
| 128 | valor: res.data.codigo | 129 | valor: res.data.codigo |
| 129 | }); | 130 | }); |
| 130 | } | 131 | } |
| 131 | }); | 132 | }); |
| 132 | focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) | 133 | focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) |
| 133 | .then(function(res) { | 134 | .then(function(res) { |
| 134 | //CONCATENA LAS CISTERNAS DEL SERVICIO Y LAS DE LA BASE DE DATOS | 135 | //CONCATENA LAS CISTERNAS DEL SERVICIO Y LAS DE LA BASE DE DATOS |
| 135 | $scope.cisternas = focaAbmVehiculoService.getCisternasLocal().concat(res.data); | 136 | $scope.cisternas = focaAbmVehiculoService.getCisternasLocal().concat(res.data); |
| 136 | }); | 137 | }); |
| 137 | $scope.next = function(key) { | 138 | $scope.next = function(key) { |
| 138 | if (key === 13) $scope.focused++; | 139 | if (key === 13) $scope.focused++; |
| 139 | }; | 140 | }; |
| 140 | $scope.cancelar = function() { | 141 | $scope.cancelar = function() { |
| 141 | $location.path('/vehiculo'); | 142 | $location.path('/vehiculo'); |
| 142 | }; | 143 | }; |
| 143 | $scope.editar = function(cisterna) { | 144 | $scope.editar = function(cisterna) { |
| 144 | if(cisterna) { | 145 | if(cisterna) { |
| 145 | if(cisterna.idTemp != undefined) { | 146 | if(cisterna.idTemp != undefined) { |
| 146 | $location.path('/vehiculo/' + $routeParams.idVehiculo + | 147 | $location.path('/vehiculo/' + $routeParams.idVehiculo + |
| 147 | '/cisterna/0/' + cisterna.idTemp); | 148 | '/cisterna/0/' + cisterna.idTemp); |
| 148 | }else { | 149 | }else { |
| 149 | $location.path('/vehiculo/' + $routeParams.idVehiculo + | 150 | $location.path('/vehiculo/' + $routeParams.idVehiculo + |
| 150 | '/cisterna/' + cisterna.id); | 151 | '/cisterna/' + cisterna.id); |
| 151 | } | 152 | } |
| 152 | }else { | 153 | }else { |
| 153 | $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/0/'); | 154 | $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/0/'); |
| 154 | } | 155 | } |
| 155 | }; | 156 | }; |
| 156 | $scope.guardar = function() { | 157 | $scope.guardar = function() { |
| 157 | //Valida si existe numero de unidad | 158 | //Valida si existe numero de unidad |
| 158 | if(!validaTotalCargas()) { | 159 | if(!validaTotalCargas()) { |
| 159 | focaModalService.alert('La suma de las capacidades de las cisternas' + | 160 | focaModalService.alert('La suma de las capacidades de las cisternas' + |
| 160 | ' debe ser igual a la capacidad total del vehículo'); | 161 | ' debe ser igual a la capacidad total del vehículo'); |
| 161 | return; | 162 | return; |
| 162 | } | 163 | } |
| 163 | validaCodigoUnidad().then(function() { | 164 | validaCodigoUnidad().then(function() { |
| 164 | delete $scope.vehiculo.transportista; | 165 | delete $scope.vehiculo.transportista; |
| 165 | delete $scope.vehiculo.cisternas; | 166 | delete $scope.vehiculo.cisternas; |
| 166 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) | 167 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) |
| 167 | .then(function(res) { | 168 | .then(function(res) { |
| 168 | if($scope.nuevo) { | 169 | if($scope.nuevo) { |
| 169 | $location.path('/vehiculo/' + res.data.id + | 170 | $location.path('/vehiculo/' + res.data.id + |
| 170 | '/' + res.data.idTransportista); | 171 | '/' + res.data.idTransportista); |
| 171 | }else { | 172 | }else { |
| 172 | guardarCisternas().then(function() { | 173 | guardarCisternas().then(function() { |
| 173 | $window.location.assign('/#!/vehiculo'); | 174 | $window.location.assign('/#!/vehiculo'); |
| 174 | }); | 175 | }); |
| 175 | } | 176 | } |
| 176 | }); | 177 | }); |
| 177 | }, function(){ | 178 | }, function(){ |
| 178 | focaModalService.alert('Código de unidad existente'); | 179 | focaModalService.alert('Código de unidad existente'); |
| 179 | }); | 180 | }); |
| 180 | 181 | ||
| 181 | }; | 182 | }; |
| 182 | $scope.solicitarConfirmacionCisterna = function(cisterna) { | 183 | $scope.solicitarConfirmacionCisterna = function(cisterna) { |
| 183 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + | 184 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + |
| 184 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( | 185 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( |
| 185 | function(data) { | 186 | function(data) { |
| 186 | if(data) { | 187 | if(data) { |
| 187 | if(cisterna.id) { | 188 | if(cisterna.id) { |
| 188 | focaAbmVehiculoService.deleteCisterna(cisterna.id); | 189 | focaAbmVehiculoService.deleteCisterna(cisterna.id); |
| 189 | } | 190 | } |
| 190 | $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1); | 191 | $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1); |
| 191 | } | 192 | } |
| 192 | } | 193 | } |
| 193 | ); | 194 | ); |
| 194 | }; | 195 | }; |
| 195 | 196 | ||
| 196 | function validaCodigoUnidad() { | 197 | function validaCodigoUnidad() { |
| 197 | return new Promise(function(resolve, reject) { | 198 | return new Promise(function(resolve, reject) { |
| 198 | focaAbmVehiculoService | 199 | focaAbmVehiculoService |
| 199 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) | 200 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) |
| 200 | .then(function(res) { | 201 | .then(function(res) { |
| 201 | //Valida si existe numero de unidad | 202 | //Valida si existe numero de unidad |
| 202 | var existe = res.data.filter(function(vehiculo) { | 203 | var existe = res.data.filter(function(vehiculo) { |
| 203 | return vehiculo.codigo === $scope.vehiculo.codigo && | 204 | return vehiculo.codigo === $scope.vehiculo.codigo && |
| 204 | vehiculo.id !== $scope.vehiculo.id; | 205 | vehiculo.id !== $scope.vehiculo.id; |
| 205 | }); | 206 | }); |
| 206 | 207 | ||
| 207 | if(existe.length) { | 208 | if(existe.length) { |
| 208 | reject(existe); | 209 | reject(existe); |
| 209 | }else { | 210 | }else { |
| 210 | resolve(); | 211 | resolve(); |
| 211 | } | 212 | } |
| 212 | }); | 213 | }); |
| 213 | }); | 214 | }); |
| 214 | } | 215 | } |
| 215 | 216 | ||
| 216 | function validaTotalCargas() { | 217 | function validaTotalCargas() { |
| 217 | var total = 0; | 218 | var total = 0; |
| 218 | $scope.cisternas.forEach(function(cisterna) { | 219 | $scope.cisternas.forEach(function(cisterna) { |
| 219 | total += parseInt(cisterna.capacidad); | 220 | total += parseInt(cisterna.capacidad); |
| 220 | }); | 221 | }); |
| 221 | return $scope.vehiculo.capacidad == total; | 222 | return $scope.vehiculo.capacidad == total; |
| 222 | } | 223 | } |
| 223 | 224 | ||
| 224 | function guardarCisternas() { | 225 | function guardarCisternas() { |
| 225 | var promesas = []; | 226 | var promesas = []; |
| 226 | 227 | ||
| 227 | focaAbmVehiculoService.getCisternasLocal().forEach(function(cisterna) { | 228 | focaAbmVehiculoService.getCisternasLocal().forEach(function(cisterna) { |
| 228 | delete cisterna.unidadMedida; | 229 | delete cisterna.unidadMedida; |
| 229 | delete cisterna.idTemp; | 230 | delete cisterna.idTemp; |
| 230 | promesas.push(focaAbmVehiculoService.guardarCisterna(cisterna)); | 231 | promesas.push(focaAbmVehiculoService.guardarCisterna(cisterna)); |
| 231 | }); | 232 | }); |
| 232 | return Promise.all(promesas); | 233 | return Promise.all(promesas); |
| 233 | } | 234 | } |
| 234 | } | 235 | } |
| 235 | ]); | 236 | ]); |
| 236 | 237 |
src/js/service.js
| 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 | var cisternas = []; | 3 | var cisternas = []; |
| 4 | return { | 4 | return { |
| 5 | getVehiculos: function() { | 5 | getVehiculos: function() { |
| 6 | return $http.get(API_ENDPOINT.URL + '/vehiculo'); | 6 | return $http.get(API_ENDPOINT.URL + '/vehiculo'); |
| 7 | }, | 7 | }, |
| 8 | getVehiculo: function(id) { | 8 | getVehiculo: function(id) { |
| 9 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); | 9 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); |
| 10 | }, | 10 | }, |
| 11 | getTransportistas: function() { | 11 | getTransportistas: function() { |
| 12 | return $http.get(API_ENDPOINT.URL + '/transportista'); | 12 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
| 13 | }, | 13 | }, |
| 14 | guardarVehiculo: function(vehiculo) { | 14 | guardarVehiculo: function(vehiculo) { |
| 15 | return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); | 15 | return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); |
| 16 | }, | 16 | }, |
| 17 | deleteVehiculo: function(id) { | 17 | deleteVehiculo: function(id) { |
| 18 | return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); | 18 | return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); |
| 19 | }, | 19 | }, |
| 20 | getCisternadoPorVehiculo: function(idVehiculo) { | 20 | getCisternadoPorVehiculo: function(idVehiculo) { |
| 21 | return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); | 21 | return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); |
| 22 | }, | 22 | }, |
| 23 | getCisterna: function(id) { | 23 | getCisterna: function(id) { |
| 24 | return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); | 24 | return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); |
| 25 | }, | 25 | }, |
| 26 | getCisternasLocal: function() { | 26 | getCisternasLocal: function() { |
| 27 | return cisternas; | 27 | return cisternas; |
| 28 | }, | 28 | }, |
| 29 | guardarCisternaLocal: function(cisterna, idTemp) { | 29 | guardarCisternaLocal: function(cisterna, idTemp) { |
| 30 | if(idTemp){ | 30 | if(idTemp) { |
| 31 | cisterna.idTemp = idTemp; | 31 | cisterna.idTemp = idTemp; |
| 32 | cisternas[idTemp] = cisterna; | 32 | cisternas[idTemp] = cisterna; |
| 33 | }else { | 33 | }else { |
| 34 | cisterna.idTemp = cisternas.length; | 34 | cisterna.idTemp = cisternas.length; |
| 35 | cisternas.push(cisterna); | 35 | cisternas.push(cisterna); |
| 36 | } | 36 | } |
| 37 | }, | 37 | }, |
| 38 | cleanCisternasLocal: function(){ | 38 | cleanCisternasLocal: function(){ |
| 39 | cisternas = []; | 39 | cisternas = []; |
| 40 | }, | 40 | }, |
| 41 | guardarCisterna: function(cisterna) { | 41 | guardarCisterna: function(cisterna) { |
| 42 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); | 42 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); |
| 43 | }, | 43 | }, |
| 44 | deleteCisterna: function(id) { | 44 | deleteCisterna: function(id) { |
| 45 | return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); | 45 | return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); |
| 46 | }, | 46 | }, |
| 47 | getVehiculosPorTransportista: function(id) { | 47 | getVehiculosPorTransportista: function(id) { |
| 48 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); | 48 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); |
| 49 | }, | 49 | }, |
| 50 | getTransportistaPorId: function(id) { | 50 | getTransportistaPorId: function(id) { |
| 51 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); | 51 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); |
| 52 | }, | 52 | }, |
| 53 | transportistaSeleccionado: {} | 53 | transportistaSeleccionado: {} |
| 54 | }; | 54 | }; |
| 55 | }]); | 55 | }]); |
| 56 | 56 |