Commit 65e7ac5fe53fda95fd89f8f0bf1b67f14a7aaae4
1 parent
ad8946fa4c
Exists in
master
formateo codigo
Showing
1 changed file
with
14 additions
and
20 deletions
Show diff stats
src/js/controller-general-unidad.js
| ... | ... | @@ -40,7 +40,7 @@ angular.module('focaModalInforme') |
| 40 | 40 | { |
| 41 | 41 | field: 'vehiculo', |
| 42 | 42 | enableSorting: false, |
| 43 | - cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | |
| 43 | + cellClass: function(grid, row, col) { | |
| 44 | 44 | if (grid.getCellValue(row,col).indexOf('Sector:') !== -1) |
| 45 | 45 | return 'yellow w-100'; |
| 46 | 46 | if (grid.getCellValue(row,col).indexOf('Producto:') !== -1) |
| ... | ... | @@ -52,7 +52,7 @@ angular.module('focaModalInforme') |
| 52 | 52 | { |
| 53 | 53 | field: 'kmRecorridos', |
| 54 | 54 | enableSorting: false, |
| 55 | - cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | |
| 55 | + cellClass: function(grid, row, col) { | |
| 56 | 56 | if (!grid.getCellValue(row,col)) |
| 57 | 57 | return 'd-none'; |
| 58 | 58 | } |
| ... | ... | @@ -60,7 +60,7 @@ angular.module('focaModalInforme') |
| 60 | 60 | { |
| 61 | 61 | field: 'litrosRepartidos', |
| 62 | 62 | enableSorting: false, |
| 63 | - cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | |
| 63 | + cellClass: function(grid, row, col) { | |
| 64 | 64 | if (!grid.getCellValue(row,col)) |
| 65 | 65 | return 'd-none'; |
| 66 | 66 | } |
| ... | ... | @@ -68,7 +68,7 @@ angular.module('focaModalInforme') |
| 68 | 68 | { |
| 69 | 69 | field: 'viajes', |
| 70 | 70 | enableSorting: false, |
| 71 | - cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) { | |
| 71 | + cellClass: function(grid, row, col) { | |
| 72 | 72 | if (!grid.getCellValue(row,col)) |
| 73 | 73 | return 'd-none'; |
| 74 | 74 | } |
| ... | ... | @@ -80,33 +80,39 @@ angular.module('focaModalInforme') |
| 80 | 80 | focaModalInformeGeneralUnidadService |
| 81 | 81 | .getInformeData($scope.params) |
| 82 | 82 | .then(function(res) { |
| 83 | - console.log(res); | |
| 84 | 83 | var result = []; |
| 85 | 84 | |
| 86 | 85 | res.data.forEach(function(sector) { |
| 87 | 86 | if (!$scope.params.sector || |
| 88 | 87 | $scope.params.sector.ID === sector.idSector) { |
| 88 | + //AGREGO SECTORES | |
| 89 | 89 | result.push({ |
| 90 | 90 | vehiculo: 'Sector: ' + |
| 91 | 91 | $filter('rellenarDigitos')(sector.idSector, 2, '0') + |
| 92 | 92 | ' - ' + sector.sector.trim() |
| 93 | 93 | }); |
| 94 | 94 | sector.productos.forEach(function(producto) { |
| 95 | + //AGREGO PRODUCTOS | |
| 95 | 96 | result.push({ |
| 96 | 97 | vehiculo: 'Producto: ' + |
| 97 | 98 | producto.idProducto + |
| 98 | 99 | ' - ' + producto.producto |
| 99 | 100 | }); |
| 100 | 101 | producto.fechas.forEach(function(fecha) { |
| 102 | + //AGREGO FECHAS | |
| 101 | 103 | result.push({ |
| 102 | 104 | vehiculo: 'Mes: ' + fecha.fecha |
| 103 | 105 | }); |
| 104 | 106 | fecha.vehiculos.forEach(function(vehiculo) { |
| 107 | + //AGREGO VEHICULOS | |
| 105 | 108 | result.push({ |
| 106 | 109 | vehiculo: vehiculo.vehiculo, |
| 107 | - kmRecorridos: $filter('number')(vehiculo.data.kms, 2), | |
| 108 | - litrosRepartidos: $filter('number')(vehiculo.data.lts, 2), | |
| 109 | - viajes: $filter('number')(vehiculo.data.viajes, 0) | |
| 110 | + kmRecorridos: | |
| 111 | + $filter('number')(vehiculo.data.kms, 2), | |
| 112 | + litrosRepartidos: | |
| 113 | + $filter('number')(vehiculo.data.lts, 2), | |
| 114 | + viajes: | |
| 115 | + $filter('number')(vehiculo.data.viajes, 0) | |
| 110 | 116 | }); |
| 111 | 117 | }); |
| 112 | 118 | }); |
| ... | ... | @@ -114,7 +120,6 @@ angular.module('focaModalInforme') |
| 114 | 120 | } |
| 115 | 121 | }); |
| 116 | 122 | |
| 117 | - | |
| 118 | 123 | $scope.gridOptions.data = result; |
| 119 | 124 | $scope.generando = false; |
| 120 | 125 | $scope.buscar = false; |
| ... | ... | @@ -151,17 +156,6 @@ angular.module('focaModalInforme') |
| 151 | 156 | $scope.cancel = function() { |
| 152 | 157 | $uibModalInstance.dismiss('Cancelar'); |
| 153 | 158 | }; |
| 154 | - | |
| 155 | - function agruparProductos(productos) { | |
| 156 | - console.log('productos', productos); | |
| 157 | - var result = { | |
| 158 | - vehiculos: [] | |
| 159 | - }; | |
| 160 | - productos.forEach(function(producto) { | |
| 161 | - result.vehiculos = result.vehiculos.concat(); | |
| 162 | - }); | |
| 163 | - return productos; | |
| 164 | - } | |
| 165 | 159 | } |
| 166 | 160 | ] |
| 167 | 161 | ); |