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

@Component({
    moduleId: module.id,
    selector: 'UnitMembersListView',
    templateUrl: './unit-members-list-view.component.html',
    styleUrls: ['./unit-members-list-view.component.scss']
})
export class UnitMembersListViewComponent {
    @Input() unitMembers: MembershipAllOutput[];
    @Output() itemTap = new EventEmitter<number>();

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

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

}
