Changeset b738035 for trip-planner-front/src/app/location
- Timestamp:
- 01/24/22 21:08:32 (3 years ago)
- Branches:
- master
- Children:
- 76712b2
- Parents:
- bdd6491
- Location:
- trip-planner-front/src/app/location
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html
rbdd6491 rb738035 7 7 </tr> 8 8 </ng-template> 9 <ng-template pTemplate="body" let-planner let-data>9 <ng-template pTemplate="body" let-planner> 10 10 <tr> 11 11 <td>{{planner.name}}</td> -
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts
rbdd6491 rb738035 1 1 import { Component, OnInit } from '@angular/core'; 2 import { ActivatedRoute } from '@angular/router';3 2 import { Planner } from 'src/app/_models/planner'; 4 3 import { PlannerService } from 'src/app/_services/planner.service'; 5 4 import { DynamicDialogRef } from 'primeng/dynamicdialog'; 6 import { LocationService } from 'src/app/_services/location.service';7 5 8 6 … … 17 15 planners: Planner[]; 18 16 19 constructor(private plannerService: PlannerService, 20 private route: ActivatedRoute, private ref: DynamicDialogRef, private locationService : LocationService) { 17 constructor(private plannerService: PlannerService, private ref: DynamicDialogRef) { 21 18 this.planners = []; 22 19 } … … 29 26 } 30 27 ); 31 32 28 } 33 29 -
trip-planner-front/src/app/location/location-details/location-details.component.html
rbdd6491 rb738035 18 18 </ng-template> 19 19 </p-galleria> 20 <br> 21 <p-rating></p-rating> 20 22 </div> 21 23 </div> -
trip-planner-front/src/app/location/location-details/location-details.component.ts
rbdd6491 rb738035 1 import { Component, OnInit , ViewEncapsulation} from '@angular/core';1 import { Component, OnInit } from '@angular/core'; 2 2 import { ActivatedRoute, Router } from '@angular/router'; 3 3 import { Images } from 'src/app/_models/images'; -
trip-planner-front/src/app/location/location.component.css
rbdd6491 rb738035 1 img{ 2 width: 150px; 3 height: 120px; 4 display: block; 5 } -
trip-planner-front/src/app/location/location.component.html
rbdd6491 rb738035 9 9 <tr> 10 10 <th scope="col">#</th> 11 <th scope="col">Photo</th> 11 12 <th scope="col">Location name</th> 12 13 <th scope="col"> Add to my planner</th> … … 17 18 <tr *ngFor="let location of listLocations"> 18 19 <td>{{location.id}}</td> 20 <td><img src="data:image/png;base64,{{location.photo}}" /></td> 19 21 <td>{{location.name}}</td> 20 22 <td><button type="button" (click)="show(location)" pButton icon="pi pi-info-circle" 21 23 label="Add to my planner"></button></td> 22 24 <td><button type="button" color="primary" pButton icon="pi pi-info-circle" 23 (click)="onClickSeeDetails(location.id)" label="See details"></button></td> 25 (click)="onClickSeeDetails(location.id)" label="See details"></button> 26 </td> 24 27 </tr> 25 28 </tbody> -
trip-planner-front/src/app/location/location.component.ts
rbdd6491 rb738035 93 93 94 94 this.ref.onClose.subscribe((planner: Planner) => { 95 if (planner){96 this.plannerLocationDto.locationId = location.id;97 this.plannerLocationDto.plannerId = planner.id;98 console.log("LOC ID: " + this.plannerLocationDto.locationId);99 console.log("PLANNER ID: " + this.plannerLocationDto.plannerId);95 if (planner) { 96 this.plannerLocationDto.locationId = location.id; 97 this.plannerLocationDto.plannerId = planner.id; 98 console.log("LOC ID: " + this.plannerLocationDto.locationId); 99 console.log("PLANNER ID: " + this.plannerLocationDto.plannerId); 100 100 101 this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe( 102 lid => { 103 if (lid.length == 0) { 104 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 105 data => { 106 console.log(data); 107 } 108 ); 109 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 110 111 } else if (lid.length > 0) { 112 if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) { 113 console.log("LOKACIJATA VEKE JA IMA VO PLANEROT"); 114 this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' }); 115 } else { 101 this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe( 102 lid => { 103 if (lid.length == 0) { 116 104 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 117 105 data => { … … 120 108 ); 121 109 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 110 111 } else if (lid.length > 0) { 112 if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) { 113 console.log("LOKACIJATA VEKE JA IMA VO PLANEROT"); 114 this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' }); 115 } else { 116 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 117 data => { 118 console.log(data); 119 } 120 ); 121 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 122 } 123 122 124 } 123 124 125 } 125 } 126 ); 126 ); 127 127 } 128 128 }); 129 129 130 130 } 131 131
Note:
See TracChangeset
for help on using the changeset viewer.