Commit 3cb8980ef43f8d488b185cc10e19e374d9dab8a4
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master See merge request !21
Showing
5 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(false); | 15 | focaBotoneraLateralService.showSalir(false); |
| 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 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 19 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
| 20 | 20 | ||
| 21 | if(focaAbmVehiculoService.transportistaSeleccionado.COD) { | 21 | if(focaAbmVehiculoService.transportistaSeleccionado.COD) { |
| 22 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); | 22 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); |
| 23 | } | 23 | } |
| 24 | focaAbmVehiculoService.cleanCisternasLocal(); | ||
| 25 | $scope.editar = function(id) { | 24 | $scope.editar = function(id) { |
| 26 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | 25 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); |
| 27 | }; | 26 | }; |
| 28 | $scope.solicitarConfirmacion = function(vehiculo) { | 27 | $scope.solicitarConfirmacion = function(vehiculo) { |
| 29 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | 28 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + |
| 30 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | 29 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( |
| 31 | function(data) { | 30 | function(data) { |
| 32 | if(data) { | 31 | if(data) { |
| 33 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); | 32 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); |
| 34 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 33 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
| 35 | } | 34 | } |
| 36 | } | 35 | } |
| 37 | ); | 36 | ); |
| 38 | }; | 37 | }; |
| 39 | $scope.seleccionarTransportista = function() { | 38 | $scope.seleccionarTransportista = function() { |
| 40 | var modalInstance = $uibModal.open( | 39 | var modalInstance = $uibModal.open( |
| 41 | { | 40 | { |
| 42 | ariaLabelledBy: 'Busqueda de Transportista', | 41 | ariaLabelledBy: 'Busqueda de Transportista', |
| 43 | templateUrl: 'modal-proveedor.html', | 42 | templateUrl: 'modal-proveedor.html', |
| 44 | controller: 'focaModalProveedorCtrl', | 43 | controller: 'focaModalProveedorCtrl', |
| 45 | size: 'lg', | 44 | size: 'lg', |
| 46 | resolve: { | 45 | resolve: { |
| 47 | transportista: function() { | 46 | transportista: function() { |
| 48 | return true; | 47 | return true; |
| 49 | } | 48 | } |
| 50 | } | 49 | } |
| 51 | } | 50 | } |
| 52 | ); | 51 | ); |
| 53 | modalInstance.result.then( | 52 | modalInstance.result.then( |
| 54 | function(transportista) { | 53 | function(transportista) { |
| 55 | elegirTransportista(transportista); | 54 | elegirTransportista(transportista); |
| 56 | focaAbmVehiculoService.transportistaSeleccionado = transportista; | 55 | focaAbmVehiculoService.transportistaSeleccionado = transportista; |
| 57 | }, function() { | 56 | }, function() { |
| 58 | 57 | ||
| 59 | } | 58 | } |
| 60 | ); | 59 | ); |
| 61 | }; | 60 | }; |
| 62 | 61 | ||
| 63 | function elegirTransportista(transportista) { | 62 | function elegirTransportista(transportista) { |
| 64 | var codigo = ('00000' + transportista.COD).slice(-5); | 63 | var codigo = ('00000' + transportista.COD).slice(-5); |
| 65 | $scope.idTransportista = transportista.COD; | 64 | $scope.idTransportista = transportista.COD; |
| 66 | $scope.filtros = transportista.NOM.trim(); | 65 | $scope.filtros = transportista.NOM.trim(); |
| 67 | $timeout(function() { | 66 | $timeout(function() { |
| 68 | $scope.$broadcast('addCabecera', { | 67 | $scope.$broadcast('addCabecera', { |
| 69 | label: 'Transportista:', | 68 | label: 'Transportista:', |
| 70 | valor: codigo + ' - ' + transportista.NOM | 69 | valor: codigo + ' - ' + transportista.NOM |
| 71 | }); | 70 | }); |
| 72 | }); | 71 | }); |
| 73 | buscar(transportista.COD); | 72 | buscar(transportista.COD); |
| 74 | } | 73 | } |
| 75 | 74 | ||
| 76 | function buscar(idTransportista) { | 75 | function buscar(idTransportista) { |
| 77 | focaAbmVehiculoService | 76 | focaAbmVehiculoService |
| 78 | .getVehiculosPorTransportista(idTransportista) | 77 | .getVehiculosPorTransportista(idTransportista) |
| 79 | .then(function(datos) { | 78 | .then(function(datos) { |
| 80 | $scope.vehiculos = datos.data; | 79 | $scope.vehiculos = datos.data; |
| 81 | }); | 80 | }); |
| 82 | } | 81 | } |
| 83 | function salir() { | 82 | function salir() { |
| 84 | focaAbmVehiculoService.transportistaSeleccionado = {}; | 83 | focaAbmVehiculoService.transportistaSeleccionado = {}; |
| 85 | $location.path('/'); | 84 | $location.path('/'); |
| 86 | } | 85 | } |
| 87 | } | 86 | } |
| 88 | ]) | 87 | ]) |
| 89 | .controller('focaAbmVehiculoController', [ | 88 | .controller('focaAbmVehiculoController', [ |
| 90 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 89 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
| 91 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$window', | 90 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$window', |
| 92 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 91 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
| 93 | focaModalService, $timeout, focaBotoneraLateralService, $window) { | 92 | focaModalService, $timeout, focaBotoneraLateralService, $window) { |
| 94 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; | 93 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; |
| 95 | $scope.now = new Date(); | 94 | $scope.now = new Date(); |
| 96 | $scope.focused = 1; | 95 | $scope.focused = 1; |
| 97 | $scope.transportistaStamp = ''; | 96 | $scope.transportistaStamp = ''; |
| 98 | $scope.cisternas = []; | 97 | $scope.cisternas = []; |
| 99 | 98 | ||
| 100 | $timeout(function() { | 99 | $timeout(function() { |
| 101 | focaBotoneraLateralService.showSalir(false); | 100 | focaBotoneraLateralService.showSalir(false); |
| 102 | focaBotoneraLateralService.showPausar(false); | 101 | focaBotoneraLateralService.showPausar(false); |
| 103 | focaBotoneraLateralService.showCancelar(false); | 102 | focaBotoneraLateralService.showCancelar(false); |
| 104 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 103 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 105 | focaBotoneraLateralService.addCustomButton('Salir', $scope.cancelar); | 104 | focaBotoneraLateralService.addCustomButton('Salir', $scope.cancelar); |
| 106 | }); | 105 | }); |
| 107 | 106 | ||
| 108 | if($scope.nuevo) { | 107 | if($scope.nuevo) { |
| 109 | focaAbmVehiculoService | 108 | focaAbmVehiculoService |
| 110 | .getTransportistaPorId($routeParams.idTransportista) | 109 | .getTransportistaPorId($routeParams.idTransportista) |
| 111 | .then(function(res) { | 110 | .then(function(res) { |
| 112 | var codigo = ('00000' + res.data.COD).slice(-5); | 111 | var codigo = ('00000' + res.data.COD).slice(-5); |
| 113 | $scope.vehiculo.idTransportista = res.data.COD; | 112 | $scope.vehiculo.idTransportista = res.data.COD; |
| 114 | $scope.vehiculo.transportista = res.data; | 113 | $scope.vehiculo.transportista = res.data; |
| 115 | $scope.$broadcast('addCabecera', { | 114 | $scope.$broadcast('addCabecera', { |
| 116 | label: 'Transportista:', | 115 | label: 'Transportista:', |
| 117 | valor: codigo + ' - ' + res.data.NOM | 116 | valor: codigo + ' - ' + res.data.NOM |
| 118 | }); | 117 | }); |
| 119 | }); | 118 | }); |
| 120 | } | 119 | } |
| 121 | $scope.vehiculo = {}; | 120 | $scope.vehiculo = {}; |
| 122 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { | 121 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { |
| 123 | if(res.data) { | 122 | if(res.data) { |
| 124 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); | 123 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); |
| 125 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM | 124 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM; |
| 126 | 125 | ||
| 127 | $scope.vehiculo = res.data; | 126 | $scope.vehiculo = res.data; |
| 128 | $scope.$broadcast('addCabecera', { | 127 | $scope.$broadcast('addCabecera', { |
| 129 | label: 'Transportista:', | 128 | label: 'Transportista:', |
| 130 | valor: $scope.transportistaStamp | 129 | valor: $scope.transportistaStamp |
| 131 | }); | 130 | }); |
| 132 | $scope.$broadcast('addCabecera', { | 131 | $scope.$broadcast('addCabecera', { |
| 133 | label: 'Unidad:', | 132 | label: 'Unidad:', |
| 134 | valor: res.data.codigo | 133 | valor: res.data.codigo |
| 135 | }); | 134 | }); |
| 135 | focaAbmVehiculoService | ||
| 136 | .getCisternas($routeParams.idVehiculo) | ||
| 137 | .then(function(res) { | ||
| 138 | $scope.cisternas = res; | ||
| 139 | $scope.$apply(); | ||
| 140 | }); | ||
| 136 | } | 141 | } |
| 137 | }); | 142 | }); |
| 138 | focaAbmVehiculoService.getCisternadoPorVehiculo($routeParams.idVehiculo) | 143 | |
| 139 | .then(function(res) { | ||
| 140 | //CONCATENA LAS CISTERNAS DEL SERVICIO Y LAS DE LA BASE DE DATOS | ||
| 141 | $scope.cisternas = focaAbmVehiculoService.getCisternasLocal().concat(res.data); | ||
| 142 | }); | ||
| 143 | $scope.next = function(key) { | 144 | $scope.next = function(key) { |
| 144 | if (key === 13) $scope.focused++; | 145 | if (key === 13) $scope.focused++; |
| 145 | }; | 146 | }; |
| 146 | $scope.cancelar = function() { | 147 | $scope.cancelar = function() { |
| 147 | $location.path('/vehiculo'); | 148 | $location.path('/vehiculo'); |
| 148 | }; | 149 | }; |
| 149 | $scope.editar = function(cisterna) { | 150 | $scope.editar = function(key) { |
| 150 | if(cisterna) { | 151 | if(key) { |
| 151 | if(cisterna.idTemp != undefined) { | 152 | $location.path('/vehiculo/' + $routeParams.idVehiculo + |
| 152 | $location.path('/vehiculo/' + $routeParams.idVehiculo + | 153 | '/cisterna/' + key); |
| 153 | '/cisterna/0/' + cisterna.idTemp); | ||
| 154 | }else { | ||
| 155 | $location.path('/vehiculo/' + $routeParams.idVehiculo + | ||
| 156 | '/cisterna/' + cisterna.id); | ||
| 157 | } | ||
| 158 | }else { | 154 | }else { |
| 159 | $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/0/'); | 155 | $location.path('/vehiculo/' + $routeParams.idVehiculo + '/cisterna/0/'); |
| 160 | } | 156 | } |
| 161 | }; | 157 | }; |
| 162 | $scope.guardar = function(key) { | 158 | $scope.guardar = function(key) { |
| 163 | key = (typeof key === 'undefined') ? 13 : key; | 159 | key = (typeof key === 'undefined') ? 13 : key; |
| 164 | if(key === 13){ | 160 | if(key === 13) { |
| 165 | //Valida si existe numero de unidad | 161 | //Valida si existe numero de unidad |
| 166 | if(!validaTotalCargas() && !$scope.nuevo) { | 162 | if(!validaTotalCargas() && !$scope.nuevo) { |
| 167 | focaModalService.alert('La suma de las capacidades de las cisternas' + | 163 | focaModalService.alert('La suma de las capacidades de las cisternas' + |
| 168 | ' debe ser igual a la capacidad total del vehículo'); | 164 | ' debe ser igual a la capacidad total del vehículo'); |
| 169 | return; | 165 | return; |
| 170 | } | 166 | } |
| 171 | validaCodigoUnidad().then(function() { | 167 | validaCodigoUnidad().then(function() { |
| 172 | delete $scope.vehiculo.transportista; | 168 | delete $scope.vehiculo.transportista; |
| 173 | delete $scope.vehiculo.cisternas; | 169 | delete $scope.vehiculo.cisternas; |
| 174 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) | 170 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) |
| 175 | .then(function(res) { | 171 | .then(function(res) { |
| 176 | if($scope.nuevo) { | 172 | if($scope.nuevo) { |
| 177 | $location.path('/vehiculo/' + res.data.id + | 173 | $location.path('/vehiculo/' + res.data.id + |
| 178 | '/' + res.data.idTransportista); | 174 | '/' + res.data.idTransportista); |
| 179 | }else { | 175 | }else { |
| 180 | guardarCisternas().then(function() { | 176 | guardarCisternas().then(function() { |
| 181 | $window.location.assign('/#!/vehiculo'); | 177 | $window.location.assign('/#!/vehiculo'); |
| 182 | }); | 178 | }); |
| 183 | } | 179 | } |
| 184 | }); | 180 | }); |
| 185 | }, function(){ | 181 | }, function() { |
| 186 | focaModalService.alert('Código de unidad existente'); | 182 | focaModalService.alert('Código de unidad existente'); |
| 187 | }); | 183 | }); |
| 188 | } | 184 | } |
| 189 | 185 | ||
| 190 | }; | 186 | }; |
| 191 | $scope.solicitarConfirmacionCisterna = function(cisterna) { | 187 | $scope.solicitarConfirmacionCisterna = function(cisterna, idx) { |
| 192 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + | 188 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + |
| 193 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( | 189 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( |
| 194 | function(data) { | 190 | function(data) { |
| 195 | if(data) { | 191 | if(data) { |
| 196 | if(cisterna.id) { | 192 | focaAbmVehiculoService.deleteCisterna(idx); |
| 197 | focaAbmVehiculoService.deleteCisterna(cisterna.id); | 193 | focaAbmVehiculoService |
| 198 | } | 194 | .getCisternas($routeParams.idVehiculo) |
| 199 | $scope.cisternas.splice($scope.cisternas.indexOf(cisterna), 1); | 195 | .then(function(res) { |
| 196 | $scope.cisternas = res; | ||
| 197 | }); | ||
| 200 | } | 198 | } |
| 201 | } | 199 | } |
| 202 | ); | 200 | ); |
| 203 | }; | 201 | }; |
| 204 | 202 | ||
| 205 | function validaCodigoUnidad() { | 203 | function validaCodigoUnidad() { |
| 206 | return new Promise(function(resolve, reject) { | 204 | return new Promise(function(resolve, reject) { |
| 207 | focaAbmVehiculoService | 205 | focaAbmVehiculoService |
| 208 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) | 206 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) |
| 209 | .then(function(res) { | 207 | .then(function(res) { |
| 210 | //Valida si existe numero de unidad | 208 | //Valida si existe numero de unidad |
| 211 | var existe = res.data.filter(function(vehiculo) { | 209 | var existe = res.data.filter(function(vehiculo) { |
| 212 | return vehiculo.codigo === $scope.vehiculo.codigo && | 210 | return vehiculo.codigo === $scope.vehiculo.codigo && |
| 213 | vehiculo.id !== $scope.vehiculo.id; | 211 | vehiculo.id !== $scope.vehiculo.id; |
| 214 | }); | 212 | }); |
| 215 | 213 | ||
| 216 | if(existe.length) { | 214 | if(existe.length) { |
| 217 | reject(existe); | 215 | reject(existe); |
| 218 | }else { | 216 | }else { |
| 219 | resolve(); | 217 | resolve(); |
| 220 | } | 218 | } |
| 221 | }); | 219 | }); |
| 222 | }); | 220 | }); |
| 223 | } | 221 | } |
| 224 | 222 | ||
| 225 | function validaTotalCargas() { | 223 | function validaTotalCargas() { |
| 226 | var total = 0; | 224 | var total = 0; |
| 227 | $scope.cisternas.forEach(function(cisterna) { | 225 | $scope.cisternas.forEach(function(cisterna) { |
| 228 | total += parseInt(cisterna.capacidad); | 226 | if(!cisterna.desactivado) { |
| 227 | total += parseInt(cisterna.capacidad); | ||
| 228 | } | ||
| 229 | }); | 229 | }); |
| 230 | return $scope.vehiculo.capacidad == total; | 230 | return $scope.vehiculo.capacidad == total; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | function guardarCisternas() { | 233 | function guardarCisternas() { |
| 234 | var promesas = []; | 234 | var cisternas = $scope.cisternas.map(function(cisterna) { |
| 235 | 235 | return { | |
| 236 | focaAbmVehiculoService.getCisternasLocal().forEach(function(cisterna) { | 236 | id: cisterna.id, |
| 237 | delete cisterna.unidadMedida; | 237 | capacidad: parseFloat(cisterna.capacidad), |
| 238 | delete cisterna.idTemp; | 238 | codigo: cisterna.codigo, |
| 239 | delete cisterna.cisternasCarga; | 239 | idUnidadMedida: cisterna.idUnidadMedida, |
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', '$window', | 4 | 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$window', |
| 5 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 5 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
| 6 | focaModalService, focaBotoneraLateralService, $timeout, $window) { | 6 | focaModalService, focaBotoneraLateralService, $timeout, $window) { |
| 7 | $scope.nuevo = ($routeParams.id > 0) ? false : true; | 7 | $scope.nuevo = ($routeParams.id > 0) ? false : true; |
| 8 | $scope.editar = false; | 8 | $scope.editar = false; |
| 9 | $scope.now = new Date(); | 9 | $scope.now = new Date(); |
| 10 | $scope.cisterna = {}; | 10 | $scope.cisterna = {}; |
| 11 | 11 | ||
| 12 | $scope.focused = $scope.nuevo ? 1 : 2; | 12 | $scope.focused = $scope.nuevo ? 1 : 2; |
| 13 | $scope.next = function(key) { | 13 | $scope.next = function(key) { |
| 14 | if (key === 13) $scope.focused++; | 14 | if (key === 13) $scope.focused++; |
| 15 | }; | 15 | }; |
| 16 | $scope.capacidadVechiulo = 0; | 16 | $scope.capacidadVechiulo = 0; |
| 17 | $scope.transportista = ''; | 17 | $scope.transportista = ''; |
| 18 | 18 | ||
| 19 | //SETEO BOTONERA LATERAL | 19 | //SETEO BOTONERA LATERAL |
| 20 | $timeout(function() { | 20 | $timeout(function() { |
| 21 | focaBotoneraLateralService.showSalir(false); | 21 | focaBotoneraLateralService.showSalir(false); |
| 22 | focaBotoneraLateralService.showPausar(false); | 22 | focaBotoneraLateralService.showPausar(false); |
| 23 | focaBotoneraLateralService.showCancelar(true); | 23 | focaBotoneraLateralService.showCancelar(true); |
| 24 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 24 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
| 25 | }); | 25 | }); |
| 26 | 26 | ||
| 27 | 27 | if($routeParams.idx !== -1) { | |
| 28 | if($routeParams.idTemp != undefined) { | 28 | $scope.cisterna = [$routeParams.idx] |
| 29 | $scope.cisterna = focaAbmVehiculoService.getCisternasLocal()[$routeParams.idTemp]; | 29 | focaAbmVehiculoService |
| 30 | }else { | 30 | .getCisternas($routeParams.idVehiculo) |
| 31 | focaAbmVehiculoService.getCisterna($routeParams.id).then(function(res) { | 31 | .then(function(res) { |
| 32 | if(res.data) $scope.cisterna = res.data; | 32 | $scope.cisterna = res[$routeParams.idx]; |
| 33 | }); | 33 | }); |
| 34 | } | 34 | } |
| 35 | |||
| 35 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { | 36 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { |
| 36 | var codigo = ('00000' + res.data.transportista.COD).slice(-5); | 37 | var codigo = ('00000' + res.data.transportista.COD).slice(-5); |
| 37 | $scope.transportista = res.data.transportista.COD; | 38 | $scope.transportista = res.data.transportista.COD; |
| 38 | $scope.capacidadVechiulo = res.data.capacidad; | 39 | $scope.capacidadVechiulo = res.data.capacidad; |
| 39 | $scope.$broadcast('addCabecera', { | 40 | $scope.$broadcast('addCabecera', { |
| 40 | label: 'Transportista:', | 41 | label: 'Transportista:', |
| 41 | valor: codigo + ' - ' + res.data.transportista.NOM | 42 | valor: codigo + ' - ' + res.data.transportista.NOM |
| 42 | }); | 43 | }); |
| 43 | $scope.$broadcast('addCabecera', { | 44 | $scope.$broadcast('addCabecera', { |
| 44 | label: 'Unidad:', | 45 | label: 'Unidad:', |
| 45 | valor: res.data.codigo | 46 | valor: res.data.codigo |
| 46 | }); | 47 | }); |
| 47 | $scope.$broadcast('addCabecera', { | 48 | $scope.$broadcast('addCabecera', { |
| 48 | label: 'Capacidad total vehículo:', | 49 | label: 'Capacidad total vehículo:', |
| 49 | valor: res.data.capacidad | 50 | valor: res.data.capacidad |
| 50 | }); | 51 | }); |
| 51 | }); | 52 | }); |
| 52 | $scope.cancelar = function() { | 53 | $scope.cancelar = function() { |
| 53 | $location.path('/vehiculo/' + $routeParams.idVehiculo); | 54 | $location.path('/vehiculo/' + $routeParams.idVehiculo); |
| 54 | }; | 55 | }; |
| 55 | $scope.guardar = function() { | 56 | $scope.guardar = function() { |
| 56 | if(!$scope.cisterna.unidadMedida) { | 57 | if(!$scope.cisterna.unidadMedida) { |
| 57 | focaModalService.alert('Ingrese unidad de medida'); | 58 | focaModalService.alert('Ingrese unidad de medida'); |
| 58 | return; | 59 | return; |
| 59 | } | 60 | } |
| 60 | validaCodigoCapacidad().then(function() { | 61 | validaCodigoCapacidad() |
| 61 | $scope.cisterna.idVehiculo = parseInt($routeParams.idVehiculo); | 62 | .then(function() { |
| 62 | delete $scope.cisterna.vehiculo; | 63 | $scope.cisterna.idVehiculo = parseInt($routeParams.idVehiculo); |
| 63 | 64 | delete $scope.cisterna.vehiculo; | |
| 64 | if($routeParams.idTemp != undefined) { | 65 | |
| 65 | //SI SE EDITA UNA CISTERNA LOCALMENTE | ||
| 66 | focaAbmVehiculoService | 66 | focaAbmVehiculoService |
| 67 | .guardarCisternaLocal($scope.cisterna, $routeParams.idTemp); | 67 | .guardarCisterna($scope.cisterna, $routeParams.idx); |
| 68 | }else if($scope.cisterna.id) { | 68 | |
| 69 | //SI SE EDITA UNA CISTERNA PREVIAMENTE GUARDADA | 69 | $window.location.assign('/#!/vehiculo/' + $routeParams.idVehiculo + |
| 70 | focaAbmVehiculoService.deleteCisterna($scope.cisterna.id); | 70 | '/' + $scope.transportista); |
| 71 | focaAbmVehiculoService.guardarCisternaLocal($scope.cisterna); | 71 | }, function(err) { |
| 72 | }else { | 72 | focaModalService.alert(err); |
| 73 | //SI SE EDITA CREA UNA NUEVA CISTERNA | 73 | }); |
| 74 | focaAbmVehiculoService.guardarCisternaLocal($scope.cisterna); | ||
| 75 | } | ||
| 76 | $window.location.assign('/#!/vehiculo/' + $routeParams.idVehiculo + | ||
| 77 | '/' + $scope.transportista); | ||
| 78 | }, function(err) { | ||
| 79 | focaModalService.alert(err); | ||
| 80 | }); | ||
| 81 | 74 | ||
| 82 | }; | 75 | }; |
| 83 | 76 | ||
| 84 | $scope.seleccionarUnidadMedida = function() { | 77 | $scope.seleccionarUnidadMedida = function() { |
| 85 | var modalInstance = $uibModal.open( | 78 | var modalInstance = $uibModal.open( |
| 86 | { | 79 | { |
| 87 | ariaLabelledBy: 'Busqueda de Unidades de medida', | 80 | ariaLabelledBy: 'Busqueda de Unidades de medida', |
| 88 | templateUrl: 'modal-unidad-medida.html', | 81 | templateUrl: 'modal-unidad-medida.html', |
| 89 | controller: 'focaModalUnidadMedidaCtrl', | 82 | controller: 'focaModalUnidadMedidaCtrl', |
| 90 | size: 'lg' | 83 | size: 'lg' |
| 91 | } | 84 | } |
| 92 | ); | 85 | ); |
| 93 | modalInstance.result.then(function(unidaMedida) { | 86 | modalInstance.result.then(function(unidaMedida) { |
| 94 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; | 87 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; |
| 95 | $scope.cisterna.unidadMedida = unidaMedida; | 88 | $scope.cisterna.unidadMedida = unidaMedida; |
| 96 | }); | 89 | }); |
| 97 | }; | 90 | }; |
| 98 | 91 | ||
| 99 | function validaCodigoCapacidad() { | 92 | function validaCodigoCapacidad() { |
| 100 | return new Promise(function(resolve, reject) { | 93 | return new Promise(function(resolve, reject) { |
| 101 | focaAbmVehiculoService | 94 | focaAbmVehiculoService |
| 102 | .getCisternadoPorVehiculo($routeParams.idVehiculo) | 95 | .getCisternas($routeParams.idVehiculo) |
| 103 | .then(function(res) { | 96 | .then(function(res) { |
| 104 | var cisternas = focaAbmVehiculoService.getCisternasLocal().concat(res.data); | 97 | var cisternas = res; |
| 105 | var totalCargado = 0; | 98 | var totalCargado = 0; |
| 106 | 99 | cisternas.forEach(function(cisterna, idx) { | |
| 107 | cisternas.forEach(function(cisterna) { | ||
| 108 | //SI EL CODIGO YA EXISTE | 100 | //SI EL CODIGO YA EXISTE |
| 109 | if(cisterna.codigo === $scope.cisterna.codigo && | 101 | if(cisterna.codigo === $scope.cisterna.codigo && |
| 110 | (cisterna.id !== $scope.cisterna.id || | 102 | idx != $routeParams.idx && |
| 111 | cisterna.idTemp !== $scope.cisterna.idTemp)) { | 103 | !cisterna.desactivado) { |
| 112 | reject('Código de cisterna existente'); | 104 | reject('Código de cisterna existente'); |
| 113 | } | 105 | } |
| 114 | if(cisterna.id !== $scope.cisterna.id) { | 106 | if(idx != $routeParams.idx && |
| 107 | !cisterna.desactivado) { | ||
| 115 | totalCargado += cisterna.capacidad; | 108 | totalCargado += cisterna.capacidad; |
| 116 | } | 109 | } |
| 117 | }); | 110 | }); |
| 118 | 111 | ||
| 119 | //SI EL TOTAL DE CAPACIDAD DE CISTERNAS ES MAYOR QUE LA DEL VEHICULO | 112 | //SI EL TOTAL DE CAPACIDAD DE CISTERNAS ES MAYOR QUE LA DEL VEHICULO |
| 120 | totalCargado = totalCargado + parseInt($scope.cisterna.capacidad); | 113 | totalCargado = totalCargado + parseInt($scope.cisterna.capacidad); |
| 121 | if(totalCargado > $scope.capacidadVechiulo) { | 114 | if(totalCargado > $scope.capacidadVechiulo) { |
| 122 | reject('La capacidad total de las cisternas' + | 115 | reject('La capacidad total de las cisternas' + |
| 123 | ' no debe ser mayor a la del vehiculo'); | 116 | ' no debe ser mayor a la del vehiculo'); |
| 124 | }else { | 117 | }else { |
| 125 | resolve(); | 118 | resolve(); |
| 126 | } | 119 | } |
| 127 | }); | 120 | }); |
| 128 | }); | 121 | }); |
| 129 | } | 122 | } |
| 130 | } | 123 | } |
src/js/route.js
| 1 | angular.module('focaAbmVehiculo') | 1 | angular.module('focaAbmVehiculo') |
| 2 | .config([ | 2 | .config([ |
| 3 | '$routeProvider', | 3 | '$routeProvider', |
| 4 | function($routeProvider) { | 4 | function($routeProvider) { |
| 5 | $routeProvider.when('/vehiculo', { | 5 | $routeProvider.when('/vehiculo', { |
| 6 | controller: 'focaAbmVehiculosController', | 6 | controller: 'focaAbmVehiculosController', |
| 7 | templateUrl: 'src/views/foca-abm-vehiculos-listado.html' | 7 | templateUrl: 'src/views/foca-abm-vehiculos-listado.html' |
| 8 | }); | 8 | }); |
| 9 | } | 9 | } |
| 10 | ]) | 10 | ]) |
| 11 | .config([ | 11 | .config([ |
| 12 | '$routeProvider', | 12 | '$routeProvider', |
| 13 | function($routeProvider) { | 13 | function($routeProvider) { |
| 14 | $routeProvider.when('/vehiculo/:idVehiculo/:idTransportista', { | 14 | $routeProvider.when('/vehiculo/:idVehiculo/:idTransportista', { |
| 15 | controller: 'focaAbmVehiculoController', | 15 | controller: 'focaAbmVehiculoController', |
| 16 | templateUrl: 'src/views/foca-abm-vehiculos-item.html' | 16 | templateUrl: 'src/views/foca-abm-vehiculos-item.html' |
| 17 | }); | 17 | }); |
| 18 | } | 18 | } |
| 19 | ]) | 19 | ]) |
| 20 | .config([ | 20 | .config([ |
| 21 | '$routeProvider', | 21 | '$routeProvider', |
| 22 | function($routeProvider) { | 22 | function($routeProvider) { |
| 23 | $routeProvider.when('/vehiculo/:idVehiculo', { | 23 | $routeProvider.when('/vehiculo/:idVehiculo', { |
| 24 | controller: 'focaAbmVehiculoController', | 24 | controller: 'focaAbmVehiculoController', |
| 25 | templateUrl: 'src/views/foca-abm-vehiculos-item.html' | 25 | templateUrl: 'src/views/foca-abm-vehiculos-item.html' |
| 26 | }); | 26 | }); |
| 27 | } | 27 | } |
| 28 | ]) | 28 | ]) |
| 29 | .config([ | 29 | .config([ |
| 30 | '$routeProvider', | 30 | '$routeProvider', |
| 31 | function($routeProvider) { | 31 | function($routeProvider) { |
| 32 | $routeProvider.when('/vehiculo/:idVehiculo/cisterna/:id', { | 32 | $routeProvider.when('/vehiculo/:idVehiculo/cisterna/:idx', { |
| 33 | controller: 'focaAbmVehiculoCisternaController', | ||
| 34 | templateUrl: 'src/views/foca-abm-cisterna-item.html' | ||
| 35 | }); | ||
| 36 | } | ||
| 37 | ]) | ||
| 38 | .config([ | ||
| 39 | '$routeProvider', | ||
| 40 | function($routeProvider) { | ||
| 41 | $routeProvider.when('/vehiculo/:idVehiculo/cisterna/:id/:idTemp', { | ||
| 42 | controller: 'focaAbmVehiculoCisternaController', | 33 | controller: 'focaAbmVehiculoCisternaController', |
| 43 | templateUrl: 'src/views/foca-abm-cisterna-item.html' | 34 | templateUrl: 'src/views/foca-abm-cisterna-item.html' |
| 44 | }); | 35 | }); |
| 45 | } | 36 | } |
| 46 | ]); | 37 | ]); |
| 47 | 38 |
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 | getCisternas: function(idVehiculo) { |
| 21 | return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); | 21 | if(cisternas.length) { |
| 22 | }, | 22 | return Promise.resolve(angular.copy(cisternas)); |
| 23 | getCisterna: function(id) { | 23 | }else { |
| 24 | return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); | 24 | return new Promise(function(resolve, reject) { |
| 25 | }, | 25 | $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo) |
| 26 | getCisternasLocal: function() { | 26 | .then(function(res) { |
| 27 | return cisternas; | 27 | cisternas = res.data; |
| 28 | resolve(res.data); | ||
| 29 | }); | ||
| 30 | }); | ||
| 31 | } | ||
| 28 | }, | 32 | }, |
| 29 | guardarCisternaLocal: function(cisterna, idTemp) { | 33 | guardarCisterna: function(cisterna, idx) { |
| 30 | if(idTemp) { | 34 | if(idx != -1) { |
| 31 | cisterna.idTemp = idTemp; | 35 | //update |
| 32 | cisternas[idTemp] = cisterna; | 36 | cisternas[idx] = cisterna; |
| 33 | }else { | 37 | }else { |
| 34 | cisterna.idTemp = cisternas.length; | 38 | //insert |
| 35 | cisternas.push(cisterna); | 39 | cisternas.push(cisterna); |
| 36 | } | 40 | } |
| 37 | }, | 41 | }, |
| 38 | cleanCisternasLocal: function(){ | 42 | guardarCisternas: function(cisternas) { |
| 39 | cisternas = []; | 43 | return $http.post(API_ENDPOINT.URL + '/cisterna', {cisternas: cisternas}); |
| 40 | }, | ||
| 41 | guardarCisterna: function(cisterna) { | ||
| 42 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); | ||
| 43 | }, | 44 | }, |
| 44 | deleteCisterna: function(id) { | 45 | deleteCisterna: function(idx) { |
| 45 | return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); | 46 | cisternas[idx].desactivado = true; |
| 46 | }, | 47 | }, |
| 47 | getVehiculosPorTransportista: function(id) { | 48 | getVehiculosPorTransportista: function(id) { |
| 48 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); | 49 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); |
| 49 | }, | 50 | }, |
| 50 | getTransportistaPorId: function(id) { | 51 | getTransportistaPorId: function(id) { |
| 51 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); | 52 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); |
| 52 | }, | 53 | }, |
| 53 | transportistaSeleccionado: {} | 54 | transportistaSeleccionado: {} |
src/views/foca-abm-vehiculos-item.html
| 1 | <div class="row"> | 1 | <div class="row"> |
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
| 3 | titulo="'Vehículo'" | 3 | titulo="'Vehículo'" |
| 4 | fecha="now" | 4 | fecha="now" |
| 5 | class="mb-0 col-lg-12" | 5 | class="mb-0 col-lg-12" |
| 6 | ></foca-cabecera-facturador> | 6 | ></foca-cabecera-facturador> |
| 7 | </div> | 7 | </div> |
| 8 | <div class="row"> | 8 | <div class="row"> |
| 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | 9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> |
| 10 | <form name="formVehiculo" class="px-3"> | 10 | <form name="formVehiculo" class="px-3"> |
| 11 | <input type="hidden" name="id" ng-model="sector.id" /> | 11 | <input type="hidden" name="id" ng-model="sector.id" /> |
| 12 | <div class="row mt-3"> | 12 | <div class="row mt-3"> |
| 13 | <div class="form-group d-flex mb-2 col-md-6"> | 13 | <div class="form-group d-flex mb-2 col-md-6"> |
| 14 | <label class="col-form-label col-md-4">Unidad</label> | 14 | <label class="col-form-label col-md-4">Unidad</label> |
| 15 | <div class="input-group col-md-8 pl-0"> | 15 | <div class="input-group col-md-8 pl-0"> |
| 16 | <input | 16 | <input |
| 17 | class="form-control" | 17 | class="form-control" |
| 18 | type="text" | 18 | type="text" |
| 19 | teclado-virtual | 19 | teclado-virtual |
| 20 | ng-model="vehiculo.codigo" | 20 | ng-model="vehiculo.codigo" |
| 21 | foca-focus="focused == 1" | 21 | foca-focus="focused == 1" |
| 22 | ng-focus="focused = 1" | 22 | ng-focus="focused = 1" |
| 23 | ng-keypress="next($event.keyCode)" | 23 | ng-keypress="next($event.keyCode)" |
| 24 | ng-disabled="!nuevo" | 24 | ng-disabled="!nuevo" |
| 25 | /> | 25 | /> |
| 26 | </div> | 26 | </div> |
| 27 | </div> | 27 | </div> |
| 28 | <div class="form-group d-flex mb-2 col-md-6"> | 28 | <div class="form-group d-flex mb-2 col-md-6"> |
| 29 | <label class="col-form-label col-md-4">Dominio tractor</label> | 29 | <label class="col-form-label col-md-4">Dominio tractor</label> |
| 30 | <div class="input-group col-md-8 pl-0"> | 30 | <div class="input-group col-md-8 pl-0"> |
| 31 | <input | 31 | <input |
| 32 | class="form-control" | 32 | class="form-control" |
| 33 | type="text" | 33 | type="text" |
| 34 | teclado-virtual | 34 | teclado-virtual |
| 35 | ng-model="vehiculo.tractor" | 35 | ng-model="vehiculo.tractor" |
| 36 | ng-required="true" | 36 | ng-required="true" |
| 37 | foca-focus="focused == 2" | 37 | foca-focus="focused == 2" |
| 38 | ng-focus="focused = 2" | 38 | ng-focus="focused = 2" |
| 39 | ng-keypress="next($event.keyCode)" | 39 | ng-keypress="next($event.keyCode)" |
| 40 | /> | 40 | /> |
| 41 | </div> | 41 | </div> |
| 42 | </div> | 42 | </div> |
| 43 | <div class="form-group d-flex mb-2 col-md-6"> | 43 | <div class="form-group d-flex mb-2 col-md-6"> |
| 44 | <label class="col-form-label col-md-4">Dominio semi</label> | 44 | <label class="col-form-label col-md-4">Dominio semi</label> |
| 45 | <div class="input-group col-md-8 pl-0"> | 45 | <div class="input-group col-md-8 pl-0"> |
| 46 | <input | 46 | <input |
| 47 | class="form-control" | 47 | class="form-control" |
| 48 | type="text" | 48 | type="text" |
| 49 | teclado-virtual | 49 | teclado-virtual |
| 50 | ng-model="vehiculo.semi" | 50 | ng-model="vehiculo.semi" |
| 51 | ng-required="true" | 51 | ng-required="true" |
| 52 | foca-focus="focused == 3" | 52 | foca-focus="focused == 3" |
| 53 | ng-focus="focused = 3" | 53 | ng-focus="focused = 3" |
| 54 | ng-keypress="next($event.keyCode)" | 54 | ng-keypress="next($event.keyCode)" |
| 55 | /> | 55 | /> |
| 56 | </div> | 56 | </div> |
| 57 | </div> | 57 | </div> |
| 58 | <div class="form-group d-flex mb-2 col-md-6"> | 58 | <div class="form-group d-flex mb-2 col-md-6"> |
| 59 | <label class="col-form-label col-md-4">Capacidad total</label> | 59 | <label class="col-form-label col-md-4">Capacidad total</label> |
| 60 | <div class="input-group col-md-8 pl-0"> | 60 | <div class="input-group col-md-8 pl-0"> |
| 61 | <input | 61 | <input |
| 62 | class="form-control" | 62 | class="form-control" |
| 63 | type="text" | 63 | type="text" |
| 64 | teclado-virtual | 64 | teclado-virtual |
| 65 | ng-model="vehiculo.capacidad" | 65 | ng-model="vehiculo.capacidad" |
| 66 | ng-required="true" | 66 | ng-required="true" |
| 67 | foca-focus="focused == 4" | 67 | foca-focus="focused == 4" |
| 68 | ng-focus="focused = 4" | 68 | ng-focus="focused = 4" |
| 69 | ng-keypress="guardar($event.keyCode)" | 69 | ng-keypress="guardar($event.keyCode)" |
| 70 | /> | 70 | /> |
| 71 | </div> | 71 | </div> |
| 72 | </div> | 72 | </div> |
| 73 | </div> | 73 | </div> |
| 74 | </form> | 74 | </form> |
| 75 | <div ng-show="!nuevo"> | 75 | <div ng-show="!nuevo"> |
| 76 | <h5 class="pl-4 table-title">Cisternas</h5> | 76 | <h5 class="pl-4 table-title">Cisternas</h5> |
| 77 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | 77 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> |
| 78 | <thead> | 78 | <thead> |
| 79 | <tr> | 79 | <tr> |
| 80 | <th class="px-5">Código</th> | 80 | <th class="px-5">Código</th> |
| 81 | <th class="text-right px-5">Capacidad</th> | 81 | <th class="text-right px-5">Capacidad</th> |
| 82 | <th class="text-center px-4"> | 82 | <th class="text-center px-4"> |
| 83 | <button | 83 | <button |
| 84 | class="btn btn-outline-debo boton-accion" | 84 | class="btn btn-outline-debo boton-accion" |
| 85 | title="Agregar" | 85 | title="Agregar" |
| 86 | ng-click="editar()"> | 86 | ng-click="editar(-1)"> |
| 87 | <i class="fa fa-plus"></i> | 87 | <i class="fa fa-plus"></i> |
| 88 | </button> | 88 | </button> |
| 89 | </th> | 89 | </th> |
| 90 | </tr> | 90 | </tr> |
| 91 | </thead> | 91 | </thead> |
| 92 | <tbody> | 92 | <tbody> |
| 93 | <tr ng-repeat="cisterna in cisternas | filter:filtros"> | 93 | <tr ng-repeat="(key, cisterna) in cisternas | filter:filtros" |
| 94 | ng-show="!cisterna.desactivado"> | ||
| 94 | <td ng-bind="cisterna.codigo" class="px-5"></td> | 95 | <td ng-bind="cisterna.codigo" class="px-5"></td> |
| 95 | <td ng-bind="cisterna.capacidad + ' ' + cisterna.unidadMedida.NOM" class="text-right px-5"></td> | 96 | <td ng-bind="cisterna.capacidad + ' ' + cisterna.unidadMedida.NOM" class="text-right px-5"></td> |
| 96 | <td class="text-center px-4"> | 97 | <td class="text-center px-4"> |
| 97 | <button | 98 | <button |
| 98 | class="btn btn-outline-dark boton-accion" | 99 | class="btn btn-outline-dark boton-accion" |
| 99 | title="Editar" | 100 | title="Editar" |
| 100 | ng-click="editar(cisterna)" | 101 | ng-click="editar(key)" |
| 101 | > | 102 | > |
| 102 | <i class="fa fa-pencil"></i> | 103 | <i class="fa fa-pencil"></i> |
| 103 | </button> | 104 | </button> |
| 104 | <button | 105 | <button |
| 105 | class="btn btn-outline-dark boton-accion" | 106 | class="btn btn-outline-dark boton-accion" |
| 106 | title="Eliminar" | 107 | title="Eliminar" |
| 107 | ng-click="solicitarConfirmacionCisterna(cisterna)" | 108 | ng-click="solicitarConfirmacionCisterna(cisterna, key)" |
| 108 | > | 109 | > |
| 109 | <i class="fa fa-trash"></i> | 110 | <i class="fa fa-trash"></i> |
| 110 | </button> | 111 | </button> |
| 111 | </td> | 112 | </td> |
| 112 | </tr> | 113 | </tr> |
| 113 | </body> | 114 | </body> |
| 114 | </table> | 115 | </table> |
| 115 | </div> | 116 | </div> |
| 116 | </div> | 117 | </div> |
| 117 | </div> | 118 | </div> |
| 118 | 119 |