Index: trip-planner-front/src/app/_services/location.service.ts
===================================================================
--- trip-planner-front/src/app/_services/location.service.ts	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/_services/location.service.ts	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -55,4 +55,9 @@
         return this.httpClient.get<Location[]>(url + "?plannerId=" + id);
     }
+
+    getAllLocationIdsForPlanner(id:number):Observable<number[]>{
+        let url = "http://localhost:8080/api/planner/locationIds";
+        return this.httpClient.get<number[]>(url + "?plannerId="+id);
+    }
     
 }
Index: trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.html
===================================================================
--- trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.html	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.html	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -1,3 +1,3 @@
-<form (ngSubmit)="onFormSubmitPlanner(f)" #f="ngForm">
+<form (ngSubmit)="onFormSubmitPlanner(f)" #f="ngForm" >
   <div mat-dialog-content>
     <p>Planner name</p>
Index: trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html
===================================================================
--- trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.html	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -7,11 +7,10 @@
         </tr>
     </ng-template>
-    <ng-template pTemplate="body" let-planner>
+    <ng-template pTemplate="body" let-planner let-data>
         <tr>
             <td>{{planner.name}}</td>
-
             <td>
-                <button pButton pRipple type="button" icon="pi pi-heart"
-                    class="p-button-rounded p-button-help p-button-text" (click)="selectPlanner(planner)"></button>
+                <button pButton pRipple type="button" icon="pi pi-heart" class="p-button-rounded p-button-help"
+                    (click)="selectPlanner(planner)" ></button>
             </td>
         </tr>
Index: trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts
===================================================================
--- trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/location/add-location-to-planner-panel/add-location-to-planner-panel.component.ts	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -4,6 +4,7 @@
 import { PlannerService } from 'src/app/_services/planner.service';
 import { DynamicDialogRef } from 'primeng/dynamicdialog';
-
-
+import { LocationService } from 'src/app/_services/location.service';
+import { Location } from 'src/app/_models/location';
+import { PlannerLocationDto } from 'src/app/_models/dto/plannerLocationDto';
 
 
@@ -16,9 +17,7 @@
 
   planners: Planner[];
-
-
-
+  
   constructor(private plannerService: PlannerService,
-    private route: ActivatedRoute, private ref: DynamicDialogRef) {
+    private route: ActivatedRoute, private ref: DynamicDialogRef, private locationService : LocationService) {
     this.planners = [];
   }
@@ -31,4 +30,5 @@
       }
     );
+
   }
 
@@ -37,5 +37,3 @@
   }
 
-
-
 }
Index: trip-planner-front/src/app/location/location-details/location-details.component.html
===================================================================
--- trip-planner-front/src/app/location/location-details/location-details.component.html	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/location/location-details/location-details.component.html	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -3,10 +3,8 @@
 <p>{{locationDetails.description}}</p>
 
-
 <div class="content-section implementation">
     <div class="card">
-        <h5>More photos</h5>
         <p-galleria [value]="images" [responsiveOptions]="responsiveOptions" [containerStyle]="{'max-width': '640px'}"
-            [numVisible]="5" [circular]="true" [showItemNavigators]="true">
+            [numVisible]="5" [circular]="true" [showItemNavigators]="true" [showThumbnails]="false">
             <ng-template pTemplate="item" let-image>
                 <img src="data:image/png;base64,{{image.content}}"
@@ -16,8 +14,8 @@
                 <div class="p-grid p-nogutter p-justify-center">
                     <img src="data:image/png;base64,{{image.content}}"
-                        style=" height:50px; display: block;" />
+                        style=" display: block;" />
                 </div>
             </ng-template>
         </p-galleria>
     </div>
-
+</div>
Index: trip-planner-front/src/app/location/location.component.ts
===================================================================
--- trip-planner-front/src/app/location/location.component.ts	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/location/location.component.ts	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -1,6 +1,5 @@
 import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { ActivatedRoute, Router } from '@angular/router';
-import { MessageService, PrimeNGConfig } from 'primeng/api';
+import { MessageService } from 'primeng/api';
 import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
 import { Planner } from '../_models/planner';
@@ -30,5 +29,5 @@
   plannerLocationDto: PlannerLocationDto;
   ref: DynamicDialogRef;
-
+  locationIdsPlanner: number[];
 
 
@@ -42,7 +41,7 @@
     this.regionId = 1;
     this.locationId = 1;
-    this.ref = new DynamicDialogRef;
+    this.ref = new DynamicDialogRef();
     this.plannerLocationDto = new PlannerLocationDto();
-
+    this.locationIdsPlanner = [];
   }
 
@@ -85,4 +84,5 @@
 
   show(location: Location) {
+    console.log(location.id);
     this.ref = this.dialogService.open(AddLocationToPlannerPanelComponent, {
       header: 'Choose a Planner',
@@ -93,17 +93,37 @@
 
     this.ref.onClose.subscribe((planner: Planner) => {
-
       this.plannerLocationDto.locationId = location.id;
       this.plannerLocationDto.plannerId = planner.id;
       console.log("LOC ID: " + this.plannerLocationDto.locationId);
       console.log("PLANNER ID: " + this.plannerLocationDto.plannerId);
-      this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
-        data => {
-          console.log(data);
+
+      this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe(
+        lid => {
+          if (lid.length == 0) {
+            this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
+              data => {
+                console.log(data);
+              }
+            );
+            this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name });
+
+          } else if (lid.length > 0) {
+            if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) {
+              console.log("LOKACIJATA VEKE JA IMA VO PLANEROT");
+              this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' });
+            } else {
+              this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
+                data => {
+                  console.log(data);
+                }
+              );
+              this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name });
+            }
+
+          }
         }
       );
-      if (planner) {
-        this.messageService.add({ severity: 'success', summary: 'Location ' + location.name +  ' has been added to planner: ' , detail: planner.name });
-      }
+
+
     });
   }
@@ -115,6 +135,8 @@
   }
 
-  onClickBackToMyPlanners(){
+  onClickBackToMyPlanners() {
     this.router.navigate(['planners']);
   }
+
+
 }
Index: trip-planner-front/src/app/locations-form/locations-form.component.ts
===================================================================
--- trip-planner-front/src/app/locations-form/locations-form.component.ts	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner-front/src/app/locations-form/locations-form.component.ts	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -68,5 +68,5 @@
 
   ngOnInit(): void {
-  
+
     this.filteredOptions = this.myControl.valueChanges
       .pipe(
@@ -140,5 +140,5 @@
           console.log(result);
           this.proba = result;
-          this.router.navigate(['locations'], {queryParams: {cityId: this.cityId, companionId: this.companionId, lengthOfStay: this.lengthOfStay, categoryIds: this.categoryIds}});
+          this.router.navigate(['locations'], { queryParams: { cityId: this.cityId, companionId: this.companionId, lengthOfStay: this.lengthOfStay, categoryIds: this.categoryIds } });
         }
       );
@@ -148,5 +148,5 @@
           result => {
             console.log(result);
-            this.router.navigate(['locations'], {queryParams: {regionId: this.regionId, companionId: this.companionId, lengthOfStay: this.lengthOfStay, categoryIds: this.categoryIds}});
+            this.router.navigate(['locations'], { queryParams: { regionId: this.regionId, companionId: this.companionId, lengthOfStay: this.lengthOfStay, categoryIds: this.categoryIds } });
           }
         );
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -84,4 +84,11 @@
     List<Location> getAllLocationsForPlanner(@Param("plannerId") Long plannerId);
 
+
+    @Query(value = "SELECT l.id_location " +
+            "FROM locations AS l " +
+            "WHERE l.id_location IN " +
+            "(SELECT pl.id_location FROM planners_contain AS pl WHERE pl.id_planner = :plannerId)", nativeQuery = true)
+    List<Long> getAllLocationIdsForPlanner(@Param("plannerId") Long plannerId);
+
     @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " +
             "FROM locations AS l " +
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -5,4 +5,5 @@
 import finki.diplomska.tripplanner.models.Planner;
 import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
+import org.springframework.data.repository.query.Param;
 
 import java.util.List;
@@ -23,3 +24,4 @@
     List<Location> getWeekendGetaways();
     List<Location> getVillages();
+    List<Long> getAllLocationIdsForPlanner(Long plannerId);
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -179,4 +179,9 @@
     }
 
+    @Override
+    public List<Long> getAllLocationIdsForPlanner(Long plannerId) {
+        return this.locationRepository.getAllLocationIdsForPlanner(plannerId);
+    }
+
 
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -5,4 +5,5 @@
 import finki.diplomska.tripplanner.service.LocationService;
 import finki.diplomska.tripplanner.service.PlannerService;
+import org.springframework.data.repository.query.Param;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
@@ -71,3 +72,8 @@
         return this.locationService.getVillages();
     }
+
+    @GetMapping(value = "/planner/locationIds")
+    public List<Long> getAllLocationIdsForPlanner(@RequestParam Long plannerId){
+        return this.locationService.getAllLocationIdsForPlanner(plannerId);
+    }
 }
Index: trip-planner/src/test/api.http
===================================================================
--- trip-planner/src/test/api.http	(revision e29cc2ea91f8c99a4329f6d20188305dfd752279)
+++ trip-planner/src/test/api.http	(revision 8d391a12ef6baa3aefe9611a6f7c5b569977c946)
@@ -61,4 +61,8 @@
 
 ###
+GET http://localhost:8080/api/planner/locationIds?plannerId=2
+Content-Type: application/x-www-form-urlencoded
+
+###
 GET http://localhost:8080/api/weekend
 Content-Type: application/x-www-form-urlencoded
