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

@Component({
    selector: 'viewRouteScheduleModal',
    templateUrl: './view-routeSchedule-modal.component.html'
})
export class ViewRouteScheduleModalComponent extends AppComponentBase {

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

    active = false;
    saving = false;

    item: GetRouteScheduleForViewDto;


    constructor(
        injector: Injector
    ) {
        super(injector);
        this.item = new GetRouteScheduleForViewDto();
        this.item.routeSchedule = new RouteScheduleDto();
    }

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

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