Commit 21e3d532b2487bad32696986a944663ce4cc79d9

Authored by Marcelo Puebla
1 parent fde949b260
Exists in develop

Fix

Agrupado de listado
Showing 2 changed files with 9 additions and 1 deletions   Show diff stats
... ... @@ -4,6 +4,7 @@
4 4 "description": "Modal para seleccionar lista de precios",
5 5 "main": "index.js",
6 6 "scripts": {
  7 + "refresh": "gulp uglify && cp tmp/foca-modal-lista-precio.js ../wrapper-demo/node_modules/foca-modal-lista-precio/dist/foca-modal-lista-precio.min.js",
7 8 "test": "echo \"Error: no test specified\" && exit 1",
8 9 "gulp-pre-commit": "gulp pre-commit",
9 10 "compile": "gulp uglify",
src/js/controller.js
... ... @@ -25,7 +25,14 @@ angular.module('focaModalListaPrecio')
25 25 function(res) {
26 26 $scope.searchLoading = false;
27 27 $scope.primerBusqueda = true;
28   - $scope.listasPrecio = res.data;
  28 + $scope.listasPrecio = res.data.reduce(function (acc, current) {
  29 + var x = acc.find(function (item) { return item.ID === current.ID });
  30 + if (!x) {
  31 + return acc.concat([current]);
  32 + } else {
  33 + return acc;
  34 + }
  35 + }, []);
29 36 $scope.search(true);
30 37 primera();
31 38 }