Commit 107f38cfbcdb298fa4f586e7c8aecf663a183260

Authored by Luigi
1 parent a329cbddc9
Exists in master

Modificar - borrar cisterna

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