import { Component, OnInit } from '@angular/core';
import { ModalDialogParams, RouterExtensions } from '@nativescript/angular';


@Component({
    selector: 'GenEventUpdateReportModalComponent',
    moduleId: module.id,
    templateUrl: './gen-event-udpate-report-modal.component.html',
})
export class GenEventUpdateReportModalComponent implements OnInit {

    formModel: { program: '', target: '' };

    constructor(
        private routerExtensions: RouterExtensions,
        private params: ModalDialogParams,
    ) {
    }

    ngOnInit(): void {
        const { program, target } = this.params.context;
        this.formModel = { program, target };
    }

    close() {
        this.params.closeCallback();
    }

    submit() {
        const { program, target } = this.formModel
        this.params.closeCallback({
            program, target
        });
    }

    onBackButton(): void {
        this.routerExtensions.back();
    }
}