import { Component, ViewChild, Injector, Output, EventEmitter } from '@angular/core';
import { ModalDirective } from 'ngx-bootstrap';
import { GetRouteTypeForViewDto, RouteTypeDto } from '@shared/service-proxies/service-proxies';
import { AppComponentBase } from '@shared/common/app-component-base';

@Component({
    selector: 'viewRouteTypeModal',
    templateUrl: './view-routeType-modal.component.html'
})
export class ViewRouteTypeModalComponent extends AppComponentBase {

    @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective;
    @Output() modalSave: EventEmitter<any> = new EventEmitter<any>();

    active = false;
    saving = false;

    item: GetRouteTypeForViewDto;


    constructor(
        injector: Injector
    ) {
        super(injector);
        this.item = new GetRouteTypeForViewDto();
        this.item.routeType = new RouteTypeDto();
    }

    show(item: GetRouteTypeForViewDto): void {
        this.item = item;
        this.active = true;
        this.modal.show();
    }

    close(): void {
        this.active = false;
        this.modal.hide();
    }
}
