import { AfterViewChecked, Component, ElementRef, EventEmitter, Injector, Output, ViewChild, Input, ViewContainerRef } from '@angular/core'; import { AppConsts } from '@shared/AppConsts'; import { AppComponentBase } from '@shared/common/app-component-base'; import { TagTypeServiceProxy, UpdateTagTypeInput, LocatorServiceProxy, MoveOrder, UpdateLocatorGeocodeInput} from '@shared/service-proxies/service-proxies'; import { ModalDirective } from 'ngx-bootstrap'; import * as _ from 'lodash'; import { finalize } from 'rxjs/operators'; import * as moment from 'moment'; import { MapFlyOutComponent } from '@app/shared/layout/flyout/map/map-flyout.component'; @Component({ selector: 'updateGeocode', templateUrl: './update-geocode.component.html' }) export class UpdateGeoCodeModalComponent extends AppComponentBase { @ViewChild('updateGeocode', {static: false}) updateGeocode: ModalDirective; @Output() modalSave: EventEmitter = new EventEmitter(); latitude: any; longtitude: any; geoCodeId: number; saving = false; active = false; constructor( injector: Injector, private _locatorAppService: LocatorServiceProxy, private viewContainerRef: ViewContainerRef ) { super(injector); } onShown():void{ } show(geocodeId, lat, lang): void { this.saving = false; this.latitude = lat; this.longtitude = lang; this.geoCodeId = geocodeId; this.active = true; this.updateGeocode.show(); } close(){ this.saving = false; this.updateGeocode.hide(); } save(): void { this.active = true; this.saving = true; let input = new UpdateLocatorGeocodeInput({ geocodeId: this.geoCodeId, latitude: this.latitude, longtitude: this.longtitude, }); this._locatorAppService.updateLocatorGeocode(input) .subscribe(result=>{ this.saving = false; this.updateGeocode.hide(); this.getParentComponent().refresh(); }); } getParentComponent() { return this.viewContainerRef[ '_data' ].componentView.component.viewContainerRef[ '_view' ].component } }