Commit 0b4f70caac093fbd688dfb7f99da4bff7c23295b
Exists in
master
and in
2 other branches
Merge branch 'develop' into 'master'
Develop See merge request !35
Showing
3 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -77,27 +77,27 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
77 | 77 | }, true); |
78 | 78 | |
79 | 79 | $scope.crearHojaRuta = function() { |
80 | - if(!$scope.hojaRuta.remitosTabla.length) { | |
80 | + if (!$scope.hojaRuta.remitosTabla.length) { | |
81 | 81 | focaModalService.alert('Ingrese Remitos'); |
82 | 82 | return; |
83 | 83 | } |
84 | - if(!$scope.hojaRuta.chofer.id) { | |
84 | + if (!$scope.hojaRuta.chofer.id) { | |
85 | 85 | focaModalService.alert('Ingrese Chofer'); |
86 | 86 | return; |
87 | 87 | } |
88 | - if(!$scope.hojaRuta.vehiculo.id) { | |
88 | + if (!$scope.hojaRuta.vehiculo.id) { | |
89 | 89 | focaModalService.alert('Ingrese Vehiculo'); |
90 | 90 | return; |
91 | 91 | } |
92 | - if(!$scope.hojaRuta.transportista.COD) { | |
92 | + if (!$scope.hojaRuta.transportista.COD) { | |
93 | 93 | focaModalService.alert('Ingrese Transportista'); |
94 | 94 | return; |
95 | 95 | } |
96 | - if(!$scope.hojaRuta.tarifario.costo) { | |
96 | + if (!$scope.hojaRuta.tarifario.costo) { | |
97 | 97 | focaModalService.alert('Ingrese Tarifario'); |
98 | 98 | return; |
99 | 99 | } |
100 | - if(!$scope.hojaRuta.datosExtra) { | |
100 | + if (!$scope.hojaRuta.datosExtra) { | |
101 | 101 | focaModalService.alert('Ingrese Datos extra'); |
102 | 102 | return; |
103 | 103 | } |
... | ... | @@ -135,7 +135,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
135 | 135 | }; |
136 | 136 | |
137 | 137 | $scope.seleccionarTransportista = function() { |
138 | - if(eligioPreConfirmado()) return; | |
138 | + if (eligioPreConfirmado()) return; | |
139 | 139 | var parametrosModal = { |
140 | 140 | titulo: 'Búsqueda de transportista', |
141 | 141 | query: '/transportista', |
... | ... | @@ -209,40 +209,37 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
209 | 209 | }; |
210 | 210 | |
211 | 211 | $scope.seleccionarVehiculo = function() { |
212 | - if(!eligioFecha() || eligioPreConfirmado()) return; | |
212 | + if (!eligioFecha() || eligioPreConfirmado()) return; | |
213 | 213 | modalVehiculos(); |
214 | 214 | }; |
215 | 215 | |
216 | 216 | $scope.seleccionarTarifario = function() { |
217 | - var modalInstance = $uibModal.open( | |
218 | - { | |
219 | - ariaLabelledBy: 'Busqueda de Tarifario', | |
220 | - templateUrl: 'modal-tarifa-flete.html', | |
221 | - controller: 'focaModalTarifaFleteController', | |
222 | - size: 'lg', | |
223 | - resolve: { | |
224 | - parametrosTarifaFlete: function() { | |
225 | - return $scope.hojaRuta.tarifario.costo; | |
226 | - } | |
217 | + focaModalService | |
218 | + .prompt({ | |
219 | + titulo: 'Tarifa flete', | |
220 | + value: $scope.hojaRuta.tarifario.costo | |
221 | + }) | |
222 | + .then(function(costo) { | |
223 | + if (isNaN(costo)) { | |
224 | + focaModalService | |
225 | + .alert('Ingrese un valor válido') | |
226 | + .then(function() { | |
227 | + $scope.seleccionarTarifario(); | |
228 | + }); | |
229 | + | |
230 | + return; | |
227 | 231 | } |
228 | - } | |
229 | - ); | |
230 | 232 | |
231 | - modalInstance.result.then( | |
232 | - function(tarifario) { | |
233 | - $scope.hojaRuta.tarifario = tarifario; | |
233 | + $scope.hojaRuta.tarifario.costo = costo; | |
234 | 234 | $scope.$broadcast('addCabecera', { |
235 | 235 | label: 'Tarifario:', |
236 | - valor: tarifario.costo | |
236 | + valor: costo | |
237 | 237 | }); |
238 | - }, function() { | |
239 | - // funcion ejecutada cuando se cancela el modal | |
240 | - } | |
241 | - ); | |
238 | + }); | |
242 | 239 | }; |
243 | 240 | |
244 | 241 | $scope.seleccionarRemitos = function() { |
245 | - if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; | |
242 | + if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; | |
246 | 243 | var modalInstance = $uibModal.open( |
247 | 244 | { |
248 | 245 | ariaLabelledBy: 'Busqueda de Remito', |
... | ... | @@ -286,9 +283,9 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
286 | 283 | |
287 | 284 | // remito.litros = litros; |
288 | 285 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; |
289 | - $scope.cargarCisterna(remito.id).then(function() { | |
286 | + $scope.cargarCisterna(remito.id).then(function(response) { | |
290 | 287 | $scope.hojaRuta.remitosTabla.push(remito); |
291 | - $scope.seleccionarRemitos(); | |
288 | + if (!response) $scope.seleccionarRemitos(); | |
292 | 289 | }, function() { |
293 | 290 | $scope.seleccionarRemitos(); |
294 | 291 | }); |
... | ... | @@ -299,12 +296,12 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
299 | 296 | }; |
300 | 297 | |
301 | 298 | $scope.seleccionarVehiculosPrecargados = function() { |
302 | - if(!eligioFecha()) return; | |
299 | + if (!eligioFecha()) return; | |
303 | 300 | modalVehiculos(true); |
304 | 301 | }; |
305 | 302 | |
306 | 303 | $scope.cargarCisterna = function(idRemito) { |
307 | - if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; | |
304 | + if (!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; | |
308 | 305 | var modalInstance = $uibModal.open( |
309 | 306 | { |
310 | 307 | ariaLabelledBy: 'Busqueda de Vehiculo', |
... | ... | @@ -363,19 +360,45 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
363 | 360 | focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + |
364 | 361 | ' vehículo?').then(function() { |
365 | 362 | focaCrearHojaRutaService.desasociarRemitos(idsRemito, |
366 | - $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1).then( | |
367 | - function() { | |
363 | + $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1) | |
364 | + .then(function() { | |
368 | 365 | $scope.hojaRuta.remitosTabla.splice(key, 1); |
369 | 366 | focaModalService.alert('Remito desasociado con éxito'); |
370 | - } | |
371 | - ); | |
367 | + }); | |
372 | 368 | }); |
373 | 369 | }; |
370 | + | |
371 | + $scope.verProductosRemito = function(idRemito) { | |
372 | + var parametrosModal = { | |
373 | + titulo: 'Articulos remito', | |
374 | + query: '/articulos/remito/' + idRemito, | |
375 | + soloMostrar: true, | |
376 | + columnas: [ | |
377 | + { | |
378 | + nombre: 'Código', | |
379 | + propiedad: 'codigo' | |
380 | + }, | |
381 | + { | |
382 | + nombre: 'Descripción', | |
383 | + propiedad: 'descripcion' | |
384 | + }, | |
385 | + { | |
386 | + nombre: 'Cantidad', | |
387 | + propiedad: 'cantidad' | |
388 | + } | |
389 | + ] | |
390 | + }; | |
391 | + focaModalService.modal(parametrosModal).then(); | |
392 | + }; | |
374 | 393 | |
375 | 394 | function elegirFecha() { |
376 | - focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { | |
395 | + var fechaEntrega = { | |
396 | + titulo: 'Fecha de entrega', | |
397 | + minDate: new Date() | |
398 | + }; | |
399 | + focaModalService.modalFecha(fechaEntrega).then(function(fecha) { | |
377 | 400 | $scope.$broadcast('addCabecera', { |
378 | - label: 'Fecha de entrega:', | |
401 | + label: 'Fecha de entrega: ', | |
379 | 402 | valor: fecha.toLocaleDateString() |
380 | 403 | }); |
381 | 404 | $scope.hojaRuta.fechaReparto = fecha; |
... | ... | @@ -383,7 +406,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
383 | 406 | } |
384 | 407 | |
385 | 408 | function eligioPreConfirmado() { |
386 | - if($scope.eligioPreConfirmado) { | |
409 | + if ($scope.eligioPreConfirmado) { | |
387 | 410 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); |
388 | 411 | return true; |
389 | 412 | } |
... | ... | @@ -391,7 +414,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
391 | 414 | } |
392 | 415 | |
393 | 416 | function eligioFecha() { |
394 | - if(!$scope.hojaRuta.fechaReparto) { | |
417 | + if (!$scope.hojaRuta.fechaReparto) { | |
395 | 418 | focaModalService.alert('Primero seleccione fecha de reparto'); |
396 | 419 | return false; |
397 | 420 | } |
... | ... | @@ -399,7 +422,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
399 | 422 | } |
400 | 423 | |
401 | 424 | function eligioVehiculo() { |
402 | - if(!$scope.hojaRuta.vehiculo.id) { | |
425 | + if (!$scope.hojaRuta.vehiculo.id) { | |
403 | 426 | focaModalService.alert('Primero seleccione vehiculo'); |
404 | 427 | return false; |
405 | 428 | } |
... | ... | @@ -408,11 +431,11 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
408 | 431 | |
409 | 432 | function modalVehiculos(preCargados) { |
410 | 433 | var parametrosModal = {}; |
411 | - if(preCargados) { | |
434 | + if (preCargados) { | |
412 | 435 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + |
413 | 436 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10); |
414 | 437 | parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; |
415 | - }else { | |
438 | + } else { | |
416 | 439 | parametrosModal.query = '/vehiculo'; |
417 | 440 | parametrosModal.titulo = 'Búsqueda de vehículos'; |
418 | 441 | } |
... | ... | @@ -431,10 +454,10 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
431 | 454 | } |
432 | 455 | ]; |
433 | 456 | focaModalService.modal(parametrosModal).then(function(vehiculo) { |
434 | - if(!preCargados && vehiculoEnUso(vehiculo)) return; | |
457 | + if (!preCargados && vehiculoEnUso(vehiculo)) return; | |
435 | 458 | $scope.hojaRuta.vehiculo = vehiculo; |
436 | 459 | $scope.hojaRuta.transportista = vehiculo.transportista; |
437 | - if(preCargados) { | |
460 | + if (preCargados) { | |
438 | 461 | $scope.eligioPreConfirmado = true; |
439 | 462 | $scope.hojaRuta.vehiculo = vehiculo; |
440 | 463 | $scope.$broadcast('addCabecera', { |
... | ... | @@ -447,7 +470,7 @@ angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
447 | 470 | .then(function(res) { |
448 | 471 | $scope.hojaRuta.remitosTabla = res.data; |
449 | 472 | }); |
450 | - }else { | |
473 | + } else { | |
451 | 474 | focaCrearHojaRutaService |
452 | 475 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true) |
453 | 476 | .then(function(res) { |
src/js/controllerDatosHojaRuta.js
... | ... | @@ -11,8 +11,8 @@ angular.module('focaCrearHojaRuta') |
11 | 11 | $scope.focused = 0; |
12 | 12 | |
13 | 13 | $scope.aceptar = function(key) { |
14 | - if(key === 13) { | |
15 | - if(!$scope.formDatosHojaRuta.$valid) { | |
14 | + if (key === 13) { | |
15 | + if (!$scope.formDatosHojaRuta.$valid) { | |
16 | 16 | focaModalService.alert('Formulario inválido'); |
17 | 17 | return; |
18 | 18 | } |
... | ... | @@ -21,7 +21,7 @@ angular.module('focaCrearHojaRuta') |
21 | 21 | }; |
22 | 22 | |
23 | 23 | $scope.next = function(key) { |
24 | - if(key === 13) $scope.focused++; | |
24 | + if (key === 13) $scope.focused++; | |
25 | 25 | }; |
26 | 26 | |
27 | 27 | $scope.cancel = function() { |
src/views/hoja-ruta.html
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | <th class="col-2">Remito</th> |
23 | 23 | <th class="col">Cliente</th> |
24 | 24 | <th class="col">Dirección</th> |
25 | + <th class="col-auto"></th> | |
25 | 26 | <th class="col-auto"> |
26 | 27 | <button |
27 | 28 | class="btn btn-outline-light selectable" |
... | ... | @@ -40,7 +41,6 @@ |
40 | 41 | </i> |
41 | 42 | </button> |
42 | 43 | </th> |
43 | - </th> | |
44 | 44 | </tr> |
45 | 45 | </thead> |
46 | 46 | <tbody class="tabla-articulo-body"> |
... | ... | @@ -52,14 +52,23 @@ |
52 | 52 | <td ng-bind="key + 1" class="col-auto"></td> |
53 | 53 | <td |
54 | 54 | class="col-2" |
55 | - ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" | |
56 | - ></td> | |
55 | + >{{remito.sucursal | rellenarDigitos: 4}}-{{remito.numeroRemito | rellenarDigitos: 8}}</td> | |
57 | 56 | <th class="col" ng-bind="remito.nombreCliente"></th> |
58 | 57 | <th class="col" ng-bind="remito.domicilioStamp"></th> |
59 | 58 | <td class="text-center col-auto"> |
60 | 59 | <button |
61 | 60 | class="btn btn-outline-light" |
61 | + ng-click="verProductosRemito(remito.id)" | |
62 | + title="Ver productos" | |
63 | + > | |
64 | + <i class="fa fa-eye"></i> | |
65 | + </button> | |
66 | + </td> | |
67 | + <td class="text-center col-auto"> | |
68 | + <button | |
69 | + class="btn btn-outline-light" | |
62 | 70 | ng-click="desasociarRemito(key, remito.id)" |
71 | + title="Eliminar" | |
63 | 72 | > |
64 | 73 | <i class="fa fa-trash"></i> |
65 | 74 | </button> |