import { Component, OnInit , Output, Input,  EventEmitter} from '@angular/core';
import { QuestionGroup } from '../../model/questiongroup.ts';

@Component({
    selector: 'questiongroup-list',
    template : `
        <mat-list-item>
            <mat-icon mat-list-icon>folder</mat-icon>
            <h4 matLine >{questionGroup.order} {{questionGroup.question_group_name}}</h4>
                <p matLine >{{"token.total" | translate }} :55 {{questionGroup.use_question_no}} 
                ( <span *ngFor="let level of questionGroup.level"> {{level.name | translate  }} : {{level.question}} </span>  )
                </p>
                <p matLine > {{questionGroup.updated | date}} </p>
                <button mat-icon-button  [matMenuTriggerFor]="menu"><mat-icon>more_vert</mat-icon></button>
                <mat-menu #menu="matMenu" yPosition="below">
                  <button mat-menu-item (click)="editQuestionGroup(questionGroup);"><mat-icon>mode_edit</mat-icon> <span> {{"token.edit_folder" | translate }}</span></button>
                  <button mat-menu-item (click)="addQuestion(questionGroup);"><mat-icon>add</mat-icon> <span> {{"token.create_question" | translate }}</span></button>
                  <button mat-menu-item (click)="removeQuestionGroup(questionGroup);"><mat-icon>delete</mat-icon> <span> {{"token.delete_folder" | translate }}</span></button>
                </mat-menu>
         </mat-list-item>
        `
})
export class AnswerFormComponent implements OnInit {
    @Input() questionGroup:QuestionGroup;
    @Output() onSelectData: EventEmitter<Answer> = new EventEmitter();
    
    
() { }

    ngOnInit() {}

    removeAnswer():void{
        console.log(this.answer);
        this.onSelectData.emit(this.answer);
    }

    changeSelected(data:any):void{
        console.log(data);
        console.log(data.checked);


        console.log("changeSelected()");
    }
}
constructor