Commit 4fd63e25ff48be432329aeb9650841ab3b83fe1d
1 parent
df2615f81c
Exists in
develop
solo se muestran categorias con fecha vigente
Showing
2 changed files
with
14 additions
and
3 deletions
Show diff stats
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.html
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | 'media-pantalla': templateCategorias.classList.contains('media-pantalla')}" |
40 | 40 | (click)="selectCategoria(i, categoria.id)" |
41 | 41 | id="cat-content" |
42 | - *ngIf="categoria.articulos > 0"> | |
42 | + *ngIf="categoria.articulos > 0 && compararFecha(categoria.vigencia_desde,categoria.vigencia_hasta)"> | |
43 | 43 | <img |
44 | 44 | draggable="false" |
45 | 45 | ondragstart="return false;" |
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.ts
... | ... | @@ -19,7 +19,7 @@ export class FiltroCategoriasComponent implements OnInit { |
19 | 19 | allActive = true; |
20 | 20 | queMostrar = 'todos'; |
21 | 21 | urlImagenes = `${APP_SETTINGS.apiImagenes}/imagenes/`; |
22 | - | |
22 | + | |
23 | 23 | constructor( |
24 | 24 | private categoriaService: CategoriaService, |
25 | 25 | private inactiveScreen: InactiveScreenService |
... | ... | @@ -67,7 +67,6 @@ export class FiltroCategoriasComponent implements OnInit { |
67 | 67 | categoria.selected = index === i ? true : false; |
68 | 68 | }); |
69 | 69 | this.filterItems.emit(); |
70 | - | |
71 | 70 | } |
72 | 71 | |
73 | 72 | @HostListener('scroll', ['$event']) |
... | ... | @@ -88,6 +87,18 @@ export class FiltroCategoriasComponent implements OnInit { |
88 | 87 | }, 500); |
89 | 88 | } |
90 | 89 | |
90 | + compararFecha(fechaInicioString: string,fechaFinString: string) { | |
91 | + const fechaInicio = new Date(fechaInicioString); | |
92 | + const fechaFin = new Date(fechaFinString); | |
93 | + const fechaAux = Date.now(); | |
94 | + const fechaHoy = new Date(fechaAux) | |
95 | + if (fechaHoy >= fechaInicio && fechaHoy <= fechaFin) { | |
96 | + return true | |
97 | + } else { | |
98 | + return false | |
99 | + } | |
100 | + } | |
101 | + | |
91 | 102 | mediaPantalla() { |
92 | 103 | if ($('body').hasClass('media-pantalla')) { |
93 | 104 | $('.cat-content,#cat-content') |