import { Component, ViewChild, Injector, Output, EventEmitter } from '@angular/core'; import { ModalDirective } from 'ngx-bootstrap'; import { LocationServiceProxy, UnlockLocationInput} from '@shared/service-proxies/service-proxies'; import { AppComponentBase } from '@shared/common/app-component-base'; @Component({ selector: 'lockModal', templateUrl: './lock-modal.component.html' }) export class LockModalComponent extends AppComponentBase { @ViewChild('createOrEditModal', { static: true }) modal: ModalDirective; @Output() modalSave: EventEmitter = new EventEmitter(); active = false; saving = false; adjustment: any; unlockUntil: any; reason: any; locations: any; unFreezeby: any minDate: any; constructor( injector: Injector, private _locationService: LocationServiceProxy, ) { super(injector); } show(locations: any): void { this.active = true; this.minDate = new Date(localStorage.getItem('loadDate')); this.locations = locations; this.modal.show(); } close(): void { this.active = false; this.modal.hide(); } save(): void { this.saving = true; this._locationService.lockLocation( this.locations.id ) .pipe() .subscribe(() => { this.notify.info(this.l('SavedSuccessfully')); this.modalSave.emit(null); this.close(); }); } }