Changeset 6fe77af for trip-planner-front/src
- Timestamp:
- 02/06/22 18:15:51 (3 years ago)
- Branches:
- master
- Children:
- 571e0df
- Parents:
- 76712b2
- Location:
- trip-planner-front/src/app
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/_services/location.service.ts
r76712b2 r6fe77af 1 import { HttpClient } from "@angular/common/http";1 import { HttpClient, HttpHeaders } from "@angular/common/http"; 2 2 import { Injectable } from "@angular/core"; 3 3 import { Observable } from "rxjs"; 4 import { LocationDto } from "../_models/dto/locationDto"; 4 5 import { PlannerLocationDto } from "../_models/dto/plannerLocationDto"; 5 6 import { Location } from "../_models/location"; … … 9 10 }) 10 11 export class LocationService{ 12 13 httpHeaders: HttpHeaders = new HttpHeaders({ 14 'Authorization': '' + sessionStorage.getItem("token"), 15 'Accept': 'application/json', 16 'Content-Type': 'application/json' 17 }); 18 11 19 constructor(private httpClient : HttpClient){} 12 20 … … 65 73 return this.httpClient.get<Location[]>(url + "?place=" + place); 66 74 } 75 76 save(locationDto : LocationDto) : Observable<Location>{ 77 let url = "http://localhost:8080/api/add"; 78 return this.httpClient.post<Location>(url, locationDto, {headers: this.httpHeaders}); 79 } 67 80 } -
trip-planner-front/src/app/app-routing.module.ts
r76712b2 r6fe77af 5 5 import { HomepageComponent } from './homepage/homepage.component'; 6 6 import { LoginComponent } from './homepage/login/login.component'; 7 import { AddLocationComponent } from './location/add-location/add-location.component'; 7 8 import { LocationDetailsComponent } from './location/location-details/location-details.component'; 8 9 import { LocationComponent } from './location/location.component'; … … 10 11 import { EditPlannerComponent } from './planner/edit-planner/edit-planner.component'; 11 12 import { PlannerComponent } from './planner/planner.component'; 13 12 14 13 15 const routes: Routes = [ … … 20 22 {path: 'location', component: LocationDetailsComponent}, 21 23 {path: 'explore', component: ExploreComponent}, 22 {path: 'results', component: ExploreResultComponent} 24 {path: 'results', component: ExploreResultComponent}, 25 {path: 'add-location', component: AddLocationComponent} 23 26 ]; 24 27 -
trip-planner-front/src/app/app.module.ts
r76712b2 r6fe77af 52 52 import { ExploreResultComponent } from './explore/explore-result/explore-result.component'; 53 53 import {RatingModule} from 'primeng/rating'; 54 import { CustomValidators } from './providers/CustomValidators'; 54 import { AddLocationComponent } from './location/add-location/add-location.component'; 55 import {StepsModule} from 'primeng/steps'; 56 import {MatStepperModule} from '@angular/material/stepper'; 57 import {FileUploadModule} from 'primeng/fileupload'; 55 58 56 59 @NgModule({ … … 68 71 LoginComponent, 69 72 ExploreComponent, 70 ExploreResultComponent 71 ], 73 ExploreResultComponent, 74 AddLocationComponent 75 ], 72 76 imports: [ 73 77 BrowserModule, … … 110 114 CardModule, 111 115 AutoCompleteModule, 112 RatingModule 113 ], 116 RatingModule, 117 StepsModule, 118 MatStepperModule, 119 FileUploadModule 120 ], 114 121 115 122 -
trip-planner-front/src/app/explore/explore-result/explore-result.component.html
r76712b2 r6fe77af 15 15 16 16 <main role="main"> 17 <h1 style="color: #F77D62; display: inline; ">Explore</h1>17 <h1 style="color: #F77D62; display: inline;">Explore</h1> 18 18 <h1 style=" display: inline;">{{place}}</h1> 19 19 <div class="lightbox" *ngFor="let l of allLocation"> … … 25 25 </div> 26 26 </div> 27 28 29 27 30 <div class="container"> 28 31 <li *ngFor="let location of allLocation"> -
trip-planner-front/src/app/explore/explore-result/explore-result.component.ts
r76712b2 r6fe77af 17 17 } 18 18 19 responsiveOptions:any[] = [ 20 { 21 breakpoint: '1024px', 22 numVisible: 5 23 }, 24 { 25 breakpoint: '768px', 26 numVisible: 3 27 }, 28 { 29 breakpoint: '560px', 30 numVisible: 1 31 } 32 ]; 19 33 ngOnInit(): void { 20 34 this.route.queryParams … … 25 39 26 40 this.locationService.getAllLocationsSearch(this.place).subscribe( 27 data=> {28 this.allLocation = data;41 res => { 42 this.allLocation = res; 29 43 } 30 44 ) -
trip-planner-front/src/app/location/location-details/location-details.component.ts
r76712b2 r6fe77af 1 1 import { Component, OnInit } from '@angular/core'; 2 import { ActivatedRoute , Router} from '@angular/router';2 import { ActivatedRoute } from '@angular/router'; 3 3 import { Images } from 'src/app/_models/images'; 4 4 import { Location } from 'src/app/_models/location'; … … 17 17 images: Images[]; 18 18 19 constructor(private route: ActivatedRoute, private router: Router, privatelocationService: LocationService,19 constructor(private route: ActivatedRoute, private locationService: LocationService, 20 20 private imagesService: ImagesService) { 21 21 this.locationId = 1; -
trip-planner-front/src/app/locations-form/locations-form.component.html
r76712b2 r6fe77af 35 35 <mat-label>Please select a region</mat-label> 36 36 <mat-select [(ngModel)]="regionId" placeholder="Select region" name="region"> 37 <mat-option [value]="region.id" *ngFor="let region of regions" [value]="region.id"> {{region.name}}37 <mat-option [value]="region.id" *ngFor="let region of regions"> {{region.name}} 38 38 </mat-option> 39 39 </mat-select> -
trip-planner-front/src/app/planner/planner.component.html
r76712b2 r6fe77af 13 13 </nav> 14 14 15 <button pButton pRipple type="button" label="Add location" class="p-button-help " (click)="onClickAddLocation()"></button> 15 16 16 17 <br> -
trip-planner-front/src/app/planner/planner.component.ts
r76712b2 r6fe77af 99 99 window.location.reload(); 100 100 } 101 102 onClickAddLocation(){ 103 this.router.navigate(['add-location']); 104 } 101 105 }
Note:
See TracChangeset
for help on using the changeset viewer.