Changeset 8d391a1 for trip-planner-front/src/app/location
- Timestamp:
- 11/26/21 20:07:18 (3 years ago)
- Branches:
- master
- Children:
- 1ad8e64
- Parents:
- e29cc2e
- Location:
- trip-planner-front/src/app/location
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html
re29cc2e r8d391a1 7 7 </tr> 8 8 </ng-template> 9 <ng-template pTemplate="body" let-planner >9 <ng-template pTemplate="body" let-planner let-data> 10 10 <tr> 11 11 <td>{{planner.name}}</td> 12 13 12 <td> 14 <button pButton pRipple type="button" icon="pi pi-heart" 15 class="p-button-rounded p-button-help p-button-text" (click)="selectPlanner(planner)"></button>13 <button pButton pRipple type="button" icon="pi pi-heart" class="p-button-rounded p-button-help" 14 (click)="selectPlanner(planner)" ></button> 16 15 </td> 17 16 </tr> -
trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts
re29cc2e r8d391a1 4 4 import { PlannerService } from 'src/app/_services/planner.service'; 5 5 import { DynamicDialogRef } from 'primeng/dynamicdialog'; 6 7 6 import { LocationService } from 'src/app/_services/location.service'; 7 import { Location } from 'src/app/_models/location'; 8 import { PlannerLocationDto } from 'src/app/_models/dto/plannerLocationDto'; 8 9 9 10 … … 16 17 17 18 planners: Planner[]; 18 19 20 19 21 20 constructor(private plannerService: PlannerService, 22 private route: ActivatedRoute, private ref: DynamicDialogRef ) {21 private route: ActivatedRoute, private ref: DynamicDialogRef, private locationService : LocationService) { 23 22 this.planners = []; 24 23 } … … 31 30 } 32 31 ); 32 33 33 } 34 34 … … 37 37 } 38 38 39 40 41 39 } -
trip-planner-front/src/app/location/location-details/location-details.component.html
re29cc2e r8d391a1 3 3 <p>{{locationDetails.description}}</p> 4 4 5 6 5 <div class="content-section implementation"> 7 6 <div class="card"> 8 <h5>More photos</h5>9 7 <p-galleria [value]="images" [responsiveOptions]="responsiveOptions" [containerStyle]="{'max-width': '640px'}" 10 [numVisible]="5" [circular]="true" [showItemNavigators]="true" >8 [numVisible]="5" [circular]="true" [showItemNavigators]="true" [showThumbnails]="false"> 11 9 <ng-template pTemplate="item" let-image> 12 10 <img src="data:image/png;base64,{{image.content}}" … … 16 14 <div class="p-grid p-nogutter p-justify-center"> 17 15 <img src="data:image/png;base64,{{image.content}}" 18 style=" height:50px;display: block;" />16 style=" display: block;" /> 19 17 </div> 20 18 </ng-template> 21 19 </p-galleria> 22 20 </div> 23 21 </div> -
trip-planner-front/src/app/location/location.component.ts
re29cc2e r8d391a1 1 1 import { Component, OnInit } from '@angular/core'; 2 import { FormBuilder, FormGroup, Validators } from '@angular/forms';3 2 import { ActivatedRoute, Router } from '@angular/router'; 4 import { MessageService , PrimeNGConfig} from 'primeng/api';3 import { MessageService } from 'primeng/api'; 5 4 import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; 6 5 import { Planner } from '../_models/planner'; … … 30 29 plannerLocationDto: PlannerLocationDto; 31 30 ref: DynamicDialogRef; 32 31 locationIdsPlanner: number[]; 33 32 34 33 … … 42 41 this.regionId = 1; 43 42 this.locationId = 1; 44 this.ref = new DynamicDialogRef ;43 this.ref = new DynamicDialogRef(); 45 44 this.plannerLocationDto = new PlannerLocationDto(); 46 45 this.locationIdsPlanner = []; 47 46 } 48 47 … … 85 84 86 85 show(location: Location) { 86 console.log(location.id); 87 87 this.ref = this.dialogService.open(AddLocationToPlannerPanelComponent, { 88 88 header: 'Choose a Planner', … … 93 93 94 94 this.ref.onClose.subscribe((planner: Planner) => { 95 96 95 this.plannerLocationDto.locationId = location.id; 97 96 this.plannerLocationDto.plannerId = planner.id; 98 97 console.log("LOC ID: " + this.plannerLocationDto.locationId); 99 98 console.log("PLANNER ID: " + this.plannerLocationDto.plannerId); 100 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 101 data => { 102 console.log(data); 99 100 this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe( 101 lid => { 102 if (lid.length == 0) { 103 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 104 data => { 105 console.log(data); 106 } 107 ); 108 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 109 110 } else if (lid.length > 0) { 111 if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) { 112 console.log("LOKACIJATA VEKE JA IMA VO PLANEROT"); 113 this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' }); 114 } else { 115 this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe( 116 data => { 117 console.log(data); 118 } 119 ); 120 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name }); 121 } 122 123 } 103 124 } 104 125 ); 105 if (planner) { 106 this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ' , detail: planner.name }); 107 } 126 127 108 128 }); 109 129 } … … 115 135 } 116 136 117 onClickBackToMyPlanners() {137 onClickBackToMyPlanners() { 118 138 this.router.navigate(['planners']); 119 139 } 140 141 120 142 }
Note:
See TracChangeset
for help on using the changeset viewer.