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