source: trip-planner-front/node_modules/.cache/babel-webpack/fa41b3b1b58ee3c28b474d23894eb4f6.json@ 84d0fbb

Last change on this file since 84d0fbb was eed0bf8, checked in by Ema <ema_spirova@…>, 3 years ago

editing location-form on frontend and backend

  • Property mode set to 100644
File size: 21.5 KB
RevLine 
[eed0bf8]1{"ast":null,"code":"import { FormControl } from '@angular/forms';\nimport { map, startWith, switchMap } from 'rxjs/operators';\nimport { Observable } from 'rxjs';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../_services/city.service\";\nimport * as i2 from \"../_services/country.service\";\nimport * as i3 from \"../_services/companion.service\";\nimport * as i4 from \"../_services/cateogry.service\";\nimport * as i5 from \"@angular/material/form-field\";\nimport * as i6 from \"@angular/material/autocomplete\";\nimport * as i7 from \"@angular/common\";\nimport * as i8 from \"@angular/material/select\";\nimport * as i9 from \"@angular/material/input\";\nimport * as i10 from \"@angular/material/chips\";\nimport * as i11 from \"@angular/material/button\";\nimport * as i12 from \"@angular/material/core\";\nimport * as i13 from \"@angular/material/icon\";\n\nfunction LocationsFormComponent_mat_option_10_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"mat-option\", 12);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const option_r4 = ctx.$implicit;\n i0.ɵɵproperty(\"value\", option_r4.name);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", option_r4.name, \" \");\n }\n}\n\nfunction LocationsFormComponent_mat_option_18_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"mat-option\", 13);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const companion_r5 = ctx.$implicit;\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate(companion_r5.type);\n }\n}\n\nfunction LocationsFormComponent_mat_chip_28_mat_icon_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"mat-icon\");\n i0.ɵɵtext(1, \"check\");\n i0.ɵɵelementEnd();\n }\n}\n\nfunction LocationsFormComponent_mat_chip_28_Template(rf, ctx) {\n if (rf & 1) {\n const _r10 = i0.ɵɵgetCurrentView();\n\n i0.ɵɵelementStart(0, \"mat-chip\", 14, 15);\n i0.ɵɵlistener(\"click\", function LocationsFormComponent_mat_chip_28_Template_mat_chip_click_0_listener() {\n const restoredCtx = i0.ɵɵrestoreView(_r10);\n const category_r6 = restoredCtx.$implicit;\n\n const _r7 = i0.ɵɵreference(1);\n\n const ctx_r9 = i0.ɵɵnextContext();\n return ctx_r9.toggleSelection(_r7, category_r6);\n });\n i0.ɵɵtemplate(2, LocationsFormComponent_mat_chip_28_mat_icon_2_Template, 2, 0, \"mat-icon\", 16);\n i0.ɵɵtext(3);\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const category_r6 = ctx.$implicit;\n\n const _r7 = i0.ɵɵreference(1);\n\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngIf\", _r7.selected);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", category_r6.name, \" \");\n }\n}\n\nexport class LocationsFormComponent {\n constructor(cityService, countryService, companionService, categoryService) {\n this.cityService = cityService;\n this.countryService = countryService;\n this.companionService = companionService;\n this.categoryService = categoryService;\n this.myControl = new FormControl();\n this.disableSelect = new FormControl(false);\n this.filteredOptions = new Observable();\n this.cities = [];\n this.countries = [];\n this.companions = [];\n this.categories = [];\n this.chipsSeletion = [];\n this.locationId = 1;\n }\n\n ngOnInit() {\n this.filteredOptions = this.myControl.valueChanges.pipe(startWith(''), switchMap(val => {\n return this.filter(val || '');\n }));\n this.categoryService.getAllCategories().subscribe(data => {\n this.categories = data;\n });\n this.companionService.getAllCompanions().subscribe(data => {\n this.companions = data;\n });\n }\n\n filter(val) {\n // call the service which makes the http-request\n return this.cityService.getAllCities().pipe(map(response => response.filter(option => {\n return option.name.toLowerCase().indexOf(val.toLowerCase()) === 0;\n })));\n }\n\n toggleSelection(chip, category) {\n chip.toggleSelected();\n\n if (this.chipsSeletion.length > 0) {\n if (this.chipsSeletion.indexOf(category.id) <= -1) {\n this.chipsSeletion.push(category.id);\n } else {\n const index = this.chipsSeletion.indexOf(category.id);\n this.chipsSeletion.splice(index, 1);\n }\n } else {\n this.chipsSeletion.push(category.id);\n }\n\n console.log(this.chipsSeletion);\n }\n\n}\n\nLocationsFormComponent.ɵfac = function LocationsFormComponent_Factory(t) {\n return new (t || LocationsFormComponent)(i0.ɵɵdirectiveInject(i1.CityService), i0.ɵɵdirectiveInject(i2.CountryService), i0.ɵɵdirectiveInject(i3.CompanionService), i0.ɵɵdirectiveInject(i4.CategoryService));\n};\n\nLocationsFormComponent.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: LocationsFormComponent,\n selectors: [[\"app-locations-form\"]],\n decls: 31,\n vars: 7,\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\"], [\"appearance\", \"fill\", 1, \"example-full-width\"], [\"type\", \"text\", \"placeholder\", \"Pick one\", \"fo]\", \"locationId\", 3, \"matAutocomplete\"], [\"autoActiveFirstOption\", \"\"], [\"auto\", \"matAutocomplete\"], [3, \"value\", 4, \"ngFor\", \"ngForOf\"], [3, \"disabled\"], [\"value\", \"option1\", 4, \"ngFor\", \"ngForOf\"], [\"matInput\", \"\", \"placeholder\", \"No. Dys\", \"type\", \"number\"], [\"selectable\", \"\", \"multiple\", \"\"], [\"color\", \"accent\", \"selected\", \"\", 3, \"click\", 4, \"ngFor\", \"ngForOf\"], [\"mat-raised-button\", \"\", \"color\", \"primary\"], [3, \"value\"], [\"value\", \"option1\"], [\"color\", \"accent\", \"selected\", \"\", 3, \"click\"], [\"c\", \"matChip\"], [4, \"ngIf\"]],\n template: function LocationsFormComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"link\", 0);\n i0.ɵɵelementStart(1, \"label\");\n i0.ɵɵelementStart(2, \"h5\");\n i0.ɵɵtext(3, \"Please select a place\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(4, \"mat-form-field\", 1);\n i0.ɵɵelementStart(5, \"mat-label\");\n i0.ɵɵtext(6, \"Please select a place\");\n i0.ɵɵelementEnd();\n i0.ɵɵelement(7, \"input\", 2);\n i0.ɵɵelementStart(8, \"mat-autocomplete\", 3, 4);\n i0.ɵɵtemplate(10, LocationsFormComponent_mat_option_10_Template, 2, 2, \"mat-option\", 5);\n i0.ɵɵpipe(11, \"async\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(12, \"h5\");\n i0.ɵɵtext(13, \"Who are you travelling with? \");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(14, \"mat-form-field\", 1);\n i0.ɵɵelementStart(15, \"mat-label\");\n i0.ɵɵtext(16, \"Please select a companion\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(17, \"mat-select\", 6);\n i0.ɵɵtemplate(18, LocationsFormComponent_mat_option_18_Template, 2, 1, \"mat-option\", 7);\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(19, \"h5\");\n i0.ɵɵtext(20, \"How many days are you willing to stay ?\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(21, \"mat-form-field\", 1);\n i0.ɵɵelementStart(22, \"mat-label\");\n i0.ɵɵtext(23, \"Please select a number of days\");\n i0.ɵɵelementEnd();\n i0.ɵɵelement(24, \"input\", 8);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(25, \"h5\");\n i0.ɵɵtext(26, \"What are your priorities to visit?\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(27, \"mat-chip-list\", 9);\n i0.ɵɵtemplate(28, LocationsFormComponent_mat_chip_28_Template, 4, 2, \"mat-chip\", 10);\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(29, \"button\", 11);\n i0.ɵɵtext(30, \"Create my planner\");\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n const _r0 = i0.ɵɵreference(9);\n\n i0.ɵɵadvance(7);\n i0.ɵɵproperty(\"matAutocomplete\", _r0);\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"ngForOf\", i0.ɵɵpipeBind1(11, 5, ctx.filteredOptions));\n i0.ɵɵadvance(7);\n i0.ɵɵproperty(\"disabled\", ctx.disableSelect.value);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngForOf\", ctx.companions);\n i0.ɵɵadvance(10);\n i0.ɵɵproperty(\"ngForOf\", ctx.categories);\n }\n },\n directives: [i5.MatFormField, i5.MatLabel, i6.MatAutocompleteTrigger, i6.MatAutocomplete, i7.NgForOf, i8.MatSelect, i9.MatInput, i10.MatChipList, i11.MatButton, i12.MatOption, i10.MatChip, i7.NgIf, i13.MatIcon],\n pipes: [i7.AsyncPipe],\n styles: [\".example-form[_ngcontent-%COMP%] {\\r\\n min-width: 150px;\\r\\n max-width: 380px;\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\n.example-full-width[_ngcontent-%COMP%] {\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\nmat-icon[_ngcontent-%COMP%] {\\r\\n height: 20px;\\r\\n width: 20px;\\r\\n font-size: 20px;\\r\\n margin-right: 5px;\\r\\n}\\r\\n\\r\\nbutton[_ngcontent-%COMP%]{\\r\\n float: right;\\r\\n}\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvY2F0aW9ucy1mb3JtLmNvbXBvbmVudC5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7RUFDRSxnQkFBZ0I7RUFDaEIsZ0JBQWdCO0VBQ2hCLFdBQVc7QUFDYjs7QUFFQTtFQUNFLFdBQVc7QUFDYjs7QUFFQTtFQUNFLFlBQVk7RUFDWixXQUFXO0VBQ1gsZUFBZTtFQUNmLGlCQUFpQjtBQUNuQjs7QUFDQTtFQUNFLFlBQVk7QUFDZCIsImZpbGUiOiJsb2NhdGlvbnMtZm9ybS5jb21wb25lbnQuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLmV4YW1wbGUtZm9ybSB7XHJcbiAgbWluLXdpZHRoOiAxNTBweDtcclxuICBtYXgtd2lkdGg6IDM4MHB4O1xyXG4gIHdpZHRoOiAxMDAlO1xyXG59XHJcblxyXG4uZXhhbXBsZS1mdWxsLXdpZHRoIHtcclxuICB3aWR0aDogMTAwJTtcclxufVxyXG5cclxubWF0LWljb24ge1xyXG4gIGhlaWdodDogMjBweDtcclxuICB3aWR0aDogMjBweDtcclxuICBmb250LXNpemU6IDIwcHg7XHJcbiAgbWFyZ2luLXJpZ2h0OiA1cHg7XHJcbn1cclxuYnV0dG9ue1xyXG4gIGZsb2F0OiByaWdodDtcclxufSJdfQ== */\"]\n});","map":{"version":3,"sources":["C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front\\src\\app\\locations-form\\locations-form.component.ts","C:\\Users\\DELL\\Desktop\\bachelor-thesis\\trip-planner-front\\src\\app\\locations-form\\locations-form.component.html"],"names":[],"mappings":"AACA,SAAS,WAAT,QAA4B,gBAA5B;AACA,SAAQ,GAAR,EAAa,SAAb,EAAwB,SAAxB,QAAwC,gBAAxC;AACA,SAAkB,UAAlB,QAAmC,MAAnC;;;;;;;;;;;;;;;;;;ACMM,IAAA,EAAA,CAAA,cAAA,CAAA,CAAA,EAAA,YAAA,EAAA,EAAA;AACE,IAAA,EAAA,CAAA,MAAA,CAAA,CAAA;AACF,IAAA,EAAA,CAAA,YAAA;;;;;AAF2D,IAAA,EAAA,CAAA,UAAA,CAAA,OAAA,EAAA,SAAA,CAAA,IAAA;AACzD,IAAA,EAAA,CAAA,S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,CAAA,EAAA,GAAA,CAAA,eAAA,CAAA;AASrB,MAAA,EAAA,CAAA,SAAA,CAAA,CAAA;AAAA,MAAA,EAAA,CAAA,UAAA,CAAA,UAAA,EAAA,GAAA,CAAA,aAAA,CAAA,KAAA;AACwC,MAAA,EAAA,CAAA,SAAA,CAAA,CAAA;AAAA,MAAA,EAAA,CAAA,UAAA,CAAA,SAAA,EAAA,GAAA,CAAA,UAAA;AAYgB,MAAA,EAAA,CAAA,SAAA,CAAA,EAAA;AAAA,MAAA,EAAA,CAAA,UAAA,CAAA,SAAA,EAAA,GAAA,CAAA,UAAA","sourcesContent":["import { Component, Injectable, OnInit } from '@angular/core';\nimport { FormControl } from '@angular/forms';\nimport {map, startWith, switchMap} from 'rxjs/operators';\nimport {forkJoin, Observable} from 'rxjs';\nimport { CityService } from '../_services/city.service';\nimport { City } from '../_models/city';\nimport { Country } from '../_models/country';\nimport { CountryService } from '../_services/country.service';\nimport { Companion } from '../_models/companion';\nimport { CompanionService } from '../_services/companion.service';\nimport { Category } from '../_models/category';\nimport { CategoryService } from '../_services/cateogry.service';\nimport {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';\nimport { MatChip } from '@angular/material/chips';\n\n@Component({\n selector: 'app-locations-form',\n templateUrl: './locations-form.component.html',\n styleUrls: ['./locations-form.component.css']\n})\nexport class LocationsFormComponent implements OnInit {\n\n myControl = new FormControl();\n cities: City[];\n countries: Country[];\n companions: Companion[];\n categories: Category[];\n filteredOptions: Observable<City[]>;\n disableSelect = new FormControl(false);\n chipsSeletion: number[];\n locationId: number;\n\n constructor(private cityService : CityService, private countryService : CountryService,\n private companionService : CompanionService, private categoryService : CategoryService){\n this.filteredOptions = new Observable<City[]>();\n this.cities = [];\n this.countries = [];\n this.companions = [];\n this.categories = [];\n this.chipsSeletion = [];\n this.locationId = 1;\n }\n \n ngOnInit() :void {\n this.filteredOptions = this.myControl.valueChanges\n .pipe(\n startWith(''),\n switchMap(val => {\n return this.filter(val || '')\n }) \n );\n\n this.categoryService.getAllCategories().subscribe(\n data => {\n this.categories = data;\n }\n );\n\n this.companionService.getAllCompanions().subscribe(\n data => {\n this.companions = data;\n }\n )\n }\n \n filter(val: string): Observable<City[]> {\n // call the service which makes the http-request\n return this.cityService.getAllCities()\n .pipe(\n map(response => response.filter(option => { \n return option.name.toLowerCase().indexOf(val.toLowerCase()) === 0\n }))\n )\n \n } \n\n toggleSelection(chip: MatChip, category: Category){\n chip.toggleSelected();\n if(this.chipsSeletion.length > 0){\n if(this.chipsSeletion.indexOf(category.id) <= -1){\n this.chipsSeletion.push(category.id);\n }else{\n const index = this.chipsSeletion.indexOf(category.id);\n this.chipsSeletion.splice(index, 1);\n }\n }else{\n this.chipsSeletion.push(category.id);\n }\n console.log(this.chipsSeletion);\n }\n}\n","<link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\" crossorigin=\"anonymous\">\n <label><h5>Please select a place</h5></label>\n <mat-form-field class=\"example-full-width\" appearance=\"fill\">\n <mat-label>Please select a place</mat-label>\n <input type=\"text\"\n placeholder=\"Pick one\"\n fo]=\"locationId\"\n [matAutocomplete]=\"auto\">\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\n <mat-option *ngFor=\"let option of filteredOptions | async\" [value]=\"option.name\">\n {{option.name}}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n\n <h5>Who are you travelling with? </h5>\n <mat-form-field appearance=\"fill\" class=\"example-full-width\">\n <mat-label>Please select a companion</mat-label>\n <mat-select [disabled]=\"disableSelect.value\">\n <mat-option value=\"option1\" *ngFor=\"let companion of companions\">{{companion.type}}</mat-option>\n </mat-select>\n </mat-form-field>\n\n <h5>How many days are you willing to stay ?</h5>\n <mat-form-field class=\"example-full-width\" appearance=\"fill\">\n <mat-label>Please select a number of days</mat-label>\n <input matInput placeholder=\"No. Dys\" type=\"number\">\n </mat-form-field>\n\n <h5>What are your priorities to visit?</h5> \n <mat-chip-list selectable multiple>\n <mat-chip #c=\"matChip\" color=\"accent\" selected *ngFor=\"let category of categories\" \n (click)=\"toggleSelection(c, category)\">\n <mat-icon *ngIf=\"c.selected\">check</mat-icon>\n {{category.name}}\n </mat-chip>\n </mat-chip-list>\n <button mat-raised-button color=\"primary\">Create my planner</button>\n"],"sourceRoot":""},"metadata":{},"sourceType":"module"}
Note: See TracBrowser for help on using the repository browser.