Commit 58888f80223892e396b55e65015dba45b668b669
1 parent
fb66976cf0
Exists in
master
Agregar Cisternas (Modificado)
Showing
3 changed files
with
33 additions
and
36 deletions
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', '$localStorage', | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', '$localStorage', |
5 | function($scope, focaAbmVehiculoService, $location, focaModalService, | 5 | function($scope, focaAbmVehiculoService, $location, focaModalService, |
6 | $uibModal, focaBotoneraLateralService, $timeout, $localStorage) { | 6 | $uibModal, focaBotoneraLateralService, $timeout, $localStorage) { |
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 | focaAbmVehiculoService.cleanCisternas(); | 14 | focaAbmVehiculoService.cleanCisternas(); |
15 | 15 | ||
16 | //SETEO BOTONERA LATERAL | 16 | //SETEO BOTONERA LATERAL |
17 | focaBotoneraLateralService.showSalir(false); | 17 | focaBotoneraLateralService.showSalir(false); |
18 | focaBotoneraLateralService.showPausar(false); | 18 | focaBotoneraLateralService.showPausar(false); |
19 | focaBotoneraLateralService.showCancelar(false); | 19 | focaBotoneraLateralService.showCancelar(false); |
20 | focaBotoneraLateralService.showGuardar(false); | 20 | focaBotoneraLateralService.showGuardar(false); |
21 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 21 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
22 | 22 | ||
23 | if (focaAbmVehiculoService.transportistaSeleccionado.COD) { | 23 | if (focaAbmVehiculoService.transportistaSeleccionado.COD) { |
24 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); | 24 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); |
25 | } | 25 | } |
26 | $scope.editar = function(id) { | 26 | $scope.editar = function(id) { |
27 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | 27 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); |
28 | }; | 28 | }; |
29 | $scope.solicitarConfirmacion = function(vehiculo) { | 29 | $scope.solicitarConfirmacion = function(vehiculo) { |
30 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | 30 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + |
31 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | 31 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( |
32 | function(data) { | 32 | function(data) { |
33 | if (data) { | 33 | if (data) { |
34 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); | 34 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); |
35 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 35 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | ); | 38 | ); |
39 | }; | 39 | }; |
40 | $scope.seleccionarTransportista = function() { | 40 | $scope.seleccionarTransportista = function() { |
41 | var parametrosModal = { | 41 | var parametrosModal = { |
42 | titulo: 'Búsqueda de Transportista', | 42 | titulo: 'Búsqueda de Transportista', |
43 | query: '/transportista', | 43 | query: '/transportista', |
44 | columnas: [ | 44 | columnas: [ |
45 | { | 45 | { |
46 | nombre: 'Código', | 46 | nombre: 'Código', |
47 | propiedad: 'COD' | 47 | propiedad: 'COD' |
48 | }, | 48 | }, |
49 | { | 49 | { |
50 | nombre: 'Nombre', | 50 | nombre: 'Nombre', |
51 | propiedad: 'NOM' | 51 | propiedad: 'NOM' |
52 | }, | 52 | }, |
53 | { | 53 | { |
54 | nombre: 'CUIT', | 54 | nombre: 'CUIT', |
55 | propiedad: 'CUIT' | 55 | propiedad: 'CUIT' |
56 | } | 56 | } |
57 | ] | 57 | ] |
58 | }; | 58 | }; |
59 | focaModalService.modal(parametrosModal).then( | 59 | focaModalService.modal(parametrosModal).then( |
60 | function(transportista) { | 60 | function(transportista) { |
61 | elegirTransportista(transportista); | 61 | elegirTransportista(transportista); |
62 | focaAbmVehiculoService.transportistaSeleccionado = transportista; | 62 | focaAbmVehiculoService.transportistaSeleccionado = transportista; |
63 | }, function() { | 63 | }, function() { |
64 | 64 | ||
65 | } | 65 | } |
66 | ); | 66 | ); |
67 | }; | 67 | }; |
68 | function elegirTransportista(transportista) { | 68 | function elegirTransportista(transportista) { |
69 | var codigo = ('00000' + transportista.COD).slice(-5); | 69 | var codigo = ('00000' + transportista.COD).slice(-5); |
70 | $scope.idTransportista = transportista.COD; | 70 | $scope.idTransportista = transportista.COD; |
71 | $scope.filtros = transportista.NOM.trim(); | 71 | $scope.filtros = transportista.NOM.trim(); |
72 | $timeout(function() { | 72 | $timeout(function() { |
73 | $scope.$broadcast('addCabecera', { | 73 | $scope.$broadcast('addCabecera', { |
74 | label: 'Transportista:', | 74 | label: 'Transportista:', |
75 | valor: codigo + ' - ' + transportista.NOM | 75 | valor: codigo + ' - ' + transportista.NOM |
76 | }); | 76 | }); |
77 | }); | 77 | }); |
78 | buscar(transportista.COD); | 78 | buscar(transportista.COD); |
79 | } | 79 | } |
80 | 80 | ||
81 | function buscar(idTransportista) { | 81 | function buscar(idTransportista) { |
82 | focaAbmVehiculoService | 82 | focaAbmVehiculoService |
83 | .getVehiculosPorTransportista(idTransportista) | 83 | .getVehiculosPorTransportista(idTransportista) |
84 | .then(function(datos) { | 84 | .then(function(datos) { |
85 | $scope.vehiculos = datos.data; | 85 | $scope.vehiculos = datos.data; |
86 | }); | 86 | }); |
87 | } | 87 | } |
88 | function salir() { | 88 | function salir() { |
89 | focaAbmVehiculoService.transportistaSeleccionado = {}; | 89 | focaAbmVehiculoService.transportistaSeleccionado = {}; |
90 | $location.path('/'); | 90 | $location.path('/'); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | ]) | 93 | ]) |
94 | .controller('focaAbmVehiculoController', [ | 94 | .controller('focaAbmVehiculoController', [ |
95 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 95 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
96 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$localStorage', '$filter', | 96 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$localStorage', '$filter', |
97 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 97 | function($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
98 | focaModalService, $timeout, focaBotoneraLateralService, $localStorage, $filter) { | 98 | focaModalService, $timeout, focaBotoneraLateralService, $localStorage, $filter) { |
99 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; | 99 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; |
100 | $scope.nuevoCisterna = ($routeParams.idx > -1) ? false : true; | 100 | $scope.nuevoCisterna = ($routeParams.idx > -1) ? false : true; |
101 | $scope.now = new Date(); | 101 | $scope.now = new Date(); |
102 | $scope.focused = 1; | 102 | $scope.focused = 1; |
103 | $scope.creando = false; | 103 | $scope.creando = false; |
104 | $scope.transportistaStamp = ''; | 104 | $scope.transportistaStamp = ''; |
105 | $scope.cisternasABorrar = []; | ||
105 | $scope.cisternas = []; | 106 | $scope.cisternas = []; |
106 | $scope.cisterna = { | 107 | $scope.cisterna = { |
107 | codigo: '', | 108 | codigo: '', |
108 | capacidad: '', | 109 | capacidad: '', |
109 | idUnidadMedida: 0, | 110 | idUnidadMedida: 0, |
110 | unidadMedida: {} | 111 | unidadMedida: {} |
111 | }; | 112 | }; |
112 | 113 | ||
113 | $timeout(function() { | 114 | $timeout(function() { |
114 | focaBotoneraLateralService.showSalir(false); | 115 | focaBotoneraLateralService.showSalir(false); |
115 | focaBotoneraLateralService.showPausar(true); | 116 | focaBotoneraLateralService.showPausar(true); |
116 | focaBotoneraLateralService.showCancelar(false); | 117 | focaBotoneraLateralService.showCancelar(false); |
117 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 118 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
118 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); | 119 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); |
119 | }); | 120 | }); |
120 | 121 | ||
121 | if ($scope.nuevo) { | 122 | if ($scope.nuevo) { |
122 | focaAbmVehiculoService | 123 | focaAbmVehiculoService |
123 | .getTransportistaPorId($routeParams.idTransportista) | 124 | .getTransportistaPorId($routeParams.idTransportista) |
124 | .then(function(res) { | 125 | .then(function(res) { |
125 | var codigo = ('00000' + res.data.COD).slice(-5); | 126 | var codigo = ('00000' + res.data.COD).slice(-5); |
126 | $scope.vehiculo.idTransportista = res.data.COD; | 127 | $scope.vehiculo.idTransportista = res.data.COD; |
127 | $scope.vehiculo.transportista = res.data; | 128 | $scope.vehiculo.transportista = res.data; |
128 | $scope.$broadcast('addCabecera', { | 129 | $scope.$broadcast('addCabecera', { |
129 | label: 'Transportista:', | 130 | label: 'Transportista:', |
130 | valor: codigo + ' - ' + res.data.NOM | 131 | valor: codigo + ' - ' + res.data.NOM |
131 | }); | 132 | }); |
132 | }); | 133 | }); |
133 | } | 134 | } |
134 | $scope.vehiculo = {}; | 135 | $scope.vehiculo = {}; |
135 | 136 | ||
136 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { | 137 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function(res) { |
137 | 138 | ||
138 | if (res.data) { | 139 | if (res.data) { |
139 | var vehiculoSeteado = getLSVehiculo(); | 140 | var vehiculoSeteado = getLSVehiculo(); |
140 | if (vehiculoSeteado === false) { | 141 | if (vehiculoSeteado === false) { |
141 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); | 142 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); |
142 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM; | 143 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM; |
143 | 144 | ||
144 | $scope.vehiculo = res.data; | 145 | $scope.vehiculo = res.data; |
145 | $scope.$broadcast('addCabecera', { | 146 | $scope.$broadcast('addCabecera', { |
146 | label: 'Transportista:', | 147 | label: 'Transportista:', |
147 | valor: $scope.transportistaStamp | 148 | valor: $scope.transportistaStamp |
148 | }); | 149 | }); |
149 | $scope.$broadcast('addCabecera', { | 150 | $scope.$broadcast('addCabecera', { |
150 | label: 'Unidad:', | 151 | label: 'Unidad:', |
151 | valor: res.data.codigo | 152 | valor: res.data.codigo |
152 | }); | 153 | }); |
153 | } | 154 | } |
154 | 155 | ||
155 | focaAbmVehiculoService | 156 | focaAbmVehiculoService |
156 | .getCisternas($routeParams.idVehiculo) | 157 | .getCisternas($routeParams.idVehiculo) |
157 | .then(function(res) { | 158 | .then(function(res) { |
158 | $scope.cisternas = res; | 159 | $scope.cisternas = res; |
159 | $scope.$apply(); | 160 | $scope.$apply(); |
160 | }); | 161 | }); |
161 | } | 162 | } |
162 | }); | 163 | }); |
163 | 164 | ||
164 | $scope.next = function(key) { | 165 | $scope.next = function(key) { |
165 | if (key === 13) $scope.focused++; | 166 | if (key === 13) $scope.focused++; |
166 | }; | 167 | }; |
167 | 168 | ||
168 | $scope.salir = function() { | 169 | $scope.salir = function() { |
169 | if (!$scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { | 170 | if (!$scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { |
170 | focaModalService.confirm( | 171 | focaModalService.confirm( |
171 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 172 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
172 | ).then(function(data) { | 173 | ).then(function(data) { |
173 | if (data) { | 174 | if (data) { |
174 | $location.path('/vehiculo'); | 175 | $location.path('/vehiculo'); |
175 | } | 176 | } |
176 | }); | 177 | }); |
177 | } else { | 178 | } else { |
178 | $location.path('/vehiculo'); | 179 | $location.path('/vehiculo'); |
179 | } | 180 | } |
180 | }; | 181 | }; |
181 | 182 | ||
182 | $scope.editar = function(key, cisterna) { | 183 | $scope.editar = function(key, cisterna) { |
183 | if (key === 'nuevo') { | 184 | if (key === 'nuevo') { |
184 | $scope.cisterna = {}; | 185 | $scope.cisterna = {}; |
185 | $scope.creando = true; | 186 | $scope.creando = true; |
186 | } else { | 187 | } else { |
187 | $scope.cisterna = cisterna; | 188 | $scope.cisterna = cisterna; |
188 | $scope.creando = true; | 189 | $scope.creando = true; |
189 | } | 190 | } |
190 | }; | 191 | }; |
191 | 192 | ||
192 | $scope.seleccionarUnidadMedida = function() { | 193 | $scope.seleccionarUnidadMedida = function() { |
193 | var modalInstance = $uibModal.open( | 194 | var modalInstance = $uibModal.open( |
194 | { | 195 | { |
195 | ariaLabelledBy: 'Busqueda de Unidades de medida', | 196 | ariaLabelledBy: 'Busqueda de Unidades de medida', |
196 | templateUrl: 'modal-unidad-medida.html', | 197 | templateUrl: 'modal-unidad-medida.html', |
197 | controller: 'focaModalUnidadMedidaCtrl', | 198 | controller: 'focaModalUnidadMedidaCtrl', |
198 | size: 'lg' | 199 | size: 'lg' |
199 | } | 200 | } |
200 | ); | 201 | ); |
201 | modalInstance.result.then(function(unidaMedida) { | 202 | modalInstance.result.then(function(unidaMedida) { |
202 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; | 203 | $scope.cisterna.idUnidadMedida = unidaMedida.ID; |
203 | $scope.cisterna.unidadMedida = unidaMedida; | 204 | $scope.cisterna.unidadMedida = unidaMedida; |
204 | }); | 205 | }); |
205 | }; | 206 | }; |
206 | 207 | ||
207 | $scope.guardar = function(key) { | 208 | $scope.guardar = function(key) { |
208 | |||
209 | key = (typeof key === 'undefined') ? 13 : key; | 209 | key = (typeof key === 'undefined') ? 13 : key; |
210 | 210 | ||
211 | if (key === 13) { | 211 | if (key === 13) { |
212 | 212 | ||
213 | if ($scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { | 213 | if ($scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { |
214 | $scope.salir(); | 214 | $scope.salir(); |
215 | return; | 215 | return; |
216 | } | 216 | } |
217 | 217 | ||
218 | if (!$scope.vehiculo.codigo) { | 218 | if (!$scope.vehiculo.codigo) { |
219 | focaModalService.alert('Ingrese unidad'); | 219 | focaModalService.alert('Ingrese unidad'); |
220 | return; | 220 | return; |
221 | } else if (!$scope.vehiculo.tractor) { | 221 | } else if (!$scope.vehiculo.tractor) { |
222 | focaModalService.alert('Ingrese dominio tractor'); | 222 | focaModalService.alert('Ingrese dominio tractor'); |
223 | return; | 223 | return; |
224 | } else if (!$scope.vehiculo.semi) { | 224 | } else if (!$scope.vehiculo.semi) { |
225 | focaModalService.alert('Ingrese dominio semi'); | 225 | focaModalService.alert('Ingrese dominio semi'); |
226 | return; | 226 | return; |
227 | } else if (!$scope.vehiculo.capacidad) { | 227 | } else if (!$scope.vehiculo.capacidad) { |
228 | focaModalService.alert('Ingrese capacidad total'); | 228 | focaModalService.alert('Ingrese capacidad total'); |
229 | return; | 229 | return; |
230 | } | 230 | } |
231 | //Valida si existe numero de unidad | 231 | //Valida si existe numero de unidad |
232 | if (!validaTotalCargas() && !$scope.nuevo) { | 232 | if (!validaTotalCargas() && !$scope.nuevo) { |
233 | focaModalService.alert('La suma de las capacidades de las cisternas' + | 233 | focaModalService.alert('La suma de las capacidades de las cisternas' + |
234 | ' debe ser igual a la capacidad total del vehículo'); | 234 | ' debe ser igual a la capacidad total del vehículo'); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | |||
238 | borrarCisternas(); | ||
239 | |||
237 | validaCodigoUnidad().then(function() { | 240 | validaCodigoUnidad().then(function() { |
238 | delete $scope.vehiculo.transportista; | 241 | delete $scope.vehiculo.transportista; |
239 | delete $scope.vehiculo.cisternas; | 242 | delete $scope.vehiculo.cisternas; |
240 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) | 243 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) |
241 | .then(function(res) { | 244 | .then(function(res) { |
242 | if ($scope.nuevo) { | 245 | if ($scope.nuevo) { |
243 | $location.path('/vehiculo/' + res.data.id + | 246 | $location.path('/vehiculo/' + res.data.id + |
244 | '/' + res.data.idTransportista); | 247 | '/' + res.data.idTransportista); |
245 | } else { | 248 | } else { |
246 | guardarCisternas().then(function() { | 249 | guardarCisternas().then(function() { |
247 | $location.path('/vehiculo'); | 250 | $location.path('/vehiculo'); |
248 | }); | 251 | }); |
249 | } | 252 | } |
250 | }); | 253 | }); |
251 | }, function() { | 254 | }, function() { |
252 | focaModalService.alert('Código de unidad existente'); | 255 | focaModalService.alert('Código de unidad existente'); |
253 | }); | 256 | }); |
254 | } | 257 | } |
255 | }; | 258 | }; |
256 | 259 | ||
257 | //Agregar propiedades de cisterna | 260 | //Agregar propiedades de cisterna |
258 | $scope.$watch('vehiculo', function(newValue) { | 261 | $scope.$watch('vehiculo', function(newValue) { |
259 | focaBotoneraLateralService.setPausarData({ | 262 | focaBotoneraLateralService.setPausarData({ |
260 | label:'vehiculo', | 263 | label:'vehiculo', |
261 | val: { | 264 | val: { |
262 | codigo: newValue.codigo, | 265 | codigo: newValue.codigo, |
263 | tractor: newValue.tractor, | 266 | tractor: newValue.tractor, |
264 | semi: newValue.semi, | 267 | semi: newValue.semi, |
265 | capacidad: newValue.capacidad, | 268 | capacidad: newValue.capacidad, |
266 | idVehiculo: newValue.idVehiculo, | 269 | idVehiculo: newValue.idVehiculo, |
267 | idTransportista: newValue.idTransportista | 270 | idTransportista: newValue.idTransportista |
268 | } | 271 | } |
269 | }); | 272 | }); |
270 | }, true); | 273 | }, true); |
271 | 274 | ||
272 | function getLSVehiculo() { | 275 | function getLSVehiculo() { |
273 | var vehiculo = JSON.parse($localStorage.vehiculo|| null); | 276 | var vehiculo = JSON.parse($localStorage.vehiculo|| null); |
274 | if (vehiculo) { | 277 | if (vehiculo) { |
275 | setearVehiculo(vehiculo); | 278 | setearVehiculo(vehiculo); |
276 | delete $localStorage.vehiculo; | 279 | delete $localStorage.vehiculo; |
277 | return true; | 280 | return true; |
278 | } | 281 | } |
279 | return false; | 282 | return false; |
280 | } | 283 | } |
281 | 284 | ||
285 | function borrarCisternas() { | ||
286 | $scope.cisternasABorrar.forEach(cisternaABorrar => { | ||
287 | focaAbmVehiculoService.deleteCisterna(cisternaABorrar); | ||
288 | focaAbmVehiculoService | ||
289 | .getCisternas($routeParams.idVehiculo) | ||
290 | .then(function(res) { | ||
291 | $scope.cisternas = res; | ||
292 | }); | ||
293 | }); | ||
294 | } | ||
295 | |||
282 | function setearVehiculo(vehiculo) { | 296 | function setearVehiculo(vehiculo) { |
283 | $scope.vehiculo = vehiculo; | 297 | $scope.vehiculo = vehiculo; |
284 | $scope.$broadcast('addCabecera', { | 298 | $scope.$broadcast('addCabecera', { |
285 | label: 'Vehiculo:', | 299 | label: 'Vehiculo:', |
286 | valor: $filter('rellenarDigitos')(vehiculo.codigo) + ' - ' | 300 | valor: $filter('rellenarDigitos')(vehiculo.codigo) + ' - ' |
287 | }); | 301 | }); |
288 | } | 302 | } |
289 | 303 | ||
290 | $scope.solicitarConfirmacionCisterna = function(cisterna, idx) { | 304 | $scope.solicitarConfirmacionTabla = function(cisterna, idx){ |
291 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + | 305 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + cisterna.id + ' ' + cisterna.codigo + ' ?') |
292 | cisterna.id + ' ' + cisterna.codigo + ' ?').then( | 306 | .then( function(data) { |
293 | function(data) { | 307 | if (data) { |
294 | if (data) { | 308 | $scope.cisternasABorrar.push(cisterna); |
295 | focaAbmVehiculoService.deleteCisterna(idx); | 309 | $scope.cisternas.splice(idx,1); |
296 | focaAbmVehiculoService | ||
297 | .getCisternas($routeParams.idVehiculo) | ||
298 | .then(function(res) { | ||
299 | $scope.cisternas = res; | ||
300 | }); | ||
301 | } | ||
302 | } | 310 | } |
303 | ); | 311 | }); |
312 | return; | ||
304 | }; | 313 | }; |
305 | 314 | ||
306 | function validaCodigoUnidad() { | 315 | function validaCodigoUnidad() { |
307 | return new Promise(function(resolve, reject) { | 316 | return new Promise(function(resolve, reject) { |
308 | focaAbmVehiculoService | 317 | focaAbmVehiculoService |
309 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) | 318 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) |
310 | .then(function(res) { | 319 | .then(function(res) { |
311 | //Valida si existe numero de unidad | 320 | //Valida si existe numero de unidad |
312 | var existe = res.data.filter(function(vehiculo) { | 321 | var existe = res.data.filter(function(vehiculo) { |
313 | return vehiculo.codigo === $scope.vehiculo.codigo && | 322 | return vehiculo.codigo === $scope.vehiculo.codigo && |
314 | vehiculo.id !== $scope.vehiculo.id; | 323 | vehiculo.id !== $scope.vehiculo.id; |
315 | }); | 324 | }); |
316 | 325 | ||
317 | if (existe.length) { | 326 | if (existe.length) { |
318 | reject(existe); | 327 | reject(existe); |
319 | } else { | 328 | } else { |
320 | resolve(); | 329 | resolve(); |
321 | } | 330 | } |
322 | }); | 331 | }); |
323 | }); | 332 | }); |
324 | } | 333 | } |
325 | 334 | ||
326 | function validaTotalCargas() { | 335 | function validaTotalCargas() { |
327 | var total = 0; | 336 | var total = 0; |
328 | $scope.cisternas.forEach(function(cisterna) { | 337 | $scope.cisternas.forEach(function(cisterna) { |
329 | if (!cisterna.desactivado) { | 338 | if (!cisterna.desactivado) { |
330 | total += parseInt(cisterna.capacidad); | 339 | total += parseInt(cisterna.capacidad); |
331 | } | 340 | } |
332 | }); | 341 | }); |
333 | return $scope.vehiculo.capacidad === total; | 342 | return $scope.vehiculo.capacidad >= total; |
334 | } | 343 | } |
335 | function guardarCisternas() { | 344 | function guardarCisternas() { |
336 | var cisternas = $scope.cisternas.map(function(cisterna) { | 345 | var cisternas = $scope.cisternas.map(function(cisterna) { |
337 | return { | 346 | return { |
338 | id: cisterna.id, | 347 | id: cisterna.id, |
339 | capacidad: parseFloat(cisterna.capacidad), | 348 | capacidad: parseFloat(cisterna.capacidad), |
340 | codigo: cisterna.codigo, | 349 | codigo: cisterna.codigo, |
341 | idUnidadMedida: cisterna.idUnidadMedida, | 350 | idUnidadMedida: cisterna.idUnidadMedida, |
342 | idVehiculo: $routeParams.idVehiculo, | 351 | idVehiculo: $routeParams.idVehiculo, |
343 | desactivado: cisterna.desactivado | 352 | desactivado: cisterna.desactivado |
344 | }; | 353 | }; |
345 | }); | 354 | }); |
346 | 355 | ||
347 | return focaAbmVehiculoService.guardarCisternas(cisternas); | 356 | return focaAbmVehiculoService.guardarCisternas(cisternas); |
348 | } | 357 | } |
349 | 358 | ||
350 | $scope.guardarCisterna = function() { | 359 | $scope.agregarCisterna = function() { |
351 | if (!$scope.cisterna.codigo) { | 360 | if (!$scope.cisterna.codigo) { |
352 | focaModalService.alert('Ingrese codigo de cisterna'); | 361 | focaModalService.alert('Ingrese codigo de cisterna'); |
353 | return; | 362 | return; |
354 | } else if (!$scope.cisterna.capacidad) { | 363 | } else if (!$scope.cisterna.capacidad) { |
355 | focaModalService.alert('Ingrese capacidad'); | 364 | focaModalService.alert('Ingrese capacidad'); |
356 | return; | 365 | return; |
357 | } else if (!$scope.cisterna.idUnidadMedida) { | 366 | } else if (!$scope.cisterna.idUnidadMedida) { |
358 | focaModalService.alert('Ingrese unidad de medida'); | 367 | focaModalService.alert('Ingrese unidad de medida'); |
359 | return; | 368 | return; |
360 | } | 369 | } |
361 | $scope.creando = false; | 370 | $scope.creando = false; |
362 | if (!$scope.cisterna.id) { | 371 | if (!$scope.cisterna.id) { |
363 | validaCodigo() | 372 | validaCodigo() |
364 | .then(function() { | 373 | .then(function() { |
365 | saveCisterna(); | 374 | saveCisterna(); |
366 | }, function(err) { | 375 | }, function(err) { |
367 | focaModalService.alert(err); | 376 | focaModalService.alert(err); |
368 | }); | 377 | }); |
369 | } else { | 378 | } else { |
370 | saveCisterna(); | 379 | saveCisterna(); |
371 | } | 380 | } |
372 | }; | 381 | }; |
373 | 382 | ||
374 | function saveCisterna () { | 383 | function saveCisterna () { |
375 | $scope.cisterna.idVehiculo = parseInt($routeParams.idVehiculo); | 384 | $scope.cisterna.idVehiculo = parseInt($routeParams.idVehiculo); |
376 | delete $scope.cisterna.vehiculo; | 385 | delete $scope.cisterna.vehiculo; |
377 | var auxCisternas = $scope.cisternas; | ||
378 | if (!$scope.cisterna.id) { | 386 | if (!$scope.cisterna.id) { |
379 | auxCisternas.push($scope.cisterna); | 387 | $scope.cisternas.push($scope.cisterna); |
388 | $scope.$apply(); | ||
380 | } | 389 | } |
381 | guardarCisternas(auxCisternas) | ||
382 | .then(function() { | ||
383 | focaAbmVehiculoService | ||
384 | .getCisternas($routeParams.idVehiculo) | ||
385 | .then(function(res) { | ||
386 | $scope.cisternas = res; | ||
387 | $scope.cisterna = {}; | ||
388 | }); | ||
389 | }) | ||
390 | .catch(function (err) { | ||
391 | console.log('Err: ', err); | ||
392 | }); | ||
393 | } | 390 | } |
394 | 391 | ||
395 | if ($routeParams.idx !== -1) { | 392 | if ($routeParams.idx !== -1) { |
396 | $scope.cisterna = [$routeParams.idx]; | 393 | $scope.cisterna = [$routeParams.idx]; |
397 | focaAbmVehiculoService | 394 | focaAbmVehiculoService |
398 | .getCisternas($routeParams.idVehiculo) | 395 | .getCisternas($routeParams.idVehiculo) |
399 | .then(function(res) { | 396 | .then(function(res) { |
400 | $scope.cisterna = res[$routeParams.idx]; | 397 | $scope.cisterna = res[$routeParams.idx]; |
401 | }); | 398 | }); |
402 | } | 399 | } |
403 | 400 | ||
404 | function validaCodigo() { | 401 | function validaCodigo() { |
405 | return new Promise(function(resolve, reject) { | 402 | return new Promise(function(resolve, reject) { |
406 | focaAbmVehiculoService | 403 | focaAbmVehiculoService |
407 | .getCisternas($routeParams.idVehiculo) | 404 | .getCisternas($routeParams.idVehiculo) |
408 | .then(function(res) { | 405 | .then(function(res) { |
409 | var cisternas = res; | 406 | var cisternas = res; |
410 | var totalCargado = 0; | 407 | var totalCargado = 0; |
411 | cisternas.forEach(function(cisterna, idx) { | 408 | cisternas.forEach(function(cisterna, idx) { |
412 | //SI EL CODIGO YA EXISTE | 409 | //SI EL CODIGO YA EXISTE |
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 | var cisternasPristine = true; | 4 | var cisternasPristine = true; |
5 | return { | 5 | return { |
6 | getVehiculos: function() { | 6 | getVehiculos: function() { |
7 | return $http.get(API_ENDPOINT.URL + '/vehiculo'); | 7 | return $http.get(API_ENDPOINT.URL + '/vehiculo'); |
8 | }, | 8 | }, |
9 | getVehiculo: function(id) { | 9 | getVehiculo: function(id) { |
10 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); | 10 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + id); |
11 | }, | 11 | }, |
12 | getTransportistas: function() { | 12 | getTransportistas: function() { |
13 | return $http.get(API_ENDPOINT.URL + '/transportista'); | 13 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
14 | }, | 14 | }, |
15 | guardarVehiculo: function(vehiculo) { | 15 | guardarVehiculo: function(vehiculo) { |
16 | return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); | 16 | return $http.post(API_ENDPOINT.URL + '/vehiculo', {vehiculo: vehiculo}); |
17 | }, | 17 | }, |
18 | deleteVehiculo: function(id) { | 18 | deleteVehiculo: function(id) { |
19 | return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); | 19 | return $http.delete(API_ENDPOINT.URL + '/vehiculo/' + id); |
20 | }, | 20 | }, |
21 | getCisternas: function(idVehiculo) { | 21 | getCisternas: function(idVehiculo) { |
22 | if (cisternas.length) { | 22 | if (cisternas.length) { |
23 | cisternasPristine = true; | 23 | cisternasPristine = true; |
24 | return Promise.resolve(angular.copy(cisternas)); | 24 | return Promise.resolve(angular.copy(cisternas)); |
25 | } else { | 25 | } else { |
26 | cisternasPristine = true; | 26 | cisternasPristine = true; |
27 | return new Promise(function(resolve) { | 27 | return new Promise(function(resolve) { |
28 | $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo) | 28 | $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo) |
29 | .then(function(res) { | 29 | .then(function(res) { |
30 | cisternas = res.data; | 30 | cisternas = res.data; |
31 | resolve(res.data); | 31 | resolve(res.data); |
32 | }); | 32 | }); |
33 | }); | 33 | }); |
34 | } | 34 | } |
35 | }, | 35 | }, |
36 | guardarCisterna: function(cisterna, idx) { | 36 | guardarCisterna: function(cisterna, idx) { |
37 | if (idx !== '-1') { | 37 | if (idx !== '-1') { |
38 | //update | 38 | //update |
39 | cisternas[idx] = cisterna; | 39 | cisternas[idx] = cisterna; |
40 | cisternasPristine = false; | 40 | cisternasPristine = false; |
41 | } else { | 41 | } else { |
42 | //insert | 42 | //insert |
43 | cisternas.push(cisterna); | 43 | cisternas.push(cisterna); |
44 | cisternasPristine = false; | 44 | cisternasPristine = false; |
45 | } | 45 | } |
46 | }, | 46 | }, |
47 | guardarCisternas: function(cisternas) { | 47 | guardarCisternas: function(cisternas) { |
48 | return $http.post(API_ENDPOINT.URL + '/cisterna', {cisternas: cisternas}); | 48 | return $http.post(API_ENDPOINT.URL + '/cisterna', {cisternas: cisternas}); |
49 | }, | 49 | }, |
50 | deleteCisterna: function(idx) { | 50 | deleteCisterna: function(cisterna) { |
51 | cisternas[idx].desactivado = true; | 51 | cisterna.desactivado = true; |
52 | cisternasPristine = false; | 52 | cisternasPristine = false; |
53 | return $http.delete(API_ENDPOINT.URL + '/cisterna/' + cisternas[idx].id); | 53 | return $http.delete(API_ENDPOINT.URL + '/cisterna/' + cisterna.id); |
54 | }, | 54 | }, |
55 | cleanCisternas: function() { | 55 | cleanCisternas: function() { |
56 | cisternas = []; | 56 | cisternas = []; |
57 | }, | 57 | }, |
58 | getVehiculosPorTransportista: function(id) { | 58 | getVehiculosPorTransportista: function(id) { |
59 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); | 59 | return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); |
60 | }, | 60 | }, |
61 | getTransportistaPorId: function(id) { | 61 | getTransportistaPorId: function(id) { |
62 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); | 62 | return $http.get(API_ENDPOINT.URL + '/transportista/' + id); |
63 | }, | 63 | }, |
64 | transportistaSeleccionado: {} | 64 | transportistaSeleccionado: {} |
65 | }; | 65 | }; |
66 | }]); | 66 | }]); |
67 | 67 |
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="text-center px-4">Código</th> | 80 | <th class="text-center px-4">Código</th> |
81 | <th class="text-center">Capacidad</th> | 81 | <th class="text-center">Capacidad</th> |
82 | <th class="text-center">Unidad de Medida</th> | 82 | <th class="text-center">Unidad de Medida</th> |
83 | <th class="text-center"> | 83 | <th class="text-center"> |
84 | <button | 84 | <button |
85 | class="btn btn-outline-debo boton-accion" | 85 | class="btn btn-outline-debo boton-accion" |
86 | title="Agregar" | 86 | title="Agregar" |
87 | ng-click="editar('nuevo')"> | 87 | ng-click="editar('nuevo')"> |
88 | <i class="fa fa-plus"></i> | 88 | <i class="fa fa-plus"></i> |
89 | </button> | 89 | </button> |
90 | </th> | 90 | </th> |
91 | </tr> | 91 | </tr> |
92 | </thead> | 92 | </thead> |
93 | <tbody> | 93 | <tbody> |
94 | <tr ng-show="creando"> | 94 | <tr ng-show="creando"> |
95 | <td align="center"> | 95 | <td align="center"> |
96 | <input | 96 | <input |
97 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" | 97 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" |
98 | ng-model="cisterna.codigo" | 98 | ng-model="cisterna.codigo" |
99 | ng-keypress="next($event.keyCode)" | 99 | ng-keypress="next($event.keyCode)" |
100 | foca-focus="focused == 1" | 100 | foca-focus="focused == 1" |
101 | ng-focus="focused = 1" | 101 | ng-focus="focused = 1" |
102 | ng-disabled="!nuevoCisterna" | 102 | ng-disabled="!nuevoCisterna" |
103 | teclado-virtual | 103 | teclado-virtual |
104 | > | 104 | > |
105 | </td> | 105 | </td> |
106 | <td align="center"> | 106 | <td align="center"> |
107 | <input | 107 | <input |
108 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" | 108 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" |
109 | teclado-virtual | 109 | teclado-virtual |
110 | foca-tipo-input | 110 | foca-tipo-input |
111 | ng-model="cisterna.capacidad" | 111 | ng-model="cisterna.capacidad" |
112 | ng-required="true" | 112 | ng-required="true" |
113 | ng-keypress="next($event.keyCode)" | 113 | ng-keypress="next($event.keyCode)" |
114 | foca-focus="focused == 2" | 114 | foca-focus="focused == 2" |
115 | ng-focus="focused = 2" | 115 | ng-focus="focused = 2" |
116 | > | 116 | > |
117 | </td> | 117 | </td> |
118 | <td align="center"> | 118 | <td align="center"> |
119 | <div class="input-group"> | 119 | <div class="input-group"> |
120 | <input | 120 | <input |
121 | ng-model="cisterna.unidadMedida.NOM" | 121 | ng-model="cisterna.unidadMedida.NOM" |
122 | class="form-control" | 122 | class="form-control" |
123 | readonly | 123 | readonly |
124 | /> | 124 | /> |
125 | <div class="input-group-append"> | 125 | <div class="input-group-append"> |
126 | <button | 126 | <button |
127 | ladda="searchLoading" | 127 | ladda="searchLoading" |
128 | class="btn btn-outline-secondary form-control" | 128 | class="btn btn-outline-secondary form-control" |
129 | type="button" | 129 | type="button" |
130 | ng-click="seleccionarUnidadMedida()" | 130 | ng-click="seleccionarUnidadMedida()" |
131 | foca-focus="focused == 3" | 131 | foca-focus="focused == 3" |
132 | > | 132 | > |
133 | <i class="fa fa-search" aria-hidden="true"></i> | 133 | <i class="fa fa-search" aria-hidden="true"></i> |
134 | </button> | 134 | </button> |
135 | </div> | 135 | </div> |
136 | </div> | 136 | </div> |
137 | </td> | 137 | </td> |
138 | <td align="center"> | 138 | <td align="center"> |
139 | <button | 139 | <button |
140 | class="btn btn-outline-dark boton-accion" | 140 | class="btn btn-outline-dark boton-accion" |
141 | ng-click="guardarCisterna()" | 141 | ng-click="agregarCisterna()" |
142 | > | 142 | > |
143 | <i class="fa fa-save"></i> | 143 | <i class="fa fa-save"></i> |
144 | </button> | 144 | </button> |
145 | </td> | 145 | </td> |
146 | </tr> | 146 | </tr> |
147 | 147 | ||
148 | <tr ng-repeat="(key, cisterna) in cisternas | filter:filtros" | 148 | <tr ng-repeat="(key, cisterna) in cisternas | filter:filtros" |
149 | ng-show="!cisterna.desactivado"> | 149 | ng-show="!cisterna.desactivado"> |
150 | <td ng-bind="cisterna.codigo" class="text-center"></td> | 150 | <td ng-bind="cisterna.codigo" class="text-center"></td> |
151 | <td ng-bind="cisterna.capacidad" class="text-center"></td> | 151 | <td ng-bind="cisterna.capacidad" class="text-center"></td> |
152 | <td ng-bind="cisterna.unidadMedida.NOM" class="text-center"></td> | 152 | <td ng-bind="cisterna.unidadMedida.NOM" class="text-center"></td> |
153 | <td class="text-center"> | 153 | <td class="text-center"> |
154 | <button | 154 | <button |
155 | class="btn btn-outline-dark boton-accion" | 155 | class="btn btn-outline-dark boton-accion" |
156 | title="Editar" | 156 | title="Editar" |
157 | ng-click="editar('',cisterna)" | 157 | ng-click="editar('',cisterna)" |
158 | > | 158 | > |
159 | <i class="fa fa-pencil"></i> | 159 | <i class="fa fa-pencil"></i> |
160 | </button> | 160 | </button> |
161 | <button | 161 | <button |
162 | class="btn btn-outline-dark boton-accion" | 162 | class="btn btn-outline-dark boton-accion" |
163 | title="Eliminar" | 163 | title="Eliminar" |
164 | ng-click="solicitarConfirmacionCisterna(cisterna, key)" | 164 | ng-click="solicitarConfirmacionTabla(cisterna,$index)" |
165 | > | 165 | > |
166 | <i class="fa fa-trash"></i> | 166 | <i class="fa fa-trash"></i> |
167 | </button> | 167 | </button> |
168 | </td> | 168 | </td> |
169 | </tr> | 169 | </tr> |
170 | </body> | 170 | </body> |
171 | </table> | 171 | </table> |
172 | </div> | 172 | </div> |
173 | </div> | 173 | </div> |
174 | </div> | 174 | </div> |
175 | 175 |