import { Component, ViewChild, Injector, Output, EventEmitter } from '@angular/core'; import { ModalDirective } from 'ngx-bootstrap'; import { ControllerRouteServiceProxy, RouteFreezeListDto } from '@shared/service-proxies/service-proxies'; import { AppComponentBase } from '@shared/common/app-component-base'; @Component({ selector: 'freezeModal', templateUrl: './freeze-modal.component.html' }) export class FreezeModalComponent extends AppComponentBase { @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective; @Output() modalSave: EventEmitter = new EventEmitter(); active = false; saving = false; reason: any; routeId: any; routeCode: any; unFreezeby: any item: RouteFreezeListDto; constructor( injector: Injector, private _controllerRouteService: ControllerRouteServiceProxy, ) { super(injector); } show(routeId, routeCode): void { this.routeId = routeId; this.active = true; this.routeCode = routeCode; this._controllerRouteService.getUnFreezeReason(this.routeId).subscribe(result => { this.item = result; }); this.modal.show(); } close(): void { this.active = false; this.modal.hide(); } save(): void { this.saving = true; this._controllerRouteService.updateFreeze(true, this.routeId) .pipe() .subscribe(() => { this.notify.info(this.l('SavedSuccessfully')); this.modalSave.emit(null); this.close(); }); } }