import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ListViewEventData } from 'nativescript-ui-listview';
import { FunctionAllOutput } from '~/pages/unit/entities/output/functionAllOutput';

@Component({
    moduleId: module.id,
    selector: 'UnitFunctionsListView',
    templateUrl: './unit-functions-list-view.component.html',
    styleUrls: ['./unit-functions-list-view.component.scss']
})
export class UnitFunctionsListViewComponent {
    @Input() unitFunctions: FunctionAllOutput[];
    @Output() itemTap = new EventEmitter<number>();

    templateSelector(item: any, index: number, items: any): string {
        return 'default';
    }

    onItemTap(event: ListViewEventData) {
        this.itemTap.emit(this.unitFunctions[event.index].ID_Person);
    }

}
