import { Component, Injector, Input, Output, EventEmitter, OnInit, AfterViewInit } from '@angular/core'; import { AppComponentBase } from '@shared/common/app-component-base'; import { CreateAddressInput, AddressTypeServiceProxy, PostalCodeServiceProxy, UpdateAddressInput } from '@shared/service-proxies/service-proxies'; @Component({ selector: 'addressForm', templateUrl: './address-form.component.html' }) export class AddressFormComponent extends AppComponentBase implements OnInit { @Input() address: UpdateAddressInput = new UpdateAddressInput(); @Input() selectedCountry: string; @Input() selectedCity: string; @Input() selectedState: string; constructor( injector: Injector, // private _countryService: CountryServiceProxy, // private _cityService: CityServiceProxy, // private _stateService: StateServiceProxy, private _addressTypeService: AddressTypeServiceProxy, private _postalCodeService: PostalCodeServiceProxy, ) { super(injector); } filteredCountries: any; filteredCities: any; filteredStates: any; filteredPostal: any; filteredAddressType: any; ngOnInit() { $('.kt-select2').select2(); let maxcount = 1000; this.filterAddressTypes(maxcount); this.filterPostal(maxcount); // this.filterCountries(); // this.filterCity(); // this.filterState(); } // filterPostal(maxcount): void { // this._postalCodeService.getPostalCode( // undefined, // undefined, // undefined, // maxcount, // undefined // ).subscribe(result => { // this.filteredPostal = result.items; // }); // } // filterCountries(maxcount): void { // this._countryService.getCountry( // undefined, // undefined, // undefined, // maxcount, // undefined // ).subscribe(result => { // this.filteredCountries = result.items; // }); // } // filterCities(maxcount): void { // this._cityService.getCity( // undefined, // undefined, // undefined, // maxcount, // undefined // ).subscribe(result => { // this.filteredCities = result.items; // }); // } // filterStates(maxcount): void { // this._stateService.getState( // undefined, // undefined, // undefined, // maxcount, // undefined // ).subscribe(result => { // this.filteredStates = result.items; // }); // } filterPostal(maxcount): void { this._postalCodeService.getPostalCode( undefined, undefined, undefined, undefined, undefined, undefined, maxcount, undefined ).subscribe(result => { this.filteredPostal = result.items; }); } // filterCountries(): void{ // this._postalCodeService.getDistinctCountry( // undefined // ).subscribe(result => { // this.filteredCountries = result.items; // }); // } // filterCity(): void{ // this._postalCodeService.getDistinctCity( // undefined // ).subscribe(result => { // this.filteredCities = result.items; // }); // } // filterState(): void{ // this._postalCodeService.getDistinctState( // undefined // ).subscribe(result => { // this.filteredStates= result.items; // }); // } filterAddressTypes(maxcount): void { this._addressTypeService.getAddressType( undefined, undefined, undefined, maxcount, undefined ).subscribe(result => { this.filteredAddressType = result.items; }); } }