Changeset 59329aa for trip-planner-front/src/app
- Timestamp:
- 11/23/21 14:58:44 (3 years ago)
- Branches:
- master
- Children:
- e29cc2e
- Parents:
- ceaed42
- Location:
- trip-planner-front/src/app
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/_models/location.ts
rceaed42 r59329aa 1 1 2 export class Location{ 2 3 … … 7 8 priority: string; 8 9 duration: number; 10 photo: any[]; 9 11 10 12 constructor(){ … … 15 17 this.priority = 'Location priority'; 16 18 this.duration = 1; 19 this.photo = []; 17 20 } 18 21 } -
trip-planner-front/src/app/_services/location.service.ts
rceaed42 r59329aa 26 26 } 27 27 28 getLocationsF roPlanner(plannerId : number) : Observable<Location[]>{28 getLocationsForPlanner(plannerId : number) : Observable<Location[]>{ 29 29 let url = "http://localhost:8080/api/planner/locations"; 30 30 return this.httpClient.get<Location[]>(url + '?plannerId=' + plannerId); 31 31 } 32 33 getAllLocations() : Observable<Location[]> { 34 let url = "http://localhost:8080/api/locations"; 35 return this.httpClient.get<Location[]>(url); 36 } 37 38 getWeekendGetaways() : Observable<Location[]>{ 39 let url = "http://localhost:8080/api/weekend"; 40 return this.httpClient.get<Location[]>(url); 41 } 42 43 getVillages() : Observable<Location[]>{ 44 let url = "http://localhost:8080/api/villages"; 45 return this.httpClient.get<Location[]>(url); 46 } 47 48 getLocation(id : number) :Observable<Location>{ 49 let url = "http://localhost:8080/api/location/" + id; 50 return this.httpClient.get<Location>(url); 51 } 52 53 getAllLocationsForPlanner(id: number): Observable<Location[]>{ 54 let url = "http://localhost:8080/api/planner/locations"; 55 return this.httpClient.get<Location[]>(url + "?plannerId=" + id); 56 } 57 32 58 } -
trip-planner-front/src/app/_services/planner.service.ts
rceaed42 r59329aa 1 import { HttpClient , HttpHeaders} from "@angular/common/http";1 import { HttpClient } from "@angular/common/http"; 2 2 import { Injectable } from "@angular/core"; 3 3 import { Observable } from "rxjs"; -
trip-planner-front/src/app/app-routing.module.ts
rceaed42 r59329aa 1 1 import { NgModule } from '@angular/core'; 2 2 import { RouterModule, Routes } from '@angular/router'; 3 import { HomepageComponent } from './homepage/homepage.component'; 4 import { LocationDetailsComponent } from './location/location-details/location-details.component'; 3 5 import { LocationComponent } from './location/location.component'; 4 6 import { LocationsFormComponent } from './locations-form/locations-form.component'; … … 10 12 {path: 'form', component: LocationsFormComponent}, 11 13 {path: 'edit/planner/:id', component: EditPlannerComponent}, 12 {path: 'locations', component: LocationComponent} 14 {path: 'locations', component: LocationComponent}, 15 {path: '', component: HomepageComponent}, 16 {path: 'location', component: LocationDetailsComponent} 13 17 ]; 14 18 -
trip-planner-front/src/app/app.module.ts
rceaed42 r59329aa 10 10 import { LocationComponent } from './location/location.component'; 11 11 import { MatIconModule } from '@angular/material/icon'; 12 import {MatListModule} from '@angular/material/list';13 12 import { MatSelectModule } from '@angular/material/select'; 14 13 import {MatInputModule} from '@angular/material/input'; … … 29 28 import { DetailPlannerComponent } from './planner/detail-planner/detail-planner.component'; 30 29 import { AddLocationToPlannerPanelComponent } from './location/add-location-to-planner-panel/add-location-to-planner-panel.component'; 30 import { HomepageComponent } from './homepage/homepage.component'; 31 import {AccordionModule} from 'primeng/accordion'; //accordion and accordion tab 32 import {MenuItem} from 'primeng/api'; 33 import {CarouselModule} from 'primeng/carousel'; 34 import {ButtonModule} from 'primeng/button'; 35 import {ToastModule} from 'primeng/toast'; 36 import {TabViewModule} from 'primeng/tabview'; 37 import { LocationDetailsComponent } from './location/location-details/location-details.component'; 38 import {GalleriaModule} from 'primeng/galleria'; 31 39 32 40 @NgModule({ … … 39 47 EditPlannerComponent, 40 48 DetailPlannerComponent, 41 AddLocationToPlannerPanelComponent 49 AddLocationToPlannerPanelComponent, 50 HomepageComponent, 51 LocationDetailsComponent 42 52 ], 43 53 imports: [ … … 61 71 HttpClientModule, 62 72 ReactiveFormsModule, 63 MatSelectModule 64 73 MatSelectModule, 74 AccordionModule, 75 CarouselModule, 76 ButtonModule, 77 ToastModule, 78 TabViewModule, 79 GalleriaModule 65 80 ], 66 81 providers: [ -
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html
rceaed42 r59329aa 13 13 </form> 14 14 15 <button mat-button (click)="onCancelClick()">Cancel</button>15 <button type="button" mat-button (click)="onCancelClick()">Cancel</button> -
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts
rceaed42 r59329aa 1 1 import { Component, OnInit } from '@angular/core'; 2 import { NgForm } from '@angular/forms';3 2 import { MatDialogRef } from '@angular/material/dialog'; 4 3 import { ActivatedRoute } from '@angular/router'; … … 21 20 locationId: number; 22 21 plannerLocationDto: PlannerLocationDto; 22 locationsInPlanner: Location[]; 23 23 24 24 25 constructor(private dialogRef: MatDialogRef<AddLocationToPlannerPanelComponent>, private plannerService: PlannerService, … … 29 30 this.locationId = 1; 30 31 this.plannerLocationDto = new PlannerLocationDto(); 32 this.locationsInPlanner = []; 31 33 } 32 34 … … 56 58 this.plannerLocationDto.locationId = this.locationId; 57 59 this.plannerLocationDto.plannerId = plannerId; 60 /* 58 61 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 59 62 data => { … … 61 64 } 62 65 ); 63 } 66 */ 67 68 // window.location.reload(); 69 } 64 70 65 71 } -
trip-planner-front/src/app/location/location.component.html
rceaed42 r59329aa 18 18 <td>{{location.name}}</td> 19 19 <td><button mat-raised-button color="primary" (click)="openDialogSave(location.id)">Add to my planner</button></td> 20 <td><button mat-raised-button color="primary" >See details</button></td>20 <td><button mat-raised-button color="primary" (click)="onClickSeeDetails(location.id)">See details</button></td> 21 21 </tr> 22 22 </tbody> -
trip-planner-front/src/app/location/location.component.ts
rceaed42 r59329aa 1 import { Route } from '@angular/compiler/src/core';2 1 import { Component, Input, OnInit, Output } from '@angular/core'; 3 2 import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 4 3 import { MatDialog } from '@angular/material/dialog'; 5 4 import { ActivatedRoute, Router } from '@angular/router'; 6 import { Location } from '../_models/location';7 5 import { LocationService } from '../_services/location.service'; 8 6 import { AddLocationToPlannerPanelComponent } from './add-location-to-planner-panel/add-location-to-planner-panel.component'; … … 24 22 regionOption: boolean = false; 25 23 regionId: number; 24 locationId: number; 26 25 27 26 constructor(private fb: FormBuilder, private route: ActivatedRoute, private locationService: LocationService, … … 36 35 this.listLocations = []; 37 36 this.regionId = 1; 37 this.locationId = 1; 38 38 } 39 39 … … 71 71 } 72 72 73 openDialogSave(locationId : number){74 console.log(locationId);73 openDialogSave(locationId){ 74 // console.log(locationId); 75 75 const dialogRef = this.dialog.open(AddLocationToPlannerPanelComponent, { 76 76 width: '250px', 77 77 data: {} 78 78 }); 79 this.router.navigate(['locations'], {queryParams: {locationId: locationId}}); 79 this.router.navigate(['locations'], {queryParams: {regionId: this.regionId, companionId: this.companionId, lengthOfStay: this.lengthOfStay, categoryIds: this.categoryIds, locationId: locationId}}); 80 80 81 } 81 82 83 onClickSeeDetails(id: number){ 84 this.router.navigate(['location'], {queryParams: {id: id}}); 85 } 82 86 } -
trip-planner-front/src/app/locations-form/locations-form.component.html
rceaed42 r59329aa 22 22 <mat-form-field appearance="fill" class="example-full-width"> 23 23 <mat-label>Please select a city</mat-label> 24 <mat-select [(ngModel)]="cityId" placeholder="Select city" name="city" >24 <mat-select [(ngModel)]="cityId" placeholder="Select city" name="city" > 25 25 <mat-option [value]="city.id" *ngFor="let city of cities" > {{city.name}}</mat-option> 26 26 </mat-select> -
trip-planner-front/src/app/planner/edit-planner/edit-planner.component.ts
rceaed42 r59329aa 48 48 .subscribe(x => this.form.patchValue(x)); 49 49 50 this.locationService.getLocationsF roPlanner(this.id).subscribe(50 this.locationService.getLocationsForPlanner(this.id).subscribe( 51 51 data => { 52 52 this.locations = data;
Note:
See TracChangeset
for help on using the changeset viewer.