import { Component, OnInit } from '@angular/core';
import { ModalDialogParams } from '@nativescript/angular';
import { GenParticipant } from '~/pages/event/types/genEvent';


@Component({
    selector: 'GenEventParticipantUpdateModal',
    moduleId: module.id,
    templateUrl: './gen-event-participant-update-modal.component.html',
    styleUrls: ['../../../event.scss'],
})
export class GenEventParticipantUpdateModalComponent implements OnInit {
    updateModel: { Note?: string; Days?: number; };
    participantName: string;

    constructor(
        private params: ModalDialogParams,
    ) {
    }

    ngOnInit(): void {
        const { Note, Days, Name } = this.params.context as GenParticipant;
        this.updateModel = { Note, Days }
        this.participantName = Name;
    }
    close() {
        this.params.closeCallback();
    }

    submit() {
        const { } = this.updateModel
        this.params.closeCallback({
            ...this.params.context,
            ...this.updateModel,
        });
    }
}