Commit 1bdc4ea25070c0b63ab28830878b13d2ef7d5172
Exists in
develop
Merge branch 'develop' into 'develop'
Solo se muestran categorias con fecha vigente See merge request !141
Showing
2 changed files
Show diff stats
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.html
| ... | ... | @@ -39,7 +39,8 @@ |
| 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 | |
| 43 | + && validarFecha(categoria.vigencia_desde, categoria.vigencia_hasta)"> | |
| 43 | 44 | <img |
| 44 | 45 | draggable="false" |
| 45 | 46 | ondragstart="return false;" |
src/app/modules/seleccion-articulos/filtro-categorias/filtro-categorias.component.ts
| ... | ... | @@ -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,14 @@ export class FiltroCategoriasComponent implements OnInit { |
| 88 | 87 | }, 500); |
| 89 | 88 | } |
| 90 | 89 | |
| 90 | + validarFecha(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 | + return (fechaHoy >= fechaInicio && fechaHoy <= fechaFin) ? true : false; | |
| 96 | + } | |
| 97 | + | |
| 91 | 98 | mediaPantalla() { |
| 92 | 99 | if ($('body').hasClass('media-pantalla')) { |
| 93 | 100 | $('.cat-content,#cat-content') |