Commit d684bd32d2b1dce27c6c2e1a3270061fdf619021

Authored by Marcelo Puebla
1 parent 7210315444
Exists in master and in 1 other branch validar_pve

Cambio de tipo en objeto sinonimo.

src/app/components/popover-sinonimos/popover-sinonimos.component.ts
1 import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; 1 import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
2 import { PopoverDirective } from 'ngx-bootstrap'; 2 import { PopoverDirective } from 'ngx-bootstrap';
3 import { Sinonimo } from 'src/app/wrappers/sinonimo'; 3 import { Producto } from 'src/app/wrappers/producto';
4 4
5 @Component({ 5 @Component({
6 selector: 'app-popover-sinonimos', 6 selector: 'app-popover-sinonimos',
7 templateUrl: './popover-sinonimos.component.html', 7 templateUrl: './popover-sinonimos.component.html',
8 styleUrls: ['./popover-sinonimos.component.scss'] 8 styleUrls: ['./popover-sinonimos.component.scss']
9 }) 9 })
10 export class PopoverSinonimosComponent implements OnInit { 10 export class PopoverSinonimosComponent implements OnInit {
11 11
12 //Directiva del popover, para poder cerrarlo desde este componente 12 //Directiva del popover, para poder cerrarlo desde este componente
13 @Input() popover: PopoverDirective; 13 @Input() popover: PopoverDirective;
14 @Input() popoverContent: Sinonimo[]; 14 @Input() popoverContent: Producto[];
15 @Output() sinonimoSeleccionado = new EventEmitter<Sinonimo>(); 15 @Output() sinonimoSeleccionado = new EventEmitter<Producto>();
16 sinonimo: Sinonimo; 16 sinonimo: Producto;
17 17
18 constructor() { } 18 constructor() { }
19 19
20 ngOnInit() { 20 ngOnInit() {
21
22 //Seteo en la variable a emitir el sinonimo que sea padre
23 this.popoverContent.forEach(sinonimo => {
24 this.sinonimo = sinonimo.esPadre ? sinonimo : undefined;
25 })
21 } 26 }
22 27
23 hidePopover() { 28 hidePopover() {
24 29
25 this.sinonimoSeleccionado.emit(this.sinonimo); 30 this.sinonimoSeleccionado.emit(this.sinonimo);
26 this.popover.hide(); 31 this.popover.hide();
27 } 32 }
28 33
29 setSinonimo(sinonimo: Sinonimo) { 34 setSinonimo(sinonimo: Producto) {
30 35
31 this.sinonimo = sinonimo; 36 this.sinonimo = sinonimo;
32 } 37 }
33 38
34 } 39 }
35 40