import { Component, ViewChild, Injector, Output, EventEmitter} from '@angular/core'; import { ModalDirective } from 'ngx-bootstrap'; import { finalize } from 'rxjs/operators'; import { PostalCodesServiceProxy, CreateOrEditPostalCodeDto, CreateZoneInput, ZoneServiceProxy, CreateZoneLocationInput, PostalCodeZoneServiceProxy, GroupedPostalCodeZoneListDto } from '@shared/service-proxies/service-proxies'; import { AppComponentBase } from '@shared/common/app-component-base'; import * as moment from 'moment'; import * as countries from '@app/sprintship/countries.json'; import { ActivatedRoute } from '@angular/router'; import { toInt } from 'ngx-bootstrap/chronos/utils/type-checks'; @Component({ selector: 'viewZoneModalComponent', templateUrl: './view-zone-modal.component.html' }) export class ViewZoneModalComponent extends AppComponentBase { @ViewChild('viewZoneModal', { static: true }) modal:ModalDirective @Output() modalSave: EventEmitter = new EventEmitter(); active= false; saving = false; locationId : number; zoneName: string; postalCodes: Array= []; zoneInput: CreateZoneInput = new CreateZoneInput(); zoneLocationInput: CreateZoneLocationInput = new CreateZoneLocationInput(); isPrimary: boolean = false; constructor( injector: Injector, private _zoneAppService: ZoneServiceProxy, private _postalCodeZoneServiceProxy: PostalCodeZoneServiceProxy, private route: ActivatedRoute, ) { super(injector); } ngOnInit(){ this.route.paramMap.subscribe(params => { this.locationId = parseInt(params.get("id")); }); } onShown(): void { // $('#CountryJson').select2(); // $('#CountryJson').select2(); } show(zoneId): void { this._postalCodeZoneServiceProxy.getGroupedPostalCodeZoneListByZoneId( zoneId ).pipe(finalize(() => this.spinnerService.hide())).subscribe(result => { this.zoneName = result[0].zoneName this.postalCodes = result[0].postalCodes; for(var x=0; x { this.saving = false; })) .subscribe(result => { this.notify.info(this.l('SavedSuccessfully')); this.close(); this.modalSave.emit(null); // this.getOrderStatus(this.orderId) // this.getOrderStatus(this.orderId); }); } close(): void { this.active = false; this.modal.hide(); } }