Commit 05ea01e417e112883b2c82979b1df5f752d7cc02
1 parent
7b348d3bbe
Exists in
master
Setear fecha predeterminada en cabecera
Showing
2 changed files
with
33 additions
and
26 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -7,6 +7,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
7 | 7 | $scope.actividad = 'Logistica'; |
8 | 8 | //Datos Pantalla |
9 | 9 | $scope.titulo = 'Logistica de Pedidos'; |
10 | + | |
10 | 11 | var transportista = { |
11 | 12 | label: 'Vehículo', |
12 | 13 | image: 'abmChofer.png' |
... | ... | @@ -28,6 +29,8 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
28 | 29 | getSeguimiento(); |
29 | 30 | }; |
30 | 31 | |
32 | + setearFecha(new Date()); | |
33 | + | |
31 | 34 | //SETEO BOTONERA LATERAL |
32 | 35 | focaBotoneraLateralService.showSalir(true); |
33 | 36 | focaBotoneraLateralService.showPausar(false); |
... | ... | @@ -44,11 +47,11 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
44 | 47 | }; |
45 | 48 | |
46 | 49 | $scope.cargar = function(idVehiculo, punto) { |
47 | - if(!eligioFecha()) return; | |
50 | + if (!eligioFecha()) return; | |
48 | 51 | var idRemito; |
49 | - if(punto === -1) { | |
52 | + if (punto === -1) { | |
50 | 53 | idRemito = -1; |
51 | - }else { | |
54 | + } else { | |
52 | 55 | idRemito = JSON.parse(punto).notaPedido.remito.id; |
53 | 56 | } |
54 | 57 | $uibModal.open( |
... | ... | @@ -67,7 +70,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
67 | 70 | }; |
68 | 71 | |
69 | 72 | $scope.quitarVehiculo = function(vehiculo) { |
70 | - if(!eligioFecha() || vehiculoEnUso(vehiculo)) return; | |
73 | + if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; | |
71 | 74 | |
72 | 75 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + |
73 | 76 | vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() { |
... | ... | @@ -76,7 +79,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
76 | 79 | }; |
77 | 80 | |
78 | 81 | $scope.hacerHojaRuta = function(vehiculo, cerrar) { |
79 | - if(!eligioFecha() || vehiculoEnUso(vehiculo)) return; | |
82 | + if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; | |
80 | 83 | var modalInstance = $uibModal.open( |
81 | 84 | { |
82 | 85 | ariaLabelledBy: 'Creación hoja ruta', |
... | ... | @@ -178,11 +181,11 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
178 | 181 | focaModalService.modal(parametrosModal).then( |
179 | 182 | function(vehiculo) { |
180 | 183 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); |
181 | - if(existe.length) { | |
184 | + if (existe.length) { | |
182 | 185 | focaModalService.alert('El vehiculo ya ha sido cargado'); |
183 | 186 | return; |
184 | 187 | } |
185 | - if(!vehiculo.cisternas.length) { | |
188 | + if (!vehiculo.cisternas.length) { | |
186 | 189 | focaModalService.alert('El vehiculo no tiene cisternas'); |
187 | 190 | return; |
188 | 191 | } |
... | ... | @@ -194,27 +197,31 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
194 | 197 | |
195 | 198 | $scope.seleccionarFechaReparto = function() { |
196 | 199 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { |
197 | - $scope.$broadcast('addCabecera',{ | |
200 | + setearFecha(fecha); | |
201 | + }); | |
202 | + }; | |
203 | + | |
204 | + function setearFecha(fecha) { | |
205 | + $scope.fechaReparto = fecha; | |
206 | + focaLogisticaPedidoRutaService.setFechaReparto(fecha); | |
207 | + focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res){ | |
208 | + $scope.vehiculos = res.data; | |
209 | + $scope.$broadcast('addCabecera', { | |
198 | 210 | label: 'Fecha:', |
199 | 211 | valor: fecha.toLocaleDateString() |
200 | 212 | }); |
201 | - $scope.fechaReparto = fecha; | |
202 | - focaLogisticaPedidoRutaService.setFechaReparto(fecha); | |
203 | - focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { | |
204 | - $scope.vehiculos = res.data; | |
205 | - }); | |
206 | 213 | }); |
207 | - }; | |
214 | + } | |
208 | 215 | |
209 | 216 | function getSeguimiento() { |
210 | 217 | var desde = new Date('1900/01/01'); |
211 | 218 | var hasta = new Date('2099/01/01'); |
212 | - if($scope.fechaDesde) { | |
219 | + if ($scope.fechaDesde) { | |
213 | 220 | var fechaDesde = $scope.fechaDesde; |
214 | 221 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); |
215 | 222 | desde = new Date(desde); |
216 | 223 | } |
217 | - if($scope.fechaHasta) { | |
224 | + if ($scope.fechaHasta) { | |
218 | 225 | var fechaHasta = $scope.fechaHasta; |
219 | 226 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); |
220 | 227 | hasta = hasta.setDate(hasta.getDate() + 1); |
... | ... | @@ -235,7 +242,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
235 | 242 | }; |
236 | 243 | |
237 | 244 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
238 | - if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { | |
245 | + if (JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { | |
239 | 246 | $scope.marcadores = datos.data; |
240 | 247 | } |
241 | 248 | }); |
... | ... | @@ -243,9 +250,9 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
243 | 250 | |
244 | 251 | function eliminarVehiculo(vehiculo) { |
245 | 252 | focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) { |
246 | - if(!res.data.length) { | |
253 | + if (!res.data.length) { | |
247 | 254 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
248 | - }else { | |
255 | + } else { | |
249 | 256 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + |
250 | 257 | 'tiene remitos asociados').then(function() { |
251 | 258 | $scope.hacerHojaRuta(vehiculo, true); |
... | ... | @@ -255,7 +262,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
255 | 262 | } |
256 | 263 | |
257 | 264 | function eligioFecha() { |
258 | - if(!$scope.fechaReparto) { | |
265 | + if (!$scope.fechaReparto) { | |
259 | 266 | focaModalService.alert('Primero seleccione fecha de reparto'); |
260 | 267 | return false; |
261 | 268 | } |
... | ... | @@ -267,7 +274,7 @@ angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaCo |
267 | 274 | for(var i = 0; i < vehiculo.cisternas.length; i++) { |
268 | 275 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { |
269 | 276 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; |
270 | - if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | |
277 | + if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | |
271 | 278 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && |
272 | 279 | cisternaCarga.idUsuarioProceso !== idUsuario) |
273 | 280 | { |
src/js/osm-directive.js
... | ... | @@ -40,8 +40,8 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() |
40 | 40 | var observacion = |
41 | 41 | 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + |
42 | 42 | ( |
43 | - marcador.notaPedido.vendedor ? | |
44 | - marcador.notaPedido.vendedor.NomVen : | |
43 | + marcador.notaPedido.vendedor ? | |
44 | + marcador.notaPedido.vendedor.NomVen : | |
45 | 45 | '' |
46 | 46 | ) + '<br/>'; |
47 | 47 | observacion += 'Fecha: ' + |
... | ... | @@ -57,12 +57,12 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() |
57 | 57 | // if($scope.parametros.individual) { |
58 | 58 | observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; |
59 | 59 | |
60 | - if(marcador.distancia) { | |
60 | + if (marcador.distancia) { | |
61 | 61 | observacion += '<br/>Distancia a casa central: ' + |
62 | 62 | marcador.distancia + 'km'; |
63 | 63 | } |
64 | 64 | var icon; |
65 | - if(marcador.notaPedido.remito.idUsuarioProceso) { | |
65 | + if (marcador.notaPedido.remito.idUsuarioProceso) { | |
66 | 66 | observacion += '<br/>'; |
67 | 67 | observacion += '<strong>'; |
68 | 68 | observacion += 'Fecha de entrega: ' + marcador.notaPedido.remito |
... | ... | @@ -84,7 +84,7 @@ angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() |
84 | 84 | popupAnchor: [1, -34], |
85 | 85 | shadowSize: [41, 41] |
86 | 86 | }); |
87 | - }else { | |
87 | + } else { | |
88 | 88 | observacion += '<br/>'; |
89 | 89 | observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+ |
90 | 90 | 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+ |