Commit a42e3b4bda7b652379f792ba763d272318397c33
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !19
Showing
5 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -16,7 +16,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
16 | 16 | label: 'Fecha Reparto', |
17 | 17 | image: 'abmChofer.png' |
18 | 18 | }; |
19 | - $scope.botonera = [transportista, fecha]; | |
19 | + $scope.botonera = [fecha, transportista]; | |
20 | 20 | var cabecera = ''; |
21 | 21 | $scope.now = new Date(); |
22 | 22 | $scope.idVendedor = 0; |
... | ... | @@ -34,10 +34,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
34 | 34 | focaBotoneraLateralService.showPausar(false); |
35 | 35 | focaBotoneraLateralService.showGuardar(false); |
36 | 36 | |
37 | - // TODO: obtener vehiculos con remitos cargados para esa fecha que no han sido confirmados | |
38 | - // focaLogisticaPedidoRutaService.getVehiculosByIdUsuario().then(function(res) { | |
39 | - // $scope.vehiculos = res.data; | |
40 | - // }); | |
37 | + | |
41 | 38 | |
42 | 39 | $scope.general = function() { |
43 | 40 | $scope.idVendedor = 0; |
... | ... | @@ -51,7 +48,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
51 | 48 | |
52 | 49 | $scope.cargar = function(idVehiculo, punto) { |
53 | 50 | if(!$scope.fechaReparto) { |
54 | - focaModalService.alert('elija primero una fecha de reparto'); | |
51 | + focaModalService.alert('Primero seleccione fecha de reparto'); | |
55 | 52 | return; |
56 | 53 | } |
57 | 54 | var idRemito; |
... | ... | @@ -86,6 +83,10 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
86 | 83 | }; |
87 | 84 | |
88 | 85 | $scope.hacerHojaRuta = function(vehiculo) { |
86 | + if(!$scope.fechaReparto) { | |
87 | + focaModalService.alert('Primero seleccione fecha de reparto'); | |
88 | + return; | |
89 | + } | |
89 | 90 | var modalInstance = $uibModal.open( |
90 | 91 | { |
91 | 92 | ariaLabelledBy: 'Creación hoja ruta', |
... | ... | @@ -184,6 +185,10 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
184 | 185 | valor: fecha.toLocaleDateString() |
185 | 186 | }); |
186 | 187 | $scope.fechaReparto = fecha; |
188 | + focaLogisticaPedidoRutaService.setFechaReparto(fecha); | |
189 | + focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { | |
190 | + $scope.vehiculos = res.data; | |
191 | + }); | |
187 | 192 | }); |
188 | 193 | }; |
189 | 194 |
src/js/controllerDetalleVehiculo.js
... | ... | @@ -7,9 +7,8 @@ angular.module('focaLogisticaPedidoRuta') |
7 | 7 | 'focaModalService', |
8 | 8 | '$filter', |
9 | 9 | 'focaLogisticaPedidoRutaService', |
10 | - 'fechaReparto', | |
11 | 10 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, |
12 | - focaLogisticaPedidoRutaService, fechaReparto | |
11 | + focaLogisticaPedidoRutaService | |
13 | 12 | ) { |
14 | 13 | //seteo variables |
15 | 14 | $scope.cargandoDatos = true; |
... | ... | @@ -24,7 +23,7 @@ angular.module('focaLogisticaPedidoRuta') |
24 | 23 | var promesaRemito; |
25 | 24 | var promesaVehiculo = focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo); |
26 | 25 | var promesaCisternas = focaLogisticaPedidoRutaService |
27 | - .obtenerCisternasPorFecha(idVehiculo, fechaReparto); | |
26 | + .obtenerCisternasPorFecha(idVehiculo); | |
28 | 27 | if(idRemito !== -1) { |
29 | 28 | promesaRemito = focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito); |
30 | 29 | } |
... | ... | @@ -77,6 +76,7 @@ angular.module('focaLogisticaPedidoRuta') |
77 | 76 | for(var i = 0; i < $scope.cisternas.length; i++) { |
78 | 77 | var cisterna = $scope.cisternas[i]; |
79 | 78 | var aCargar = parseFloat($scope.aCargar[i]); |
79 | + var fechaReparto = focaLogisticaPedidoRutaService.fecha; | |
80 | 80 | //validaciones |
81 | 81 | if(!aCargar) { |
82 | 82 | continue; |
... | ... | @@ -121,8 +121,10 @@ angular.module('focaLogisticaPedidoRuta') |
121 | 121 | } |
122 | 122 | }; |
123 | 123 | $scope.calcularPorcentaje = function(cisterna) { |
124 | - if(!cisterna.cisternaCarga.cantidad) { | |
125 | - cisterna.cisternaCarga.cantidad = 0; | |
124 | + if(!cisterna.cisternaCarga) { | |
125 | + cisterna.cisternaCarga = { | |
126 | + cantidad: 0 | |
127 | + }; | |
126 | 128 | } |
127 | 129 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / |
128 | 130 | cisterna.capacidad) + '%'; |
... | ... | @@ -156,7 +158,8 @@ angular.module('focaLogisticaPedidoRuta') |
156 | 158 | $scope.cisternas[i].disabled = true; |
157 | 159 | continue; |
158 | 160 | } |
159 | - if($scope.cisternas[i].cisternaCarga.idProducto && | |
161 | + if($scope.cisternas[i].cisternaCarga && | |
162 | + $scope.cisternas[i].cisternaCarga.idProducto && | |
160 | 163 | $scope.articuloSeleccionado.idArticulo !== |
161 | 164 | $scope.cisternas[i].cisternaCarga.idProducto) |
162 | 165 | { |
src/js/service.js
1 | 1 | angular.module('focaLogisticaPedidoRuta') |
2 | - .service( | |
2 | + .factory( | |
3 | 3 | 'focaLogisticaPedidoRutaService', [ |
4 | 4 | '$http', |
5 | 5 | '$cookies', |
... | ... | @@ -45,13 +45,20 @@ angular.module('focaLogisticaPedidoRuta') |
45 | 45 | obtenerRemitosDeCarga: function(remitos) { |
46 | 46 | var remitosRes = []; |
47 | 47 | for(var i = 0; i < remitos.cisternas.length; i++) { |
48 | - procesoCistena(remitos.cisternas[i]); | |
48 | + procesoCistena(remitos.cisternas[i], this.fecha.toISOString()); | |
49 | 49 | } |
50 | - function procesoCistena(cisterna) { | |
51 | - for(var j = 0; j < cisterna.cisternaCarga.cisternaMovimientos.length; | |
52 | - j++) { | |
53 | - procesoMovimiento( | |
54 | - cisterna.cisternaCarga.cisternaMovimientos[j]); | |
50 | + function procesoCistena(cisterna, fecha) { | |
51 | + for(var j = 0; j < cisterna.cisternasCarga.length; j++) { | |
52 | + for(var k = 0; k < cisterna.cisternasCarga[j].cisternaMovimientos | |
53 | + .length; k++) | |
54 | + { | |
55 | + if(cisterna.cisternasCarga[j].fechaReparto.substring(0, 10) === | |
56 | + fecha.substring(0, 10)) | |
57 | + { | |
58 | + procesoMovimiento(cisterna.cisternasCarga[j] | |
59 | + .cisternaMovimientos[k]); | |
60 | + } | |
61 | + } | |
55 | 62 | } |
56 | 63 | } |
57 | 64 | function procesoMovimiento(movimiento) { |
... | ... | @@ -69,9 +76,16 @@ angular.module('focaLogisticaPedidoRuta') |
69 | 76 | getVehiculosByIdUsuario: function() { |
70 | 77 | return $http.get(API_ENDPOINT.URL + '/vehiculo/usuario/' + this.idUsuario); |
71 | 78 | }, |
72 | - obtenerCisternasPorFecha: function(idVehiculo, fecha) { | |
79 | + obtenerCisternasPorFecha: function(idVehiculo) { | |
73 | 80 | return $http.post(API_ENDPOINT.URL + '/cisterna/listar/fecha', |
74 | - {idVehiculo: idVehiculo, fechaReparto: fecha}); | |
81 | + {idVehiculo: idVehiculo, fechaReparto: this.fecha}); | |
82 | + }, | |
83 | + getUnidadesByFecha: function() { | |
84 | + return $http.post(API_ENDPOINT.URL + '/vehiculo/listar/fecha', | |
85 | + {fecha: this.fecha}); | |
86 | + }, | |
87 | + setFechaReparto: function(fechaReparto) { | |
88 | + this.fecha = fechaReparto; | |
75 | 89 | } |
76 | 90 | }; |
77 | 91 | }]); |
src/views/foca-logistica-pedido-ruta.html
... | ... | @@ -137,8 +137,8 @@ |
137 | 137 | src="img/hojaRutaVolante.png" |
138 | 138 | width="100%"> |
139 | 139 | </div> |
140 | - <div class="col-3" | |
141 | - uib-tooltip="Confeccionar hoja de ruta" | |
140 | + <div class="col-3" | |
141 | + uib-tooltip="Confirmar hoja de ruta" | |
142 | 142 | ng-click="hacerHojaRuta(vehiculo)"></div> |
143 | 143 | <div class="col-3"> |
144 | 144 | <i |
src/views/foca-modal-crear-hoja-ruta.html