Commit 9718d371ba5880041f4d1f1ff74e506edcd44b9e
1 parent
8e1b86ffa9
Exists in
master
Merge conflicts
Showing
1 changed file
with
0 additions
and
25 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaLogisticaPedidoRuta').controller('focaLogisticaPedidoRutaController', [ | 1 | angular.module('focaLogisticaPedidoRuta').controller('focaLogisticaPedidoRutaController', [ |
2 | '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', | 2 | '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', |
3 | 'focaModalService', 'focaBotoneraLateralService', '$interval', | 3 | 'focaModalService', 'focaBotoneraLateralService', '$interval', |
4 | function ($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, | 4 | function ($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, |
5 | focaModalService, focaBotoneraLateralService, $interval | 5 | focaModalService, focaBotoneraLateralService, $interval |
6 | ) { | 6 | ) { |
7 | $scope.actividad = 'Logistica'; | 7 | $scope.actividad = 'Logistica'; |
8 | //Datos Pantalla | 8 | //Datos Pantalla |
9 | $scope.titulo = 'Logistica de Pedidos'; | 9 | $scope.titulo = 'Logistica de Pedidos'; |
10 | 10 | ||
11 | var transportista = { | 11 | var transportista = { |
12 | label: 'Vehículo', | 12 | label: 'Vehículo', |
13 | image: 'abmChofer.png' | 13 | image: 'abmChofer.png' |
14 | }; | 14 | }; |
15 | var fecha = { | 15 | var fecha = { |
16 | label: 'Fecha Reparto', | 16 | label: 'Fecha Reparto', |
17 | image: 'FechaEntrega.png' | 17 | image: 'FechaEntrega.png' |
18 | }; | 18 | }; |
19 | $scope.botonera = [fecha, transportista]; | 19 | $scope.botonera = [fecha, transportista]; |
20 | var cabecera = ''; | 20 | var cabecera = ''; |
21 | $scope.now = new Date(); | 21 | $scope.now = new Date(); |
22 | $scope.idVendedor = 0; | 22 | $scope.idVendedor = 0; |
23 | $scope.marcadores = []; | 23 | $scope.marcadores = []; |
24 | $scope.vehiculos = []; | 24 | $scope.vehiculos = []; |
25 | getSeguimiento(); | 25 | getSeguimiento(); |
26 | $scope.arrastrando = false; | 26 | $scope.arrastrando = false; |
27 | $scope.general = function () { | 27 | $scope.general = function () { |
28 | $scope.idVendedor = 0; | 28 | $scope.idVendedor = 0; |
29 | getSeguimiento(); | 29 | getSeguimiento(); |
30 | }; | 30 | }; |
31 | 31 | ||
32 | setearFecha(new Date()); | 32 | setearFecha(new Date()); |
33 | 33 | ||
34 | //SETEO BOTONERA LATERAL | 34 | //SETEO BOTONERA LATERAL |
35 | focaBotoneraLateralService.showSalir(true); | 35 | focaBotoneraLateralService.showSalir(true); |
36 | focaBotoneraLateralService.showPausar(false); | 36 | focaBotoneraLateralService.showPausar(false); |
37 | focaBotoneraLateralService.showGuardar(false); | 37 | focaBotoneraLateralService.showGuardar(false); |
38 | 38 | ||
39 | $scope.general = function () { | 39 | $scope.general = function () { |
40 | $scope.idVendedor = 0; | 40 | $scope.idVendedor = 0; |
41 | getSeguimiento(); | 41 | getSeguimiento(); |
42 | $scope.$broadcast('removeCabecera', cabecera); | 42 | $scope.$broadcast('removeCabecera', cabecera); |
43 | $scope.$broadcast('addCabecera', { | 43 | $scope.$broadcast('addCabecera', { |
44 | label: 'General', | 44 | label: 'General', |
45 | valor: '' | 45 | valor: '' |
46 | }); | 46 | }); |
47 | }; | 47 | }; |
48 | 48 | ||
49 | $scope.cargar = function (idVehiculo, punto) { | 49 | $scope.cargar = function (idVehiculo, punto) { |
50 | if (!eligioFecha()) return; | 50 | if (!eligioFecha()) return; |
51 | var idRemito; | 51 | var idRemito; |
52 | if (punto === -1) { | 52 | if (punto === -1) { |
53 | idRemito = -1; | 53 | idRemito = -1; |
54 | } else { | 54 | } else { |
55 | idRemito = JSON.parse(punto).notaPedido.remito.id; | 55 | idRemito = JSON.parse(punto).notaPedido.remito.id; |
56 | } | 56 | } |
57 | $uibModal.open( | 57 | $uibModal.open( |
58 | { | 58 | { |
59 | ariaLabelledBy: 'Busqueda de Vehiculo', | 59 | ariaLabelledBy: 'Busqueda de Vehiculo', |
60 | templateUrl: 'foca-detalle-vehiculo.html', | 60 | templateUrl: 'foca-detalle-vehiculo.html', |
61 | controller: 'focaDetalleVehiculo', | 61 | controller: 'focaDetalleVehiculo', |
62 | size: 'lg', | 62 | size: 'lg', |
63 | resolve: { | 63 | resolve: { |
64 | idVehiculo: function () { return idVehiculo; }, | 64 | idVehiculo: function () { return idVehiculo; }, |
65 | idRemito: function () { return idRemito; }, | 65 | idRemito: function () { return idRemito; }, |
66 | fechaReparto: function () { return $scope.fechaReparto; } | 66 | fechaReparto: function () { return $scope.fechaReparto; } |
67 | } | 67 | } |
68 | } | 68 | } |
69 | ); | 69 | ); |
70 | }; | 70 | }; |
71 | 71 | ||
72 | $scope.quitarVehiculo = function (vehiculo) { | 72 | $scope.quitarVehiculo = function (vehiculo) { |
73 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; | 73 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; |
74 | 74 | ||
75 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + | 75 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + |
76 | vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function () { | 76 | vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function () { |
77 | eliminarVehiculo(vehiculo); | 77 | eliminarVehiculo(vehiculo); |
78 | }); | 78 | }); |
79 | }; | 79 | }; |
80 | 80 | ||
81 | $scope.hacerHojaRuta = function (vehiculo, cerrar) { | 81 | $scope.hacerHojaRuta = function (vehiculo, cerrar) { |
82 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; | 82 | if (!eligioFecha() || vehiculoEnUso(vehiculo)) return; |
83 | var modalInstance = $uibModal.open( | 83 | var modalInstance = $uibModal.open( |
84 | { | 84 | { |
85 | ariaLabelledBy: 'Creación hoja ruta', | 85 | ariaLabelledBy: 'Creación hoja ruta', |
86 | templateUrl: 'foca-modal-cerrar-vehiculo.html', | 86 | templateUrl: 'foca-modal-cerrar-vehiculo.html', |
87 | controller: 'focaModalCerrarVehiculo', | 87 | controller: 'focaModalCerrarVehiculo', |
88 | size: 'lg', | 88 | size: 'lg', |
89 | resolve: { | 89 | resolve: { |
90 | idVehiculo: function () { return vehiculo.id; }, | 90 | idVehiculo: function () { return vehiculo.id; }, |
91 | fechaReparto: function () { return $scope.fechaReparto; }, | 91 | fechaReparto: function () { return $scope.fechaReparto; }, |
92 | cerrar: function () { return cerrar; } | 92 | cerrar: function () { return cerrar; } |
93 | } | 93 | } |
94 | } | 94 | } |
95 | ); | 95 | ); |
96 | modalInstance.result.then(function () { | 96 | modalInstance.result.then(function () { |
97 | 97 | ||
98 | }, function () { | 98 | }, function () { |
99 | //usar cuando se cancela el modal | 99 | //usar cuando se cancela el modal |
100 | }); | 100 | }); |
101 | }; | 101 | }; |
102 | 102 | ||
103 | $scope.arrastra = function () { | 103 | $scope.arrastra = function () { |
104 | $scope.arrastrando = true; | 104 | $scope.arrastrando = true; |
105 | $scope.$digest(); | 105 | $scope.$digest(); |
106 | }; | 106 | }; |
107 | 107 | ||
108 | $scope.noArrastra = function () { | 108 | $scope.noArrastra = function () { |
109 | $scope.arrastrando = false; | 109 | $scope.arrastrando = false; |
110 | $scope.$digest(); | 110 | $scope.$digest(); |
111 | }; | 111 | }; |
112 | 112 | ||
113 | $scope.individual = function () { | 113 | $scope.individual = function () { |
114 | $scope.idVendedor = -1; | 114 | $scope.idVendedor = -1; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | $scope.mostrarDetalle = function () { | 117 | $scope.mostrarDetalle = function () { |
118 | $scope.detalle = true; | 118 | $scope.detalle = true; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | $scope.salir = function () { | 121 | $scope.salir = function () { |
122 | $location.path('/'); | 122 | $location.path('/'); |
123 | }; | 123 | }; |
124 | 124 | ||
125 | $scope.search = function () { | 125 | $scope.search = function () { |
126 | getSeguimiento(); | 126 | getSeguimiento(); |
127 | }; | 127 | }; |
128 | 128 | ||
129 | $scope.fecha = function () { | 129 | $scope.fecha = function () { |
130 | getSeguimiento(); | 130 | getSeguimiento(); |
131 | }; | 131 | }; |
132 | 132 | ||
133 | $scope.seleccionarVehículo = function () { | 133 | $scope.seleccionarVehículo = function () { |
134 | var parametrosModal = { | 134 | var parametrosModal = { |
135 | titulo: 'Búsqueda de Transportista', | 135 | titulo: 'Búsqueda de Transportista', |
136 | query: '/transportista', | 136 | query: '/transportista', |
137 | columnas: [ | 137 | columnas: [ |
138 | { | 138 | { |
139 | nombre: 'Código', | 139 | nombre: 'Código', |
140 | propiedad: 'COD' | 140 | propiedad: 'COD' |
141 | }, | 141 | }, |
142 | { | 142 | { |
143 | nombre: 'Nombre', | 143 | nombre: 'Nombre', |
144 | propiedad: 'NOM' | 144 | propiedad: 'NOM' |
145 | }, | 145 | }, |
146 | { | 146 | { |
147 | nombre: 'CUIT', | 147 | nombre: 'CUIT', |
148 | propiedad: 'CUIT' | 148 | propiedad: 'CUIT' |
149 | } | 149 | } |
150 | ] | 150 | ] |
151 | }; | 151 | }; |
152 | focaModalService.modal(parametrosModal).then(function (transportista) { | 152 | focaModalService.modal(parametrosModal).then(function (transportista) { |
153 | $scope.selectVehiculo(transportista.COD, transportista.NOM); | 153 | $scope.selectVehiculo(transportista.COD, transportista.NOM); |
154 | }); | 154 | }); |
155 | }; | 155 | }; |
156 | 156 | ||
157 | <<<<<<< HEAD | ||
158 | $scope.selectVehiculo = function (idTransportista, nombreTransportista) { | ||
159 | ======= | ||
160 | $scope.busquedaAvanzada = function () { | 157 | $scope.busquedaAvanzada = function () { |
161 | var modalInstance = $uibModal.open( | 158 | var modalInstance = $uibModal.open( |
162 | { | 159 | { |
163 | ariaLabelledBy: 'Busqueda Avanzada', | 160 | ariaLabelledBy: 'Busqueda Avanzada', |
164 | templateUrl: 'foca-modal-busqueda-avanzada.html', | 161 | templateUrl: 'foca-modal-busqueda-avanzada.html', |
165 | controller: 'focaModalBusquedaAvanzadaController', | 162 | controller: 'focaModalBusquedaAvanzadaController', |
166 | resolve: { | 163 | resolve: { |
167 | parametrosModal: function () { | 164 | parametrosModal: function () { |
168 | return { | 165 | return { |
169 | remitos: $scope.marcadores | 166 | remitos: $scope.marcadores |
170 | }; | 167 | }; |
171 | } | 168 | } |
172 | } | 169 | } |
173 | } | 170 | } |
174 | ); | 171 | ); |
175 | modalInstance.result.then(function(data) { | 172 | modalInstance.result.then(function(data) { |
176 | actualizarMarcadores(data); | 173 | actualizarMarcadores(data); |
177 | }, function () { | 174 | }, function () { |
178 | // funcion ejecutada cuando se cancela el modal | 175 | // funcion ejecutada cuando se cancela el modal |
179 | } | 176 | } |
180 | ); | 177 | ); |
181 | }; | 178 | }; |
182 | 179 | ||
183 | $scope.selectVehiculo = function(idTransportista, nombreTransportista) { | 180 | $scope.selectVehiculo = function(idTransportista, nombreTransportista) { |
184 | >>>>>>> 5309ab05fe911513dc48620950d4119937687802 | ||
185 | var parametrosModal = { | 181 | var parametrosModal = { |
186 | columnas: [ | 182 | columnas: [ |
187 | { | 183 | { |
188 | propiedad: 'codigo', | 184 | propiedad: 'codigo', |
189 | nombre: 'Código' | 185 | nombre: 'Código' |
190 | }, | 186 | }, |
191 | { | 187 | { |
192 | propiedad: 'tractor', | 188 | propiedad: 'tractor', |
193 | nombre: 'tractor' | 189 | nombre: 'tractor' |
194 | }, | 190 | }, |
195 | { | 191 | { |
196 | propiedad: 'semi', | 192 | propiedad: 'semi', |
197 | nombre: 'Semi' | 193 | nombre: 'Semi' |
198 | }, | 194 | }, |
199 | { | 195 | { |
200 | propiedad: 'capacidadTotalCisternas', | 196 | propiedad: 'capacidadTotalCisternas', |
201 | nombre: 'Capacidad' | 197 | nombre: 'Capacidad' |
202 | } | 198 | } |
203 | ], | 199 | ], |
204 | query: '/vehiculo/transportista/' + idTransportista, | 200 | query: '/vehiculo/transportista/' + idTransportista, |
205 | titulo: 'Búsqueda de vehiculos', | 201 | titulo: 'Búsqueda de vehiculos', |
206 | subTitulo: idTransportista + '-' + nombreTransportista | 202 | subTitulo: idTransportista + '-' + nombreTransportista |
207 | }; | 203 | }; |
208 | focaModalService.modal(parametrosModal).then( | 204 | focaModalService.modal(parametrosModal).then( |
209 | function (vehiculo) { | 205 | function (vehiculo) { |
210 | var existe = $filter('filter')($scope.vehiculos, { id: vehiculo.id }); | 206 | var existe = $filter('filter')($scope.vehiculos, { id: vehiculo.id }); |
211 | if (existe.length) { | 207 | if (existe.length) { |
212 | focaModalService.alert('El vehiculo ya ha sido cargado'); | 208 | focaModalService.alert('El vehiculo ya ha sido cargado'); |
213 | return; | 209 | return; |
214 | } | 210 | } |
215 | if (!vehiculo.cisternas.length) { | 211 | if (!vehiculo.cisternas.length) { |
216 | focaModalService.alert('El vehiculo no tiene cisternas'); | 212 | focaModalService.alert('El vehiculo no tiene cisternas'); |
217 | return; | 213 | return; |
218 | } | 214 | } |
219 | $scope.vehiculos.push(vehiculo); | 215 | $scope.vehiculos.push(vehiculo); |
220 | }, function () { | 216 | }, function () { |
221 | // funcion ejecutada cuando se cancela el modal | 217 | // funcion ejecutada cuando se cancela el modal |
222 | }); | 218 | }); |
223 | }; | 219 | }; |
224 | <<<<<<< HEAD | ||
225 | |||
226 | $scope.seleccionarFechaReparto = function () { | ||
227 | focaModalService.modalFecha('Fecha de reparto').then(function (fecha) { | ||
228 | ======= | ||
229 | $scope.seleccionarFechaReparto = function() { | 220 | $scope.seleccionarFechaReparto = function() { |
230 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { | 221 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { |
231 | >>>>>>> 5309ab05fe911513dc48620950d4119937687802 | ||
232 | setearFecha(fecha); | 222 | setearFecha(fecha); |
233 | }); | 223 | }); |
234 | }; | 224 | }; |
235 | 225 | ||
236 | function actualizarMarcadores (filtros) { | 226 | function actualizarMarcadores (filtros) { |
237 | var marcadores = []; | 227 | var marcadores = []; |
238 | if (filtros.cliente && filtros.remito === undefined) { | 228 | if (filtros.cliente && filtros.remito === undefined) { |
239 | 229 | ||
240 | $scope.marcadores.forEach( function (marcador) { | 230 | $scope.marcadores.forEach( function (marcador) { |
241 | if (marcador.notaPedido.cliente.NOM === filtros.cliente) { | 231 | if (marcador.notaPedido.cliente.NOM === filtros.cliente) { |
242 | marcadores.push(marcador); | 232 | marcadores.push(marcador); |
243 | } | 233 | } |
244 | }); | 234 | }); |
245 | 235 | ||
246 | if (marcadores.length === 0) { | 236 | if (marcadores.length === 0) { |
247 | focaModalService.alert('No se encontraron coincidencias en la busqueda') | 237 | focaModalService.alert('No se encontraron coincidencias en la busqueda') |
248 | .then(function (data) { | 238 | .then(function (data) { |
249 | if (data) { | 239 | if (data) { |
250 | $scope.marcadoresFiltro = marcadores; | 240 | $scope.marcadoresFiltro = marcadores; |
251 | } | 241 | } |
252 | }); | 242 | }); |
253 | $scope.$broadcast('cleanCabecera'); | 243 | $scope.$broadcast('cleanCabecera'); |
254 | setearFecha(new Date()); | 244 | setearFecha(new Date()); |
255 | return; | 245 | return; |
256 | } else { | 246 | } else { |
257 | $scope.marcadoresFiltro = marcadores; | 247 | $scope.marcadoresFiltro = marcadores; |
258 | $scope.$broadcast('addCabecera', { | 248 | $scope.$broadcast('addCabecera', { |
259 | label: 'Cliente:', | 249 | label: 'Cliente:', |
260 | valor: filtros.cliente | 250 | valor: filtros.cliente |
261 | }); | 251 | }); |
262 | } | 252 | } |
263 | } else { | 253 | } else { |
264 | $scope.marcadores.forEach( function (marcador) { | 254 | $scope.marcadores.forEach( function (marcador) { |
265 | if (filtros.remito.id === marcador.notaPedido.remito.id) { | 255 | if (filtros.remito.id === marcador.notaPedido.remito.id) { |
266 | marcadores.push(marcador); | 256 | marcadores.push(marcador); |
267 | } | 257 | } |
268 | }); | 258 | }); |
269 | if (marcadores.length === 0) { | 259 | if (marcadores.length === 0) { |
270 | focaModalService.alert('No se encontraron coincidencias en la busqueda') | 260 | focaModalService.alert('No se encontraron coincidencias en la busqueda') |
271 | .then(function (data) { | 261 | .then(function (data) { |
272 | if (data) { | 262 | if (data) { |
273 | $scope.marcadoresFiltro = marcadores; | 263 | $scope.marcadoresFiltro = marcadores; |
274 | } | 264 | } |
275 | }); | 265 | }); |
276 | $scope.$broadcast('cleanCabecera'); | 266 | $scope.$broadcast('cleanCabecera'); |
277 | setearFecha(new Date()); | 267 | setearFecha(new Date()); |
278 | return; | 268 | return; |
279 | } else { | 269 | } else { |
280 | $scope.marcadoresFiltro = marcadores; | 270 | $scope.marcadoresFiltro = marcadores; |
281 | $scope.$broadcast('addCabecera', { | 271 | $scope.$broadcast('addCabecera', { |
282 | label: 'Cliente:', | 272 | label: 'Cliente:', |
283 | valor: filtros.cliente | 273 | valor: filtros.cliente |
284 | }); | 274 | }); |
285 | } | 275 | } |
286 | } | 276 | } |
287 | } | 277 | } |
288 | 278 | ||
289 | function setearFecha(fecha) { | 279 | function setearFecha(fecha) { |
290 | $scope.fechaReparto = fecha; | 280 | $scope.fechaReparto = fecha; |
291 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); | 281 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); |
292 | focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function (res) { | 282 | focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function (res) { |
293 | $scope.vehiculos = res.data; | 283 | $scope.vehiculos = res.data; |
294 | $scope.$broadcast('addCabecera', { | 284 | $scope.$broadcast('addCabecera', { |
295 | label: 'Fecha:', | 285 | label: 'Fecha:', |
296 | valor: fecha.toLocaleDateString() | 286 | valor: fecha.toLocaleDateString() |
297 | }); | 287 | }); |
298 | }); | 288 | }); |
299 | } | 289 | } |
300 | 290 | ||
301 | function getSeguimiento() { | 291 | function getSeguimiento() { |
302 | var desde = new Date('1900/01/01'); | 292 | var desde = new Date('1900/01/01'); |
303 | var hasta = new Date('2099/01/01'); | 293 | var hasta = new Date('2099/01/01'); |
304 | if ($scope.fechaDesde) { | 294 | if ($scope.fechaDesde) { |
305 | var fechaDesde = $scope.fechaDesde; | 295 | var fechaDesde = $scope.fechaDesde; |
306 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); | 296 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); |
307 | desde = new Date(desde); | 297 | desde = new Date(desde); |
308 | } | 298 | } |
309 | if ($scope.fechaHasta) { | 299 | if ($scope.fechaHasta) { |
310 | var fechaHasta = $scope.fechaHasta; | 300 | var fechaHasta = $scope.fechaHasta; |
311 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); | 301 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); |
312 | hasta = hasta.setDate(hasta.getDate() + 1); | 302 | hasta = hasta.setDate(hasta.getDate() + 1); |
313 | hasta = new Date(hasta); | 303 | hasta = new Date(hasta); |
314 | } | 304 | } |
315 | var datos = { | 305 | var datos = { |
316 | actividad: $scope.actividad, | 306 | actividad: $scope.actividad, |
317 | idUsuario: $scope.idVendedor, | 307 | idUsuario: $scope.idVendedor, |
318 | fechaDesde: desde, | 308 | fechaDesde: desde, |
319 | fechaHasta: hasta, | 309 | fechaHasta: hasta, |
320 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? | 310 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? |
321 | false : undefined) | 311 | false : undefined) |
322 | }; | 312 | }; |
323 | 313 | ||
324 | $scope.datosBuscados = { | 314 | $scope.datosBuscados = { |
325 | actividad: $scope.actividad, | 315 | actividad: $scope.actividad, |
326 | individual: $scope.idVendedor ? true : false | 316 | individual: $scope.idVendedor ? true : false |
327 | }; | 317 | }; |
328 | 318 | ||
329 | <<<<<<< HEAD | ||
330 | focaLogisticaPedidoRutaService.obtenerActividad(datos) | ||
331 | .then(function (datos) { | ||
332 | if (JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { | ||
333 | $scope.marcadores = datos.data; | ||
334 | } | ||
335 | }); | ||
336 | ======= | ||
337 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { | 319 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
338 | if (!angular.equals($scope.marcadores, datos.data)) { | 320 | if (!angular.equals($scope.marcadores, datos.data)) { |
339 | $scope.marcadores = datos.data; | 321 | $scope.marcadores = datos.data; |
340 | $scope.marcadoresFiltro = $scope.marcadores; | 322 | $scope.marcadoresFiltro = $scope.marcadores; |
341 | } | 323 | } |
342 | }); | 324 | }); |
343 | >>>>>>> 5309ab05fe911513dc48620950d4119937687802 | ||
344 | } | 325 | } |
345 | 326 | ||
346 | function eliminarVehiculo(vehiculo) { | 327 | function eliminarVehiculo(vehiculo) { |
347 | focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function (res) { | 328 | focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function (res) { |
348 | if (!res.data.length) { | 329 | if (!res.data.length) { |
349 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 330 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
350 | } else { | 331 | } else { |
351 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + | 332 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + |
352 | 'tiene remitos asociados').then(function () { | 333 | 'tiene remitos asociados').then(function () { |
353 | $scope.hacerHojaRuta(vehiculo, true); | 334 | $scope.hacerHojaRuta(vehiculo, true); |
354 | }); | 335 | }); |
355 | } | 336 | } |
356 | }); | 337 | }); |
357 | } | 338 | } |
358 | 339 | ||
359 | function eligioFecha() { | 340 | function eligioFecha() { |
360 | if (!$scope.fechaReparto) { | 341 | if (!$scope.fechaReparto) { |
361 | focaModalService.alert('Primero seleccione fecha de reparto'); | 342 | focaModalService.alert('Primero seleccione fecha de reparto'); |
362 | return false; | 343 | return false; |
363 | } | 344 | } |
364 | return true; | 345 | return true; |
365 | } | 346 | } |
366 | 347 | ||
367 | function vehiculoEnUso(vehiculo) { | 348 | function vehiculoEnUso(vehiculo) { |
368 | var idUsuario = focaLogisticaPedidoRutaService.idUsuario; | 349 | var idUsuario = focaLogisticaPedidoRutaService.idUsuario; |
369 | for (var i = 0; i < vehiculo.cisternas.length; i++) { | 350 | for (var i = 0; i < vehiculo.cisternas.length; i++) { |
370 | for (var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | 351 | for (var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { |
371 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | 352 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; |
372 | if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | 353 | if (cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto |
373 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && | 354 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && |
374 | cisternaCarga.idUsuarioProceso !== idUsuario) { | 355 | cisternaCarga.idUsuarioProceso !== idUsuario) { |
375 | focaModalService.alert('El vehículo está siendo usado por otro usuario'); | 356 | focaModalService.alert('El vehículo está siendo usado por otro usuario'); |
376 | return true; | 357 | return true; |
377 | } | 358 | } |
378 | } | 359 | } |
379 | } | 360 | } |
380 | return false; | 361 | return false; |
381 | } | 362 | } |
382 | <<<<<<< HEAD | ||
383 | $interval(function () { | ||
384 | getSeguimiento(); | ||
385 | }, 5000); | ||
386 | ======= | ||
387 | // $interval(function() { | 363 | // $interval(function() { |
388 | // getSeguimiento(); | 364 | // getSeguimiento(); |
389 | // }, 5000); | 365 | // }, 5000); |
390 | >>>>>>> 5309ab05fe911513dc48620950d4119937687802 | ||
391 | } | 366 | } |
392 | ]); | 367 | ]); |
393 | 368 |