1 | {"ast":null,"code":"import * as i0 from \"@angular/core\";\nimport * as i1 from \"../_services/city.service\";\nimport * as i2 from \"../_services/location.service\";\nimport * as i3 from \"../_services/region.service\";\nimport * as i4 from \"primeng/autocomplete\";\nimport * as i5 from \"@angular/forms\";\nimport * as i6 from \"@angular/material/autocomplete\";\nimport * as i7 from \"@angular/common\";\nimport * as i8 from \"primeng/button\";\nimport * as i9 from \"@angular/material/core\";\n\nfunction ExploreComponent_mat_option_16_Template(rf, ctx) {\n if (rf & 1) {\n const _r4 = i0.ɵɵgetCurrentView();\n\n i0.ɵɵelementStart(0, \"mat-option\", 12);\n i0.ɵɵlistener(\"click\", function ExploreComponent_mat_option_16_Template_mat_option_click_0_listener() {\n i0.ɵɵrestoreView(_r4);\n const ctx_r3 = i0.ɵɵnextContext();\n return ctx_r3.OnHumanSelected(ctx_r3.SelectedHuman);\n });\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const human_r2 = ctx.$implicit;\n i0.ɵɵproperty(\"value\", human_r2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate2(\" \", human_r2.Name, \" - \", human_r2.Surname, \" \");\n }\n}\n\nexport class ExploreComponent {\n constructor(cityService, locationService, regionService) {\n this.cityService = cityService;\n this.locationService = locationService;\n this.regionService = regionService;\n this.loading = [false, false, false, false];\n this.regions = [];\n this.cities = [];\n this.filteredCountries = [];\n this.text = '';\n }\n\n ngOnInit() {\n this.cityService.getAllCities().subscribe(cities => {\n this.cities = cities;\n });\n this.regionService.getAllRegions().subscribe(regions => {\n this.regions = regions;\n });\n }\n\n search(event) {\n let filtered = [];\n let query = event.query;\n\n for (let i = 0; i < this.cities.length; i++) {\n let city = this.cities[i];\n\n if (city.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\n filtered.push(city);\n }\n }\n\n for (let i = 0; i < this.regions.length; i++) {\n let region = this.regions[i];\n\n if (region.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\n filtered.push(region);\n }\n }\n\n this.filteredCountries = filtered;\n }\n\n load(index) {\n this.loading[index] = true;\n setTimeout(() => this.loading[index] = false, 1000);\n }\n\n OnHumanSelected(option) {\n console.log(option.value);\n }\n\n}\n\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) {\n return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.CityService), i0.ɵɵdirectiveInject(i2.LocationService), i0.ɵɵdirectiveInject(i3.RegionService));\n};\n\nExploreComponent.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: ExploreComponent,\n selectors: [[\"app-explore\"]],\n decls: 20,\n vars: 8,\n consts: [[\"href\", \"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\", \"rel\", \"stylesheet\", \"integrity\", \"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\", \"crossorigin\", \"anonymous\"], [\"lang\", \"en\"], [\"charset\", \"utf-8\"], [1, \"navbar\", \"navbar-expand-sm\"], [1, \"navbar-brand\"], [1, \"navbar-nav\", \"ml-auto\"], [1, \"nav-item\"], [\"field\", \"name\", 3, \"ngModel\", \"suggestions\", \"minLength\", \"ngModelChange\", \"completeMethod\"], [3, \"displayWith\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", \"click\", 4, \"ngFor\", \"ngForOf\"], [\"label\", \"Search\", \"icon\", \"pi pi-search\", \"id\", \"button\", 3, \"loading\", \"click\"], [3, \"value\", \"click\"]],\n template: function ExploreComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"link\", 0);\n i0.ɵɵelementStart(1, \"html\", 1);\n i0.ɵɵelementStart(2, \"head\");\n i0.ɵɵelement(3, \"meta\", 2);\n i0.ɵɵelementStart(4, \"title\");\n i0.ɵɵtext(5, \"Explore\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(6, \"body\");\n i0.ɵɵelementStart(7, \"header\");\n i0.ɵɵelementStart(8, \"nav\", 3);\n i0.ɵɵelementStart(9, \"strong\", 4);\n i0.ɵɵtext(10, \"Trivia Trip\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(11, \"ul\", 5);\n i0.ɵɵelementStart(12, \"li\", 6);\n i0.ɵɵelementStart(13, \"p-autoComplete\", 7);\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_p_autoComplete_ngModelChange_13_listener($event) {\n return ctx.text = $event;\n })(\"completeMethod\", function ExploreComponent_Template_p_autoComplete_completeMethod_13_listener($event) {\n return ctx.search($event);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(14, \"mat-autocomplete\", 8, 9);\n i0.ɵɵtemplate(16, ExploreComponent_mat_option_16_Template, 2, 3, \"mat-option\", 10);\n i0.ɵɵpipe(17, \"async\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(18, \"p-button\", 11);\n i0.ɵɵlistener(\"click\", function ExploreComponent_Template_p_button_click_18_listener() {\n return ctx.load(0);\n });\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelement(19, \"li\", 6);\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n i0.ɵɵadvance(13);\n i0.ɵɵproperty(\"ngModel\", ctx.text)(\"suggestions\", ctx.filteredCountries)(\"minLength\", 1);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"displayWith\", ctx.filteredCountries);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(17, 6, ctx.arrFilteredHumans));\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"loading\", ctx.loading[0]);\n }\n },\n directives: [i4.AutoComplete, i5.NgControlStatus, i5.NgModel, i6.MatAutocomplete, i7.NgForOf, i8.Button, i9.MatOption],\n pipes: [i7.AsyncPipe],\n styles: [\"#button[_ngcontent-%COMP%]{\\r\\n margin-left: 20px;\\r\\n}\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cGxvcmUuY29tcG9uZW50LmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtJQUNJLGlCQUFpQjtBQUNyQiIsImZpbGUiOiJleHBsb3JlLmNvbXBvbmVudC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIjYnV0dG9ue1xyXG4gICAgbWFyZ2luLWxlZnQ6IDIwcHg7XHJcbn0iXX0= */\"]\n});","map":{"version":3,"sources":["C:/Users/DELL/Desktop/bachelor-thesis/trip-planner-front/src/app/explore/explore.component.ts"],"names":["i0","i1","i2","i3","i4","i5","i6","i7","i8","i9","ExploreComponent_mat_option_16_Template","rf","ctx","_r4","ɵɵgetCurrentView","ɵɵelementStart","ɵɵlistener","ExploreComponent_mat_option_16_Template_mat_option_click_0_listener","ɵɵrestoreView","ctx_r3","ɵɵnextContext","OnHumanSelected","SelectedHuman","ɵɵtext","ɵɵelementEnd","human_r2","$implicit","ɵɵproperty","ɵɵadvance","ɵɵtextInterpolate2","Name","Surname","ExploreComponent","constructor","cityService","locationService","regionService","loading","regions","cities","filteredCountries","text","ngOnInit","getAllCities","subscribe","getAllRegions","search","event","filtered","query","i","length","city","name","toLowerCase","indexOf","push","region","load","index","setTimeout","option","console","log","value","ɵfac","ExploreComponent_Factory","t","ɵɵdirectiveInject","CityService","LocationService","RegionService","ɵcmp","ɵɵdefineComponent","type","selectors","decls","vars","consts","template","ExploreComponent_Template","ɵɵelement","ExploreComponent_Template_p_autoComplete_ngModelChange_13_listener","$event","ExploreComponent_Template_p_autoComplete_completeMethod_13_listener","ɵɵtemplate","ɵɵpipe","ExploreComponent_Template_p_button_click_18_listener","ɵɵpipeBind1","arrFilteredHumans","directives","AutoComplete","NgControlStatus","NgModel","MatAutocomplete","NgForOf","Button","MatOption","pip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AACA5B,MAAAA,EAAE,CAAC2B,UAAH,CAAc,SAAd,EAAyB3B,EAAE,CAACwF,WAAH,CAAe,EAAf,EAAmB,CAAnB,EAAsB5E,GAAG,CAAC6E,iBAA1B,CAAzB;AACAzF,MAAAA,EAAE,CAAC4B,SAAH,CAAa,CAAb;AACA5B,MAAAA,EAAE,CAAC2B,UAAH,CAAc,SAAd,EAAyBf,GAAG,CAACyB,OAAJ,CAAY,CAAZ,CAAzB;AACH;AAAE,GA3CoD;AA2ClDqD,EAAAA,UAAU,EAAE,CAACtF,EAAE,CAACuF,YAAJ,EAAkBtF,EAAE,CAACuF,eAArB,EAAsCvF,EAAE,CAACwF,OAAzC,EAAkDvF,EAAE,CAACwF,eAArD,EAAsEvF,EAAE,CAACwF,OAAzE,EAAkFvF,EAAE,CAACwF,MAArF,EAA6FvF,EAAE,CAACwF,SAAhG,CA3CsC;AA2CsEC,EAAAA,KAAK,EAAE,CAAC3F,EAAE,CAAC4F,SAAJ,CA3C7E;AA2C6FC,EAAAA,MAAM,EAAE,CAAC,+WAAD;AA3CrG,CAArB,CAAtC","sourcesContent":["import * as i0 from \"@angular/core\";\r\nimport * as i1 from \"../_services/city.service\";\r\nimport * as i2 from \"../_services/location.service\";\r\nimport * as i3 from \"../_services/region.service\";\r\nimport * as i4 from \"primeng/autocomplete\";\r\nimport * as i5 from \"@angular/forms\";\r\nimport * as i6 from \"@angular/material/autocomplete\";\r\nimport * as i7 from \"@angular/common\";\r\nimport * as i8 from \"primeng/button\";\r\nimport * as i9 from \"@angular/material/core\";\r\nfunction ExploreComponent_mat_option_16_Template(rf, ctx) { if (rf & 1) {\r\n const _r4 = i0.ɵɵgetCurrentView();\r\n i0.ɵɵelementStart(0, \"mat-option\", 12);\r\n i0.ɵɵlistener(\"click\", function ExploreComponent_mat_option_16_Template_mat_option_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(); return ctx_r3.OnHumanSelected(ctx_r3.SelectedHuman); });\r\n i0.ɵɵtext(1);\r\n i0.ɵɵelementEnd();\r\n} if (rf & 2) {\r\n const human_r2 = ctx.$implicit;\r\n i0.ɵɵproperty(\"value\", human_r2);\r\n i0.ɵɵadvance(1);\r\n i0.ɵɵtextInterpolate2(\" \", human_r2.Name, \" - \", human_r2.Surname, \" \");\r\n} }\r\nexport class ExploreComponent {\r\n constructor(cityService, locationService, regionService) {\r\n this.cityService = cityService;\r\n this.locationService = locationService;\r\n this.regionService = regionService;\r\n this.loading = [false, false, false, false];\r\n this.regions = [];\r\n this.cities = [];\r\n this.filteredCountries = [];\r\n this.text = '';\r\n }\r\n ngOnInit() {\r\n this.cityService.getAllCities().subscribe(cities => {\r\n this.cities = cities;\r\n });\r\n this.regionService.getAllRegions().subscribe(regions => {\r\n this.regions = regions;\r\n });\r\n }\r\n search(event) {\r\n let filtered = [];\r\n let query = event.query;\r\n for (let i = 0; i < this.cities.length; i++) {\r\n let city = this.cities[i];\r\n if (city.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\r\n filtered.push(city);\r\n }\r\n }\r\n for (let i = 0; i < this.regions.length; i++) {\r\n let region = this.regions[i];\r\n if (region.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\r\n filtered.push(region);\r\n }\r\n }\r\n this.filteredCountries = filtered;\r\n }\r\n load(index) {\r\n this.loading[index] = true;\r\n setTimeout(() => this.loading[index] = false, 1000);\r\n }\r\n OnHumanSelected(option) {\r\n console.log(option.value);\r\n }\r\n}\r\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) { return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.CityService), i0.ɵɵdirectiveInject(i2.LocationService), i0.ɵɵdirectiveInject(i3.RegionService)); };\r\nExploreComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ExploreComponent, selectors: [[\"app-explore\"]], decls: 20, vars: 8, consts: [[\"href\", \"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\", \"rel\", \"stylesheet\", \"integrity\", \"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\", \"crossorigin\", \"anonymous\"], [\"lang\", \"en\"], [\"charset\", \"utf-8\"], [1, \"navbar\", \"navbar-expand-sm\"], [1, \"navbar-brand\"], [1, \"navbar-nav\", \"ml-auto\"], [1, \"nav-item\"], [\"field\", \"name\", 3, \"ngModel\", \"suggestions\", \"minLength\", \"ngModelChange\", \"completeMethod\"], [3, \"displayWith\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", \"click\", 4, \"ngFor\", \"ngForOf\"], [\"label\", \"Search\", \"icon\", \"pi pi-search\", \"id\", \"button\", 3, \"loading\", \"click\"], [3, \"value\", \"click\"]], template: function ExploreComponent_Template(rf, ctx) { if (rf & 1) {\r\n i0.ɵɵelement(0, \"link\", 0);\r\n i0.ɵɵelementStart(1, \"html\", 1);\r\n i0.ɵɵelementStart(2, \"head\");\r\n i0.ɵɵelement(3, \"meta\", 2);\r\n i0.ɵɵelementStart(4, \"title\");\r\n i0.ɵɵtext(5, \"Explore\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(6, \"body\");\r\n i0.ɵɵelementStart(7, \"header\");\r\n i0.ɵɵelementStart(8, \"nav\", 3);\r\n i0.ɵɵelementStart(9, \"strong\", 4);\r\n i0.ɵɵtext(10, \"Trivia Trip\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(11, \"ul\", 5);\r\n i0.ɵɵelementStart(12, \"li\", 6);\r\n i0.ɵɵelementStart(13, \"p-autoComplete\", 7);\r\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_p_autoComplete_ngModelChange_13_listener($event) { return ctx.text = $event; })(\"completeMethod\", function ExploreComponent_Template_p_autoComplete_completeMethod_13_listener($event) { return ctx.search($event); });\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(14, \"mat-autocomplete\", 8, 9);\r\n i0.ɵɵtemplate(16, ExploreComponent_mat_option_16_Template, 2, 3, \"mat-option\", 10);\r\n i0.ɵɵpipe(17, \"async\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(18, \"p-button\", 11);\r\n i0.ɵɵlistener(\"click\", function ExploreComponent_Template_p_button_click_18_listener() { return ctx.load(0); });\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelement(19, \"li\", 6);\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n } if (rf & 2) {\r\n i0.ɵɵadvance(13);\r\n i0.ɵɵproperty(\"ngModel\", ctx.text)(\"suggestions\", ctx.filteredCountries)(\"minLength\", 1);\r\n i0.ɵɵadvance(1);\r\n i0.ɵɵproperty(\"displayWith\", ctx.filteredCountries);\r\n i0.ɵɵadvance(2);\r\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(17, 6, ctx.arrFilteredHumans));\r\n i0.ɵɵadvance(2);\r\n i0.ɵɵproperty(\"loading\", ctx.loading[0]);\r\n } }, directives: [i4.AutoComplete, i5.NgControlStatus, i5.NgModel, i6.MatAutocomplete, i7.NgForOf, i8.Button, i9.MatOption], pipes: [i7.AsyncPipe], styles: [\"#button[_ngcontent-%COMP%]{\\r\\n margin-left: 20px;\\r\\n}\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImV4cGxvcmUuY29tcG9uZW50LmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtJQUNJLGlCQUFpQjtBQUNyQiIsImZpbGUiOiJleHBsb3JlLmNvbXBvbmVudC5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIjYnV0dG9ue1xyXG4gICAgbWFyZ2luLWxlZnQ6IDIwcHg7XHJcbn0iXX0= */\"] });\r\n"]},"metadata":{},"sourceType":"module"} |
---|