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