From ae09b14fab7867cc3e34b761545e97954bcf7e99 Mon Sep 17 00:00:00 2001 From: Luigi Date: Wed, 20 Mar 2019 15:53:39 -0300 Subject: [PATCH] Filtro de busqueda por palabras --- src/js/controller-general-unidad.js | 3 +- src/js/controller-hoja-ruta.js | 2 - src/js/controller-litros-km-unidad.js | 73 ++++++++++++++++++----------------- src/js/controller-productividad.js | 22 +++++------ src/js/controller-reparto-optimo.js | 20 +++++----- 5 files changed, 59 insertions(+), 61 deletions(-) diff --git a/src/js/controller-general-unidad.js b/src/js/controller-general-unidad.js index 49b6fa2..a28b0d8 100644 --- a/src/js/controller-general-unidad.js +++ b/src/js/controller-general-unidad.js @@ -146,6 +146,7 @@ angular.module('focaModalInforme') if (key === 13) { var parametrosModal = { titulo: 'Búsqueda de Sector', + searchText: $scope.params.sector.NOMBRE, query: '/sector', columnas: [ { @@ -237,8 +238,6 @@ angular.module('focaModalInforme') }); return results; } - - } ] ); diff --git a/src/js/controller-hoja-ruta.js b/src/js/controller-hoja-ruta.js index 73fdcec..2bc912a 100644 --- a/src/js/controller-hoja-ruta.js +++ b/src/js/controller-hoja-ruta.js @@ -32,7 +32,6 @@ angular.module('focaModalInforme') ] }; }, - }; $scope.generarInforme = function() { focaModalInformeHojaRutaService @@ -51,7 +50,6 @@ angular.module('focaModalInforme') fechaDeReparto: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy') }; }); - //TODO: sacar id empresa hardcodeado return focaModalInformeHojaRutaService.getEmpresa(1); }) diff --git a/src/js/controller-litros-km-unidad.js b/src/js/controller-litros-km-unidad.js index fff8e05..b901735 100644 --- a/src/js/controller-litros-km-unidad.js +++ b/src/js/controller-litros-km-unidad.js @@ -57,7 +57,7 @@ angular.module('focaModalInforme') field: 'kmRecorridos', enableSorting: false, cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } }, @@ -143,40 +143,43 @@ angular.module('focaModalInforme') return focaModalService.modal(parametrosModal) }; - $scope.seleccionarUnidad = function() { - $scope.seleccionarTransportista().then( - function(transportista) { - $scope.transportista = transportista; - var parametrosModal = { - titulo: 'Búsqueda de vehículos', - query: '/vehiculo/transportista/' + transportista.COD, - columnas: [ - { - propiedad: 'codigo', - nombre: 'Código' - }, - { - propiedad: 'tractor', - nombre: 'Tractor' - }, - { - propiedad: 'semi', - nombre: 'Semi' - }, - { - propiedad: 'tractor', - nombre: 'Tractor' - } - ], - size: 'md' - }; - focaModalService.modal(parametrosModal).then( - function(unidad) { - $scope.unidad = unidad; - }, function() { - $scope.seleccionarUnidad(); - }); - }); + $scope.seleccionarUnidad = function(key) { + if (key === 13) { + $scope.seleccionarTransportista().then( + function(transportista) { + $scope.transportista = transportista; + var parametrosModal = { + titulo: 'Búsqueda de vehículos', + searchText: $scope.unidad.codigo, + query: '/vehiculo/transportista/' + transportista.COD, + columnas: [ + { + propiedad: 'codigo', + nombre: 'Código' + }, + { + propiedad: 'tractor', + nombre: 'Tractor' + }, + { + propiedad: 'semi', + nombre: 'Semi' + }, + { + propiedad: 'tractor', + nombre: 'Tractor' + } + ], + size: 'md' + }; + focaModalService.modal(parametrosModal).then( + function(unidad) { + $scope.unidad = unidad; + }, function() { + $scope.seleccionarUnidad(); + }); + }); + } }; $scope.volver = function() { $scope.buscar = true; diff --git a/src/js/controller-productividad.js b/src/js/controller-productividad.js index 076f59d..5c8b9bf 100644 --- a/src/js/controller-productividad.js +++ b/src/js/controller-productividad.js @@ -45,21 +45,21 @@ angular.module('focaModalInforme') if (value.indexOf('Vendedores') !== -1 || value.indexOf('Cobradores') !== -1 || - value.indexOf('Transportistas') !== -1) + value.indexOf('Transportistas') !== -1) return 'yellow w-100'; if (value.indexOf('Vendedor:') !== -1 || value.indexOf('Cobrador:') !== -1 || - value.indexOf('Transportista:') !== -1) + value.indexOf('Transportista:') !== -1) return 'red w-100'; - if (value.indexOf('Fecha:') !== -1) + if (value.indexOf('Fecha:') !== -1) return 'green w-100'; } }, - { + { field: 'fecha', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } }, @@ -67,15 +67,15 @@ angular.module('focaModalInforme') field: 'kmRecorridos', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } }, - { + { field: 'geolocalizacion', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } } @@ -175,8 +175,8 @@ angular.module('focaModalInforme') geolocalizacion; remito.hojaRutaMovimiento.forEach(function(movimiento) { kms += movimiento.seguimiento.kmRecorridos || 0; - geolocalizacion = geolocalizacion || - movimiento.seguimiento.latitud + ', ' + + geolocalizacion = geolocalizacion || + movimiento.seguimiento.latitud + ', ' + movimiento.seguimiento.longitud; }); result.push({ @@ -194,7 +194,6 @@ angular.module('focaModalInforme') }); }; - $scope.volver = function() { $scope.buscar = true; }; @@ -204,7 +203,6 @@ angular.module('focaModalInforme') $scope.clearEntidad = function() { $scope.params.entidad = undefined; }; - } ] ); diff --git a/src/js/controller-reparto-optimo.js b/src/js/controller-reparto-optimo.js index 79bb0b3..db5397a 100644 --- a/src/js/controller-reparto-optimo.js +++ b/src/js/controller-reparto-optimo.js @@ -43,17 +43,17 @@ angular.module('focaModalInforme') cellClass: function(grid, row, col) { if (grid.getCellValue(row,col).indexOf('Sector:') !== -1) return 'yellow w-100'; - if (grid.getCellValue(row,col).indexOf('Producto:') !== -1) + if (grid.getCellValue(row,col).indexOf('Producto:') !== -1) return 'red w-100'; - if (grid.getCellValue(row,col).indexOf('Fecha:') !== -1) + if (grid.getCellValue(row,col).indexOf('Fecha:') !== -1) return 'green w-100'; } }, - { + { field: 'ltsRepartidos', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } }, @@ -61,23 +61,23 @@ angular.module('focaModalInforme') field: 'ltsOptimos', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } }, - { + { field: 'diferencia', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } }, - { + { field: 'porcentaje', enableSorting: false, cellClass: function(grid, row, col) { - if (!grid.getCellValue(row,col)) + if (!grid.getCellValue(row,col)) return 'd-none'; } } @@ -157,11 +157,11 @@ angular.module('focaModalInforme') }); }; - $scope.seleccionarSector = function(key) { if (key === 13) { var parametrosModal = { titulo: 'Búsqueda de Sector', + searchText: $scope.params.sector.NOMBRE, query: '/sector', columnas: [ { -- 1.9.1