Ignore:
Timestamp:
01/24/22 21:08:32 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
76712b2
Parents:
bdd6491
Message:

signup/login server errors on front and remove location from planner

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  
    77        </tr>
    88    </ng-template>
    9     <ng-template pTemplate="body" let-planner let-data>
     9    <ng-template pTemplate="body" let-planner>
    1010        <tr>
    1111            <td>{{planner.name}}</td>
  • trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts

    rbdd6491 rb738035  
    11import { Component, OnInit } from '@angular/core';
    2 import { ActivatedRoute } from '@angular/router';
    32import { Planner } from 'src/app/_models/planner';
    43import { PlannerService } from 'src/app/_services/planner.service';
    54import { DynamicDialogRef } from 'primeng/dynamicdialog';
    6 import { LocationService } from 'src/app/_services/location.service';
    75
    86
     
    1715  planners: Planner[];
    1816 
    19   constructor(private plannerService: PlannerService,
    20     private route: ActivatedRoute, private ref: DynamicDialogRef, private locationService : LocationService) {
     17  constructor(private plannerService: PlannerService, private ref: DynamicDialogRef) {
    2118    this.planners = [];
    2219  }
     
    2926      }
    3027    );
    31 
    3228  }
    3329
  • trip-planner-front/src/app/location/location-details/location-details.component.html

    rbdd6491 rb738035  
    1818            </ng-template>
    1919        </p-galleria>
     20        <br>
     21        <p-rating></p-rating>
    2022    </div>
    2123</div>
  • trip-planner-front/src/app/location/location-details/location-details.component.ts

    rbdd6491 rb738035  
    1 import { Component, OnInit, ViewEncapsulation } from '@angular/core';
     1import { Component, OnInit } from '@angular/core';
    22import { ActivatedRoute, Router } from '@angular/router';
    33import { Images } from 'src/app/_models/images';
  • trip-planner-front/src/app/location/location.component.css

    rbdd6491 rb738035  
     1img{
     2    width: 150px;
     3    height: 120px;
     4    display: block;
     5}
  • trip-planner-front/src/app/location/location.component.html

    rbdd6491 rb738035  
    99    <tr>
    1010      <th scope="col">#</th>
     11      <th scope="col">Photo</th>
    1112      <th scope="col">Location name</th>
    1213      <th scope="col"> Add to my planner</th>
     
    1718    <tr *ngFor="let location of listLocations">
    1819      <td>{{location.id}}</td>
     20      <td><img src="data:image/png;base64,{{location.photo}}" /></td>
    1921      <td>{{location.name}}</td>
    2022      <td><button type="button" (click)="show(location)" pButton icon="pi pi-info-circle"
    2123          label="Add to my planner"></button></td>
    2224      <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>
    2427    </tr>
    2528  </tbody>
  • trip-planner-front/src/app/location/location.component.ts

    rbdd6491 rb738035  
    9393
    9494    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);
    100100
    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) {
    116104              this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
    117105                data => {
     
    120108              );
    121109              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
    122124            }
    123 
    124125          }
    125         }
    126       );
     126        );
    127127      }
    128128    });
    129  
     129
    130130  }
    131131
Note: See TracChangeset for help on using the changeset viewer.