2022-07-22 13:13:50 +03:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
|
import { SelectItem } from 'primeng/api';
|
|
|
|
|
import { CountryService } from 'src/app/demo/service/country.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
2022-10-13 13:12:26 +03:00
|
|
|
templateUrl: './inputdemo.component.html'
|
2022-07-22 13:13:50 +03:00
|
|
|
})
|
|
|
|
|
export class InputDemoComponent implements OnInit {
|
2022-10-16 13:29:59 +03:00
|
|
|
|
2022-07-22 13:13:50 +03:00
|
|
|
countries: any[] = [];
|
|
|
|
|
|
|
|
|
|
filteredCountries: any[] = [];
|
|
|
|
|
|
|
|
|
|
selectedCountryAdvanced: any[] = [];
|
|
|
|
|
|
|
|
|
|
valSlider = 50;
|
|
|
|
|
|
|
|
|
|
valColor = '#424242';
|
|
|
|
|
|
|
|
|
|
valRadio: string = '';
|
|
|
|
|
|
|
|
|
|
valCheck: string[] = [];
|
|
|
|
|
|
2022-07-25 17:30:29 +03:00
|
|
|
valCheck2: boolean = false;
|
|
|
|
|
|
2022-07-22 13:13:50 +03:00
|
|
|
valSwitch: boolean = false;
|
|
|
|
|
|
|
|
|
|
cities: SelectItem[] = [];
|
|
|
|
|
|
|
|
|
|
selectedList: SelectItem = { value: '' };
|
|
|
|
|
|
|
|
|
|
selectedDrop: SelectItem = { value: '' };
|
|
|
|
|
|
|
|
|
|
selectedMulti: any[] = [];
|
|
|
|
|
|
|
|
|
|
valToggle = false;
|
|
|
|
|
|
|
|
|
|
paymentOptions: any[] = [];
|
|
|
|
|
|
|
|
|
|
valSelect1: string = "";
|
|
|
|
|
|
|
|
|
|
valSelect2: string = "";
|
|
|
|
|
|
|
|
|
|
valueKnob = 20;
|
|
|
|
|
|
|
|
|
|
constructor(private countryService: CountryService) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.countryService.getCountries().then(countries => {
|
|
|
|
|
this.countries = countries;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.cities = [
|
|
|
|
|
{ label: 'New York', value: { id: 1, name: 'New York', code: 'NY' } },
|
|
|
|
|
{ label: 'Rome', value: { id: 2, name: 'Rome', code: 'RM' } },
|
|
|
|
|
{ label: 'London', value: { id: 3, name: 'London', code: 'LDN' } },
|
|
|
|
|
{ label: 'Istanbul', value: { id: 4, name: 'Istanbul', code: 'IST' } },
|
|
|
|
|
{ label: 'Paris', value: { id: 5, name: 'Paris', code: 'PRS' } }
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
this.paymentOptions = [
|
|
|
|
|
{ name: 'Option 1', value: 1 },
|
|
|
|
|
{ name: 'Option 2', value: 2 },
|
|
|
|
|
{ name: 'Option 3', value: 3 }
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filterCountry(event: any) {
|
|
|
|
|
const filtered: any[] = [];
|
|
|
|
|
const query = event.query;
|
|
|
|
|
for (let i = 0; i < this.countries.length; i++) {
|
|
|
|
|
const country = this.countries[i];
|
|
|
|
|
if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {
|
|
|
|
|
filtered.push(country);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.filteredCountries = filtered;
|
|
|
|
|
}
|
|
|
|
|
}
|