Ignore:
Timestamp:
11/23/21 14:58:44 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
e29cc2e
Parents:
ceaed42
Message:

adding photos

Location:
trip-planner-front/src
Files:
8 added
12 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/_models/location.ts

    rceaed42 r59329aa  
     1
    12export class Location{
    23   
     
    78    priority: string;
    89    duration: number;
     10    photo: any[];
    911
    1012    constructor(){
     
    1517        this.priority = 'Location priority';
    1618        this.duration = 1;
     19        this.photo = [];
    1720    }
    1821}
  • trip-planner-front/src/app/_services/location.service.ts

    rceaed42 r59329aa  
    2626    }
    2727
    28     getLocationsFroPlanner(plannerId : number) : Observable<Location[]>{
     28    getLocationsForPlanner(plannerId : number) : Observable<Location[]>{
    2929        let url = "http://localhost:8080/api/planner/locations";
    3030        return this.httpClient.get<Location[]>(url + '?plannerId=' + plannerId);
    3131    }
     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   
    3258}
  • trip-planner-front/src/app/_services/planner.service.ts

    rceaed42 r59329aa  
    1 import { HttpClient, HttpHeaders } from "@angular/common/http";
     1import { HttpClient } from "@angular/common/http";
    22import { Injectable } from "@angular/core";
    33import { Observable } from "rxjs";
  • trip-planner-front/src/app/app-routing.module.ts

    rceaed42 r59329aa  
    11import { NgModule } from '@angular/core';
    22import { RouterModule, Routes } from '@angular/router';
     3import { HomepageComponent } from './homepage/homepage.component';
     4import { LocationDetailsComponent } from './location/location-details/location-details.component';
    35import { LocationComponent } from './location/location.component';
    46import { LocationsFormComponent } from './locations-form/locations-form.component';
     
    1012  {path: 'form', component: LocationsFormComponent},
    1113  {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}
    1317];
    1418
  • trip-planner-front/src/app/app.module.ts

    rceaed42 r59329aa  
    1010import { LocationComponent } from './location/location.component';
    1111import { MatIconModule } from '@angular/material/icon';
    12 import {MatListModule} from '@angular/material/list';
    1312import { MatSelectModule } from '@angular/material/select';
    1413import {MatInputModule} from '@angular/material/input';
     
    2928import { DetailPlannerComponent } from './planner/detail-planner/detail-planner.component';
    3029import { AddLocationToPlannerPanelComponent } from './location/add-location-to-planner-panel/add-location-to-planner-panel.component';
     30import { HomepageComponent } from './homepage/homepage.component';
     31import {AccordionModule} from 'primeng/accordion';     //accordion and accordion tab
     32import {MenuItem} from 'primeng/api';
     33import {CarouselModule} from 'primeng/carousel';
     34import {ButtonModule} from 'primeng/button';
     35import {ToastModule} from 'primeng/toast';
     36import {TabViewModule} from 'primeng/tabview';
     37import { LocationDetailsComponent } from './location/location-details/location-details.component';
     38import {GalleriaModule} from 'primeng/galleria';
    3139
    3240@NgModule({
     
    3947    EditPlannerComponent,
    4048    DetailPlannerComponent,
    41     AddLocationToPlannerPanelComponent
     49    AddLocationToPlannerPanelComponent,
     50    HomepageComponent,
     51    LocationDetailsComponent
    4252    ],
    4353  imports: [
     
    6171    HttpClientModule,
    6272    ReactiveFormsModule,
    63     MatSelectModule
    64    
     73    MatSelectModule,
     74    AccordionModule,
     75    CarouselModule,
     76    ButtonModule,
     77    ToastModule,
     78    TabViewModule,
     79    GalleriaModule
    6580  ],
    6681  providers: [
  • trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html

    rceaed42 r59329aa  
    1313  </form>
    1414 
    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  
    11import { Component, OnInit } from '@angular/core';
    2 import { NgForm } from '@angular/forms';
    32import { MatDialogRef } from '@angular/material/dialog';
    43import { ActivatedRoute } from '@angular/router';
     
    2120  locationId: number;
    2221  plannerLocationDto: PlannerLocationDto;
     22  locationsInPlanner: Location[];
     23
    2324
    2425  constructor(private dialogRef: MatDialogRef<AddLocationToPlannerPanelComponent>, private plannerService: PlannerService,
     
    2930    this.locationId = 1;
    3031    this.plannerLocationDto = new PlannerLocationDto();
     32    this.locationsInPlanner = [];
    3133  }
    3234
     
    5658    this.plannerLocationDto.locationId = this.locationId;
    5759    this.plannerLocationDto.plannerId = plannerId;
     60    /*
    5861    this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
    5962      data => {
     
    6164      }
    6265    );
    63   }
     66    */
     67
     68   // window.location.reload();
     69    }
    6470
    6571}
  • trip-planner-front/src/app/location/location.component.html

    rceaed42 r59329aa  
    1818      <td>{{location.name}}</td>
    1919      <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>
    2121    </tr> 
    2222  </tbody>
  • trip-planner-front/src/app/location/location.component.ts

    rceaed42 r59329aa  
    1 import { Route } from '@angular/compiler/src/core';
    21import { Component, Input, OnInit, Output } from '@angular/core';
    32import { FormBuilder, FormGroup, Validators } from '@angular/forms';
    43import { MatDialog } from '@angular/material/dialog';
    54import { ActivatedRoute, Router } from '@angular/router';
    6 import { Location } from '../_models/location';
    75import { LocationService } from '../_services/location.service';
    86import { AddLocationToPlannerPanelComponent } from './add-location-to-planner-panel/add-location-to-planner-panel.component';
     
    2422  regionOption: boolean = false;
    2523  regionId: number;
     24  locationId: number;
    2625
    2726  constructor(private fb: FormBuilder, private route: ActivatedRoute, private locationService: LocationService,
     
    3635    this.listLocations = [];
    3736    this.regionId = 1;
     37    this.locationId = 1;
    3838  }
    3939
     
    7171  }
    7272
    73   openDialogSave(locationId: number){
    74     console.log(locationId);
     73  openDialogSave(locationId){
     74   // console.log(locationId);
    7575      const dialogRef = this.dialog.open(AddLocationToPlannerPanelComponent, {
    7676        width: '250px',
    7777        data: {}
    7878      });
    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     
    8081  }
    8182
     83  onClickSeeDetails(id: number){
     84    this.router.navigate(['location'], {queryParams: {id: id}});
     85  }
    8286}
  • trip-planner-front/src/app/locations-form/locations-form.component.html

    rceaed42 r59329aa  
    2222        <mat-form-field appearance="fill" class="example-full-width">
    2323          <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" >
    2525            <mat-option [value]="city.id" *ngFor="let city of cities" > {{city.name}}</mat-option>
    2626          </mat-select>
  • trip-planner-front/src/app/planner/edit-planner/edit-planner.component.ts

    rceaed42 r59329aa  
    4848      .subscribe(x => this.form.patchValue(x));
    4949
    50     this.locationService.getLocationsFroPlanner(this.id).subscribe(
     50    this.locationService.getLocationsForPlanner(this.id).subscribe(
    5151      data => {
    5252          this.locations = data;
  • trip-planner-front/src/styles.css

    rceaed42 r59329aa  
    11/* You can add global styles to this file, and also import other style files */
    22@import "../node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css";
    3 
    4 
     3@import url("../node_modules/primeicons/primeicons.css");
     4@import url("../node_modules/primeng/resources/themes/saga-orange/theme.css");
     5@import url("../node_modules/primeng/resources/primeng.min.css");
     6body {
     7    padding: 2em;
     8    font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Helvetica, Arial, sans-serif, “Apple Color Emoji”, “Segoe UI Emoji”, “Segoe UI Symbol”;
     9  }
Note: See TracChangeset for help on using the changeset viewer.